()
| 1387 | } |
| 1388 | |
| 1389 | private AstNode statement() throws IOException { |
| 1390 | int pos = ts.tokenBeg; |
| 1391 | try { |
| 1392 | AstNode pn = statementHelper(); |
| 1393 | if (pn != null) { |
| 1394 | if (compilerEnv.isStrictMode() && !pn.hasSideEffects()) { |
| 1395 | int beg = pn.getPosition(); |
| 1396 | beg = Math.max(beg, lineBeginningFor(beg)); |
| 1397 | addStrictWarning( |
| 1398 | pn instanceof EmptyStatement |
| 1399 | ? "msg.extra.trailing.semi" |
| 1400 | : "msg.no.side.effects", |
| 1401 | "", |
| 1402 | beg, |
| 1403 | nodeEnd(pn) - beg); |
| 1404 | } |
| 1405 | int ntt = peekToken(); |
| 1406 | if (ntt == Token.COMMENT |
| 1407 | && pn.getLineno() |
| 1408 | == scannedComments.get(scannedComments.size() - 1).getLineno()) { |
| 1409 | pn.setInlineComment(scannedComments.get(scannedComments.size() - 1)); |
| 1410 | consumeToken(); |
| 1411 | } |
| 1412 | return pn; |
| 1413 | } |
| 1414 | } catch (ParserException e) { |
| 1415 | // an ErrorNode was added to the ErrorReporter |
| 1416 | } |
| 1417 | |
| 1418 | // error: skip ahead to a probable statement boundary |
| 1419 | guessingStatementEnd: |
| 1420 | for (; ; ) { |
| 1421 | int tt = peekTokenOrEOL(); |
| 1422 | consumeToken(); |
| 1423 | switch (tt) { |
| 1424 | case Token.ERROR: |
| 1425 | case Token.EOF: |
| 1426 | case Token.EOL: |
| 1427 | case Token.SEMI: |
| 1428 | break guessingStatementEnd; |
| 1429 | } |
| 1430 | } |
| 1431 | // We don't make error nodes explicitly part of the tree; |
| 1432 | // they get added to the ErrorReporter. May need to do |
| 1433 | // something different here. |
| 1434 | return new EmptyStatement(pos, ts.tokenBeg - pos); |
| 1435 | } |
| 1436 | |
| 1437 | private AstNode statementHelper() throws IOException { |
| 1438 | // If the statement is set, then it's been told its label by now. |
no test coverage detected