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