@@ -212,12 +212,14 @@ class ExprNode extends Node, TExprNode {
212
212
* The value of a parameter at function entry, viewed as a node in a data
213
213
* flow graph.
214
214
*/
215
- class ParameterNode extends LocalSourceNode instanceof ParameterNodeImpl {
215
+ class ParameterNode extends LocalSourceNode {
216
+ ParameterNode ( ) { exists ( getParameterPosition ( this , _) ) }
217
+
216
218
/** Gets the parameter corresponding to this node, if any. */
217
- final Parameter getParameter ( ) { result = super . getParameter ( ) }
219
+ final Parameter getParameter ( ) { result = getParameter ( this ) }
218
220
219
221
/** Gets the callable that this parameter belongs to. */
220
- final Callable getCallable ( ) { result = super . getCfgScope ( ) }
222
+ final Callable getCallable ( ) { result = getCfgScope ( this ) }
221
223
222
224
/** Gets the name of the parameter, if any. */
223
225
final string getName ( ) { result = this .getParameter ( ) .( NamedParameter ) .getName ( ) }
@@ -348,9 +350,13 @@ class LocalSourceNode extends Node {
348
350
* Nodes corresponding to AST elements, for example `ExprNode`, usually refer
349
351
* to the value before the update.
350
352
*/
351
- class PostUpdateNode extends Node instanceof PostUpdateNodeImpl {
353
+ class PostUpdateNode extends Node {
354
+ private Node pre ;
355
+
356
+ PostUpdateNode ( ) { pre = getPreUpdateNode ( this ) }
357
+
352
358
/** Gets the node before the state update. */
353
- Node getPreUpdateNode ( ) { result = super . getPreUpdateNode ( ) }
359
+ Node getPreUpdateNode ( ) { result = pre }
354
360
}
355
361
356
362
/** An SSA definition, viewed as a node in a data flow graph. */
@@ -383,6 +389,28 @@ private module Cached {
383
389
)
384
390
}
385
391
392
+ cached
393
+ CfgScope getCfgScope ( NodeImpl node ) { result = node .getCfgScope ( ) }
394
+
395
+ cached
396
+ ReturnNode getAReturnNode ( Callable callable ) { getCfgScope ( result ) = callable }
397
+
398
+ cached
399
+ Parameter getParameter ( ParameterNodeImpl param ) { result = param .getParameter ( ) }
400
+
401
+ cached
402
+ ParameterPosition getParameterPosition ( ParameterNodeImpl param , DataFlowCallable c ) {
403
+ param .isParameterOf ( c , result )
404
+ }
405
+
406
+ cached
407
+ ParameterPosition getSourceParameterPosition ( ParameterNodeImpl param , Callable c ) {
408
+ param .isSourceParameterOf ( c , result )
409
+ }
410
+
411
+ cached
412
+ Node getPreUpdateNode ( PostUpdateNodeImpl node ) { result = node .getPreUpdateNode ( ) }
413
+
386
414
cached
387
415
predicate methodHasSuperCall ( MethodNode method , CallNode call ) {
388
416
call .isSuperCall ( ) and method = call .getEnclosingMethod ( )
@@ -1271,7 +1299,7 @@ class CallableNode extends StmtSequenceNode {
1271
1299
Callable asCallableAstNode ( ) { result = callable }
1272
1300
1273
1301
private ParameterPosition getParameterPosition ( ParameterNodeImpl node ) {
1274
- node . isSourceParameterOf ( callable , result )
1302
+ result = getSourceParameterPosition ( node , callable )
1275
1303
}
1276
1304
1277
1305
/** Gets the `n`th positional parameter. */
@@ -1311,7 +1339,7 @@ class CallableNode extends StmtSequenceNode {
1311
1339
/**
1312
1340
* Gets a data flow node whose value is about to be returned by this callable.
1313
1341
*/
1314
- Node getAReturnNode ( ) { result . ( ReturnNode ) . ( NodeImpl ) . getCfgScope ( ) = callable }
1342
+ Node getAReturnNode ( ) { result = getAReturnNode ( callable ) }
1315
1343
1316
1344
/**
1317
1345
* DEPRECATED. Use `getAReturnNode` instead.
0 commit comments