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