()
| 1072 | } |
| 1073 | |
| 1074 | public List<Parameter> formalParameterList() { |
| 1075 | List<Parameter> params = new ArrayList<>(); |
| 1076 | |
| 1077 | while (la() != RIGHT_PAREN) { |
| 1078 | params.add(parameter()); |
| 1079 | if (la() == COMMA) { |
| 1080 | consume(); |
| 1081 | } else { |
| 1082 | break; |
| 1083 | } |
| 1084 | } |
| 1085 | |
| 1086 | if (currentContext().isStrict()) { |
| 1087 | Set<String> seen = new HashSet<>(); |
| 1088 | for (Parameter each : params) { |
| 1089 | if (seen.contains(each.getIdentifier())) { |
| 1090 | throw new SyntaxError(each.getPosition(), "duplicate formal parameters not allowed in strict-mode"); |
| 1091 | } |
| 1092 | seen.add(each.getIdentifier()); |
| 1093 | } |
| 1094 | } |
| 1095 | |
| 1096 | return params; |
| 1097 | } |
| 1098 | |
| 1099 | public Parameter parameter() { |
| 1100 | Token identifier = consume(IDENTIFIER); |
no test coverage detected