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/log.h" | 9 #include "vm/log.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 #define DEFINE_NAME_FUNCTION(BaseName) \ | 31 #define DEFINE_NAME_FUNCTION(BaseName) \ |
| 32 const char* BaseName##Node::Name() const { \ | 32 const char* BaseName##Node::Name() const { \ |
| 33 return #BaseName; \ | 33 return #BaseName; \ |
| 34 } | 34 } |
| 35 | 35 |
| 36 FOR_EACH_NODE(DEFINE_NAME_FUNCTION) | 36 FOR_EACH_NODE(DEFINE_NAME_FUNCTION) |
| 37 #undef DEFINE_NAME_FUNCTION | 37 #undef DEFINE_NAME_FUNCTION |
| 38 | 38 |
| 39 | 39 |
| 40 const Field* AstNode::MayCloneField(const Field& value) { | |
| 41 if (Compiler::IsBackgroundCompilation() || | |
| 42 FLAG_force_clone_compiler_objects) { | |
| 43 return value.CloneFromOriginal(); | |
|
siva
2016/02/25 23:38:32
Why not create the zone handle here instead of hav
srdjan
2016/02/26 00:40:42
OK, always returning RawField* instead of Field* i
| |
| 44 } else { | |
| 45 ASSERT(value.IsZoneHandle()); | |
| 46 return &value; | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 | |
|
siva
2016/02/25 23:38:32
Add
const Field* AstNode::OriginalAsHandle(const
srdjan
2016/02/26 00:40:42
It feels wrong to put that shared functionality in
| |
| 40 // A visitor class to collect all the nodes (including children) into an | 51 // A visitor class to collect all the nodes (including children) into an |
| 41 // array. | 52 // array. |
| 42 class AstNodeCollector : public AstNodeVisitor { | 53 class AstNodeCollector : public AstNodeVisitor { |
| 43 public: | 54 public: |
| 44 explicit AstNodeCollector(GrowableArray<AstNode*>* nodes) | 55 explicit AstNodeCollector(GrowableArray<AstNode*>* nodes) |
| 45 : nodes_(nodes) { } | 56 : nodes_(nodes) { } |
| 46 | 57 |
| 47 #define DEFINE_VISITOR_FUNCTION(BaseName) \ | 58 #define DEFINE_VISITOR_FUNCTION(BaseName) \ |
| 48 virtual void Visit##BaseName##Node(BaseName##Node* node) { \ | 59 virtual void Visit##BaseName##Node(BaseName##Node* node) { \ |
| 49 nodes_->Add(node); \ | 60 nodes_->Add(node); \ |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 if (field().is_final()) { | 586 if (field().is_final()) { |
| 576 return NULL; | 587 return NULL; |
| 577 } | 588 } |
| 578 if (Isolate::Current()->flags().type_checks()) { | 589 if (Isolate::Current()->flags().type_checks()) { |
| 579 rhs = new AssignableNode( | 590 rhs = new AssignableNode( |
| 580 field().token_pos(), | 591 field().token_pos(), |
| 581 rhs, | 592 rhs, |
| 582 AbstractType::ZoneHandle(field().type()), | 593 AbstractType::ZoneHandle(field().type()), |
| 583 String::ZoneHandle(field().name())); | 594 String::ZoneHandle(field().name())); |
| 584 } | 595 } |
| 585 return new StoreStaticFieldNode(token_pos(), field(), rhs); | 596 return new StoreStaticFieldNode( |
| 597 token_pos(), *field().OriginalAsHandle(), rhs); | |
|
siva
2016/02/25 23:38:32
token_pos(), *OriginalAsHandle(field(), rhs);
srdjan
2016/02/26 00:40:42
Resolved using Field::ZoneHandle
| |
| 586 } | 598 } |
| 587 | 599 |
| 588 | 600 |
| 589 AstNode* InstanceGetterNode::MakeAssignmentNode(AstNode* rhs) { | 601 AstNode* InstanceGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| 590 return new InstanceSetterNode(token_pos(), | 602 return new InstanceSetterNode(token_pos(), |
| 591 receiver(), | 603 receiver(), |
| 592 field_name(), | 604 field_name(), |
| 593 rhs, | 605 rhs, |
| 594 is_conditional()); | 606 is_conditional()); |
| 595 } | 607 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 if (result.IsError() || result.IsNull()) { | 829 if (result.IsError() || result.IsNull()) { |
| 818 // TODO(turnidge): We could get better error messages by returning | 830 // TODO(turnidge): We could get better error messages by returning |
| 819 // the Error object directly to the parser. This will involve | 831 // the Error object directly to the parser. This will involve |
| 820 // replumbing all of the EvalConstExpr methods. | 832 // replumbing all of the EvalConstExpr methods. |
| 821 return NULL; | 833 return NULL; |
| 822 } | 834 } |
| 823 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 835 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 824 } | 836 } |
| 825 | 837 |
| 826 } // namespace dart | 838 } // namespace dart |
| OLD | NEW |