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

Method formalParameterList

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

Source from the content-addressed store, hash-verified

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);

Callers 1

formalParametersMethod · 0.95

Calls 9

laMethod · 0.95
parameterMethod · 0.95
consumeMethod · 0.95
currentContextMethod · 0.95
containsMethod · 0.80
isStrictMethod · 0.65
getPositionMethod · 0.65
addMethod · 0.45
getIdentifierMethod · 0.45

Tested by

no test coverage detected