Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 29817) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -5557,8 +5557,24 @@ |
| (LookaheadToken(1) != Token::kLPAREN)) { |
| result_type = ParseType(ClassFinalizer::kCanonicalize); |
| } |
| + intptr_t name_pos = TokenPos(); |
|
srdjan
2013/11/04 18:18:55
const
hausner
2013/11/04 18:52:23
Done.
|
| variable_name = ExpectIdentifier("function name expected"); |
| function_name = variable_name; |
| + |
| + // Check that the function name has not been referenced |
| + // before this declaration. |
| + ASSERT(current_block_ != NULL); |
| + const intptr_t previous_pos = |
| + current_block_->scope->PreviousReferencePos(*function_name); |
| + if (previous_pos >= 0) { |
| + ASSERT(!script_.IsNull()); |
| + intptr_t line_number; |
| + script_.GetTokenLocation(previous_pos, &line_number, NULL); |
| + ErrorMsg(name_pos, |
| + "identifier '%s' previously used in line %" Pd "", |
| + function_name->ToCString(), |
| + line_number); |
| + } |
| } |
| if (CurrentToken() != Token::kLPAREN) { |