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

Unified Diff: src/v8natives.js

Issue 14912002: toString() on generator functions prints with function* (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Remove TODO Created 7 years, 8 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/runtime.cc ('k') | test/mjsunit/harmony/generators-runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 425863e5010fd63f3f9240b051e5007cca2450e7..9266af6f0c3243e063b9374fe0853a0b9e20c1d7 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1665,7 +1665,6 @@ function FunctionSourceString(func) {
func = %GetCallTrap(func);
}
- // TODO(wingo): Print source using function* for generators.
if (!IS_FUNCTION(func)) {
throw new $TypeError('Function.prototype.toString is not generic');
}
@@ -1684,7 +1683,8 @@ function FunctionSourceString(func) {
var name = %FunctionNameShouldPrintAsAnonymous(func)
? 'anonymous'
: %FunctionGetName(func);
- return 'function ' + name + source;
+ var head = %FunctionIsGenerator(func) ? 'function* ' : 'function ';
+ return head + name + source;
}
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/harmony/generators-runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698