@@ -1285,23 +1285,9 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
12851285 )
12861286 }
12871287
1288- /** Holds if `n` has `l`, possibly through enclosing labeled statements. */
1289- private predicate hasLabel ( AstNode n , Input1:: Label l ) {
1290- Input1:: hasLabel ( n , l )
1291- or
1292- exists ( LabeledStmt labeled | labeled .getStmt ( ) = n and hasLabel ( labeled , l ) )
1293- }
1294-
1295- /**
1296- * Holds if `target` is a labeled statement at the start of `root`,
1297- * possibly nested under other labeled statements.
1298- */
1299- private predicate labeledTargetInRoot ( Stmt root , LabeledStmt target ) {
1300- root = target
1301- or
1302- exists ( LabeledStmt labeled |
1303- root = labeled and labeledTargetInRoot ( labeled .getStmt ( ) , target )
1304- )
1288+ /** Holds if `n` is marked with a `LabeledStmt` with label `l`. */
1289+ private predicate hasEnclosingLabel ( AstNode n , Input1:: Label l ) {
1290+ exists ( LabeledStmt labeled | labeled .getStmt + ( ) = n and Input1:: hasLabel ( labeled , l ) )
13051291 }
13061292
13071293 private predicate callableHasParamDefault ( Callable c , Expr defaultValue ) {
@@ -1342,7 +1328,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
13421328 or
13431329 exists ( Input1:: Label l |
13441330 c .hasLabel ( l ) and
1345- hasLabel ( loop , l )
1331+ hasEnclosingLabel ( loop , l )
13461332 )
13471333 )
13481334 )
@@ -1382,7 +1368,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
13821368 or
13831369 exists ( Input1:: Label l |
13841370 c .hasLabel ( l ) and
1385- hasLabel ( switch , l )
1371+ hasEnclosingLabel ( switch , l )
13861372 )
13871373 )
13881374 or
@@ -1394,19 +1380,11 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
13941380 c .hasLabel ( l )
13951381 )
13961382 or
1397- exists ( AstNode parent , Stmt root , LabeledStmt target , Input1:: Label l |
1383+ exists ( AstNode parent , LabeledStmt root , LabeledStmt target , Input1:: Label l |
13981384 ast = getChild ( parent , _) and
13991385 root = getChild ( parent , _) and
1400- labeledTargetInRoot ( root , target ) and
1401- Input1:: hasLabel ( target , l ) and
1402- n .isBefore ( target ) and
1403- c .getSuccessorType ( ) instanceof GotoSuccessor and
1404- c .hasLabel ( l )
1405- )
1406- or
1407- exists ( LabeledStmt target , Input1:: Label l |
1408- ast = target .getStmt ( ) and
1409- Input1:: hasLabel ( target , l ) and
1386+ root .getStmt * ( ) = target and
1387+ Input1:: hasLabel ( pragma [ only_bind_into ] ( target ) , l ) and
14101388 n .isBefore ( target ) and
14111389 c .getSuccessorType ( ) instanceof GotoSuccessor and
14121390 c .hasLabel ( l )
0 commit comments