@@ -179,12 +179,14 @@ class CastExprTree extends StandardPostOrderTree instanceof CastExpr {
179179 override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
180180}
181181
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 {
186183 override predicate first ( AstNode first ) { first = this }
187184
185+ override predicate last ( AstNode last , Completion c ) {
186+ last = this and
187+ completionIsValidFor ( c , this )
188+ }
189+
188190 override predicate propagatesAbnormal ( AstNode child ) { none ( ) }
189191
190192 override AstNode getChildNode ( int i ) {
@@ -193,11 +195,6 @@ class ClosureExprTree extends StandardPostOrderTree, ClosureExpr {
193195 i = this .getParamList ( ) .getNumberOfParams ( ) and
194196 result = this .getBody ( )
195197 }
196-
197- override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
198- super .succ ( pred , succ , c ) and
199- not succ = this
200- }
201198}
202199
203200class ContinueExprTree extends LeafTree , ContinueExpr {
@@ -218,11 +215,9 @@ class FieldExprTree extends StandardPostOrderTree instanceof FieldExpr {
218215 override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
219216}
220217
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+
226221 override predicate last ( AstNode last , Completion c ) {
227222 last = this and
228223 completionIsValidFor ( c , this )
@@ -236,11 +231,6 @@ class FunctionTree extends StandardPreOrderTree, Function {
236231 i = this .getParamList ( ) .getNumberOfParams ( ) and
237232 result = this .getBody ( )
238233 }
239-
240- override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
241- super .succ ( pred , succ , c ) and
242- not pred = this
243- }
244234}
245235
246236class ParamTree extends StandardPostOrderTree , Param {
0 commit comments