Skip to content

Commit 42e6c7e

Browse files
committed
JS: Remove field from InvokeNode
1 parent c03e9d6 commit 42e6c7e

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

javascript/ql/src/semmle/javascript/StringConcatenation.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,8 @@ module StringConcatenation {
5555
exists(DataFlow::MethodCallNode call |
5656
node = call and
5757
call.getMethodName() = "concat" and
58-
not (
59-
exists(DataFlow::ArrayCreationNode array |
60-
array.flowsTo(call.getAnArgument()) or array.flowsTo(call.getReceiver())
61-
)
62-
or
63-
DataFlow::reflectiveCallNode(_) = call
58+
not exists(DataFlow::ArrayCreationNode array |
59+
array.flowsTo(call.getAnArgument()) or array.flowsTo(call.getReceiver())
6460
) and
6561
(
6662
n = 0 and

javascript/ql/src/semmle/javascript/dataflow/Nodes.qll

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,16 @@ class ParameterNode extends DataFlow::SourceNode {
5959
* ```
6060
*/
6161
class InvokeNode extends DataFlow::SourceNode {
62-
DataFlow::Impl::InvokeNodeDef impl;
63-
64-
InvokeNode() { this = impl }
62+
InvokeNode() { this instanceof DataFlow::Impl::InvokeNodeDef }
6563

6664
/** Gets the syntactic invoke expression underlying this function invocation. */
67-
InvokeExpr getInvokeExpr() { result = impl.getInvokeExpr() }
65+
InvokeExpr getInvokeExpr() { result = this.(DataFlow::Impl::InvokeNodeDef).getInvokeExpr() }
6866

6967
/** Gets the name of the function or method being invoked, if it can be determined. */
70-
string getCalleeName() { result = impl.getCalleeName() }
68+
string getCalleeName() { result = this.(DataFlow::Impl::InvokeNodeDef).getCalleeName() }
7169

7270
/** Gets the data flow node specifying the function to be called. */
73-
DataFlow::Node getCalleeNode() { result = impl.getCalleeNode() }
71+
DataFlow::Node getCalleeNode() { result = this.(DataFlow::Impl::InvokeNodeDef).getCalleeNode() }
7472

7573
/**
7674
* Gets the data flow node corresponding to the `i`th argument of this invocation.
@@ -91,10 +89,10 @@ class InvokeNode extends DataFlow::SourceNode {
9189
* but the position of `z` cannot be determined, hence there are no first and second
9290
* argument nodes.
9391
*/
94-
DataFlow::Node getArgument(int i) { result = impl.getArgument(i) }
92+
DataFlow::Node getArgument(int i) { result = this.(DataFlow::Impl::InvokeNodeDef).getArgument(i) }
9593

9694
/** Gets the data flow node corresponding to an argument of this invocation. */
97-
DataFlow::Node getAnArgument() { result = impl.getAnArgument() }
95+
DataFlow::Node getAnArgument() { result = this.(DataFlow::Impl::InvokeNodeDef).getAnArgument() }
9896

9997
/** Gets the data flow node corresponding to the last argument of this invocation. */
10098
DataFlow::Node getLastArgument() { result = getArgument(getNumArgument() - 1) }
@@ -111,10 +109,12 @@ class InvokeNode extends DataFlow::SourceNode {
111109
* ```
112110
* .
113111
*/
114-
DataFlow::Node getASpreadArgument() { result = impl.getASpreadArgument() }
112+
DataFlow::Node getASpreadArgument() {
113+
result = this.(DataFlow::Impl::InvokeNodeDef).getASpreadArgument()
114+
}
115115

116116
/** Gets the number of arguments of this invocation, if it can be determined. */
117-
int getNumArgument() { result = impl.getNumArgument() }
117+
int getNumArgument() { result = this.(DataFlow::Impl::InvokeNodeDef).getNumArgument() }
118118

119119
Function getEnclosingFunction() { result = getBasicBlock().getContainer() }
120120

@@ -256,14 +256,14 @@ class InvokeNode extends DataFlow::SourceNode {
256256
* ```
257257
*/
258258
class CallNode extends InvokeNode {
259-
override DataFlow::Impl::CallNodeDef impl;
259+
CallNode() { this instanceof DataFlow::Impl::CallNodeDef }
260260

261261
/**
262262
* Gets the data flow node corresponding to the receiver expression of this method call.
263263
*
264264
* For example, the receiver of `x.m()` is `x`.
265265
*/
266-
DataFlow::Node getReceiver() { result = impl.getReceiver() }
266+
DataFlow::Node getReceiver() { result = this.(DataFlow::Impl::CallNodeDef).getReceiver() }
267267
}
268268

269269
/**
@@ -277,10 +277,10 @@ class CallNode extends InvokeNode {
277277
* ```
278278
*/
279279
class MethodCallNode extends CallNode {
280-
override DataFlow::Impl::MethodCallNodeDef impl;
280+
MethodCallNode() { this instanceof DataFlow::Impl::MethodCallNodeDef }
281281

282282
/** Gets the name of the invoked method, if it can be determined. */
283-
string getMethodName() { result = impl.getMethodName() }
283+
string getMethodName() { result = this.(DataFlow::Impl::MethodCallNodeDef).getMethodName() }
284284

285285
/**
286286
* Holds if this data flow node calls method `methodName` on receiver node `receiver`.
@@ -300,7 +300,7 @@ class MethodCallNode extends CallNode {
300300
* ```
301301
*/
302302
class NewNode extends InvokeNode {
303-
override DataFlow::Impl::NewNodeDef impl;
303+
NewNode() { this instanceof DataFlow::Impl::NewNodeDef }
304304
}
305305

306306
/**

0 commit comments

Comments
 (0)