| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void CallPrinter::VisitVariableDeclaration(VariableDeclaration* node) {} | 98 void CallPrinter::VisitVariableDeclaration(VariableDeclaration* node) {} |
| 99 | 99 |
| 100 | 100 |
| 101 void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {} | 101 void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {} |
| 102 | 102 |
| 103 | 103 |
| 104 void CallPrinter::VisitImportDeclaration(ImportDeclaration* node) { | 104 void CallPrinter::VisitImportDeclaration(ImportDeclaration* node) { |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 void CallPrinter::VisitExportDeclaration(ExportDeclaration* node) {} | |
| 109 | |
| 110 | |
| 111 void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 108 void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
| 112 Find(node->expression()); | 109 Find(node->expression()); |
| 113 } | 110 } |
| 114 | 111 |
| 115 | 112 |
| 116 void CallPrinter::VisitEmptyStatement(EmptyStatement* node) {} | 113 void CallPrinter::VisitEmptyStatement(EmptyStatement* node) {} |
| 117 | 114 |
| 118 | 115 |
| 119 void CallPrinter::VisitSloppyBlockFunctionStatement( | 116 void CallPrinter::VisitSloppyBlockFunctionStatement( |
| 120 SloppyBlockFunctionStatement* node) { | 117 SloppyBlockFunctionStatement* node) { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 516 |
| 520 void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) { | 517 void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) { |
| 521 Print("import "); | 518 Print("import "); |
| 522 PrintLiteral(node->proxy()->name(), false); | 519 PrintLiteral(node->proxy()->name(), false); |
| 523 Print(" from "); | 520 Print(" from "); |
| 524 PrintLiteral(node->module_specifier()->string(), true); | 521 PrintLiteral(node->module_specifier()->string(), true); |
| 525 Print(";"); | 522 Print(";"); |
| 526 } | 523 } |
| 527 | 524 |
| 528 | 525 |
| 529 void PrettyPrinter::VisitExportDeclaration(ExportDeclaration* node) { | |
| 530 Print("export "); | |
| 531 PrintLiteral(node->proxy()->name(), false); | |
| 532 Print(";"); | |
| 533 } | |
| 534 | |
| 535 | |
| 536 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 526 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
| 537 Visit(node->expression()); | 527 Visit(node->expression()); |
| 538 Print(";"); | 528 Print(";"); |
| 539 } | 529 } |
| 540 | 530 |
| 541 | 531 |
| 542 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { | 532 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { |
| 543 Print(";"); | 533 Print(";"); |
| 544 } | 534 } |
| 545 | 535 |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 } | 1294 } |
| 1305 | 1295 |
| 1306 | 1296 |
| 1307 void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) { | 1297 void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) { |
| 1308 IndentedScope indent(this, "IMPORT", node->position()); | 1298 IndentedScope indent(this, "IMPORT", node->position()); |
| 1309 PrintLiteralIndented("NAME", node->proxy()->name(), true); | 1299 PrintLiteralIndented("NAME", node->proxy()->name(), true); |
| 1310 PrintLiteralIndented("FROM", node->module_specifier()->string(), true); | 1300 PrintLiteralIndented("FROM", node->module_specifier()->string(), true); |
| 1311 } | 1301 } |
| 1312 | 1302 |
| 1313 | 1303 |
| 1314 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) { | |
| 1315 IndentedScope indent(this, "EXPORT", node->position()); | |
| 1316 PrintLiteral(node->proxy()->name(), true); | |
| 1317 } | |
| 1318 | |
| 1319 | |
| 1320 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 1304 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
| 1321 IndentedScope indent(this, "EXPRESSION STATEMENT", node->position()); | 1305 IndentedScope indent(this, "EXPRESSION STATEMENT", node->position()); |
| 1322 Visit(node->expression()); | 1306 Visit(node->expression()); |
| 1323 } | 1307 } |
| 1324 | 1308 |
| 1325 | 1309 |
| 1326 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { | 1310 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { |
| 1327 IndentedScope indent(this, "EMPTY", node->position()); | 1311 IndentedScope indent(this, "EMPTY", node->position()); |
| 1328 } | 1312 } |
| 1329 | 1313 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 | 1732 |
| 1749 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { | 1733 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { |
| 1750 Visit(node->expression()); | 1734 Visit(node->expression()); |
| 1751 } | 1735 } |
| 1752 | 1736 |
| 1753 | 1737 |
| 1754 #endif // DEBUG | 1738 #endif // DEBUG |
| 1755 | 1739 |
| 1756 } // namespace internal | 1740 } // namespace internal |
| 1757 } // namespace v8 | 1741 } // namespace v8 |
| OLD | NEW |