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 <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast-value-factory.h" | 9 #include "src/ast-value-factory.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 InitializeAstVisitor(isolate, zone); | 426 InitializeAstVisitor(isolate, zone); |
427 } | 427 } |
428 | 428 |
429 | 429 |
430 PrettyPrinter::~PrettyPrinter() { | 430 PrettyPrinter::~PrettyPrinter() { |
431 DeleteArray(output_); | 431 DeleteArray(output_); |
432 } | 432 } |
433 | 433 |
434 | 434 |
435 void PrettyPrinter::VisitBlock(Block* node) { | 435 void PrettyPrinter::VisitBlock(Block* node) { |
436 if (!node->is_initializer_block()) Print("{ "); | 436 if (!node->ignore_completion_value()) Print("{ "); |
437 PrintStatements(node->statements()); | 437 PrintStatements(node->statements()); |
438 if (node->statements()->length() > 0) Print(" "); | 438 if (node->statements()->length() > 0) Print(" "); |
439 if (!node->is_initializer_block()) Print("}"); | 439 if (!node->ignore_completion_value()) Print("}"); |
440 } | 440 } |
441 | 441 |
442 | 442 |
443 void PrettyPrinter::VisitVariableDeclaration(VariableDeclaration* node) { | 443 void PrettyPrinter::VisitVariableDeclaration(VariableDeclaration* node) { |
444 Print("var "); | 444 Print("var "); |
445 PrintLiteral(node->proxy()->name(), false); | 445 PrintLiteral(node->proxy()->name(), false); |
446 Print(";"); | 446 Print(";"); |
447 } | 447 } |
448 | 448 |
449 | 449 |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 | 1139 |
1140 | 1140 |
1141 void AstPrinter::PrintArguments(ZoneList<Expression*>* arguments) { | 1141 void AstPrinter::PrintArguments(ZoneList<Expression*>* arguments) { |
1142 for (int i = 0; i < arguments->length(); i++) { | 1142 for (int i = 0; i < arguments->length(); i++) { |
1143 Visit(arguments->at(i)); | 1143 Visit(arguments->at(i)); |
1144 } | 1144 } |
1145 } | 1145 } |
1146 | 1146 |
1147 | 1147 |
1148 void AstPrinter::VisitBlock(Block* node) { | 1148 void AstPrinter::VisitBlock(Block* node) { |
1149 const char* block_txt = node->is_initializer_block() ? "BLOCK INIT" : "BLOCK"; | 1149 const char* block_txt = |
| 1150 node->ignore_completion_value() ? "BLOCK NOCOMPLETIONS" : "BLOCK"; |
1150 IndentedScope indent(this, block_txt); | 1151 IndentedScope indent(this, block_txt); |
1151 PrintStatements(node->statements()); | 1152 PrintStatements(node->statements()); |
1152 } | 1153 } |
1153 | 1154 |
1154 | 1155 |
1155 // TODO(svenpanne) Start with IndentedScope. | 1156 // TODO(svenpanne) Start with IndentedScope. |
1156 void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) { | 1157 void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) { |
1157 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()), | 1158 PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()), |
1158 node->proxy()->var(), | 1159 node->proxy()->var(), |
1159 node->proxy()->name()); | 1160 node->proxy()->name()); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 | 1543 |
1543 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { | 1544 void AstPrinter::VisitSuperCallReference(SuperCallReference* node) { |
1544 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); | 1545 IndentedScope indent(this, "SUPER-CALL-REFERENCE"); |
1545 } | 1546 } |
1546 | 1547 |
1547 | 1548 |
1548 #endif // DEBUG | 1549 #endif // DEBUG |
1549 | 1550 |
1550 } // namespace internal | 1551 } // namespace internal |
1551 } // namespace v8 | 1552 } // namespace v8 |
OLD | NEW |