-
Notifications
You must be signed in to change notification settings - Fork 15
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
ES2020 Operators support #92
Comments
I good place to start would be to add these punctuation marks to ress. This enum would need new variants, and then the tokenizer would need to be updated to parse these new tokens. This method is the starting point for parsing the new operators. Once that is done, an update to resast would need to be made to account for the new tokens, all but For for Once those are in place, then ressa can be updated to handle these new tokens/generate the new AST. |
Most of this is now in place, however I am still trying to figure out how to integrate the optional chain.
|
awesome @FreeMasen ! |
I would say that the primary issue I have is that the usage is pretty inconsistent. For example a?.b
a?.['b']
a?.() In these three expressions, the first completely replaces the index operator, while the second is a duplicate indexer and the last one is entirely new syntax for the call expression. So, coming up with a decent way to represent this as a single Looking at the SWC implementation they are using a It might make sense to have an |
uh agree this operator can be thrown into many places which makes it difficult to represent as |
Made a try to finish the optional chaining:
What do you think? |
I think what you have looks very good! |
I would like to have support for the operators coming with ES2020 (https://www.w3schools.com/jS/js_2020.asp):
Any hints how to implement them are very welcome.
I probably start with the Logical AND / OR as these seem more simple to me.
The text was updated successfully, but these errors were encountered: