language-javascript
language-javascript copied to clipboard
async keyword parsing
I think the async
keyword is not always parsed correctly. At some stage in my compilation/deployment pipeline this file is being parsed https://github.com/purescript-web/purescript-web-html/blob/d6960bcf86763a1b8c83641b7f0b46506eb3886e/src/Web/HTML/HTMLScriptElement.js and I encounter this error
Unable to parse foreign module:
.spago/web-html/v2.3.0/src/Web/HTML/HTMLScriptElement.js
The module could not be parsed:
AsyncToken {tokenSpan = TokenPn 1062 57 30, tokenLiteral = "async", tokenComment = []}
It does work with 0.7.0.0 though and I think the usage of async
in the file is legal.
According to section 11.6.2 of the ECMAScript 2021 Language Specification:
async
is not reserved; it can be used as a variable name or statement label without restriction.
@linearray Would you be able to post the two or three lines around the mis-parse?
It fails right here where the parameter is called async
: https://github.com/purescript-web/purescript-web-html/blob/d6960bcf86763a1b8c83641b7f0b46506eb3886e/src/Web/HTML/HTMLScriptElement.js#L57