archives

« Bugzilla Issues Index

#2476 — 9.2.13 CloneMethod: CloneMethod should also copy properties to the new function


9.2.13 CloneMethod(function, newHome, newName):

Step 4 only copies the internal slots and internal methods to the new function object, but properties are currently not defined as an internal slot, so it should be made more explicit that the new function also receives the properties from the original function.

Or alternatively 9.1 needs to be changed to define properties as an internal slot.


toMethod intentionally does not copy properties. It is intended to be a primitive building block and that an additional function layer would deal with copying properties.

The main concern is that properties may themselves be functions with super bindings and hence the cloning/copying needs to be recursively applied.

We'll discuss this further at the Jan. 2014 TC39 meeting.


If properties should not copied, there still needs to be some additional code to call 9.2.8 AddRestrictedFunctionProperties() to prevent .caller and .arguments access for strict functions. And most importantly the value of the [[Extensible]] internal slot must not be copied over the new function object.


fixed in rev23 editor's draft

Specified that it must work for exotic built-in functions
set [[Extensible]] true
Adds restricted properties for Strict functions.


fixed in rev23 draft