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

Unified Diff: src/ast/prettyprinter.cc

Issue 2405253006: [builtins] implement Array.prototype[@@iterator] in TFJ builtins (Closed)
Patch Set: latest round Created 4 years, 2 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/ast-types.cc ('k') | src/bootstrapper.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 874c15991ea75a396cc37b0e134bde5850a31b4f..19e9478da27a18f38fbbb7e6eb6279e84e873c8b 100644
--- a/src/ast/prettyprinter.cc
+++ b/src/ast/prettyprinter.cc
@@ -529,6 +529,18 @@ void AstPrinter::PrintLiteral(Handle<Object> value, bool quote) {
}
} else if (object->IsFixedArray()) {
Print("FixedArray");
+ } else if (object->IsSymbol()) {
+ // Symbols can only occur as literals if they were inserted by the parser.
+ Symbol* symbol = Symbol::cast(object);
+ if (symbol->name()->IsString()) {
+ int length = 0;
+ String* string = String::cast(symbol->name());
+ std::unique_ptr<char[]> desc = string->ToCString(
+ ALLOW_NULLS, FAST_STRING_TRAVERSAL, 0, string->length(), &length);
+ Print("Symbol(%*s)", length, desc.get());
+ } else {
+ Print("Symbol()");
+ }
} else {
Print("<unknown literal %p>", static_cast<void*>(object));
}
« no previous file with comments | « src/ast/ast-types.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698