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

Method condition

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

Source from the content-addressed store, hash-verified

1366
1367 // parse and return a parenthesized expression
1368 private ConditionData condition() throws IOException {
1369 ConditionData data = new ConditionData();
1370
1371 if (mustMatchToken(Token.LP, "msg.no.paren.cond", true)) data.lp = ts.tokenBeg;
1372
1373 data.condition = expr(false);
1374
1375 if (mustMatchToken(Token.RP, "msg.no.paren.after.cond", true)) data.rp = ts.tokenBeg;
1376
1377 // Report strict warning on code like "if (a = 7) ...". Suppress the
1378 // warning if the condition is parenthesized, like "if ((a = 7)) ...".
1379 if (data.condition instanceof Assignment) {
1380 addStrictWarning(
1381 "msg.equal.as.assign",
1382 "",
1383 data.condition.getPosition(),
1384 data.condition.getLength());
1385 }
1386 return data;
1387 }
1388
1389 private AstNode statement() throws IOException {
1390 int pos = ts.tokenBeg;

Callers 5

ifStatementMethod · 0.95
whileLoopMethod · 0.95
doLoopMethod · 0.95
arrayComprehensionMethod · 0.95
generatorExpressionMethod · 0.95

Calls 5

mustMatchTokenMethod · 0.95
exprMethod · 0.95
addStrictWarningMethod · 0.95
getPositionMethod · 0.65
getLengthMethod · 0.65

Tested by

no test coverage detected