@@ -187,10 +187,10 @@ module Node {
187187 * The value of a parameter at function entry, viewed as a node in a data
188188 * flow graph.
189189 */
190- final class NormalParameterNode extends ParameterNode , TParameterNode {
190+ final class PositionalParameterNode extends ParameterNode , TParameterNode {
191191 override ParamCfgNode n ;
192192
193- NormalParameterNode ( ) { this = TParameterNode ( n ) }
193+ PositionalParameterNode ( ) { this = TParameterNode ( n ) }
194194
195195 /** Gets the parameter in the CFG that this node corresponds to. */
196196 ParamCfgNode getParameter ( ) { result = n }
@@ -230,10 +230,7 @@ module Node {
230230
231231 /** A data flow node that represents a value returned by a callable. */
232232 final class ReturnNode extends ExprNode {
233- ReturnNode ( ) {
234- this .getCfgNode ( ) .getASuccessor ( ) instanceof ExitCfgNode or
235- this .getCfgNode ( ) .getASuccessor ( ) instanceof AnnotatedExitCfgNode
236- }
233+ ReturnNode ( ) { this .getCfgNode ( ) .getASuccessor ( ) instanceof AnnotatedExitCfgNode }
237234
238235 ReturnKind getKind ( ) { any ( ) }
239236 }
@@ -270,11 +267,11 @@ module Node {
270267 /** Gets the node before the state update. */
271268 Node getPreUpdateNode ( ) { result = TExprNode ( n ) }
272269
273- final override CfgScope getCfgScope ( ) { result = n .getAstNode ( ) . getEnclosingCfgScope ( ) }
270+ final override CfgScope getCfgScope ( ) { result = n .getScope ( ) }
274271
275- final override Location getLocation ( ) { result = n .getAstNode ( ) . getLocation ( ) }
272+ final override Location getLocation ( ) { result = n .getLocation ( ) }
276273
277- final override string toString ( ) { result = n .getAstNode ( ) . toString ( ) }
274+ final override string toString ( ) { result = n .toString ( ) }
278275 }
279276
280277 final class CastNode = NaNode ;
@@ -287,7 +284,7 @@ module SsaFlow {
287284 private module SsaFlow = SsaImpl:: DataFlowIntegration;
288285
289286 private Node:: ParameterNode toParameterNode ( ParamCfgNode p ) {
290- result .( Node:: NormalParameterNode ) .getParameter ( ) = p
287+ result .( Node:: PositionalParameterNode ) .getParameter ( ) = p
291288 }
292289
293290 /** Converts a control flow node into an SSA control flow node. */
@@ -336,7 +333,8 @@ module LocalFlow {
336333 nodeFrom .( Node:: AstCfgFlowNode ) .getCfgNode ( ) =
337334 nodeTo .( Node:: SsaNode ) .getDefinitionExt ( ) .( Ssa:: WriteDefinition ) .getControlFlowNode ( )
338335 or
339- nodeFrom .( Node:: NormalParameterNode ) .getParameter ( ) .getPat ( ) = nodeTo .( Node:: PatNode ) .getPat ( )
336+ nodeFrom .( Node:: PositionalParameterNode ) .getParameter ( ) .getPat ( ) =
337+ nodeTo .( Node:: PatNode ) .getPat ( )
340338 or
341339 SsaFlow:: localFlowStep ( _, nodeFrom , nodeTo , _)
342340 or
@@ -376,7 +374,7 @@ module RustDataFlow implements InputSig<Location> {
376374
377375 /** Holds if `p` is a parameter of `c` at the position `pos`. */
378376 predicate isParameterNode ( ParameterNode p , DataFlowCallable c , ParameterPosition pos ) {
379- p .getCfgNode ( ) .getAstNode ( ) = pos .getParameterIn ( c .asCfgScope ( ) .( Function ) .getParamList ( ) )
377+ p .getCfgNode ( ) .getAstNode ( ) = pos .getParameterIn ( c .asCfgScope ( ) .( Callable ) .getParamList ( ) )
380378 }
381379
382380 /** Holds if `n` is an argument of `c` at the position `pos`. */
@@ -590,7 +588,7 @@ private module Cached {
590588 cached
591589 newtype TParameterPosition =
592590 TPositionalParameterPosition ( int i ) {
593- exists ( any ( ParamList l ) .getParam ( i ) ) or exists ( any ( ArgList l ) .getArg ( i ) )
591+ i in [ 0 .. max ( [ any ( ParamList l ) .getNumberOfParams ( ) , any ( ArgList l ) .getNumberOfArgs ( ) ] ) - 1 ]
594592 } or
595593 TSelfParameterPosition ( )
596594}
0 commit comments