@@ -44,12 +44,10 @@ private module CfgInput implements InputSig<Location> {
4444 predicate successorTypeIsCondition ( SuccessorType t ) { t instanceof Cfg:: BooleanSuccessor }
4545
4646 /** Holds if `first` is first executed when entering `scope`. */
47- predicate scopeFirst ( CfgScope scope , AstNode first ) {
48- first ( scope .( CfgScopeTree ) .getFirstChildNode ( ) , first )
49- }
47+ predicate scopeFirst ( CfgScope scope , AstNode first ) { scope .scopeFirst ( first ) }
5048
5149 /** Holds if `scope` is exited when `last` finishes with completion `c`. */
52- predicate scopeLast ( CfgScope scope , AstNode last , Completion c ) { last ( scope .getBody ( ) , last , c ) }
50+ predicate scopeLast ( CfgScope scope , AstNode last , Completion c ) { scope .scopeLast ( last , c ) }
5351}
5452
5553private module CfgSplittingInput implements SplittingInputSig< Location , CfgInput > {
@@ -71,14 +69,7 @@ private module CfgImpl =
7169
7270import CfgImpl
7371
74- class CfgScopeTree extends StandardTree , Scope:: CfgScope {
75- override predicate first ( AstNode first ) { first = this }
76-
77- override predicate last ( AstNode last , Completion c ) {
78- last = this and
79- completionIsValidFor ( c , this )
80- }
81-
72+ class CallableScopeTree extends StandardTree , PreOrderTree , PostOrderTree , Scope:: CallableScope {
8273 override predicate propagatesAbnormal ( AstNode child ) { none ( ) }
8374
8475 override AstNode getChildNode ( int i ) {
@@ -280,13 +271,23 @@ module ExprTrees {
280271 }
281272 }
282273
274+ private AstNode getBlockChildNode ( BlockExpr b , int i ) {
275+ result = b .getStmtList ( ) .getStatement ( i )
276+ or
277+ i = b .getStmtList ( ) .getNumberOfStatements ( ) and
278+ result = b .getStmtList ( ) .getTailExpr ( )
279+ }
280+
281+ class AsyncBlockExprTree extends StandardTree , PreOrderTree , PostOrderTree , AsyncBlockExpr {
282+ override AstNode getChildNode ( int i ) { result = getBlockChildNode ( this , i ) }
283+
284+ override predicate propagatesAbnormal ( AstNode child ) { none ( ) }
285+ }
286+
283287 class BlockExprTree extends StandardPostOrderTree , BlockExpr {
284- override AstNode getChildNode ( int i ) {
285- result = this .getStmtList ( ) .getStatement ( i )
286- or
287- i = this .getStmtList ( ) .getNumberOfStatements ( ) and
288- result = this .getStmtList ( ) .getTailExpr ( )
289- }
288+ BlockExprTree ( ) { not this .isAsync ( ) }
289+
290+ override AstNode getChildNode ( int i ) { result = getBlockChildNode ( this , i ) }
290291
291292 override predicate propagatesAbnormal ( AstNode child ) { child = this .getChildNode ( _) }
292293 }
0 commit comments