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

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

Issue 2774713002: Remove outdated special handling of 'void' when parsing class members. (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | 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 4441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4452 ConsumeToken(); 4452 ConsumeToken();
4453 if (member.has_static) { 4453 if (member.has_static) {
4454 ReportError("factory method cannot be explicitly marked static"); 4454 ReportError("factory method cannot be explicitly marked static");
4455 } 4455 }
4456 member.has_factory = true; 4456 member.has_factory = true;
4457 member.has_static = true; 4457 member.has_static = true;
4458 // The result type depends on the name of the factory method. 4458 // The result type depends on the name of the factory method.
4459 } 4459 }
4460 4460
4461 // Optionally parse a type. 4461 // Optionally parse a type.
4462 if (CurrentToken() == Token::kVOID) { 4462 bool found_type = false;
4463 if (member.has_var || member.has_factory) { 4463 {
4464 ReportError("void not expected"); 4464 // Lookahead to determine whether the next tokens are a return type.
4465 } 4465 TokenPosScope saved_pos(this);
4466 ConsumeToken(); 4466 if (TryParseType(true)) {
4467 ASSERT(member.type == NULL); 4467 if (IsIdentifier() || (CurrentToken() == Token::kGET) ||
4468 member.type = &Object::void_type(); 4468 (CurrentToken() == Token::kSET) ||
4469 } else { 4469 (CurrentToken() == Token::kOPERATOR)) {
4470 bool found_type = false; 4470 found_type = true;
4471 {
4472 // Lookahead to determine whether the next tokens are a return type.
4473 TokenPosScope saved_pos(this);
4474 if (TryParseType(true)) {
4475 if (IsIdentifier() || (CurrentToken() == Token::kGET) ||
4476 (CurrentToken() == Token::kSET) ||
4477 (CurrentToken() == Token::kOPERATOR)) {
4478 found_type = true;
4479 }
4480 } 4471 }
4481 } 4472 }
4482 if (found_type) { 4473 }
4483 // It is too early to resolve the type here, since it can be a result type 4474 if (found_type) {
4484 // referring to a not yet declared function type parameter. 4475 // It is too early to resolve the type here, since it can be a result type
4485 member.type = &AbstractType::ZoneHandle( 4476 // referring to a not yet declared function type parameter.
4486 Z, ParseTypeOrFunctionType(false, ClassFinalizer::kDoNotResolve)); 4477 member.type = &AbstractType::ZoneHandle(
4487 } 4478 Z, ParseTypeOrFunctionType(true, ClassFinalizer::kDoNotResolve));
4488 } 4479 }
4489 4480
4490 // Optionally parse a (possibly named) constructor name or factory. 4481 // Optionally parse a (possibly named) constructor name or factory.
4491 if (IsIdentifier() && 4482 if (IsIdentifier() &&
4492 (CurrentLiteral()->Equals(members->class_name()) || member.has_factory)) { 4483 (CurrentLiteral()->Equals(members->class_name()) || member.has_factory)) {
4493 member.name_pos = TokenPos(); 4484 member.name_pos = TokenPos();
4494 member.name = CurrentLiteral(); // Unqualified identifier. 4485 member.name = CurrentLiteral(); // Unqualified identifier.
4495 ConsumeToken(); 4486 ConsumeToken();
4496 if (member.has_factory) { 4487 if (member.has_factory) {
4497 // The factory name may be qualified, but the first identifier must match 4488 // The factory name may be qualified, but the first identifier must match
(...skipping 10699 matching lines...) Expand 10 before | Expand all | Expand 10 after
15197 const ArgumentListNode& function_args, 15188 const ArgumentListNode& function_args,
15198 const LocalVariable* temp_for_last_arg, 15189 const LocalVariable* temp_for_last_arg,
15199 bool is_super_invocation) { 15190 bool is_super_invocation) {
15200 UNREACHABLE(); 15191 UNREACHABLE();
15201 return NULL; 15192 return NULL;
15202 } 15193 }
15203 15194
15204 } // namespace dart 15195 } // namespace dart
15205 15196
15206 #endif // DART_PRECOMPILED_RUNTIME 15197 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698