@@ -63,6 +63,10 @@ class AwaitExprTree extends StandardPostOrderTree instanceof AwaitExpr {
6363 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
6464}
6565
66+ class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
67+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
68+ }
69+
6670class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
6771 BinaryOpExprTree ( ) { super .getOp ( ) != "&&" and super .getOp ( ) != "||" }
6872
@@ -133,7 +137,8 @@ class LogicalAndBinaryOpExprTree extends PreOrderTree instanceof BinaryExpr {
133137 }
134138}
135139
136- // NOTE: This covers both normal blocks, async blocks, and unsafe blocks
140+ // NOTE: This covers both normal blocks `BlockExpr`, async blocks
141+ // `AsyncBlockExpr`, and unsafe blocks `UnsafeBlockExpr`.
137142class BaseBlockExprTree extends StandardPostOrderTree instanceof BlockExprBase {
138143 override ControlFlowTree getChildNode ( int i ) {
139144 result = super .getStatement ( i )
@@ -165,13 +170,25 @@ class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
165170 }
166171}
167172
173+ class CastExprTree extends StandardPostOrderTree instanceof CastExpr {
174+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
175+ }
176+
168177class ClosureExprTree extends LeafTree instanceof ClosureExpr { }
169178
170179class ConstExprTree extends LeafTree instanceof ConstExpr { }
171180
172181class ContinueExprTree extends LeafTree instanceof ContinueExpr { }
173182
174- class ExprStmtTree extends StandardPostOrderTree instanceof ExprStmt {
183+ class ElementListExprTree extends StandardPostOrderTree instanceof ElementListExpr {
184+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getElement ( i ) }
185+ }
186+
187+ class ExprStmtTree extends StandardPreOrderTree instanceof ExprStmt {
188+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
189+ }
190+
191+ class FieldExprTree extends StandardPostOrderTree instanceof BecomeExpr {
175192 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
176193}
177194
@@ -207,11 +224,19 @@ class IfExprTree extends PostOrderTree instanceof IfExpr {
207224 }
208225}
209226
227+ class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
228+ override ControlFlowTree getChildNode ( int i ) {
229+ i = 0 and result = super .getBase ( )
230+ or
231+ i = 1 and result = super .getIndex ( )
232+ }
233+ }
234+
210235class LetExprTree extends StandardPostOrderTree instanceof LetExpr {
211236 override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
212237}
213238
214- class LetStmtTree extends StandardPostOrderTree instanceof LetStmt {
239+ class LetStmtTree extends StandardPreOrderTree instanceof LetStmt {
215240 override ControlFlowTree getChildNode ( int i ) {
216241 // TODO: For now we ignore the else branch (`super.getElse`). This branch
217242 // is guaranteed to be diverging so will need special treatment in the CFG.
@@ -247,12 +272,33 @@ class LoopExprTree extends PostOrderTree instanceof LoopExpr {
247272 }
248273}
249274
275+ class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr {
276+ override ControlFlowTree getChildNode ( int i ) {
277+ result = super .getReceiver ( ) and
278+ result = super .getArg ( i + 1 )
279+ }
280+ }
281+
282+ class OffsetOfExprTree extends LeafTree instanceof OffsetOfExpr { }
283+
250284class PathExprTree extends LeafTree instanceof PathExpr { }
251285
252- class RecordLitExprTree extends StandardPostOrderTree instanceof RecordExpr {
286+ class RecordExprTree extends StandardPostOrderTree instanceof RecordExpr {
253287 override ControlFlowTree getChildNode ( int i ) { result = super .getFld ( i ) .getExpr ( ) }
254288}
255289
290+ class RefExprTree extends StandardPostOrderTree instanceof RefExpr {
291+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
292+ }
293+
294+ class RepeatExprTree extends StandardPostOrderTree instanceof RepeatExpr {
295+ override ControlFlowTree getChildNode ( int i ) {
296+ i = 0 and result = super .getInitializer ( )
297+ or
298+ i = 1 and result = super .getRepeat ( )
299+ }
300+ }
301+
256302class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
257303 override predicate propagatesAbnormal ( AstNode child ) { child = super .getExpr ( ) }
258304
@@ -279,3 +325,11 @@ class UnaryOpExprTree extends StandardPostOrderTree instanceof PrefixExpr {
279325
280326// A leaf tree for unimplemented nodes in the AST.
281327class UnimplementedTree extends LeafTree instanceof Unimplemented { }
328+
329+ class YieldExprTree extends StandardPostOrderTree instanceof YieldExpr {
330+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
331+ }
332+
333+ class YeetExprTree extends StandardPostOrderTree instanceof YeetExpr {
334+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
335+ }
0 commit comments