@@ -62,10 +62,13 @@ import CfgImpl
6262/** A trivial pattern that is always guaranteed to match. */
6363predicate trivialPat ( Pat p ) { p instanceof WildcardPat or p instanceof IdentPat }
6464
65+ class AsmExprTree extends LeafTree instanceof AsmExpr { }
66+
6567class AwaitExprTree extends StandardPostOrderTree instanceof AwaitExpr {
6668 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
6769}
6870
71+ // NOTE: `become` is a reserved but unused keyword.
6972class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
7073 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
7174}
@@ -142,7 +145,7 @@ class LogicalAndBinaryOpExprTree extends PreOrderTree instanceof BinaryExpr {
142145
143146// NOTE: This covers both normal blocks `BlockExpr`, async blocks
144147// `AsyncBlockExpr`, and unsafe blocks `UnsafeBlockExpr`.
145- class BaseBlockExprTree extends StandardPostOrderTree instanceof BlockExprBase {
148+ class BlockExprBaseTree extends StandardPostOrderTree instanceof BlockExprBase {
146149 override ControlFlowTree getChildNode ( int i ) {
147150 result = super .getStatement ( i )
148151 or
@@ -152,6 +155,10 @@ class BaseBlockExprTree extends StandardPostOrderTree instanceof BlockExprBase {
152155 }
153156}
154157
158+ class BoxExprTree extends StandardPostOrderTree instanceof BoxExpr {
159+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
160+ }
161+
155162class BreakExprTree extends PostOrderTree instanceof BreakExpr {
156163 override predicate propagatesAbnormal ( AstNode child ) { child = super .getExpr ( ) }
157164
@@ -168,8 +175,9 @@ class BreakExprTree extends PostOrderTree instanceof BreakExpr {
168175
169176class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
170177 override ControlFlowTree getChildNode ( int i ) {
171- result = super .getCallee ( ) and
172- result = super .getArg ( i + 1 )
178+ i = 0 and result = super .getCallee ( )
179+ or
180+ result = super .getArg ( i - 1 )
173181 }
174182}
175183
@@ -191,7 +199,7 @@ class ExprStmtTree extends StandardPreOrderTree instanceof ExprStmt {
191199 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
192200}
193201
194- class FieldExprTree extends StandardPostOrderTree instanceof BecomeExpr {
202+ class FieldExprTree extends StandardPostOrderTree instanceof FieldExpr {
195203 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
196204}
197205
@@ -371,10 +379,23 @@ class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr
371379
372380class OffsetOfExprTree extends LeafTree instanceof OffsetOfExpr { }
373381
382+ // This covers all patterns as they all extend `Pat`
374383class PatExprTree extends LeafTree instanceof Pat { }
375384
376385class PathExprTree extends LeafTree instanceof PathExpr { }
377386
387+ class PrefixExprTree extends StandardPostOrderTree instanceof PrefixExpr {
388+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
389+ }
390+
391+ class RangeExprTree extends StandardPostOrderTree instanceof RangeExpr {
392+ override ControlFlowTree getChildNode ( int i ) {
393+ i = 0 and result = super .getLhs ( )
394+ or
395+ i = 1 and result = super .getRhs ( )
396+ }
397+ }
398+
378399class RecordExprTree extends StandardPostOrderTree instanceof RecordExpr {
379400 override ControlFlowTree getChildNode ( int i ) { result = super .getFld ( i ) .getExpr ( ) }
380401}
@@ -409,19 +430,19 @@ class TupleExprTree extends StandardPostOrderTree instanceof TupleExpr {
409430 override ControlFlowTree getChildNode ( int i ) { result = super .getExpr ( i ) }
410431}
411432
412- class UnderscoreExprTree extends LeafTree instanceof UnderscoreExpr { }
433+ class TypeRefTree extends LeafTree instanceof TypeRef { }
413434
414- class UnaryOpExprTree extends StandardPostOrderTree instanceof PrefixExpr {
415- override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
416- }
435+ class UnderscoreExprTree extends LeafTree instanceof UnderscoreExpr { }
417436
418437// A leaf tree for unimplemented nodes in the AST.
419438class UnimplementedTree extends LeafTree instanceof Unimplemented { }
420439
440+ // NOTE: `yield` is a reserved but unused keyword.
421441class YieldExprTree extends StandardPostOrderTree instanceof YieldExpr {
422442 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
423443}
424444
445+ // NOTE: `yeet` is experimental and not a part of Rust.
425446class YeetExprTree extends StandardPostOrderTree instanceof YeetExpr {
426447 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
427448}
0 commit comments