| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 VisitGenericAstNode(arguments); | 48 VisitGenericAstNode(arguments); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 void AstPrinter::VisitReturnNode(ReturnNode* node) { | 52 void AstPrinter::VisitReturnNode(ReturnNode* node) { |
| 53 VisitGenericAstNode(node); | 53 VisitGenericAstNode(node); |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 void AstPrinter::VisitGenericLocalNode(AstNode* node, | 57 void AstPrinter::VisitGenericLocalNode(AstNode* node, |
| 58 const LocalVariable& var) { | 58 const LocalVariable* var) { |
| 59 OS::Print("(%s %s%s '%s'", | 59 OS::Print("(%s %s%s '%s'", |
| 60 node->Name(), | 60 node->Name(), |
| 61 var.is_final() ? "final " : "", | 61 var->is_final() ? "final " : "", |
| 62 String::Handle(var.type().Name()).ToCString(), | 62 String::Handle(var->type().Name()).ToCString(), |
| 63 var.name().ToCString()); | 63 var->name().ToCString()); |
| 64 if (var.HasIndex()) { | 64 if (var->HasIndex()) { |
| 65 OS::Print(" @%d", var.index()); | 65 OS::Print(" @%d", var->index()); |
| 66 if (var.is_captured()) { | 66 if (var->is_captured()) { |
| 67 OS::Print(" ctx %d", var.owner()->context_level()); | 67 OS::Print(" ctx %d", var->owner()->context_level()); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 node->VisitChildren(this); | 70 node->VisitChildren(this); |
| 71 OS::Print(")"); | 71 OS::Print(")"); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 void AstPrinter::VisitLoadLocalNode(LoadLocalNode* node) { | 75 void AstPrinter::VisitLoadLocalNode(LoadLocalNode* node) { |
| 76 VisitGenericLocalNode(node, node->local()); | 76 VisitGenericLocalNode(node, node->local()); |
| 77 } | 77 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 ASSERT(node_sequence != NULL); | 472 ASSERT(node_sequence != NULL); |
| 473 AstPrinter ast_printer; | 473 AstPrinter ast_printer; |
| 474 const char* function_name = | 474 const char* function_name = |
| 475 parsed_function.function().ToFullyQualifiedCString(); | 475 parsed_function.function().ToFullyQualifiedCString(); |
| 476 OS::Print("Ast for function '%s' {\n", function_name); | 476 OS::Print("Ast for function '%s' {\n", function_name); |
| 477 node_sequence->Visit(&ast_printer); | 477 node_sequence->Visit(&ast_printer); |
| 478 OS::Print("}\n"); | 478 OS::Print("}\n"); |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace dart | 481 } // namespace dart |
| OLD | NEW |