@@ -63,6 +63,10 @@ class AwaitExprTree extends StandardPostOrderTree instanceof AwaitExpr {
63
63
override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
64
64
}
65
65
66
+ class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
67
+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
68
+ }
69
+
66
70
class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
67
71
BinaryOpExprTree ( ) { super .getOp ( ) != "&&" and super .getOp ( ) != "||" }
68
72
@@ -133,7 +137,8 @@ class LogicalAndBinaryOpExprTree extends PreOrderTree instanceof BinaryExpr {
133
137
}
134
138
}
135
139
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`.
137
142
class BaseBlockExprTree extends StandardPostOrderTree instanceof BlockExprBase {
138
143
override ControlFlowTree getChildNode ( int i ) {
139
144
result = super .getStatement ( i )
@@ -165,13 +170,25 @@ class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
165
170
}
166
171
}
167
172
173
+ class CastExprTree extends StandardPostOrderTree instanceof CastExpr {
174
+ override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
175
+ }
176
+
168
177
class ClosureExprTree extends LeafTree instanceof ClosureExpr { }
169
178
170
179
class ConstExprTree extends LeafTree instanceof ConstExpr { }
171
180
172
181
class ContinueExprTree extends LeafTree instanceof ContinueExpr { }
173
182
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 {
175
192
override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
176
193
}
177
194
@@ -207,11 +224,19 @@ class IfExprTree extends PostOrderTree instanceof IfExpr {
207
224
}
208
225
}
209
226
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
+
210
235
class LetExprTree extends StandardPostOrderTree instanceof LetExpr {
211
236
override ControlFlowTree getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
212
237
}
213
238
214
- class LetStmtTree extends StandardPostOrderTree instanceof LetStmt {
239
+ class LetStmtTree extends StandardPreOrderTree instanceof LetStmt {
215
240
override ControlFlowTree getChildNode ( int i ) {
216
241
// TODO: For now we ignore the else branch (`super.getElse`). This branch
217
242
// is guaranteed to be diverging so will need special treatment in the CFG.
@@ -247,12 +272,33 @@ class LoopExprTree extends PostOrderTree instanceof LoopExpr {
247
272
}
248
273
}
249
274
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
+
250
284
class PathExprTree extends LeafTree instanceof PathExpr { }
251
285
252
- class RecordLitExprTree extends StandardPostOrderTree instanceof RecordExpr {
286
+ class RecordExprTree extends StandardPostOrderTree instanceof RecordExpr {
253
287
override ControlFlowTree getChildNode ( int i ) { result = super .getFld ( i ) .getExpr ( ) }
254
288
}
255
289
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
+
256
302
class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
257
303
override predicate propagatesAbnormal ( AstNode child ) { child = super .getExpr ( ) }
258
304
@@ -279,3 +325,11 @@ class UnaryOpExprTree extends StandardPostOrderTree instanceof PrefixExpr {
279
325
280
326
// A leaf tree for unimplemented nodes in the AST.
281
327
class 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