-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
swc_ecma_parser: Unexpected escape sequence in reserved word (2) #9227
Comments
GFI guide
This is about an object lieral, and the relevant code lives at swc/crates/swc_ecma_parser/src/parser/object.rs Lines 183 to 212 in 1ec68cb
It seems like
swc/crates/swc_ecma_parser/src/parser/object.rs Lines 43 to 122 in 1ec68cb
But there's no relevant error reporting logic so my guess is that the error is from lexer. The relevant error reporting logic is at swc/crates/swc_ecma_parser/src/lexer/mod.rs Lines 777 to 780 in 1ec68cb
We need to patch this logic to allow escapes in reserved word in property names. |
I'm going to take a stab at it |
Describe the bug
Have swc_ecma_parser parse this test262 case: test/language/import/import-assertions/json-extensibility-array.js (others also exhibit this behavior).
(This is a re-post of #9214, this time with a proper reproduction link that works on the latest parser version, 0.147.0)
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.6.7&code=H4sIAAAAAAAAAytLLFLIT8pSsFXQqFZIKkqNKTUwMDPMtlIwMVKo1bTmAgDLr8KQIAAAAA%3D%3D&config=H4sIAAAAAAAAA1VPSQ7CMAy89xWRzxwACQ78gUdYwa1SZVMcJKKqfyfNUujNs3nsZRACZpbwEEseM%2FAYmMKOM8PJRvxkBkgaZBmUj3Dq6sybNKJmKtRaFYgYJoolxdfz5dYSoJ1j6onGGWXVmP47pTM%2BEPPRuFnRTpqOjUNrBeNe7yK2X2LyVC%2B4w8%2FUy%2FbFoPjZk3Xt%2BgVne8%2FLGAEAAA%3D%3D
SWC Info output
No response
Expected behavior
The above code is parsed as an object literal with property "var" (which is legal JS). This works in node.
Actual behavior
The following error is reported:
Version
0.147.0
Additional context
The relevant code that calls the parser is the following (just an extract; the original with full context is here):
The text was updated successfully, but these errors were encountered: