| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3759 is_getter = (CurrentToken() == Token::kGET); | 3759 is_getter = (CurrentToken() == Token::kGET); |
| 3760 if (CurrentToken() == Token::kGET || CurrentToken() == Token::kSET) { | 3760 if (CurrentToken() == Token::kGET || CurrentToken() == Token::kSET) { |
| 3761 ConsumeToken(); | 3761 ConsumeToken(); |
| 3762 } else { | 3762 } else { |
| 3763 UnexpectedToken(); | 3763 UnexpectedToken(); |
| 3764 } | 3764 } |
| 3765 } | 3765 } |
| 3766 const intptr_t name_pos = TokenPos(); | 3766 const intptr_t name_pos = TokenPos(); |
| 3767 const String* field_name = ExpectIdentifier("accessor name expected"); | 3767 const String* field_name = ExpectIdentifier("accessor name expected"); |
| 3768 | 3768 |
| 3769 if (CurrentToken() != Token::kLPAREN) { | |
| 3770 ErrorMsg("'(' expected"); | |
| 3771 } | |
| 3772 const intptr_t accessor_pos = TokenPos(); | 3769 const intptr_t accessor_pos = TokenPos(); |
| 3773 ParamList params; | 3770 ParamList params; |
| 3774 const bool allow_explicit_default_values = true; | 3771 // TODO(hausner): Remove the ( check once we remove old getter syntax. |
| 3775 ParseFormalParameterList(allow_explicit_default_values, ¶ms); | 3772 if (!is_getter || (CurrentToken() == Token::kLPAREN)) { |
| 3773 const bool allow_explicit_default_values = true; |
| 3774 ParseFormalParameterList(allow_explicit_default_values, ¶ms); |
| 3775 } |
| 3776 String& accessor_name = String::ZoneHandle(); | 3776 String& accessor_name = String::ZoneHandle(); |
| 3777 int expected_num_parameters = -1; | 3777 int expected_num_parameters = -1; |
| 3778 if (is_getter) { | 3778 if (is_getter) { |
| 3779 expected_num_parameters = 0; | 3779 expected_num_parameters = 0; |
| 3780 accessor_name = Field::GetterSymbol(*field_name); | 3780 accessor_name = Field::GetterSymbol(*field_name); |
| 3781 } else { | 3781 } else { |
| 3782 expected_num_parameters = 1; | 3782 expected_num_parameters = 1; |
| 3783 accessor_name = Field::SetterSymbol(*field_name); | 3783 accessor_name = Field::SetterSymbol(*field_name); |
| 3784 } | 3784 } |
| 3785 if ((params.num_fixed_parameters != expected_num_parameters) || | 3785 if ((params.num_fixed_parameters != expected_num_parameters) || |
| (...skipping 5296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9082 void Parser::SkipQualIdent() { | 9082 void Parser::SkipQualIdent() { |
| 9083 ASSERT(IsIdentifier()); | 9083 ASSERT(IsIdentifier()); |
| 9084 ConsumeToken(); | 9084 ConsumeToken(); |
| 9085 if (CurrentToken() == Token::kPERIOD) { | 9085 if (CurrentToken() == Token::kPERIOD) { |
| 9086 ConsumeToken(); // Consume the kPERIOD token. | 9086 ConsumeToken(); // Consume the kPERIOD token. |
| 9087 ExpectIdentifier("identifier expected after '.'"); | 9087 ExpectIdentifier("identifier expected after '.'"); |
| 9088 } | 9088 } |
| 9089 } | 9089 } |
| 9090 | 9090 |
| 9091 } // namespace dart | 9091 } // namespace dart |
| OLD | NEW |