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" |
11 #include "vm/resolver.h" | 11 #include "vm/resolver.h" |
12 | 12 |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 DEFINE_FLAG(bool, trace_ast_visitor, false, | 16 DEFINE_FLAG(bool, trace_ast_visitor, false, |
17 "Trace AstVisitor."); | 17 "Trace AstVisitor."); |
18 | 18 |
19 #define DEFINE_VISIT_FUNCTION(BaseName) \ | 19 #define DEFINE_VISIT_FUNCTION(BaseName) \ |
20 void BaseName##Node::Visit(AstNodeVisitor* visitor) { \ | 20 void BaseName##Node::Visit(AstNodeVisitor* visitor) { \ |
21 if (FLAG_trace_ast_visitor) { \ | 21 if (FLAG_trace_ast_visitor) { \ |
22 THR_Print("Visiting %s\n", PrettyName()); \ | 22 THR_Print("Visiting %s\n", Name()); \ |
23 } \ | 23 } \ |
24 visitor->Visit##BaseName##Node(this); \ | 24 visitor->Visit##BaseName##Node(this); \ |
25 } | 25 } |
26 | 26 |
27 FOR_EACH_NODE(DEFINE_VISIT_FUNCTION) | 27 FOR_EACH_NODE(DEFINE_VISIT_FUNCTION) |
28 #undef DEFINE_VISIT_FUNCTION | 28 #undef DEFINE_VISIT_FUNCTION |
29 | 29 |
30 | 30 |
31 #define DEFINE_NAME_FUNCTION(BaseName) \ | 31 #define DEFINE_NAME_FUNCTION(BaseName) \ |
32 const char* BaseName##Node::PrettyName() 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 // A visitor class to collect all the nodes (including children) into an | 40 // A visitor class to collect all the nodes (including children) into an |
41 // array. | 41 // array. |
42 class AstNodeCollector : public AstNodeVisitor { | 42 class AstNodeCollector : public AstNodeVisitor { |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 if (result.IsError() || result.IsNull()) { | 817 if (result.IsError() || result.IsNull()) { |
818 // TODO(turnidge): We could get better error messages by returning | 818 // TODO(turnidge): We could get better error messages by returning |
819 // the Error object directly to the parser. This will involve | 819 // the Error object directly to the parser. This will involve |
820 // replumbing all of the EvalConstExpr methods. | 820 // replumbing all of the EvalConstExpr methods. |
821 return NULL; | 821 return NULL; |
822 } | 822 } |
823 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 823 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
824 } | 824 } |
825 | 825 |
826 } // namespace dart | 826 } // namespace dart |
OLD | NEW |