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

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

Issue 11312109: Make sure setter does not conflict with method (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/field7_negative_test.dart » ('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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 bool is_interface, 575 bool is_interface,
576 intptr_t token_pos) 576 intptr_t token_pos)
577 : clazz_(cls), 577 : clazz_(cls),
578 class_name_(cls_name), 578 class_name_(cls_name),
579 is_interface_(is_interface), 579 is_interface_(is_interface),
580 token_pos_(token_pos), 580 token_pos_(token_pos),
581 functions_(GrowableObjectArray::Handle(GrowableObjectArray::New())), 581 functions_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
582 fields_(GrowableObjectArray::Handle(GrowableObjectArray::New())) { 582 fields_(GrowableObjectArray::Handle(GrowableObjectArray::New())) {
583 } 583 }
584 584
585 // Parameter 'name' is the unmangled name, i.e. without the setter
586 // name mangling.
585 bool FunctionNameExists(const String& name, RawFunction::Kind kind) const { 587 bool FunctionNameExists(const String& name, RawFunction::Kind kind) const {
586 // First check if a function or field of same name exists. 588 // First check if a function or field of same name exists.
587 if (FunctionExists(name)) { 589 if ((kind != RawFunction::kSetterFunction) && FunctionExists(name)) {
588 return true; 590 return true;
589 } 591 }
590 // Now check whether there is a field and whether its implicit getter 592 // Now check whether there is a field and whether its implicit getter
591 // or setter collides with the name. 593 // or setter collides with the name.
592 Field* field = LookupField(name); 594 Field* field = LookupField(name);
593 if (field != NULL) { 595 if (field != NULL) {
594 if (kind == RawFunction::kSetterFunction) { 596 if (kind == RawFunction::kSetterFunction) {
595 // It's ok to have an implicit getter, it does not collide with 597 // It's ok to have an implicit getter, it does not collide with
596 // this setter function. 598 // this setter function.
597 if (!field->is_final()) { 599 if (!field->is_final()) {
(...skipping 9351 matching lines...) Expand 10 before | Expand all | Expand 10 after
9949 void Parser::SkipQualIdent() { 9951 void Parser::SkipQualIdent() {
9950 ASSERT(IsIdentifier()); 9952 ASSERT(IsIdentifier());
9951 ConsumeToken(); 9953 ConsumeToken();
9952 if (CurrentToken() == Token::kPERIOD) { 9954 if (CurrentToken() == Token::kPERIOD) {
9953 ConsumeToken(); // Consume the kPERIOD token. 9955 ConsumeToken(); // Consume the kPERIOD token.
9954 ExpectIdentifier("identifier expected after '.'"); 9956 ExpectIdentifier("identifier expected after '.'");
9955 } 9957 }
9956 } 9958 }
9957 9959
9958 } // namespace dart 9960 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/field7_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698