Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 7923) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -1034,6 +1034,16 @@ |
| params->has_field_initializer = true; |
| } |
| + // Check that the formal parameter is not repeated. |
| + const intptr_t num_existing_parameters = |
| + params->num_fixed_parameters + params->num_optional_parameters; |
| + for (intptr_t i = 0; i < num_existing_parameters; i++) { |
| + ParamDesc& existing_parameter = (*params->parameters)[i]; |
| + if (existing_parameter.name->Equals(*parameter.name)) { |
| + ErrorMsg(parameter.name_pos, "repeated formal parameter"); |
|
hausner
2012/05/23 21:34:39
In other places we use the phrase "duplicate", so
|
| + } |
| + } |
| + |
| if (CurrentToken() == Token::kLPAREN) { |
| // This parameter is probably a closure. If we saw the keyword 'var' |
| // or 'final', a closure is not legal here and we ignore the |