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

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

Issue 1636583003: Allow methods to be named ‘factory’ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | tests/language/language_dart2js.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 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after
4105 if (member.has_const) { 4105 if (member.has_const) {
4106 ReportError("identifier expected after 'const'"); 4106 ReportError("identifier expected after 'const'");
4107 } 4107 }
4108 if (member.has_final) { 4108 if (member.has_final) {
4109 ReportError("identifier expected after 'final'"); 4109 ReportError("identifier expected after 'final'");
4110 } 4110 }
4111 ConsumeToken(); 4111 ConsumeToken();
4112 member.has_var = true; 4112 member.has_var = true;
4113 // The member type is the 'dynamic' type. 4113 // The member type is the 'dynamic' type.
4114 member.type = &Object::dynamic_type(); 4114 member.type = &Object::dynamic_type();
4115 } else if (CurrentToken() == Token::kFACTORY) { 4115 } else if ((CurrentToken() == Token::kFACTORY) &&
4116 (LookaheadToken(1) != Token::kLPAREN)) {
4116 ConsumeToken(); 4117 ConsumeToken();
4117 if (member.has_static) { 4118 if (member.has_static) {
4118 ReportError("factory method cannot be explicitly marked static"); 4119 ReportError("factory method cannot be explicitly marked static");
4119 } 4120 }
4120 member.has_factory = true; 4121 member.has_factory = true;
4121 member.has_static = true; 4122 member.has_static = true;
4122 // The result type depends on the name of the factory method. 4123 // The result type depends on the name of the factory method.
4123 } 4124 }
4124 // Optionally parse a type. 4125 // Optionally parse a type.
4125 if (CurrentToken() == Token::kVOID) { 4126 if (CurrentToken() == Token::kVOID) {
(...skipping 10227 matching lines...) Expand 10 before | Expand all | Expand 10 after
14353 const ArgumentListNode& function_args, 14354 const ArgumentListNode& function_args,
14354 const LocalVariable* temp_for_last_arg, 14355 const LocalVariable* temp_for_last_arg,
14355 bool is_super_invocation) { 14356 bool is_super_invocation) {
14356 UNREACHABLE(); 14357 UNREACHABLE();
14357 return NULL; 14358 return NULL;
14358 } 14359 }
14359 14360
14360 } // namespace dart 14361 } // namespace dart
14361 14362
14362 #endif // DART_PRECOMPILED_RUNTIME 14363 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698