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

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

Issue 25842003: VM: Fix bug with evaluation order of static setter invocation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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-co19.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 8118 matching lines...) Expand 10 before | Expand all | Expand 10 after
8129 } 8129 }
8130 8130
8131 // Explicit setter function for the field found, field does not exist. 8131 // Explicit setter function for the field found, field does not exist.
8132 // Create a getter node first in case it is needed. If getter node 8132 // Create a getter node first in case it is needed. If getter node
8133 // is used as part of, e.g., "+=", and the explicit getter does not 8133 // is used as part of, e.g., "+=", and the explicit getter does not
8134 // exist, and error will be reported by the code generator. 8134 // exist, and error will be reported by the code generator.
8135 access = new StaticGetterNode(call_pos, 8135 access = new StaticGetterNode(call_pos,
8136 NULL, 8136 NULL,
8137 false, 8137 false,
8138 Class::ZoneHandle(cls.raw()), 8138 Class::ZoneHandle(cls.raw()),
8139 String::ZoneHandle(field_name.raw())); 8139 field_name);
Florian Schneider 2013/10/03 15:33:22 field_name is already a ZoneHandle.
8140 } else { 8140 } else {
8141 // Field exists. 8141 // Field exists.
8142 if (field.is_final()) { 8142 if (field.is_final()) {
8143 // Field has been marked as final, report an error as the field 8143 // Field has been marked as final, report an error as the field
8144 // is not settable. 8144 // is not settable.
8145 ErrorMsg(ident_pos, 8145 ErrorMsg(ident_pos,
8146 "field '%s' is const static, cannot assign to it", 8146 "field '%s' is const static, cannot assign to it",
8147 field_name.ToCString()); 8147 field_name.ToCString());
8148 } 8148 }
8149 access = GenerateStaticFieldLookup(field, TokenPos()); 8149 access = GenerateStaticFieldLookup(field, TokenPos());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
8199 if (primary->IsSuper()) { 8199 if (primary->IsSuper()) {
8200 return primary; 8200 return primary;
8201 } 8201 }
8202 // In a static method, evaluation of an unresolved identifier causes a 8202 // In a static method, evaluation of an unresolved identifier causes a
8203 // NoSuchMethodError to be thrown. 8203 // NoSuchMethodError to be thrown.
8204 // In an instance method, we convert this into a getter call 8204 // In an instance method, we convert this into a getter call
8205 // for a field (which may be defined in a subclass.) 8205 // for a field (which may be defined in a subclass.)
8206 String& name = String::CheckedZoneHandle(primary->primary().raw()); 8206 String& name = String::CheckedZoneHandle(primary->primary().raw());
8207 if (current_function().is_static() || 8207 if (current_function().is_static() ||
8208 current_function().IsInFactoryScope()) { 8208 current_function().IsInFactoryScope()) {
8209 return ThrowNoSuchMethodError(primary->token_pos(), 8209 return new StaticGetterNode(primary->token_pos(),
8210 current_class(), 8210 NULL, // No receiver.
8211 name, 8211 false, // Not a super getter.
8212 NULL, // No arguments. 8212 Class::ZoneHandle(current_class().raw()),
8213 InvocationMirror::kStatic, 8213 name);
Ivan Posva 2013/10/03 16:44:05 You are losing information here about the kind of
Florian Schneider 2013/10/04 09:10:28 We would need the RHS of the assignment as argumen
8214 InvocationMirror::kField,
8215 NULL); // No existing function.
8216 } else { 8214 } else {
8217 AstNode* receiver = LoadReceiver(primary->token_pos()); 8215 AstNode* receiver = LoadReceiver(primary->token_pos());
8218 return CallGetter(node->token_pos(), receiver, name); 8216 return CallGetter(node->token_pos(), receiver, name);
8219 } 8217 }
8220 } 8218 }
8221 return primary; 8219 return primary;
8222 } 8220 }
8223 8221
8224 8222
8225 AstNode* Parser::LoadClosure(PrimaryNode* primary) { 8223 AstNode* Parser::LoadClosure(PrimaryNode* primary) {
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after
10620 void Parser::SkipQualIdent() { 10618 void Parser::SkipQualIdent() {
10621 ASSERT(IsIdentifier()); 10619 ASSERT(IsIdentifier());
10622 ConsumeToken(); 10620 ConsumeToken();
10623 if (CurrentToken() == Token::kPERIOD) { 10621 if (CurrentToken() == Token::kPERIOD) {
10624 ConsumeToken(); // Consume the kPERIOD token. 10622 ConsumeToken(); // Consume the kPERIOD token.
10625 ExpectIdentifier("identifier expected after '.'"); 10623 ExpectIdentifier("identifier expected after '.'");
10626 } 10624 }
10627 } 10625 }
10628 10626
10629 } // namespace dart 10627 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698