Skip to content

Commit 346867f

Browse files
committed
JS: Remove Import->SourceNode dependency from AMD
1 parent 3804d3f commit 346867f

File tree

1 file changed

+8
-2
lines changed
  • javascript/ql/src/semmle/javascript

1 file changed

+8
-2
lines changed

javascript/ql/src/semmle/javascript/AMD.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,16 @@ class AmdModuleDefinition extends CallExpr {
5656
*/
5757
pragma[nomagic]
5858
DataFlow::SourceNode getFactoryNode() {
59-
result.flowsToExpr(getLastArgument()) and
59+
result = getFactoryNodeInternal() and
6060
result instanceof DataFlow::ValueNode
6161
}
6262

63+
private
64+
DataFlow::Node getFactoryNodeInternal() {
65+
result = DataFlow::valueNode(getLastArgument()) or
66+
result = getFactoryNodeInternal().getAPredecessor()
67+
}
68+
6369
/** Gets the expression defining this module. */
6470
Expr getModuleExpr() {
6571
exists(DataFlow::Node f | f = getFactoryNode() |
@@ -108,7 +114,7 @@ class AmdModuleDefinition extends CallExpr {
108114
* Gets the `i`th parameter of the factory function of this module.
109115
*/
110116
private SimpleParameter getFactoryParameter(int i) {
111-
getFactoryNode().(DataFlow::FunctionNode).getParameter(i) = DataFlow::parameterNode(result)
117+
getFactoryNodeInternal().asExpr().(Function).getParameter(i) = result
112118
}
113119

114120
/**

0 commit comments

Comments
 (0)