Status: Untriaged
Owner: ----

New issue 4140 by [email protected]: Generator method `prototype` property incorrectly defined as non-writable
https://code.google.com/p/v8/issues/detail?id=4140

Version: 7ffdb5194d51a5813f9474d2453859c376223b18 (Thu May 21 10:47:07 2015 -0700)
OS: Ubuntu Linux
Architecture: x64

$ d8 -e "print(Object.getOwnPropertyDescriptor({ *g() {} }.g, 'prototype').writable)"

Expected: true
Actual: false

14.4.13 Runtime Semantics: PropertyDefinitionEvaluation

With parameter object and enumerable.

GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }

   1. Let propKey be the result of evaluating PropertyName.
   2. ReturnIfAbrupt(propKey).
3. If the function code for this GeneratorMethod is strict mode code, let
      strict be true. Otherwise let strict be false.
   4. Let scope be the running execution context’s LexicalEnvironment.
5. Let closure be GeneratorFunctionCreate(Method, StrictFormalParameters,
      GeneratorBody, scope, strict).
   6. Perform MakeMethod(closure, object).
   7. Let prototype be ObjectCreate(%GeneratorPrototype%).
   8. Perform MakeConstructor(closure, true, prototype).
   [ ... ]

9.2.8 MakeConstructor (F, writablePrototype, prototype)

The abstract operation MakeConstructor requires a Function argument F and
optionally, a Boolean writablePrototype and an object prototype. If prototype
is provided it is assumed to already contain, if needed, a "constructor"
property whose value is F. This operation converts F into a constructor by
performing the following steps:

   1. Assert: F is an ECMAScript function object.
   2. Assert: F has a [[Construct]] internal method.
3. Assert: F is an extensible object that does not have a prototype own property. 4. If the writablePrototype argument was not provided, let writablePrototype be true.
   5. If the prototype argument was not provided, then
      a. Let prototype be ObjectCreate(%ObjectPrototype%).
      b. Let status be DefinePropertyOrThrow(prototype, "constructor",
         PropertyDescriptor{[[Value]]: F, [[Writable]]: writablePrototype,
         [[Enumerable]]: false, [[Configurable]]: true }).
      c. Assert: status is not an abrupt completion.
   6. Let status be DefinePropertyOrThrow(F, "prototype",
      PropertyDescriptor{[[Value]]: prototype, [[Writable]]:
      writablePrototype, [[Enumerable]]: false, [[Configurable]]: false}).
   [...]

Sources:

- https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
- https://people.mozilla.org/~jorendorff/es6-draft.html#sec-makeconstructor


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to