@@ -179,12 +179,14 @@ class CastExprTree extends StandardPostOrderTree instanceof CastExpr {
179
179
override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
180
180
}
181
181
182
- // Closures have their own CFG scope, so we need to make sure that their
183
- // CFG is not mixed with the surrounding CFG. This is done by retrofitting
184
- // `first`, `propagatesAbnormal`, and `succ` below.
185
- class ClosureExprTree extends StandardPostOrderTree , ClosureExpr {
182
+ class ClosureExprTree extends StandardTree , ClosureExpr {
186
183
override predicate first ( AstNode first ) { first = this }
187
184
185
+ override predicate last ( AstNode last , Completion c ) {
186
+ last = this and
187
+ completionIsValidFor ( c , this )
188
+ }
189
+
188
190
override predicate propagatesAbnormal ( AstNode child ) { none ( ) }
189
191
190
192
override AstNode getChildNode ( int i ) {
@@ -193,11 +195,6 @@ class ClosureExprTree extends StandardPostOrderTree, ClosureExpr {
193
195
i = this .getParamList ( ) .getNumberOfParams ( ) and
194
196
result = this .getBody ( )
195
197
}
196
-
197
- override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
198
- super .succ ( pred , succ , c ) and
199
- not succ = this
200
- }
201
198
}
202
199
203
200
class ContinueExprTree extends LeafTree , ContinueExpr {
@@ -218,11 +215,9 @@ class FieldExprTree extends StandardPostOrderTree instanceof FieldExpr {
218
215
override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
219
216
}
220
217
221
- // Functions have their own CFG scope, so we need to make sure that their
222
- // CFG is not mixed with the surrounding CFG in case of nested functions.
223
- // This is done by retrofitting `last`, `propagatesAbnormal`, and `succ`
224
- // below.
225
- class FunctionTree extends StandardPreOrderTree , Function {
218
+ class FunctionTree extends StandardTree , Function {
219
+ override predicate first ( AstNode first ) { first = this }
220
+
226
221
override predicate last ( AstNode last , Completion c ) {
227
222
last = this and
228
223
completionIsValidFor ( c , this )
@@ -236,11 +231,6 @@ class FunctionTree extends StandardPreOrderTree, Function {
236
231
i = this .getParamList ( ) .getNumberOfParams ( ) and
237
232
result = this .getBody ( )
238
233
}
239
-
240
- override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
241
- super .succ ( pred , succ , c ) and
242
- not pred = this
243
- }
244
234
}
245
235
246
236
class ParamTree extends StandardPostOrderTree , Param {
0 commit comments