Fix await using double lookahead edge case#1382
Conversation
85961d4 to
b45f21e
Compare
|
Thanks for fixing that! |
|
My pleasure. However, how about the other similar cases of lookaheads I mentioned above, in the PR description? Shall I submit another PR and shall we discuss those there? |
|
Either works. I don't have time to look into them today but I could also have a look later this week. |
|
Attached patch adjusts I don't think there's an issue in |
Thank you. This will report the error at the correct position BTW. However, it's still not completely correct as it doesn't account for astral identifier characters. I submitted another PR, which hopefully sorts this out once and for all. |
In the double lookahead to determine whether it's an await using declaration, the check for the
usingkeyword is not correct. Adding a Unicode escaped identifier character fools the parser logic:async () => { await using\\u0061 b = c }This incorrectly parses without an error.
I made an attempt at fixing the issue. (This way we should be consistent with the
readWord1function of the tokenizer.)BTW, it seems like there are similar issues here:
acorn/acorn/src/statement.js
Line 73 in ad66d00
acorn/acorn/src/statement.js
Line 45 in ad66d00