()
| 1131 | // ---------------------------------------------------------------------- |
| 1132 | |
| 1133 | public List<Statement> sourceElements() { |
| 1134 | List<Statement> statements = new ArrayList<>(); |
| 1135 | while (la() != EOF && la() != RIGHT_BRACE) { |
| 1136 | Statement element = sourceElement(); |
| 1137 | if (currentContext().isInProlog()) { |
| 1138 | if (element instanceof ExpressionStatement) { |
| 1139 | Expression expr = ((ExpressionStatement) element).getExpr(); |
| 1140 | if (expr instanceof StringLiteralExpression) { |
| 1141 | if (((StringLiteralExpression) expr).getLiteral().equals("use strict")) { |
| 1142 | if (!((StringLiteralExpression) expr).isContinuedLine() && !((StringLiteralExpression) expr).isEscaped()) { |
| 1143 | currentContext().setStrict(true); |
| 1144 | } |
| 1145 | } |
| 1146 | } else { |
| 1147 | currentContext().setInProlog(false); |
| 1148 | } |
| 1149 | } else { |
| 1150 | currentContext().setInProlog(false); |
| 1151 | } |
| 1152 | } |
| 1153 | statements.add(element); |
| 1154 | } |
| 1155 | return statements; |
| 1156 | } |
| 1157 | |
| 1158 | public Statement sourceElement() { |
| 1159 | if (la() == FUNCTION) { |
no test coverage detected