MCPcopy Create free account
hub / github.com/mozilla/rhino / enterLoop

Method enterLoop

rhino/src/main/java/org/mozilla/javascript/Parser.java:567–584  ·  view source on GitHub ↗
(Loop loop)

Source from the content-addressed store, hash-verified

565 }
566
567 private void enterLoop(Loop loop) {
568 if (loopSet == null) loopSet = new ArrayList<>();
569 loopSet.add(loop);
570 if (loopAndSwitchSet == null) loopAndSwitchSet = new ArrayList<>();
571 loopAndSwitchSet.add(loop);
572 pushScope(loop);
573 if (currentLabel != null) {
574 currentLabel.setStatement(loop);
575 currentLabel.getFirstLabel().setLoop(loop);
576 // This is the only time during parsing that we set a node's parent
577 // before parsing the children. In order for the child node offsets
578 // to be correct, we adjust the loop's reported position back to an
579 // absolute source offset, and restore it when we call
580 // restoreRelativeLoopPosition() (invoked just before setBody() is
581 // called on the loop).
582 loop.setRelative(-currentLabel.getPosition());
583 }
584 }
585
586 private void exitLoop() {
587 loopSet.remove(loopSet.size() - 1);

Callers 3

whileLoopMethod · 0.95
doLoopMethod · 0.95
forLoopMethod · 0.95

Calls 7

pushScopeMethod · 0.95
setLoopMethod · 0.80
getFirstLabelMethod · 0.80
setRelativeMethod · 0.80
addMethod · 0.65
getPositionMethod · 0.65
setStatementMethod · 0.45

Tested by

no test coverage detected