Skip to content

Commit 221d949

Browse files
committed
JS: Resolve simple calls based on qualified name
1 parent ca71d31 commit 221d949

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

javascript/ql/src/semmle/javascript/Closure.qll

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,4 @@ module Closure {
244244
DataFlow::SourceNode moduleImport(string moduleName) {
245245
getClosureNamespaceFromSourceNode(result) = moduleName
246246
}
247-
248-
private class ClosureNamespaceCall extends DataFlow::InvokeNode {
249-
override Function getACallee(int imprecision) {
250-
result = super.getACallee(imprecision)
251-
or
252-
imprecision = 0 and
253-
exists(string name |
254-
GlobalAccessPath::isAssignedInUniqueFile(name) and
255-
GlobalAccessPath::fromRhs(result.flow()) = name and
256-
GlobalAccessPath::fromReference(getCalleeNode()) = name and
257-
not result.getTopLevel().isExterns()
258-
)
259-
}
260-
}
261247
}

javascript/ql/src/semmle/javascript/dataflow/internal/FlowSteps.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ private module CachedSteps {
127127
invk = cls.getAClassReference().getAMethodCall(name) and
128128
f = cls.getStaticMethod(name).getFunction()
129129
)
130+
or
131+
// Call from `foo.bar.baz()` to `foo.bar.baz = function()`
132+
not f.getTopLevel().isExterns() and
133+
exists(string name |
134+
GlobalAccessPath::isAssignedInUniqueFile(name) and
135+
GlobalAccessPath::fromRhs(f.flow()) = name and
136+
GlobalAccessPath::fromReference(invk.getCalleeNode()) = name
137+
)
130138
}
131139

132140
/**

0 commit comments

Comments
 (0)