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

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

Issue 23684061: Detect illegal class member names (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/co19/co19-runtime.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 "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 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 ConsumeToken(); 3610 ConsumeToken();
3611 } else if (IsIdentifier()) { 3611 } else if (IsIdentifier()) {
3612 member.name = CurrentLiteral(); 3612 member.name = CurrentLiteral();
3613 member.name_pos = TokenPos(); 3613 member.name_pos = TokenPos();
3614 ConsumeToken(); 3614 ConsumeToken();
3615 } else { 3615 } else {
3616 ErrorMsg("identifier expected"); 3616 ErrorMsg("identifier expected");
3617 } 3617 }
3618 3618
3619 ASSERT(member.name != NULL); 3619 ASSERT(member.name != NULL);
3620 if (member.kind != RawFunction::kConstructor) {
3621 if (member.name->Equals(members->class_name())) {
3622 ErrorMsg(member.name_pos,
3623 "class member must not have the same name as its class");
3624 }
3625 }
3626
3620 if (CurrentToken() == Token::kLPAREN || member.IsGetter()) { 3627 if (CurrentToken() == Token::kLPAREN || member.IsGetter()) {
3621 // Constructor or method. 3628 // Constructor or method.
3622 if (member.type == NULL) { 3629 if (member.type == NULL) {
3623 member.type = &Type::ZoneHandle(Type::DynamicType()); 3630 member.type = &Type::ZoneHandle(Type::DynamicType());
3624 } 3631 }
3625 ASSERT(member.IsFactory() == member.has_factory); 3632 ASSERT(member.IsFactory() == member.has_factory);
3626 ParseMethodOrConstructor(members, &member); 3633 ParseMethodOrConstructor(members, &member);
3627 } else if (CurrentToken() == Token::kSEMICOLON || 3634 } else if (CurrentToken() == Token::kSEMICOLON ||
3628 CurrentToken() == Token::kCOMMA || 3635 CurrentToken() == Token::kCOMMA ||
3629 CurrentToken() == Token::kASSIGN) { 3636 CurrentToken() == Token::kASSIGN) {
(...skipping 6780 matching lines...) Expand 10 before | Expand all | Expand 10 after
10410 void Parser::SkipQualIdent() { 10417 void Parser::SkipQualIdent() {
10411 ASSERT(IsIdentifier()); 10418 ASSERT(IsIdentifier());
10412 ConsumeToken(); 10419 ConsumeToken();
10413 if (CurrentToken() == Token::kPERIOD) { 10420 if (CurrentToken() == Token::kPERIOD) {
10414 ConsumeToken(); // Consume the kPERIOD token. 10421 ConsumeToken(); // Consume the kPERIOD token.
10415 ExpectIdentifier("identifier expected after '.'"); 10422 ExpectIdentifier("identifier expected after '.'");
10416 } 10423 }
10417 } 10424 }
10418 10425
10419 } // namespace dart 10426 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698