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

Decorator parsing is too forgiving #394

Closed
adams85 opened this issue Aug 6, 2023 · 0 comments · Fixed by #393
Closed

Decorator parsing is too forgiving #394

adams85 opened this issue Aug 6, 2023 · 0 comments · Fixed by #393
Labels

Comments

@adams85
Copy link
Collaborator

adams85 commented Aug 6, 2023

According to the proposal, when decorator expression is not wrapped in parentheses, it must be an identifier or a special member expression (which can contain . member access only). Other expressions must be parenthesized. See also https://github.com/tc39/proposal-decorators#syntax

Currently we just parse it as a plain LHS expression, so invalid syntaxes like @d['a'], @d?.a, @function(){ } class X {} are accepted.

AST to JS formatter doesn't deal with this correctly either, must be adjusted too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant