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

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

Issue 12308005: Fix static name resolution in mixing code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/mixin_extends_method_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 8237 matching lines...) Expand 10 before | Expand all | Expand 10 after
8248 if (local->IsConst()) { 8248 if (local->IsConst()) {
8249 *node = new LiteralNode(ident_pos, *local->ConstValue()); 8249 *node = new LiteralNode(ident_pos, *local->ConstValue());
8250 } else { 8250 } else {
8251 *node = new LoadLocalNode(ident_pos, local); 8251 *node = new LoadLocalNode(ident_pos, local);
8252 } 8252 }
8253 } 8253 }
8254 return true; 8254 return true;
8255 } 8255 }
8256 8256
8257 // Try to find the identifier in the class scope of the current class. 8257 // Try to find the identifier in the class scope of the current class.
8258 Class& cls = Class::Handle(isolate, current_class().raw()); 8258 // If the current class is the result of a mixin application, we must
8259 // use the class scope of the class from which the function originates.
8260 Class& cls = Class::Handle(isolate);
8261 if (current_class().mixin() == Type::null()) {
8262 cls = current_class().raw();
8263 } else {
8264 cls = parsed_function()->function().origin();
8265 }
8259 Function& func = Function::Handle(isolate, Function::null()); 8266 Function& func = Function::Handle(isolate, Function::null());
8260 Field& field = Field::Handle(isolate, Field::null()); 8267 Field& field = Field::Handle(isolate, Field::null());
8261 8268
8262 // First check if a field exists. 8269 // First check if a field exists.
8263 field = cls.LookupField(ident); 8270 field = cls.LookupField(ident);
8264 if (!field.IsNull()) { 8271 if (!field.IsNull()) {
8265 if (node != NULL) { 8272 if (node != NULL) {
8266 if (!field.is_static()) { 8273 if (!field.is_static()) {
8267 CheckInstanceFieldAccess(ident_pos, ident); 8274 CheckInstanceFieldAccess(ident_pos, ident);
8268 *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident); 8275 *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
9992 void Parser::SkipQualIdent() { 9999 void Parser::SkipQualIdent() {
9993 ASSERT(IsIdentifier()); 10000 ASSERT(IsIdentifier());
9994 ConsumeToken(); 10001 ConsumeToken();
9995 if (CurrentToken() == Token::kPERIOD) { 10002 if (CurrentToken() == Token::kPERIOD) {
9996 ConsumeToken(); // Consume the kPERIOD token. 10003 ConsumeToken(); // Consume the kPERIOD token.
9997 ExpectIdentifier("identifier expected after '.'"); 10004 ExpectIdentifier("identifier expected after '.'");
9998 } 10005 }
9999 } 10006 }
10000 10007
10001 } // namespace dart 10008 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/mixin_extends_method_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698