| 480 | // Prune nested lexical scopes that have depth > than the loop head |
| 481 | // We use _breakScope as a proxy for the loop head scope to obtain the depth |
| 482 | while( cur.depth() > _breakScope.depth() ) |
| 483 | cur.pop(); |
| 484 | // If this is a continue then first time the target is null |
| 485 | // So we just use the pruned current scope as the base for the |
| 486 | // "continue" |
| 487 | if( toScope == null ) |
| 488 | return cur; |
| 489 | // toScope is either the break scope, or a scope that was created here |
| 490 | assert toScope.depth() <= _breakScope.depth(); |
| 491 | toScope.ctrl(toScope.mergeScopes(cur,loc()).peephole()); |
| 492 | return toScope; |
| 493 | } |
| 494 | |
| 495 | private void checkLoopActive() { if (_breakScope == null) throw error("No active loop for a break or continue"); } |
| 496 | |
| 497 | private Node parseContinue() { checkLoopActive(); _continueScope = require(jumpTo( _continueScope ),";"); return ZERO; } |
| 498 | private Node parseBreak () { |
| 499 | checkLoopActive(); |
| 500 | // At the time of the break, and loop-exit conditions are only valid if |
| 501 | // they are ALSO valid at the break. It is the intersection of |