));
%FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]');
- %SetProperty(SetIterator.prototype, InternalSymbol('Symbol.iterator'),
+ %SetProperty(SetIterator.prototype, symbolIterator,
SetIteratorSymbolIterator, DONT_ENUM);
}
'values', SetValues
));
- %SetProperty($Set.prototype, InternalSymbol('Symbol.iterator'), SetValues,
+ %SetProperty($Set.prototype, symbolIterator, SetValues,
DONT_ENUM);
}
));
%FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]');
- %SetProperty(MapIterator.prototype, InternalSymbol('Symbol.iterator'),
+ %SetProperty(MapIterator.prototype, symbolIterator,
MapIteratorSymbolIterator, DONT_ENUM);
}
'values', MapValues
));
- %SetProperty($Map.prototype, InternalSymbol('Symbol.iterator'), MapEntries,
+ %SetProperty($Map.prototype, symbolIterator, MapEntries,
DONT_ENUM);
}
DEFINE_implication(harmony, harmony_arrays)
DEFINE_implication(harmony_modules, harmony_scoping)
DEFINE_implication(harmony_collections, harmony_symbols)
+DEFINE_implication(harmony_generators, harmony_symbols)
DEFINE_implication(harmony, es_staging)
DEFINE_implication(es_staging, harmony_maths)
return %_GeneratorThrow(this, exn);
}
+function GeneratorObjectIterator() {
+ return this;
+}
+
function GeneratorFunctionPrototypeConstructor(x) {
if (%_IsConstructCall()) {
throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
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);
// Test aspects of the generator runtime.
-// FIXME(wingo): Replace this reference with a more official link.
// See:
-// http://wiki.ecmascript.org/lib/exe/fetch.php?cache=cache&media=harmony:es6_generator_object_model_3-29-13.png
+// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-objects
function f() { }
function* g() { yield 1; }
found_property_names.sort();
assertArrayEquals(expected_property_names, found_property_names);
+
+ iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
+ Symbol.iterator);
+ assertTrue(iterator_desc !== undefined);
+ assertFalse(iterator_desc.writable);
+ assertFalse(iterator_desc.enumerable);
+ assertFalse(iterator_desc.configurable);
+
+ // The generator object's "iterator" function is just the identity.
+ assertSame(iterator_desc.value.call(42), 42);
}
TestGeneratorObjectPrototype();
EXPECTED_FUZZABLE_COUNT = 325
EXPECTED_CCTEST_COUNT = 6
EXPECTED_UNKNOWN_COUNT = 5
-EXPECTED_BUILTINS_COUNT = 796
+EXPECTED_BUILTINS_COUNT = 797
# Don't call these at all.