@@ -212,12 +212,14 @@ class ExprNode extends Node, TExprNode {
212212 * The value of a parameter at function entry, viewed as a node in a data
213213 * flow graph.
214214 */
215- class ParameterNode extends LocalSourceNode instanceof ParameterNodeImpl {
215+ class ParameterNode extends LocalSourceNode {
216+ ParameterNode ( ) { exists ( getParameterPosition ( this , _) ) }
217+
216218 /** Gets the parameter corresponding to this node, if any. */
217- final Parameter getParameter ( ) { result = super . getParameter ( ) }
219+ final Parameter getParameter ( ) { result = getParameter ( this ) }
218220
219221 /** Gets the callable that this parameter belongs to. */
220- final Callable getCallable ( ) { result = super . getCfgScope ( ) }
222+ final Callable getCallable ( ) { result = getCfgScope ( this ) }
221223
222224 /** Gets the name of the parameter, if any. */
223225 final string getName ( ) { result = this .getParameter ( ) .( NamedParameter ) .getName ( ) }
@@ -348,9 +350,13 @@ class LocalSourceNode extends Node {
348350 * Nodes corresponding to AST elements, for example `ExprNode`, usually refer
349351 * to the value before the update.
350352 */
351- class PostUpdateNode extends Node instanceof PostUpdateNodeImpl {
353+ class PostUpdateNode extends Node {
354+ private Node pre ;
355+
356+ PostUpdateNode ( ) { pre = getPreUpdateNode ( this ) }
357+
352358 /** Gets the node before the state update. */
353- Node getPreUpdateNode ( ) { result = super . getPreUpdateNode ( ) }
359+ Node getPreUpdateNode ( ) { result = pre }
354360}
355361
356362/** An SSA definition, viewed as a node in a data flow graph. */
@@ -383,6 +389,28 @@ private module Cached {
383389 )
384390 }
385391
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+
386414 cached
387415 predicate methodHasSuperCall ( MethodNode method , CallNode call ) {
388416 call .isSuperCall ( ) and method = call .getEnclosingMethod ( )
@@ -1271,7 +1299,7 @@ class CallableNode extends StmtSequenceNode {
12711299 Callable asCallableAstNode ( ) { result = callable }
12721300
12731301 private ParameterPosition getParameterPosition ( ParameterNodeImpl node ) {
1274- node . isSourceParameterOf ( callable , result )
1302+ result = getSourceParameterPosition ( node , callable )
12751303 }
12761304
12771305 /** Gets the `n`th positional parameter. */
@@ -1311,7 +1339,7 @@ class CallableNode extends StmtSequenceNode {
13111339 /**
13121340 * Gets a data flow node whose value is about to be returned by this callable.
13131341 */
1314- Node getAReturnNode ( ) { result . ( ReturnNode ) . ( NodeImpl ) . getCfgScope ( ) = callable }
1342+ Node getAReturnNode ( ) { result = getAReturnNode ( callable ) }
13151343
13161344 /**
13171345 * DEPRECATED. Use `getAReturnNode` instead.
0 commit comments