| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/ast.h" | 5 #include "vm/ast.h" |
| 6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 bool is_prefix) { | 399 bool is_prefix) { |
| 400 return new IncrOpIndexedNode(token_index, | 400 return new IncrOpIndexedNode(token_index, |
| 401 kind, | 401 kind, |
| 402 is_prefix, | 402 is_prefix, |
| 403 array(), | 403 array(), |
| 404 index_expr()); | 404 index_expr()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 | 407 |
| 408 AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { | 408 AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| 409 return new StaticSetterNode(token_index(), cls(), field_name(), rhs); | 409 // If no setter exist, set the field directly. |
| 410 const String& setter_name = String::Handle(Field::SetterName(field_name())); |
| 411 const Function& setter = |
| 412 Function::ZoneHandle(cls().LookupStaticFunction(setter_name)); |
| 413 if (setter.IsNull()) { |
| 414 // Access to a lazily initialized static field that has not yet been |
| 415 // initialized is compiled to a static implicit getter. |
| 416 // A setter may not exist for such a field. |
| 417 #if defined(DEBUG) |
| 418 const String& getter_name = String::Handle(Field::GetterName(field_name())); |
| 419 const Function& getter = |
| 420 Function::ZoneHandle(cls().LookupStaticFunction(getter_name)); |
| 421 ASSERT(!getter.IsNull() && |
| 422 (getter.kind() == RawFunction::kConstImplicitGetter)); |
| 423 #endif |
| 424 const Field& field = Field::ZoneHandle( |
| 425 cls().LookupStaticField(field_name())); |
| 426 ASSERT(!field.IsNull()); |
| 427 return new StoreStaticFieldNode(token_index(), field, rhs); |
| 428 } else { |
| 429 return new StaticSetterNode(token_index(), cls(), field_name(), rhs); |
| 430 } |
| 410 } | 431 } |
| 411 | 432 |
| 412 | 433 |
| 413 AstNode* StaticGetterNode::MakeIncrOpNode(intptr_t token_index, | 434 AstNode* StaticGetterNode::MakeIncrOpNode(intptr_t token_index, |
| 414 Token::Kind kind, | 435 Token::Kind kind, |
| 415 bool is_prefix) { | 436 bool is_prefix) { |
| 416 UNIMPLEMENTED(); | 437 UNIMPLEMENTED(); |
| 417 return NULL; | 438 return NULL; |
| 418 } | 439 } |
| 419 | 440 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 437 // the Error object directly to the parser. This will involve | 458 // the Error object directly to the parser. This will involve |
| 438 // replumbing all of the EvalConstExpr methods. | 459 // replumbing all of the EvalConstExpr methods. |
| 439 return NULL; | 460 return NULL; |
| 440 } | 461 } |
| 441 Instance& field_value = Instance::ZoneHandle(); | 462 Instance& field_value = Instance::ZoneHandle(); |
| 442 field_value ^= result.raw(); | 463 field_value ^= result.raw(); |
| 443 return &field_value; | 464 return &field_value; |
| 444 } | 465 } |
| 445 | 466 |
| 446 } // namespace dart | 467 } // namespace dart |
| OLD | NEW |