@@ -143,6 +143,13 @@ signature module AstSig<LocationSig Location> {
143143 */
144144 class ContinueStmt extends Stmt ;
145145
146+ /**
147+ * A `goto` statement.
148+ *
149+ * Goto statements complete abruptly and jump to a labeled statement.
150+ */
151+ class GotoStmt extends Stmt ;
152+
146153 /**
147154 * A `return` statement.
148155 *
@@ -432,6 +439,8 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
432439 or
433440 n instanceof ContinueStmt
434441 or
442+ n instanceof GotoStmt
443+ or
435444 n instanceof Expr and
436445 exists ( getChild ( n , _) ) and
437446 not Input1:: preOrderExpr ( n ) and
@@ -561,6 +570,8 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
561570 or
562571 n instanceof ContinueStmt
563572 or
573+ n instanceof GotoStmt
574+ or
564575 n instanceof ReturnStmt
565576 or
566577 n instanceof Throw
@@ -1000,6 +1011,9 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
10001011 or
10011012 ast instanceof ContinueStmt and
10021013 c .getSuccessorType ( ) instanceof ContinueSuccessor
1014+ or
1015+ ast instanceof GotoStmt and
1016+ c .getSuccessorType ( ) instanceof GotoSuccessor
10031017 ) and
10041018 (
10051019 not Input1:: hasLabel ( ast , _) and not c .hasLabel ( _)
@@ -1020,6 +1034,11 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
10201034 )
10211035 }
10221036
1037+ private Stmt getAStmtInBlock ( AstNode block ) {
1038+ result = block .( BlockStmt ) .getStmt ( _) or
1039+ result = block .( Switch ) .getStmt ( _)
1040+ }
1041+
10231042 /**
10241043 * Holds if an abrupt completion `c` from within `ast` is caught with
10251044 * flow continuing at `n`.
@@ -1098,6 +1117,16 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
10981117 Input1:: hasLabel ( switch , l )
10991118 )
11001119 )
1120+ or
1121+ exists ( AstNode block , Input1:: Label l , Stmt lblstmt |
1122+ ast = getAStmtInBlock ( block ) and
1123+ lblstmt = getAStmtInBlock ( block ) and
1124+ not lblstmt instanceof GotoStmt and
1125+ Input1:: hasLabel ( pragma [ only_bind_into ] ( lblstmt ) , l ) and
1126+ n .isBefore ( lblstmt ) and
1127+ c .getSuccessorType ( ) instanceof GotoSuccessor and
1128+ c .hasLabel ( l )
1129+ )
11011130 }
11021131
11031132 /**
0 commit comments