Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: src/ast/prettyprinter.cc

Issue 1695393003: [es6] Implement for-of iterator finalization (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable iterator test for Ignition Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/prettyprinter.h ('k') | src/ast/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/prettyprinter.cc
diff --git a/src/ast/prettyprinter.cc b/src/ast/prettyprinter.cc
index 3f624be864878428e16e6d30314e2091848b7bd0..9cc841601d9f9fed9824dc3d4d983e84b2bb8533 100644
--- a/src/ast/prettyprinter.cc
+++ b/src/ast/prettyprinter.cc
@@ -1203,6 +1203,14 @@ const char* AstPrinter::PrintProgram(FunctionLiteral* program) {
}
+void AstPrinter::PrintOut(Isolate* isolate, AstNode* node) {
+ AstPrinter printer(isolate);
+ printer.Init();
+ printer.Visit(node);
+ PrintF("%s", printer.Output());
+}
+
+
void AstPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) {
if (declarations->length() > 0) {
IndentedScope indent(this, "DECLS");
@@ -1390,6 +1398,10 @@ void AstPrinter::VisitForOfStatement(ForOfStatement* node) {
PrintIndentedVisit("FOR", node->each());
PrintIndentedVisit("OF", node->iterable());
PrintIndentedVisit("BODY", node->body());
+ PrintIndentedVisit("INIT", node->assign_iterator());
+ PrintIndentedVisit("NEXT", node->next_result());
+ PrintIndentedVisit("EACH", node->assign_each());
+ PrintIndentedVisit("DONE", node->result_done());
}
@@ -1542,31 +1554,36 @@ void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
void AstPrinter::VisitVariableProxy(VariableProxy* node) {
- Variable* var = node->var();
EmbeddedVector<char, 128> buf;
int pos =
FormatSlotNode(&buf, node, "VAR PROXY", node->VariableFeedbackSlot());
- switch (var->location()) {
- case VariableLocation::UNALLOCATED:
- break;
- case VariableLocation::PARAMETER:
- SNPrintF(buf + pos, " parameter[%d]", var->index());
- break;
- case VariableLocation::LOCAL:
- SNPrintF(buf + pos, " local[%d]", var->index());
- break;
- case VariableLocation::CONTEXT:
- SNPrintF(buf + pos, " context[%d]", var->index());
- break;
- case VariableLocation::GLOBAL:
- SNPrintF(buf + pos, " global[%d]", var->index());
- break;
- case VariableLocation::LOOKUP:
- SNPrintF(buf + pos, " lookup");
- break;
+ if (!node->is_resolved()) {
+ SNPrintF(buf + pos, " unresolved");
+ PrintLiteralWithModeIndented(buf.start(), nullptr, node->name());
+ } else {
+ Variable* var = node->var();
+ switch (var->location()) {
+ case VariableLocation::UNALLOCATED:
+ break;
+ case VariableLocation::PARAMETER:
+ SNPrintF(buf + pos, " parameter[%d]", var->index());
+ break;
+ case VariableLocation::LOCAL:
+ SNPrintF(buf + pos, " local[%d]", var->index());
+ break;
+ case VariableLocation::CONTEXT:
+ SNPrintF(buf + pos, " context[%d]", var->index());
+ break;
+ case VariableLocation::GLOBAL:
+ SNPrintF(buf + pos, " global[%d]", var->index());
+ break;
+ case VariableLocation::LOOKUP:
+ SNPrintF(buf + pos, " lookup");
+ break;
+ }
+ PrintLiteralWithModeIndented(buf.start(), var, node->name());
}
- PrintLiteralWithModeIndented(buf.start(), var, node->name());
}
« no previous file with comments | « src/ast/prettyprinter.h ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698