MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / jumpTo

Method jumpTo

chapter24/src/main/java/com/seaofnodes/simple/Parser.java:482–498  ·  view source on GitHub ↗
(ScopeNode toScope)

Source from the content-addressed store, hash-verified

480 // Prune nested lexical scopes that have depth > than the loop head
481 // We use _breakScope as a proxy for the loop head scope to obtain the depth
482 while( cur.depth() > _breakScope.depth() )
483 cur.pop();
484 // If this is a continue then first time the target is null
485 // So we just use the pruned current scope as the base for the
486 // "continue"
487 if( toScope == null )
488 return cur;
489 // toScope is either the break scope, or a scope that was created here
490 assert toScope.depth() <= _breakScope.depth();
491 toScope.ctrl(toScope.mergeScopes(cur,loc()).peephole());
492 return toScope;
493 }
494
495 private void checkLoopActive() { if (_breakScope == null) throw error("No active loop for a break or continue"); }
496
497 private Node parseContinue() { checkLoopActive(); _continueScope = require(jumpTo( _continueScope ),";"); return ZERO; }
498 private Node parseBreak () {
499 checkLoopActive();
500 // At the time of the break, and loop-exit conditions are only valid if
501 // they are ALSO valid at the break. It is the intersection of

Callers 3

parseLoopingMethod · 0.95
parseContinueMethod · 0.95
parseBreakMethod · 0.95

Calls 7

ctrlMethod · 0.95
depthMethod · 0.95
popMethod · 0.95
locMethod · 0.95
dupMethod · 0.45
peepholeMethod · 0.45
mergeScopesMethod · 0.45

Tested by

no test coverage detected