Builtins::kIllegal, kUseStrictFunctionMap);
// Create maps for generator functions and their prototypes. Store those
- // maps in the native context. Generator functions do not have writable
- // prototypes, nor do they have "caller" or "arguments" accessors.
- Handle<Map> strict_function_map(native_context()->strict_function_map());
+ // maps in the native context. The "prototype" property descriptor is
+ // writable, non-enumerable, and non-configurable (as per ES6 draft
+ // 04-14-15, section 25.2.4.3).
+ Handle<Map> strict_function_map(strict_function_map_writable_prototype_);
+ // Generator functions do not have "caller" or "arguments" accessors.
Handle<Map> sloppy_generator_function_map =
Map::Copy(strict_function_map, "SloppyGeneratorFunction");
Map::SetPrototype(sloppy_generator_function_map,
var prop = f_own_property_names[i];
var f_desc = Object.getOwnPropertyDescriptor(f, prop);
var g_desc = Object.getOwnPropertyDescriptor(g, prop);
- if (prop === "prototype") {
- // ES6 draft 03-17-2015 section 25.2.2.2
- assertFalse(g_desc.writable, prop);
- assertFalse(g_desc.enumerable, prop);
- assertFalse(g_desc.configurable, prop);
- } else {
- assertEquals(f_desc.configurable, g_desc.configurable, prop);
- assertEquals(f_desc.writable, g_desc.writable, prop);
- assertEquals(f_desc.enumerable, g_desc.enumerable, prop);
- }
+ assertEquals(f_desc.configurable, g_desc.configurable, prop);
+ assertEquals(f_desc.writable, g_desc.writable, prop);
+ assertEquals(f_desc.enumerable, g_desc.enumerable, prop);
}
}
TestGeneratorFunctionInstance();
assertTrue((new GeneratorFunction()) instanceof GeneratorFunction);
assertTrue(GeneratorFunction() instanceof GeneratorFunction);
+
+ // ES6 draft 04-14-15, section 25.2.2.2
+ var prototype_desc = Object.getOwnPropertyDescriptor(GeneratorFunction,
+ "prototype");
+ assertFalse(prototype_desc.writable);
+ assertFalse(prototype_desc.enumerable);
+ assertFalse(prototype_desc.configurable);
}
TestGeneratorFunction();
var GeneratorFunction = function*() {}.__proto__.constructor;
+var GeneratorPrototype = Object.getPrototypeOf(function*() {}).prototype;
function assertIteratorResult(value, done, result) {
})();
+(function TestGeneratorPrototypeDescriptor() {
+ var object = {
+ *method() {}
+ };
+
+ var desc = Object.getOwnPropertyDescriptor(object.method, 'prototype');
+ assertFalse(desc.enumerable);
+ assertFalse(desc.configurable);
+ assertTrue(desc.writable);
+ assertEquals(GeneratorPrototype, Object.getPrototypeOf(desc.value));
+})();
+
+
(function TestGeneratorProto() {
var object = {
*method() {}