Conversation
| ```js | ||
| interface GetAccessorMethod <: Node { | ||
| type: "GetAccessorMethod"; | ||
| params: []; |
There was a problem hiding this comment.
The params must be an empty array. It is to provide compatibility for general function AST visitors: A function always has params property.
| } | ||
| ``` | ||
|
|
||
| ### GetAccessorStub |
There was a problem hiding this comment.
Why use “stub” instead of using the proposal language, such as GetAutoAccessor?
There was a problem hiding this comment.
The "stub" comes from the proposed syntax section.
According to the spec, an auto-accessor is a simplified version of grouped accessor, e.g. accessor x = { get; set; }, where the accessor stub refers to the set and get shorthand.
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
| interface ClassAccessor <: PropertyDefinition { | ||
| type: "ClassAccessor"; | ||
| get: GetAccessorStub | GetAccessorMethod | null; | ||
| set: SetAccessorStub | SetAccessorMethod | null; |
There was a problem hiding this comment.
ClassAccessor should also have a value field which is similar to a class field's value/initializer:
accessor foo { get; set; } = 123;There was a problem hiding this comment.
Ah, I see, it inherits these properties. I think this makes sense.
66d4fd4 to
5ccc7c3
Compare
| computed: boolean; | ||
| get: GetAccessorStub | GetAccessorMethod | null; | ||
| set: SetAccessorStub | SetAccessorMethod | null; | ||
| } |
There was a problem hiding this comment.
In the latest commit I removed the inheritance from Property, because it will inherit value: Expression and kind: "init" | "set" | "get". These properties are not applicable to the grouped accessor.
5ccc7c3 to
c138d66
Compare
View Rendered Text
This PR adds support to the Grouped Accessors and Auto-Accessors proposal.