Skip to content

Commit ab5acbf

Browse files
committed
JS: Use name resolution in call graph construction
1 parent f5db4f0 commit ab5acbf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
private import javascript
66
private import semmle.javascript.dataflow.internal.StepSummary
77
private import semmle.javascript.dataflow.internal.PreCallGraphStep
8+
private import semmle.javascript.internal.NameResolution
89

910
cached
1011
module CallGraph {
1112
/** Gets the function referenced by `node`, as determined by the type inference. */
1213
cached
1314
Function getAFunctionValue(AnalyzedNode node) {
1415
result = node.getAValue().(AbstractCallable).getFunction()
16+
or
17+
node = DataFlow::valueNode(NameResolution::trackFunctionValue(result))
1518
}
1619

1720
/** Holds if the type inferred for `node` is indefinite due to global flow. */

javascript/ql/test/library-tests/CallGraphs/AnnotatedTest/Test.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ spuriousCallee
22
missingCallee
33
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
44
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} | -1 | calls |
5-
| reExportLibClient.js:4:1:4:6 | ns.f() | lib.js:3:2:3:14 | function() {} | -1 | calls |
65
badAnnotation
76
accessorCall
87
| accessors.js:12:1:12:5 | obj.f | accessors.js:5:8:5:12 | () {} |

0 commit comments

Comments
 (0)