MCPcopy Create free account
hub / github.com/dynjs/dynjs / returnStatement

Method returnStatement

src/main/java/org/dynjs/parser/js/Parser.java:1391–1417  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1389 }
1390
1391 public ReturnStatement returnStatement() {
1392 Token position = consume(RETURN);
1393
1394 if (!isValidReturn()) {
1395 throw new SyntaxError(position, "return not allowed");
1396 }
1397
1398 Expression expr = null;
1399
1400 switch (la(false)) {
1401 case SEMICOLON:
1402 consume( SEMICOLON );
1403 case CR:
1404 case NL:
1405 case CRNL:
1406 case PARAGRAPH_SEPARATOR:
1407 case LINE_SEPARATOR:
1408 case RIGHT_BRACE:
1409 return factory.returnStatement(position);
1410 default:
1411 expr = expression();
1412 }
1413
1414 ReturnStatement statement = factory.returnStatement(position, expr);
1415 semic();
1416 return statement;
1417 }
1418
1419 public ThrowStatement throwStatement() {
1420 Token position = consume(THROW);

Callers 1

statementMethod · 0.95

Calls 5

consumeMethod · 0.95
isValidReturnMethod · 0.95
laMethod · 0.95
expressionMethod · 0.95
semicMethod · 0.95

Tested by

no test coverage detected