(ScopeNode toScope)
| 297 | } |
| 298 | |
| 299 | private ScopeNode jumpTo(ScopeNode toScope) { |
| 300 | ScopeNode cur = _scope.dup(); |
| 301 | ctrl(XCTRL); // Kill current scope |
| 302 | // Prune nested lexical scopes that have depth > than the loop head |
| 303 | // We use _breakScope as a proxy for the loop head scope to obtain the depth |
| 304 | while( cur._scopes.size() > _breakScope._scopes.size() ) |
| 305 | cur.pop(); |
| 306 | // If this is a continue then first time the target is null |
| 307 | // So we just use the pruned current scope as the base for the |
| 308 | // "continue" |
| 309 | if (toScope == null) |
| 310 | return cur; |
| 311 | // toScope is either the break scope, or a scope that was created here |
| 312 | assert toScope._scopes.size() <= _breakScope._scopes.size(); |
| 313 | toScope.ctrl(toScope.mergeScopes(cur)); |
| 314 | return toScope; |
| 315 | } |
| 316 | |
| 317 | private void checkLoopActive() { if (_breakScope == null) throw Parser.error("No active loop for a break or continue"); } |
| 318 |
no test coverage detected