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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 FindStatements(node->statements()); | 93 FindStatements(node->statements()); |
94 } | 94 } |
95 | 95 |
96 | 96 |
97 void CallPrinter::VisitVariableDeclaration(VariableDeclaration* node) {} | 97 void CallPrinter::VisitVariableDeclaration(VariableDeclaration* node) {} |
98 | 98 |
99 | 99 |
100 void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {} | 100 void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {} |
101 | 101 |
102 | 102 |
103 void CallPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { | |
104 Find(node->module()); | |
105 } | |
106 | |
107 | |
108 void CallPrinter::VisitImportDeclaration(ImportDeclaration* node) { | 103 void CallPrinter::VisitImportDeclaration(ImportDeclaration* node) { |
109 } | 104 } |
110 | 105 |
111 | 106 |
112 void CallPrinter::VisitExportDeclaration(ExportDeclaration* node) {} | 107 void CallPrinter::VisitExportDeclaration(ExportDeclaration* node) {} |
113 | 108 |
114 | 109 |
115 void CallPrinter::VisitModuleLiteral(ModuleLiteral* node) { | |
116 VisitBlock(node->body()); | |
117 } | |
118 | |
119 | |
120 void CallPrinter::VisitModulePath(ModulePath* node) { Find(node->module()); } | |
121 | |
122 | |
123 void CallPrinter::VisitModuleUrl(ModuleUrl* node) {} | |
124 | |
125 | |
126 void CallPrinter::VisitModuleStatement(ModuleStatement* node) { | |
127 Find(node->body()); | |
128 } | |
129 | |
130 | |
131 void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 110 void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
132 Find(node->expression()); | 111 Find(node->expression()); |
133 } | 112 } |
134 | 113 |
135 | 114 |
136 void CallPrinter::VisitEmptyStatement(EmptyStatement* node) {} | 115 void CallPrinter::VisitEmptyStatement(EmptyStatement* node) {} |
137 | 116 |
138 | 117 |
139 void CallPrinter::VisitIfStatement(IfStatement* node) { | 118 void CallPrinter::VisitIfStatement(IfStatement* node) { |
140 Find(node->condition()); | 119 Find(node->condition()); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 446 |
468 void PrettyPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) { | 447 void PrettyPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) { |
469 Print("function "); | 448 Print("function "); |
470 PrintLiteral(node->proxy()->name(), false); | 449 PrintLiteral(node->proxy()->name(), false); |
471 Print(" = "); | 450 Print(" = "); |
472 PrintFunctionLiteral(node->fun()); | 451 PrintFunctionLiteral(node->fun()); |
473 Print(";"); | 452 Print(";"); |
474 } | 453 } |
475 | 454 |
476 | 455 |
477 void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { | |
478 Print("module "); | |
479 PrintLiteral(node->proxy()->name(), false); | |
480 Print(" = "); | |
481 Visit(node->module()); | |
482 Print(";"); | |
483 } | |
484 | |
485 | |
486 void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) { | 456 void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) { |
487 Print("import "); | 457 Print("import "); |
488 PrintLiteral(node->proxy()->name(), false); | 458 PrintLiteral(node->proxy()->name(), false); |
489 Print(" from "); | 459 Print(" from "); |
490 PrintLiteral(node->module_specifier()->string(), true); | 460 PrintLiteral(node->module_specifier()->string(), true); |
491 Print(";"); | 461 Print(";"); |
492 } | 462 } |
493 | 463 |
494 | 464 |
495 void PrettyPrinter::VisitExportDeclaration(ExportDeclaration* node) { | 465 void PrettyPrinter::VisitExportDeclaration(ExportDeclaration* node) { |
496 Print("export "); | 466 Print("export "); |
497 PrintLiteral(node->proxy()->name(), false); | 467 PrintLiteral(node->proxy()->name(), false); |
498 Print(";"); | 468 Print(";"); |
499 } | 469 } |
500 | 470 |
501 | 471 |
502 void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) { | |
503 VisitBlock(node->body()); | |
504 } | |
505 | |
506 | |
507 void PrettyPrinter::VisitModulePath(ModulePath* node) { | |
508 Visit(node->module()); | |
509 Print("."); | |
510 PrintLiteral(node->name(), false); | |
511 } | |
512 | |
513 | |
514 void PrettyPrinter::VisitModuleUrl(ModuleUrl* node) { | |
515 Print("at "); | |
516 PrintLiteral(node->url(), true); | |
517 } | |
518 | |
519 | |
520 void PrettyPrinter::VisitModuleStatement(ModuleStatement* node) { | |
521 Print("module "); | |
522 Visit(node->body()); | |
523 } | |
524 | |
525 | |
526 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 472 void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
527 Visit(node->expression()); | 473 Visit(node->expression()); |
528 Print(";"); | 474 Print(";"); |
529 } | 475 } |
530 | 476 |
531 | 477 |
532 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { | 478 void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) { |
533 Print(";"); | 479 Print(";"); |
534 } | 480 } |
535 | 481 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 // TODO(svenpanne) Start with IndentedScope. | 1155 // TODO(svenpanne) Start with IndentedScope. |
1210 void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) { | 1156 void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) { |
1211 PrintIndented("FUNCTION "); | 1157 PrintIndented("FUNCTION "); |
1212 PrintLiteral(node->proxy()->name(), true); | 1158 PrintLiteral(node->proxy()->name(), true); |
1213 Print(" = function "); | 1159 Print(" = function "); |
1214 PrintLiteral(node->fun()->name(), false); | 1160 PrintLiteral(node->fun()->name(), false); |
1215 Print("\n"); | 1161 Print("\n"); |
1216 } | 1162 } |
1217 | 1163 |
1218 | 1164 |
1219 void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) { | |
1220 IndentedScope indent(this, "MODULE"); | |
1221 PrintLiteralIndented("NAME", node->proxy()->name(), true); | |
1222 Visit(node->module()); | |
1223 } | |
1224 | |
1225 | |
1226 void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) { | 1165 void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) { |
1227 IndentedScope indent(this, "IMPORT"); | 1166 IndentedScope indent(this, "IMPORT"); |
1228 PrintLiteralIndented("NAME", node->proxy()->name(), true); | 1167 PrintLiteralIndented("NAME", node->proxy()->name(), true); |
1229 PrintLiteralIndented("FROM", node->module_specifier()->string(), true); | 1168 PrintLiteralIndented("FROM", node->module_specifier()->string(), true); |
1230 } | 1169 } |
1231 | 1170 |
1232 | 1171 |
1233 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) { | 1172 void AstPrinter::VisitExportDeclaration(ExportDeclaration* node) { |
1234 IndentedScope indent(this, "EXPORT "); | 1173 IndentedScope indent(this, "EXPORT "); |
1235 PrintLiteral(node->proxy()->name(), true); | 1174 PrintLiteral(node->proxy()->name(), true); |
1236 } | 1175 } |
1237 | 1176 |
1238 | 1177 |
1239 void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) { | |
1240 IndentedScope indent(this, "MODULE LITERAL"); | |
1241 VisitBlock(node->body()); | |
1242 } | |
1243 | |
1244 | |
1245 void AstPrinter::VisitModulePath(ModulePath* node) { | |
1246 IndentedScope indent(this, "MODULE PATH"); | |
1247 PrintIndentedVisit("MODULE PATH PARENT", node->module()); | |
1248 PrintLiteralIndented("NAME", node->name(), true); | |
1249 } | |
1250 | |
1251 | |
1252 void AstPrinter::VisitModuleUrl(ModuleUrl* node) { | |
1253 PrintLiteralIndented("URL", node->url(), true); | |
1254 } | |
1255 | |
1256 | |
1257 void AstPrinter::VisitModuleStatement(ModuleStatement* node) { | |
1258 IndentedScope indent(this, "MODULE STATEMENT"); | |
1259 PrintStatements(node->body()->statements()); | |
1260 } | |
1261 | |
1262 | |
1263 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { | 1178 void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) { |
1264 IndentedScope indent(this, "EXPRESSION STATEMENT"); | 1179 IndentedScope indent(this, "EXPRESSION STATEMENT"); |
1265 Visit(node->expression()); | 1180 Visit(node->expression()); |
1266 } | 1181 } |
1267 | 1182 |
1268 | 1183 |
1269 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { | 1184 void AstPrinter::VisitEmptyStatement(EmptyStatement* node) { |
1270 IndentedScope indent(this, "EMPTY"); | 1185 IndentedScope indent(this, "EMPTY"); |
1271 } | 1186 } |
1272 | 1187 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 } | 1513 } |
1599 | 1514 |
1600 | 1515 |
1601 void AstPrinter::VisitSuperReference(SuperReference* node) { | 1516 void AstPrinter::VisitSuperReference(SuperReference* node) { |
1602 IndentedScope indent(this, "SUPER-REFERENCE"); | 1517 IndentedScope indent(this, "SUPER-REFERENCE"); |
1603 } | 1518 } |
1604 | 1519 |
1605 #endif // DEBUG | 1520 #endif // DEBUG |
1606 | 1521 |
1607 } } // namespace v8::internal | 1522 } } // namespace v8::internal |
OLD | NEW |