Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 5539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5550 ASSERT(CurrentToken() == Token::kLPAREN); | 5550 ASSERT(CurrentToken() == Token::kLPAREN); |
| 5551 function_name = &Symbols::AnonymousClosure(); | 5551 function_name = &Symbols::AnonymousClosure(); |
| 5552 } else { | 5552 } else { |
| 5553 if (CurrentToken() == Token::kVOID) { | 5553 if (CurrentToken() == Token::kVOID) { |
| 5554 ConsumeToken(); | 5554 ConsumeToken(); |
| 5555 result_type = Type::VoidType(); | 5555 result_type = Type::VoidType(); |
| 5556 } else if ((CurrentToken() == Token::kIDENT) && | 5556 } else if ((CurrentToken() == Token::kIDENT) && |
| 5557 (LookaheadToken(1) != Token::kLPAREN)) { | 5557 (LookaheadToken(1) != Token::kLPAREN)) { |
| 5558 result_type = ParseType(ClassFinalizer::kCanonicalize); | 5558 result_type = ParseType(ClassFinalizer::kCanonicalize); |
| 5559 } | 5559 } |
| 5560 intptr_t name_pos = TokenPos(); | |
|
srdjan
2013/11/04 18:18:55
const
hausner
2013/11/04 18:52:23
Done.
| |
| 5560 variable_name = ExpectIdentifier("function name expected"); | 5561 variable_name = ExpectIdentifier("function name expected"); |
| 5561 function_name = variable_name; | 5562 function_name = variable_name; |
| 5563 | |
| 5564 // Check that the function name has not been referenced | |
| 5565 // before this declaration. | |
| 5566 ASSERT(current_block_ != NULL); | |
| 5567 const intptr_t previous_pos = | |
| 5568 current_block_->scope->PreviousReferencePos(*function_name); | |
| 5569 if (previous_pos >= 0) { | |
| 5570 ASSERT(!script_.IsNull()); | |
| 5571 intptr_t line_number; | |
| 5572 script_.GetTokenLocation(previous_pos, &line_number, NULL); | |
| 5573 ErrorMsg(name_pos, | |
| 5574 "identifier '%s' previously used in line %" Pd "", | |
| 5575 function_name->ToCString(), | |
| 5576 line_number); | |
| 5577 } | |
| 5562 } | 5578 } |
| 5563 | 5579 |
| 5564 if (CurrentToken() != Token::kLPAREN) { | 5580 if (CurrentToken() != Token::kLPAREN) { |
| 5565 ErrorMsg("'(' expected"); | 5581 ErrorMsg("'(' expected"); |
| 5566 } | 5582 } |
| 5567 | 5583 |
| 5568 // Check whether we have parsed this closure function before, in a previous | 5584 // Check whether we have parsed this closure function before, in a previous |
| 5569 // compilation. If so, reuse the function object, else create a new one | 5585 // compilation. If so, reuse the function object, else create a new one |
| 5570 // and register it in the current class. | 5586 // and register it in the current class. |
| 5571 // Note that we cannot share the same closure function between the closurized | 5587 // Note that we cannot share the same closure function between the closurized |
| (...skipping 5183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10755 void Parser::SkipQualIdent() { | 10771 void Parser::SkipQualIdent() { |
| 10756 ASSERT(IsIdentifier()); | 10772 ASSERT(IsIdentifier()); |
| 10757 ConsumeToken(); | 10773 ConsumeToken(); |
| 10758 if (CurrentToken() == Token::kPERIOD) { | 10774 if (CurrentToken() == Token::kPERIOD) { |
| 10759 ConsumeToken(); // Consume the kPERIOD token. | 10775 ConsumeToken(); // Consume the kPERIOD token. |
| 10760 ExpectIdentifier("identifier expected after '.'"); | 10776 ExpectIdentifier("identifier expected after '.'"); |
| 10761 } | 10777 } |
| 10762 } | 10778 } |
| 10763 | 10779 |
| 10764 } // namespace dart | 10780 } // namespace dart |
| OLD | NEW |