@@ -132,6 +132,7 @@ private module Ast implements AstSig<Location> {
132132 or
133133 not exists ( adjustedGetChild ( parent , _) ) and
134134 not parent instanceof R:: Ast:: Callable and
135+ not parent instanceof R:: Ast:: EndBlock and
135136 (
136137 synthChild ( parent , index , result )
137138 or
@@ -151,15 +152,19 @@ private module Ast implements AstSig<Location> {
151152 cached
152153 Callable getEnclosingCallable ( AstNode node ) { result = parentScope * ( scopeOfInclSynth ( node ) ) }
153154
154- // TODO: Include EndBlock
155155 class Callable extends AstNode {
156- Callable ( ) { this instanceof R:: Ast:: Toplevel or this instanceof R:: Ast:: Callable }
156+ Callable ( ) {
157+ this instanceof R:: Ast:: Toplevel or
158+ this instanceof R:: Ast:: Callable or
159+ this instanceof R:: Ast:: EndBlock
160+ }
157161 }
158162
159163 AstNode callableGetBody ( Callable c ) {
160164 result = c .( R:: Ast:: Toplevel ) .getABeginBlock ( ) or
161165 result = c .( R:: Ast:: Toplevel ) .getAStmt ( ) or
162- result = c .( R:: Ast:: Callable ) .getBody ( )
166+ result = c .( R:: Ast:: Callable ) .getBody ( ) or
167+ result = c .( R:: Ast:: EndBlock ) .getAStmt ( )
163168 }
164169
165170 class Parameter extends AstNode instanceof R:: Ast:: Parameter {
@@ -190,7 +195,7 @@ private module Ast implements AstSig<Location> {
190195 class Expr = Stmt ;
191196
192197 class BlockStmt extends Stmt instanceof R:: Ast:: StmtSequence {
193- BlockStmt ( ) { not this instanceof TryStmt }
198+ BlockStmt ( ) { not this instanceof TryStmt and not this instanceof R :: Ast :: EndBlock }
194199
195200 Stmt getStmt ( int n ) { result = desugar ( super .getStmt ( n ) ) }
196201
@@ -445,6 +450,12 @@ private module Input implements InputSig1, InputSig2 {
445450 result = t .getBeginBlock ( index ) or
446451 result = desugar ( t .getStmt ( index - count ( t .getABeginBlock ( ) ) ) )
447452 )
453+ or
454+ exists ( R:: Ast:: EndBlock e |
455+ c = e and
456+ exists ( ctx ) and
457+ result = desugar ( e .getStmt ( index ) )
458+ )
448459 }
449460
450461 predicate catchAll ( Ast:: CatchClause catch ) {
0 commit comments