| 447 | } |
| 448 | |
| 449 | private ScopeNode jumpTo(ScopeNode toScope) { |
| 450 | ScopeNode cur = _scope.dup(); |
| 451 | ctrl(XCTRL); // Kill current scope |
| 452 | // Prune nested lexical scopes that have depth > than the loop head |
| 453 | // We use _breakScope as a proxy for the loop head scope to obtain the depth |
| 454 | while( cur._lexSize.size() > _breakScope._lexSize.size() ) |
| 455 | cur.pop(); |
| 456 | // If this is a continue then first time the target is null |
| 457 | // So we just use the pruned current scope as the base for the |
| 458 | // "continue" |
| 459 | if( toScope == null ) |
| 460 | return cur; |
| 461 | // toScope is either the break scope, or a scope that was created here |
| 462 | assert toScope._lexSize.size() <= _breakScope._lexSize.size(); |
| 463 | toScope.ctrl(toScope.mergeScopes(cur,loc()).peephole()); |
| 464 | return toScope; |
| 465 | } |
| 466 | |
| 467 | private void checkLoopActive() { if (_breakScope == null) throw error("No active loop for a break or continue"); } |
| 468 | |