(ScopeNode toScope)
| 321 | } |
| 322 | |
| 323 | private ScopeNode jumpTo(ScopeNode toScope) { |
| 324 | ScopeNode cur = _scope.dup(); |
| 325 | ctrl(XCTRL); // Kill current scope |
| 326 | // Prune nested lexical scopes that have depth > than the loop head |
| 327 | // We use _breakScope as a proxy for the loop head scope to obtain the depth |
| 328 | while( cur._scopes.size() > _breakScope._scopes.size() ) |
| 329 | cur.pop(); |
| 330 | // If this is a continue then first time the target is null |
| 331 | // So we just use the pruned current scope as the base for the |
| 332 | // "continue" |
| 333 | if (toScope == null) |
| 334 | return cur; |
| 335 | // toScope is either the break scope, or a scope that was created here |
| 336 | assert toScope._scopes.size() <= _breakScope._scopes.size(); |
| 337 | toScope.ctrl(toScope.mergeScopes(cur)); |
| 338 | return toScope; |
| 339 | } |
| 340 | |
| 341 | private void checkLoopActive() { if (_breakScope == null) throw Parser.error("No active loop for a break or continue"); } |
| 342 |
no test coverage detected