Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Side by Side Diff: runtime/vm/parser.cc

Issue 10837288: New getter syntax for top-level getters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, &params); 3772 if (!is_getter || (CurrentToken() == Token::kLPAREN)) {
3773 const bool allow_explicit_default_values = true;
3774 ParseFormalParameterList(allow_explicit_default_values, &params);
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
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
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698