Chromium Code Reviews| 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& function = | |
| 412 Function::ZoneHandle(cls().LookupStaticFunction(setter_name)); | |
| 413 if (function.IsNull()) { | |
| 414 const Field& field = Field::ZoneHandle( | |
| 415 cls().LookupStaticField(field_name())); | |
| 416 ASSERT(!field.IsNull()); | |
|
srdjan
2012/04/11 19:52:51
Please add a comment why the field must exist.
regis
2012/04/11 21:11:24
Done. I added a comment and debugging code verifyi
| |
| 417 return new StoreStaticFieldNode(token_index(), field, rhs); | |
| 418 } else { | |
| 419 return new StaticSetterNode(token_index(), cls(), field_name(), rhs); | |
| 420 } | |
| 410 } | 421 } |
| 411 | 422 |
| 412 | 423 |
| 413 AstNode* StaticGetterNode::MakeIncrOpNode(intptr_t token_index, | 424 AstNode* StaticGetterNode::MakeIncrOpNode(intptr_t token_index, |
| 414 Token::Kind kind, | 425 Token::Kind kind, |
| 415 bool is_prefix) { | 426 bool is_prefix) { |
| 416 UNIMPLEMENTED(); | 427 UNIMPLEMENTED(); |
| 417 return NULL; | 428 return NULL; |
| 418 } | 429 } |
| 419 | 430 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 437 // the Error object directly to the parser. This will involve | 448 // the Error object directly to the parser. This will involve |
| 438 // replumbing all of the EvalConstExpr methods. | 449 // replumbing all of the EvalConstExpr methods. |
| 439 return NULL; | 450 return NULL; |
| 440 } | 451 } |
| 441 Instance& field_value = Instance::ZoneHandle(); | 452 Instance& field_value = Instance::ZoneHandle(); |
| 442 field_value ^= result.raw(); | 453 field_value ^= result.raw(); |
| 443 return &field_value; | 454 return &field_value; |
| 444 } | 455 } |
| 445 | 456 |
| 446 } // namespace dart | 457 } // namespace dart |
| OLD | NEW |