Skip to content
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

FieldDefinition -> ClassProperty? #134

Closed
fisker opened this issue Oct 28, 2020 · 10 comments
Closed

FieldDefinition -> ClassProperty? #134

fisker opened this issue Oct 28, 2020 · 10 comments
Milestone

Comments

@fisker
Copy link
Collaborator

fisker commented Oct 28, 2020

babel / flow / @typecript-eslint/parser uses ClassProperty

I believe FieldDefinition is a old AST type from babel?

 require('meriyah').parse('class A{a=1}',{next:true}).body[0].body.body[0]
{ type: 'FieldDefinition',
  key: { type: 'Identifier', name: 'a' },
  value: { type: 'Literal', value: 1 },
  static: false,
  computed: false,
  decorators: [] }
@3cp
Copy link
Member

3cp commented Oct 28, 2020

Also PrivateName -> PrivateIdentifier

@3cp
Copy link
Member

3cp commented Oct 28, 2020

Latest is called PropertyDefinition, not ClassProperty?

https://github.com/estree/estree/blob/master/experimental/class-features.md

@3cp
Copy link
Member

3cp commented Oct 28, 2020

estree/estree#222

@fisker
Copy link
Collaborator Author

fisker commented Oct 28, 2020

I didn't know that. I thought estree hasn't support class property.

I'm good with PropertyDefinition.

My purpose here is trying to align meriyah ast with other parsers, I think other parsers will change their asts, then no rush.

@3cp
Copy link
Member

3cp commented Oct 28, 2020

Maybe you can add support of old FieldDefinition for now? I will do a thorough cleanup in future to align with latest estree spec.

@KFlash
Copy link
Contributor

KFlash commented Oct 28, 2020

@3cp I gave @fisker a "little upgrade" if he checks his email

@fisker
Copy link
Collaborator Author

fisker commented Oct 28, 2020

Maybe you can add support of old FieldDefinition for now?

Already did.

@fisker
Copy link
Collaborator Author

fisker commented Oct 28, 2020

@KFlash Thanks for you invitation, I may don't have time to contribute though 😄

@KFlash KFlash added this to the 4.0 milestone Oct 28, 2020
@fisker
Copy link
Collaborator Author

fisker commented Oct 29, 2020

Another difference between babel and meriyah

babel use PrivateName.id, meriyah use PrivateName.name.

We are going to follow the new spec anyway, so no need to change for now.

@3cp
Copy link
Member

3cp commented Dec 27, 2020

FYI, PrivateIdentifier.name is in latest spec. https://github.com/estree/estree/blob/master/experimental/class-features.md#privateidentifier

@3cp 3cp closed this as completed in 2a588e5 Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants