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

Unified Diff: src/generator.js

Issue 328093002: Add @@iterator for generator objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/flag-definitions.h ('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/generator.js
diff --git a/src/generator.js b/src/generator.js
index c152e3a6eea369d4c4306bb946df2d5edeeed29e..3133eddf3f3cea113513095ea167b91c589726da 100644
--- a/src/generator.js
+++ b/src/generator.js
@@ -32,6 +32,10 @@ function GeneratorObjectThrow(exn) {
return %_GeneratorThrow(this, exn);
}
+function GeneratorObjectIterator() {
+ return this;
+}
+
function GeneratorFunctionPrototypeConstructor(x) {
if (%_IsConstructCall()) {
throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
@@ -56,6 +60,8 @@ function SetUpGenerators() {
DONT_ENUM | DONT_DELETE | READ_ONLY,
["next", GeneratorObjectNext,
"throw", GeneratorObjectThrow]);
+ %SetProperty(GeneratorObjectPrototype, symbolIterator, GeneratorObjectIterator,
+ DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetProperty(GeneratorObjectPrototype, "constructor",
GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetPrototype(GeneratorFunctionPrototype, $Function.prototype);
« no previous file with comments | « src/flag-definitions.h ('k') | test/mjsunit/harmony/generators-runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698