-
-
Notifications
You must be signed in to change notification settings - Fork 529
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(parser): throw syntax error for import without arguments #5099
Conversation
5ef0006
to
8f5ac82
Compare
CodSpeed Performance ReportMerging #5099 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. I am going to request some changes because we have a better infrastructure to handle errors, and we should use that :)
p.error(p.err_builder( | ||
format!("Expected '(', but got '{}' here", p.cur_text()), | ||
p.cur_range(), | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not how we should handle the error case. You need to handle the error where parse_ts_import_type_arguments
is called (line 1168) and instead of doing .ok()
, you need to create a diagnostic there. The type ParsedSyntax
provide methods to do so, such as or_add_diagnostic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i will fix this later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated~
5dd5add
to
62c47cc
Compare
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
Summary
closes: #4982
The follwing code will throw a syntax error:
Test Plan
I add test case for this.