OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |