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

Method doLoop

rhino/src/main/java/org/mozilla/javascript/Parser.java:1717–1745  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1715 }
1716
1717 private DoLoop doLoop() throws IOException {
1718 if (currentToken != Token.DO) codeBug();
1719 consumeToken();
1720 int pos = ts.tokenBeg, end;
1721 DoLoop pn = new DoLoop(pos);
1722 pn.setLineColumnNumber(lineNumber(), columnNumber());
1723 enterLoop(pn);
1724 try {
1725 AstNode body = getNextStatementAfterInlineComments(pn);
1726 mustMatchToken(Token.WHILE, "msg.no.while.do", true);
1727 pn.setWhilePosition(ts.tokenBeg - pos);
1728 ConditionData data = condition();
1729 pn.setCondition(data.condition);
1730 pn.setParens(data.lp - pos, data.rp - pos);
1731 end = getNodeEnd(body);
1732 restoreRelativeLoopPosition(pn);
1733 pn.setBody(body);
1734 } finally {
1735 exitLoop();
1736 }
1737 // Always auto-insert semicolon to follow SpiderMonkey:
1738 // It is required by ECMAScript but is ignored by the rest of
1739 // world, see bug 238945
1740 if (matchToken(Token.SEMI, true)) {
1741 end = ts.tokenEnd;
1742 }
1743 pn.setLength(end - pos);
1744 return pn;
1745 }
1746
1747 private int peekUntilNonComment(int tt) throws IOException {
1748 while (tt == Token.COMMENT) {

Callers 1

statementHelperMethod · 0.95

Calls 15

codeBugMethod · 0.95
consumeTokenMethod · 0.95
lineNumberMethod · 0.95
columnNumberMethod · 0.95
enterLoopMethod · 0.95
mustMatchTokenMethod · 0.95
setWhilePositionMethod · 0.95
conditionMethod · 0.95
setConditionMethod · 0.95
getNodeEndMethod · 0.95

Tested by

no test coverage detected