| 427 | } |
| 428 | |
| 429 | private ScopeNode jumpTo(ScopeNode toScope) { |
| 430 | ScopeNode cur = _scope.dup(); |
| 431 | ctrl(XCTRL); // Kill current scope |
| 432 | // Prune nested lexical scopes that have depth > than the loop head |
| 433 | // We use _breakScope as a proxy for the loop head scope to obtain the depth |
| 434 | while( cur._lexSize.size() > _breakScope._lexSize.size() ) |
| 435 | cur.pop(); |
| 436 | // If this is a continue then first time the target is null |
| 437 | // So we just use the pruned current scope as the base for the |
| 438 | // "continue" |
| 439 | if( toScope == null ) |
| 440 | return cur; |
| 441 | // toScope is either the break scope, or a scope that was created here |
| 442 | assert toScope._lexSize.size() <= _breakScope._lexSize.size(); |
| 443 | toScope.ctrl(toScope.mergeScopes(cur,loc()).peephole()); |
| 444 | return toScope; |
| 445 | } |
| 446 | |
| 447 | private void checkLoopActive() { if (_breakScope == null) throw error("No active loop for a break or continue"); } |
| 448 | |