Open overlookmotel opened 2 weeks ago
This aligns with jsparagus https://gist.github.com/Boshen/0b481a058cd715576aaf1624d2c6d469#file-types_generated-rs-L511-L516
#[derive(Debug, PartialEq)]
pub enum ObjectProperty<'alloc> {
NamedObjectProperty(NamedObjectProperty<'alloc>),
ShorthandProperty(ShorthandProperty),
SpreadProperty(arena::Box<'alloc, Expression<'alloc>>),
}
#[derive(Debug, PartialEq)]
pub enum NamedObjectProperty<'alloc> {
MethodDefinition(MethodDefinition<'alloc>),
DataProperty(DataProperty<'alloc>),
}
#[derive(Debug, PartialEq)]
pub enum MethodDefinition<'alloc> {
Method(Method<'alloc>),
Getter(Getter<'alloc>),
Setter(Setter<'alloc>),
}
but breaks estree. I went for estree back in time.
Let's see how @ottomated's work progresses, but hopefully it'll make it easier for us to shape our Rust AST however we choose, while still having an ESTree-compatible AST on JS side.
https://github.com/oxc-project/oxc/issues/7175 demonstrates that it's easy to confuse a function which is the property value of an object expression with an object method. i.e. to conflate these 2:
We could avoid this confusing by changing
ObjectPropertyKind
to have separate variants for methods, getters and setters.Current:
Proposed: