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 27 matching lines...) Expand all Loading... |
38 VisitGenericAstNode(node); | 38 VisitGenericAstNode(node); |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 void AstPrinter::VisitArgumentListNode(ArgumentListNode* arguments) { | 42 void AstPrinter::VisitArgumentListNode(ArgumentListNode* arguments) { |
43 VisitGenericAstNode(arguments); | 43 VisitGenericAstNode(arguments); |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 void AstPrinter::VisitReturnNode(ReturnNode* node) { | 47 void AstPrinter::VisitReturnNode(ReturnNode* node) { |
48 OS::Print("(%s %s", | 48 const char* kind; |
49 node->PrettyName(), | 49 switch (node->return_type()) { |
50 (node->return_type() == ReturnNode::kContinuation) ? | 50 case ReturnNode::kContinuation: |
51 "continuation " : ""); | 51 kind = "continuation "; |
| 52 break; |
| 53 case ReturnNode::kContinuationTarget: |
| 54 kind = "continuation-target "; |
| 55 break; |
| 56 case ReturnNode::kRegular: |
| 57 kind = ""; |
| 58 break; |
| 59 default: |
| 60 UNREACHABLE(); |
| 61 } |
| 62 OS::Print("(%s %s", node->PrettyName(), kind); |
52 node->VisitChildren(this); | 63 node->VisitChildren(this); |
53 OS::Print(")"); | 64 OS::Print(")"); |
54 } | 65 } |
55 | 66 |
56 | 67 |
57 void AstPrinter::VisitGenericLocalNode(AstNode* node, | 68 void AstPrinter::VisitGenericLocalNode(AstNode* node, |
58 const LocalVariable& var) { | 69 const LocalVariable& var) { |
59 OS::Print("(%s %s%s \"%s\"", | 70 OS::Print("(%s %s%s \"%s\"", |
60 node->PrettyName(), | 71 node->PrettyName(), |
61 var.is_final() ? "final " : "", | 72 var.is_final() ? "final " : "", |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 ASSERT(node_sequence != NULL); | 540 ASSERT(node_sequence != NULL); |
530 AstPrinter ast_printer; | 541 AstPrinter ast_printer; |
531 const char* function_name = | 542 const char* function_name = |
532 parsed_function.function().ToFullyQualifiedCString(); | 543 parsed_function.function().ToFullyQualifiedCString(); |
533 OS::Print("Ast for function '%s' {\n", function_name); | 544 OS::Print("Ast for function '%s' {\n", function_name); |
534 node_sequence->Visit(&ast_printer); | 545 node_sequence->Visit(&ast_printer); |
535 OS::Print("}\n"); | 546 OS::Print("}\n"); |
536 } | 547 } |
537 | 548 |
538 } // namespace dart | 549 } // namespace dart |
OLD | NEW |