-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class binding references in static field initializers should be resolved to the decorated class #3787
Comments
I think it's unclear what should happen here until tc39/proposal-decorators#529 is resolved, as the specification may be changed. Supposedly that may be resolved after the upcoming TC39 meeting (from June 11th to June 13th?). |
If I read correctly, the discussion result in tc39/proposal-decorators#529 is that the homeObject of the static accessor might be reverted back to |
In that case, consider the following test case: let old
let block
class Bar {}
@(cls => (old = cls, Bar)) class Foo {
static { block = Foo }
method() { return Foo }
static method() { return Foo }
field = Foo
static field = Foo
get getter() { return Foo }
static get getter() { return Foo }
set setter(x) { x.foo = Foo }
static set setter(x) { x.foo = Foo }
accessor accessor = Foo
static accessor accessor = Foo
}
let foo = new old
let obj
console.log(
Foo !== old,
Foo === Bar,
block === Bar,
Foo.field === Bar,
old.getter === Bar,
(obj = { foo: null }, old.setter = obj, obj.foo) === Bar,
foo.field === Bar,
foo.getter === Bar,
(obj = { foo: null }, foo.setter = obj, obj.foo) === Bar,
// These are determined by the outcome of https://github.com/tc39/proposal-decorators/issues/529
// Foo.accessor === Bar,
// old.accessor === Bar,
) I think you're saying they should all return I believe how accessors behave in this scenario is still determined by the outcome of tc39/proposal-decorators#529. Currently |
Input (playground):
Option:
Expected: It should print
true
, as per spec, static field initializers (step 40) should run after the class binding was initialized (step 38).Actual: It prints
false
.The text was updated successfully, but these errors were encountered: