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

fix(ecma/parser): parse types in CallExpression inside templates #6611

Merged
merged 4 commits into from Dec 10, 2022

Conversation

alexander-akait
Copy link
Collaborator

Description:

#6601

BREAKING CHANGE:

No

Related issue (if exists):

Fixed #6601

@alexander-akait alexander-akait changed the title Issue 6601 fix(ecma/parser): aprse types in CallExpression inside templates Dec 9, 2022
@@ -841,7 +844,6 @@ impl<I: Tokens> Parser<I> {
let return_type = if !self.ctx().will_expect_colon_for_cond
&& self.input.syntax().typescript()
&& is!(self, ':')
&& !self.ctx().dont_parse_colon_as_type_ann
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need dont_parse_colon_as_type_ann, because will_expect_colon_for_cond is used to check should we parse : as type or not, also I found we duplicate logic, i.e. we set will_expect_colon_for_cond and dont_parse_colon_as_type_ann to the same value (except switch logic, but I found it is not used there plus I added test cases)

@alexander-akait alexander-akait changed the title fix(ecma/parser): aprse types in CallExpression inside templates fix(ecma/parser): parse types in CallExpression inside templates Dec 9, 2022
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!


swc-bump:

  • swc_ecma_parser

@kdy1 kdy1 enabled auto-merge (squash) December 10, 2022 00:05
@kdy1 kdy1 merged commit c44f1d0 into swc-project:main Dec 10, 2022
@kdy1 kdy1 added this to the Planned milestone Dec 10, 2022
@alexander-akait alexander-akait deleted the issue-6601 branch December 10, 2022 21:51
@kdy1 kdy1 modified the milestones: Planned, v1.3.23 Dec 14, 2022
@swc-project swc-project locked as resolved and limited conversation to collaborators Jan 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Syntax Error thrown on valid typescript input
2 participants