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