@@ -187,10 +187,10 @@ module Node {
187
187
* The value of a parameter at function entry, viewed as a node in a data
188
188
* flow graph.
189
189
*/
190
- final class NormalParameterNode extends ParameterNode , TParameterNode {
190
+ final class PositionalParameterNode extends ParameterNode , TParameterNode {
191
191
override ParamCfgNode n ;
192
192
193
- NormalParameterNode ( ) { this = TParameterNode ( n ) }
193
+ PositionalParameterNode ( ) { this = TParameterNode ( n ) }
194
194
195
195
/** Gets the parameter in the CFG that this node corresponds to. */
196
196
ParamCfgNode getParameter ( ) { result = n }
@@ -230,10 +230,7 @@ module Node {
230
230
231
231
/** A data flow node that represents a value returned by a callable. */
232
232
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 }
237
234
238
235
ReturnKind getKind ( ) { any ( ) }
239
236
}
@@ -270,11 +267,11 @@ module Node {
270
267
/** Gets the node before the state update. */
271
268
Node getPreUpdateNode ( ) { result = TExprNode ( n ) }
272
269
273
- final override CfgScope getCfgScope ( ) { result = n .getAstNode ( ) . getEnclosingCfgScope ( ) }
270
+ final override CfgScope getCfgScope ( ) { result = n .getScope ( ) }
274
271
275
- final override Location getLocation ( ) { result = n .getAstNode ( ) . getLocation ( ) }
272
+ final override Location getLocation ( ) { result = n .getLocation ( ) }
276
273
277
- final override string toString ( ) { result = n .getAstNode ( ) . toString ( ) }
274
+ final override string toString ( ) { result = n .toString ( ) }
278
275
}
279
276
280
277
final class CastNode = NaNode ;
@@ -287,7 +284,7 @@ module SsaFlow {
287
284
private module SsaFlow = SsaImpl:: DataFlowIntegration;
288
285
289
286
private Node:: ParameterNode toParameterNode ( ParamCfgNode p ) {
290
- result .( Node:: NormalParameterNode ) .getParameter ( ) = p
287
+ result .( Node:: PositionalParameterNode ) .getParameter ( ) = p
291
288
}
292
289
293
290
/** Converts a control flow node into an SSA control flow node. */
@@ -336,7 +333,8 @@ module LocalFlow {
336
333
nodeFrom .( Node:: AstCfgFlowNode ) .getCfgNode ( ) =
337
334
nodeTo .( Node:: SsaNode ) .getDefinitionExt ( ) .( Ssa:: WriteDefinition ) .getControlFlowNode ( )
338
335
or
339
- nodeFrom .( Node:: NormalParameterNode ) .getParameter ( ) .getPat ( ) = nodeTo .( Node:: PatNode ) .getPat ( )
336
+ nodeFrom .( Node:: PositionalParameterNode ) .getParameter ( ) .getPat ( ) =
337
+ nodeTo .( Node:: PatNode ) .getPat ( )
340
338
or
341
339
SsaFlow:: localFlowStep ( _, nodeFrom , nodeTo , _)
342
340
or
@@ -376,7 +374,7 @@ module RustDataFlow implements InputSig<Location> {
376
374
377
375
/** Holds if `p` is a parameter of `c` at the position `pos`. */
378
376
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 ( ) )
380
378
}
381
379
382
380
/** Holds if `n` is an argument of `c` at the position `pos`. */
@@ -590,7 +588,7 @@ private module Cached {
590
588
cached
591
589
newtype TParameterPosition =
592
590
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 ]
594
592
} or
595
593
TSelfParameterPosition ( )
596
594
}
0 commit comments