-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(parser): Terminate modifier parsing at newline #17307
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
Conversation
magic-akari
commented
May 13, 2025
Q | A |
---|---|
Fixed Issues? | Fixes: #17305 |
Patch: Bug Fix? | |
Major: Breaking Change? | |
Minor: New Feature? | |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59322 |
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.
@@ -447,6 +447,10 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) => | |||
modifier, | |||
}); | |||
} | |||
|
|||
if (this.hasPrecedingLineBreak()) { |
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.
We already check the newline in tsNextTokenCanFollowModifier
, but somehow we missed this check for the static
token, could you move the newline check there? So we don't have to check the line break for every other modifiers here.
packages/babel-parser/test/fixtures/typescript/class/static-static/input.ts
Show resolved
Hide resolved
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.
Thanks!