()
| 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); |
no test coverage detected