File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ module CallGraph {
1414 Function getAFunctionValue ( AnalyzedNode node ) {
1515 result = node .getAValue ( ) .( AbstractCallable ) .getFunction ( )
1616 or
17- node = DataFlow :: valueNode ( NameResolution:: trackFunctionValue ( result ) )
17+ node = NameResolution:: trackFunctionValue ( result ) . toDataFlowNode ( ) . ( DataFlow :: SourceNode )
1818 }
1919
2020 /** Holds if the type inferred for `node` is indefinite due to global flow. */
Original file line number Diff line number Diff line change @@ -336,27 +336,17 @@ private module CachedSteps {
336336 // TODO: Ensure name resolution has good enough support for NodeJS and AMD
337337 exists ( NameResolution:: Node node1 , NameResolution:: Node node2 |
338338 NameResolution:: ValueFlow:: resolvedReadStep ( node1 , node2 ) and
339- pred = DataFlow :: valueNode ( node1 ) and
340- succ = getNodeFromNameResolutionNode ( node2 )
339+ pred = node1 . toDataFlowNode ( ) and
340+ succ = node2 . toDataFlowNode ( )
341341 )
342342 or
343343 exists ( Import imprt , Module mod |
344344 imprt .getImportedModule ( ) = mod and
345- pred = DataFlow :: valueNode ( NameResolution:: getModuleBulkExport ( mod ) ) and
345+ pred = NameResolution:: getModuleBulkExport ( mod ) . toDataFlowNode ( ) and
346346 succ = imprt .getImportedModuleNodeStrict ( )
347347 )
348348 }
349349
350- pragma [ inline]
351- private DataFlow:: Node getNodeFromNameResolutionNode ( NameResolution:: Node node ) {
352- result = DataFlow:: valueNode ( node )
353- or
354- exists ( ImportSpecifier spec |
355- node = spec .getLocal ( ) and
356- result = DataFlow:: valueNode ( spec )
357- )
358- }
359-
360350 /**
361351 * Gets a node whose value is assigned to `gv` in `f`.
362352 */
Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ module NameResolution {
3434 or
3535 result = this .( JSDocTypeExpr ) .getLocation ( )
3636 }
37+
38+ DataFlow:: Node toDataFlowNode ( ) {
39+ result = DataFlow:: valueNode ( this )
40+ or
41+ // TODO: refactor graph to avoid the need for this
42+ exists ( ImportSpecifier spec |
43+ this = spec .getLocal ( ) and
44+ result = DataFlow:: valueNode ( spec )
45+ )
46+ }
3747 }
3848
3949 private signature predicate nodeSig ( Node node ) ;
You can’t perform that action at this time.
0 commit comments