| 480 | } |
| 481 | |
| 482 | private ScopeNode jumpTo(ScopeNode toScope) { |
| 483 | ScopeNode cur = _scope.dup(); |
| 484 | ctrl(XCTRL); // Kill current scope |
| 485 | // Prune nested lexical scopes that have depth > than the loop head |
| 486 | // We use _breakScope as a proxy for the loop head scope to obtain the depth |
| 487 | while( cur.depth() > _breakScope.depth() ) |
| 488 | cur.pop(); |
| 489 | // If this is a continue then first time the target is null |
| 490 | // So we just use the pruned current scope as the base for the |
| 491 | // "continue" |
| 492 | if( toScope == null ) |
| 493 | return cur; |
| 494 | // toScope is either the break scope, or a scope that was created here |
| 495 | assert toScope.depth() <= _breakScope.depth(); |
| 496 | toScope.ctrl(toScope.mergeScopes(cur,loc()).peephole()); |
| 497 | return toScope; |
| 498 | } |
| 499 | |
| 500 | private void checkLoopActive() { if (_breakScope == null) throw error("No active loop for a break or continue"); } |
| 501 | |