@@ -57,11 +57,11 @@ module CfgScope {
5757
5858 private class EndBlockScope extends Range_ , EndBlock {
5959 final override predicate entry ( AstNode first ) {
60- first ( this .( Trees:: EndBlockTree ) .getFirstChildNode ( ) , first )
60+ first ( this .( Trees:: EndBlockTree ) .getBodyChild ( 0 , _ ) , first )
6161 }
6262
6363 final override predicate exit ( AstNode last , Completion c ) {
64- last ( this .( Trees:: EndBlockTree ) .getLastChildNode ( ) , last , c )
64+ last ( this .( Trees:: EndBlockTree ) .getLastBodyChild ( ) , last , c )
6565 }
6666 }
6767
@@ -738,8 +738,17 @@ module Trees {
738738
739739 private class EmptyStatementTree extends LeafTree , EmptyStmt { }
740740
741- class EndBlockTree extends ScopeTree , EndBlock {
742- final override ControlFlowTree getChildNode ( int i ) { result = this .getStmt ( i ) }
741+ class EndBlockTree extends StmtSequenceTree , EndBlock {
742+ override predicate first ( AstNode first ) { first = this }
743+
744+ override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
745+ // Normal left-to-right evaluation in the body
746+ exists ( int i |
747+ last ( this .getBodyChild ( i , _) , pred , c ) and
748+ first ( this .getBodyChild ( i + 1 , _) , succ ) and
749+ c instanceof NormalCompletion
750+ )
751+ }
743752 }
744753
745754 private class ForInTree extends LeafTree , ForIn { }
@@ -1153,8 +1162,6 @@ module Trees {
11531162 private class SplatParameterTree extends NonDefaultValueParameterTree , SplatParameter { }
11541163
11551164 class StmtSequenceTree extends PostOrderTree , StmtSequence {
1156- StmtSequenceTree ( ) { not this instanceof EndBlock }
1157-
11581165 override predicate propagatesAbnormal ( AstNode child ) { child = this .getAStmt ( ) }
11591166
11601167 override predicate first ( AstNode first ) { first ( this .getStmt ( 0 ) , first ) }
0 commit comments