File tree Expand file tree Collapse file tree
javascript/ql/src/semmle/javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,16 +125,14 @@ private module ArrayDataFlow {
125125 /**
126126 * A step for storing an element on an array using `arr.push(e)` or `arr.unshift(e)`.
127127 */
128- private class ArrayAppendStep extends DataFlow:: AdditionalFlowStep , DataFlow:: MethodCallNode {
129- ArrayAppendStep ( ) {
130- this .getMethodName ( ) = "push" or
131- this .getMethodName ( ) = "unshift"
132- }
133-
128+ private class ArrayAppendStep extends DataFlow:: SharedFlowStep {
134129 override predicate storeStep ( DataFlow:: Node element , DataFlow:: SourceNode obj , string prop ) {
135130 prop = arrayElement ( ) and
136- element = this .getAnArgument ( ) and
137- obj .getAMethodCall ( ) = this
131+ exists ( DataFlow:: MethodCallNode call |
132+ call .getMethodName ( ) = [ "push" , "unshift" ] and
133+ element = call .getAnArgument ( ) and
134+ obj .getAMethodCall ( ) = call
135+ )
138136 }
139137 }
140138
You can’t perform that action at this time.
0 commit comments