OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast/prettyprinter.h" | 5 #include "src/ast/prettyprinter.h" |
6 | 6 |
7 #include <stdarg.h> | 7 #include <stdarg.h> |
8 | 8 |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 655 } |
656 | 656 |
657 | 657 |
658 void AstPrinter::PrintOut(Isolate* isolate, AstNode* node) { | 658 void AstPrinter::PrintOut(Isolate* isolate, AstNode* node) { |
659 AstPrinter printer(isolate); | 659 AstPrinter printer(isolate); |
660 printer.Init(); | 660 printer.Init(); |
661 printer.Visit(node); | 661 printer.Visit(node); |
662 PrintF("%s", printer.output_); | 662 PrintF("%s", printer.output_); |
663 } | 663 } |
664 | 664 |
665 | 665 void AstPrinter::PrintDeclarations(Declaration::List* declarations) { |
666 void AstPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) { | 666 if (!declarations->is_empty()) { |
667 if (declarations->length() > 0) { | |
668 IndentedScope indent(this, "DECLS"); | 667 IndentedScope indent(this, "DECLS"); |
669 for (int i = 0; i < declarations->length(); i++) { | 668 for (Declaration* decl : *declarations) Visit(decl); |
670 Visit(declarations->at(i)); | |
671 } | |
672 } | 669 } |
673 } | 670 } |
674 | 671 |
675 void AstPrinter::PrintParameters(DeclarationScope* scope) { | 672 void AstPrinter::PrintParameters(DeclarationScope* scope) { |
676 if (scope->num_parameters() > 0) { | 673 if (scope->num_parameters() > 0) { |
677 IndentedScope indent(this, "PARAMS"); | 674 IndentedScope indent(this, "PARAMS"); |
678 for (int i = 0; i < scope->num_parameters(); i++) { | 675 for (int i = 0; i < scope->num_parameters(); i++) { |
679 PrintLiteralWithModeIndented("VAR", scope->parameter(i), | 676 PrintLiteralWithModeIndented("VAR", scope->parameter(i), |
680 scope->parameter(i)->name()); | 677 scope->parameter(i)->name()); |
681 } | 678 } |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 | 1199 |
1203 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { | 1200 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { |
1204 Visit(node->expression()); | 1201 Visit(node->expression()); |
1205 } | 1202 } |
1206 | 1203 |
1207 | 1204 |
1208 #endif // DEBUG | 1205 #endif // DEBUG |
1209 | 1206 |
1210 } // namespace internal | 1207 } // namespace internal |
1211 } // namespace v8 | 1208 } // namespace v8 |
OLD | NEW |