You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncfunctionfoo(){varawait=1;// should be an error, but not}asyncfunctionbar(){letawait=2;// error}function*foo1(){varyield=1;// should be an error, but not}function*bar1(){letyield=2;// error}
π Actual behavior
BindingIdentifier in await/yield with var keyword does not throw errors.
The problem is that let await errors are issued in the parser and var await errors are issued in the binder. Syntax errors block reporting of semantic errors.
The parse errors for let await are horrible, so the right fix is to allow it in the parser and issue the same grammar error as for var await in the binder.
Note that this will make the error disappear in plain JS files for now. I hope to fix that soon.
Sorry, it's a new term. 'plain JS file' means a JS file that is part of a compilation, but is not reporting semantic errors. That is, checkJS is not turned on OR explicitly off, and the file doesn't have // @ts-check or // @ts-no-check in it. Plain JS files report syntax errors but not semantic errors, so moving a parser error to a grammar error makes it disappear. However, I'm planning to turn on grammar errors for plain JS files in the next release.
Bug Report
π Search Terms
parsing, await, yield
π Version & Regression Information
β― Playground Link
Playground
π» Code
π Actual behavior
BindingIdentifier in await/yield with
var
keyword does not throw errors.π Expected behavior
It should.
Related:
The text was updated successfully, but these errors were encountered: