Skip to content

Commit bc28e17

Browse files
committed
Refactor to get rid of duplication
1 parent 9f4fd7f commit bc28e17

File tree

1 file changed

+4
-8
lines changed
  • go/ql/lib/semmle/go/frameworks/stdlib

1 file changed

+4
-8
lines changed

go/ql/lib/semmle/go/frameworks/stdlib/IoFs.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@ module IoFs {
2020
private class WalkDirStep extends TaintTracking::AdditionalTaintStep {
2121
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
2222
//signature: func WalkDir(fsys FS, root string, fn WalkDirFunc) error
23-
exists(DataFlow::CallNode call, DataFlow::FunctionNode f |
24-
f.(DataFlow::FuncLitNode).getASuccessor*() = call.getArgument(2)
23+
exists(DataFlow::CallNode call, DataFlow::FunctionNode f, DataFlow::Node n |
24+
n = f.(DataFlow::FuncLitNode)
2525
or
26-
exists(DataFlow::ExprNode functionName |
27-
f.(DataFlow::GlobalFunctionNode).getFunction() =
28-
functionName.asExpr().(FunctionName).getTarget()
29-
|
30-
functionName.getASuccessor*() = call.getArgument(2)
31-
)
26+
n.asExpr().(FunctionName).getTarget() = f.(DataFlow::GlobalFunctionNode).getFunction()
3227
|
3328
call.getTarget().hasQualifiedName(packagePath(), "WalkDir") and
29+
n.getASuccessor*() = call.getArgument(2) and
3430
pred = call.getArgument(0) and
3531
succ = f.getParameter([0, 1])
3632
)

0 commit comments

Comments
 (0)