| 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_printer.h" | 5 #include "vm/ast_printer.h" |
| 6 | 6 |
| 7 #include "vm/handles.h" | 7 #include "vm/handles.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void AstPrinter::VisitStoreLocalNode(StoreLocalNode* node) { | 78 void AstPrinter::VisitStoreLocalNode(StoreLocalNode* node) { |
| 79 VisitGenericLocalNode(node, node->local()); | 79 VisitGenericLocalNode(node, node->local()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) { | 83 void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) { |
| 84 OS::Print("(%s %s%s '%s' ", | 84 OS::Print("(%s %s%s '%s' ", |
| 85 node->Name(), | 85 node->Name(), |
| 86 field.is_final() ? "final " : "", | 86 field.is_final() ? "final " : "", |
| 87 String::Handle(Type::Handle(field.type()).Name()).ToCString(), | 87 String::Handle(AbstractType::Handle(field.type()).Name()). |
| 88 ToCString(), |
| 88 String::Handle(field.name()).ToCString()); | 89 String::Handle(field.name()).ToCString()); |
| 89 node->VisitChildren(this); | 90 node->VisitChildren(this); |
| 90 OS::Print(")"); | 91 OS::Print(")"); |
| 91 } | 92 } |
| 92 | 93 |
| 93 | 94 |
| 94 void AstPrinter::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { | 95 void AstPrinter::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { |
| 95 VisitGenericFieldNode(node, node->field()); | 96 VisitGenericFieldNode(node, node->field()); |
| 96 } | 97 } |
| 97 | 98 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 116 } | 117 } |
| 117 | 118 |
| 118 | 119 |
| 119 void AstPrinter::VisitLiteralNode(LiteralNode* node) { | 120 void AstPrinter::VisitLiteralNode(LiteralNode* node) { |
| 120 const Instance& literal = node->literal(); | 121 const Instance& literal = node->literal(); |
| 121 OS::Print("'%s'", literal.ToCString()); | 122 OS::Print("'%s'", literal.ToCString()); |
| 122 } | 123 } |
| 123 | 124 |
| 124 | 125 |
| 125 void AstPrinter::VisitTypeNode(TypeNode* node) { | 126 void AstPrinter::VisitTypeNode(TypeNode* node) { |
| 126 const Type& type = node->type(); | 127 const AbstractType& type = node->type(); |
| 127 OS::Print("'%s'", String::Handle(type.Name()).ToCString()); | 128 OS::Print("'%s'", String::Handle(type.Name()).ToCString()); |
| 128 } | 129 } |
| 129 | 130 |
| 130 | 131 |
| 131 void AstPrinter::VisitAssignableNode(AssignableNode* node) { | 132 void AstPrinter::VisitAssignableNode(AssignableNode* node) { |
| 132 OS::Print("(assignable "); | 133 OS::Print("(assignable "); |
| 133 node->expr()->Visit(this); | 134 node->expr()->Visit(this); |
| 134 const Type& type = node->type(); | 135 const AbstractType& type = node->type(); |
| 135 const String& dst_name = node->dst_name(); | 136 const String& dst_name = node->dst_name(); |
| 136 OS::Print(" to type '%s' of '%s')", | 137 OS::Print(" to type '%s' of '%s')", |
| 137 String::Handle(type.Name()).ToCString(), | 138 String::Handle(type.Name()).ToCString(), |
| 138 dst_name.ToCString()); | 139 dst_name.ToCString()); |
| 139 } | 140 } |
| 140 | 141 |
| 141 | 142 |
| 142 void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { | 143 void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { |
| 143 OS::Print("***** PRIMARY NODE IN AST ***** (%s '%s')", | 144 OS::Print("***** PRIMARY NODE IN AST ***** (%s '%s')", |
| 144 node->Name(), node->primary().ToCString()); | 145 node->Name(), node->primary().ToCString()); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 ASSERT(node_sequence != NULL); | 480 ASSERT(node_sequence != NULL); |
| 480 AstPrinter ast_printer; | 481 AstPrinter ast_printer; |
| 481 const char* function_name = | 482 const char* function_name = |
| 482 parsed_function.function().ToFullyQualifiedCString(); | 483 parsed_function.function().ToFullyQualifiedCString(); |
| 483 OS::Print("Ast for function '%s' {\n", function_name); | 484 OS::Print("Ast for function '%s' {\n", function_name); |
| 484 node_sequence->Visit(&ast_printer); | 485 node_sequence->Visit(&ast_printer); |
| 485 OS::Print("}\n"); | 486 OS::Print("}\n"); |
| 486 } | 487 } |
| 487 | 488 |
| 488 } // namespace dart | 489 } // namespace dart |
| OLD | NEW |