sebastienros / esprima-dotnet

Esprima .NET (BSD license) is a .NET port of the esprima.org project. It is a standard-compliant ECMAScript parser (also popularly known as JavaScript).
BSD 3-Clause "New" or "Revised" License
425 stars 75 forks source link

Do we have accessor keyword for properties? #350

Closed jogibear9988 closed 1 year ago

jogibear9988 commented 1 year ago

It's part of the decorators proposal see: https://github.com/estree/estree/blob/master/stage3/decorators.md#accessorproperty

lahma commented 1 year ago

A slightly delayed response... I guess there's none yet but probably will be a nice addition.

jogibear9988 commented 1 year ago

work started here: https://github.com/sebastienros/esprima-dotnet/pull/353

is the correct way to create a new node type? or should we add a property "IsAccessor" ? I think estree spec says it's a new node type: https://github.com/estree/estree/blob/master/stage3/decorators.md

Parsing is not so simple, cause I need 2 lookforwards in static part e.g.

   static accessor = 3;

so here accessor is not the keyword, it's a static property name... I'm looking whats the best way to do this. Mainly I think the complete "ParseClassElement" should be refactored to smaller functions, it's a bit of a mess

lahma commented 1 year ago

is the correct way to create a new node type? or should we add a property "IsAccessor" ? I think estree spec says it's a new node type: estree/estree@master/stage3/decorators.md

Maybe we should start with new type that inherits from ClassProperty like current MethodDefinition and PropertyDefinition. It seems that you've gone this route already and we can always change if needed.

lahma commented 1 year ago

I believe this is done!