@@ -64,18 +64,18 @@ predicate trivialPat(Pat p) { p instanceof WildcardPat or p instanceof IdentPat
64
64
class AsmExprTree extends LeafTree instanceof AsmExpr { }
65
65
66
66
class AwaitExprTree extends StandardPostOrderTree instanceof AwaitExpr {
67
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
67
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
68
68
}
69
69
70
70
// NOTE: `become` is a reserved but unused keyword.
71
71
class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
72
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
72
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
73
73
}
74
74
75
75
class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
76
76
BinaryOpExprTree ( ) { not this instanceof BinaryLogicalOperation }
77
77
78
- override ControlFlowTree getChildNode ( int i ) {
78
+ override AstNode getChildNode ( int i ) {
79
79
i = 0 and result = super .getLhs ( )
80
80
or
81
81
i = 1 and result = super .getRhs ( )
@@ -133,7 +133,7 @@ class LogicalAndBinaryOpExprTree extends PreOrderTree, LogicalAndExpr {
133
133
}
134
134
135
135
class BlockExprBaseTree extends StandardPostOrderTree instanceof BlockExpr {
136
- override ControlFlowTree getChildNode ( int i ) {
136
+ override AstNode getChildNode ( int i ) {
137
137
result = super .getStmtList ( ) .getStatement ( i )
138
138
or
139
139
not exists ( super .getStmtList ( ) .getStatement ( i ) ) and
@@ -157,27 +157,27 @@ class BreakExprTree extends PostOrderTree instanceof BreakExpr {
157
157
}
158
158
159
159
class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
160
- override ControlFlowTree getChildNode ( int i ) {
160
+ override AstNode getChildNode ( int i ) {
161
161
i = 0 and result = super .getExpr ( )
162
162
or
163
163
result = super .getArgList ( ) .getArg ( i - 1 )
164
164
}
165
165
}
166
166
167
167
class CastExprTree extends StandardPostOrderTree instanceof CastExpr {
168
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
168
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
169
169
}
170
170
171
171
class ClosureExprTree extends LeafTree instanceof ClosureExpr { }
172
172
173
173
class ContinueExprTree extends LeafTree instanceof ContinueExpr { }
174
174
175
175
class ExprStmtTree extends StandardPreOrderTree instanceof ExprStmt {
176
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
176
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
177
177
}
178
178
179
179
class FieldExprTree extends StandardPostOrderTree instanceof FieldExpr {
180
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
180
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
181
181
}
182
182
183
183
class FunctionTree extends LeafTree instanceof Function { }
@@ -219,7 +219,7 @@ class IfExprTree extends PostOrderTree instanceof IfExpr {
219
219
}
220
220
221
221
class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
222
- override ControlFlowTree getChildNode ( int i ) {
222
+ override AstNode getChildNode ( int i ) {
223
223
i = 0 and result = super .getBase ( )
224
224
or
225
225
i = 1 and result = super .getIndex ( )
@@ -230,7 +230,7 @@ class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
230
230
// dominating successors in the graph in the same way that patterns do in
231
231
// `match` expressions.
232
232
class LetExprTree extends StandardPreOrderTree instanceof LetExpr {
233
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getPat ( ) }
233
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getPat ( ) }
234
234
}
235
235
236
236
// We handle `let` statements with trivial patterns separately as they don't
@@ -239,7 +239,7 @@ class LetExprTree extends StandardPreOrderTree instanceof LetExpr {
239
239
class LetStmtTreeTrivialPat extends StandardPreOrderTree instanceof LetStmt {
240
240
LetStmtTreeTrivialPat ( ) { trivialPat ( super .getPat ( ) ) }
241
241
242
- override ControlFlowTree getChildNode ( int i ) {
242
+ override AstNode getChildNode ( int i ) {
243
243
i = 0 and result = super .getInitializer ( )
244
244
or
245
245
i = 1 and result = super .getPat ( )
@@ -370,7 +370,7 @@ class MatchExprTree extends PostOrderTree instanceof MatchExpr {
370
370
}
371
371
372
372
class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr {
373
- override ControlFlowTree getChildNode ( int i ) {
373
+ override AstNode getChildNode ( int i ) {
374
374
result = super .getReceiver ( ) and
375
375
result = super .getArgList ( ) .getArg ( i + 1 )
376
376
}
@@ -379,7 +379,7 @@ class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr
379
379
class OffsetOfExprTree extends LeafTree instanceof OffsetOfExpr { }
380
380
381
381
class ParenExprTree extends StandardPostOrderTree , ParenExpr {
382
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
382
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
383
383
}
384
384
385
385
// This covers all patterns as they all extend `Pat`
@@ -388,25 +388,25 @@ class PatExprTree extends LeafTree instanceof Pat { }
388
388
class PathExprTree extends LeafTree instanceof PathExpr { }
389
389
390
390
class PrefixExprTree extends StandardPostOrderTree instanceof PrefixExpr {
391
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
391
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
392
392
}
393
393
394
394
class RangeExprTree extends StandardPostOrderTree instanceof RangeExpr {
395
- override ControlFlowTree getChildNode ( int i ) {
395
+ override AstNode getChildNode ( int i ) {
396
396
i = 0 and result = super .getStart ( )
397
397
or
398
398
i = 1 and result = super .getEnd ( )
399
399
}
400
400
}
401
401
402
402
class RecordExprTree extends StandardPostOrderTree instanceof RecordExpr {
403
- override ControlFlowTree getChildNode ( int i ) {
403
+ override AstNode getChildNode ( int i ) {
404
404
result = super .getRecordExprFieldList ( ) .getField ( i ) .getExpr ( )
405
405
}
406
406
}
407
407
408
408
class RefExprTree extends StandardPostOrderTree instanceof RefExpr {
409
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
409
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
410
410
}
411
411
412
412
class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
@@ -424,7 +424,7 @@ class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
424
424
}
425
425
426
426
class TupleExprTree extends StandardPostOrderTree instanceof TupleExpr {
427
- override ControlFlowTree getChildNode ( int i ) { result = super .getField ( i ) }
427
+ override AstNode getChildNode ( int i ) { result = super .getField ( i ) }
428
428
}
429
429
430
430
class TypeRefTree extends LeafTree instanceof TypeRef { }
@@ -433,10 +433,10 @@ class UnderscoreExprTree extends LeafTree instanceof UnderscoreExpr { }
433
433
434
434
// NOTE: `yield` is a reserved but unused keyword.
435
435
class YieldExprTree extends StandardPostOrderTree instanceof YieldExpr {
436
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
436
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
437
437
}
438
438
439
439
// NOTE: `yeet` is experimental and not a part of Rust.
440
440
class YeetExprTree extends StandardPostOrderTree instanceof YeetExpr {
441
- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
441
+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
442
442
}
0 commit comments