| 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/object_store.h" | 10 #include "vm/object_store.h" |
| 10 #include "vm/resolver.h" | 11 #include "vm/resolver.h" |
| 11 | 12 |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 16 DEFINE_FLAG(bool, trace_ast_visitor, false, |
| 17 "Trace AstVisitor."); |
| 18 |
| 15 #define DEFINE_VISIT_FUNCTION(BaseName) \ | 19 #define DEFINE_VISIT_FUNCTION(BaseName) \ |
| 16 void BaseName##Node::Visit(AstNodeVisitor* visitor) { \ | 20 void BaseName##Node::Visit(AstNodeVisitor* visitor) { \ |
| 21 if (FLAG_trace_ast_visitor) { \ |
| 22 THR_Print("Visiting %s\n", PrettyName()); \ |
| 23 } \ |
| 17 visitor->Visit##BaseName##Node(this); \ | 24 visitor->Visit##BaseName##Node(this); \ |
| 18 } | 25 } |
| 19 | 26 |
| 20 FOR_EACH_NODE(DEFINE_VISIT_FUNCTION) | 27 FOR_EACH_NODE(DEFINE_VISIT_FUNCTION) |
| 21 #undef DEFINE_VISIT_FUNCTION | 28 #undef DEFINE_VISIT_FUNCTION |
| 22 | 29 |
| 23 | 30 |
| 24 #define DEFINE_NAME_FUNCTION(BaseName) \ | 31 #define DEFINE_NAME_FUNCTION(BaseName) \ |
| 25 const char* BaseName##Node::PrettyName() const { \ | 32 const char* BaseName##Node::PrettyName() const { \ |
| 26 return #BaseName; \ | 33 return #BaseName; \ |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 if (result.IsError() || result.IsNull()) { | 780 if (result.IsError() || result.IsNull()) { |
| 774 // TODO(turnidge): We could get better error messages by returning | 781 // TODO(turnidge): We could get better error messages by returning |
| 775 // the Error object directly to the parser. This will involve | 782 // the Error object directly to the parser. This will involve |
| 776 // replumbing all of the EvalConstExpr methods. | 783 // replumbing all of the EvalConstExpr methods. |
| 777 return NULL; | 784 return NULL; |
| 778 } | 785 } |
| 779 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 786 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 780 } | 787 } |
| 781 | 788 |
| 782 } // namespace dart | 789 } // namespace dart |
| OLD | NEW |