-
Notifications
You must be signed in to change notification settings - Fork 112
Description
This issue is a meta issue for tracking a number of normative updates that are being proposed to the spec in the upcoming March plenary.
-
Remove the dynamic assignment of
[[HomeObject]]
from decorator method application/evaluation (PR, Issue)This dynamic assignment/update of a function's
[[HomeObject]]
is a new behavior that has not occurred before in the spec, and is even asserted against. It results in unexpected behavior and does not have an actual use-case. This decision was likely due to a misunderstanding of what theMakeMethod
s purpose was. This change removes the reassignment entirely. -
Call decorators with their natural
this
value instead ofundefined
(PR, Issue)Currently decorators are always called with an undefined
this
value, even when it might appear that they should have one (e.g.@foo.bar
should be called withfoo
as the receiver). This change threads the receiver through so the decorator can be called with it. -
Throw an error if the value passed to
addInitializer
is not callable (PR)addInitializer
expects to receive a function, and all of the spec text downstream from it assumes this as well, so this assertion is necessary to ensure that the value is actually callable. -
Set the name of the
addInitializer
function (PR)Sets the name of
addInitializer
, which is currently an empty string. -
Remove
SetFunctionName
from decoration (PR)Currently,
SetFunctionName
is called on the returned decorated methods. This two main problems:- It messes up stack traces, because the actual function name will be different than the code, which would be confusing when trying to debug.
SetFunctionName
asserts against ever being called twice for the same method.
-
"Bind" static accessors directly to the class itself. (PR pending, issue)
Static accessors are implemented conceptually as a sugar on top of private fields. A getter and setter are generated which access private storage on the same class. For static accessors, this results in them not working when inherited by a child class, since static fields and accessors are not redefined on child classes.
The proposed update is to "bind" static accessors to their original class, e.g. instead of being sugar for:
class A {
static #x = 42
static get x() { return this.#x }
static set x(v) { this.#x = v }
}
They would desugar to:
class A {
static #x = 42
static get x() { return A.#x }
static set x(v) { A.#x = v }
}