-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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: Parse placeholder for TS namespace #16903
fix: Parse placeholder for TS namespace #16903
Conversation
liuxingbaoyu
commented
Oct 13, 2024
•
edited
Loading
edited
Q | A |
---|---|
Fixed Issues? | Fixes #16902 |
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/58276 |
@@ -351,7 +351,7 @@ export const tt = { | |||
} as const; | |||
|
|||
export function tokenIsIdentifier(token: TokenType): boolean { | |||
return token >= tt._as && token <= tt.name; | |||
return (token >= tt._as && token <= tt.name) || token === tt.placeholder; |
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.
Can we move the placeholder token right after the name token so that we can compare with the placeholder token directly?
@@ -328,6 +328,9 @@ export const tt = { | |||
_opaque: createKeywordLike("opaque", { startsExpr }), | |||
// end: isFlowInterfaceOrTypeOrOpaque | |||
name: createToken("name", { startsExpr }), | |||
|
|||
// placeholder plugin | |||
placeholder: createToken("%%", { startsExpr: true }), |
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.
Since this change will also affect tokenIsLiteralPropertyName
, can you add a parser test for placeholder used as a property name?
5686b19
to
5986582
Compare