esprima-dotnet: Parser error on Asynchronous iteration and Asynchronous generators
The parser has issues with the aforementioned ES2018 features:
-
Asynchronous iteration works only whenParserOptions.Tolerant
is set to false, otherwise it results inParserException
. Sample input:for await (const x of syncToAsyncIterable(['a', 'b'])) { console.log(x); }
results in error as expected but is parsed fine in async contexts:
async function f() { for await (const x of syncToAsyncIterable(['a', 'b'])) { console.log(x); } }
-
Asynchronous generators results in in
ParserException
regardless theParserOptions.Tolerant
setting. Sample input:async function* asyncGen() { yield someValue; }
Library version: 2.0.2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (2 by maintainers)
Commits related to this issue
- improves error reporting of 'for await' loops (https://github.com/sebastienros/esprima-dotnet/issues/183) — committed to adams85/esprima-dotnet by adams85 3 years ago
- improves error reporting of 'for await' loops (https://github.com/sebastienros/esprima-dotnet/issues/183) — committed to adams85/esprima-dotnet by adams85 3 years ago
- improves error reporting of 'for await' loops (https://github.com/sebastienros/esprima-dotnet/issues/183) — committed to adams85/esprima-dotnet by adams85 3 years ago
- improves error reporting of 'for await' loops (https://github.com/sebastienros/esprima-dotnet/issues/183) — committed to adams85/esprima-dotnet by adams85 3 years ago
- Improvement on error reporting of 'for await' loops (#189) * minor code readability improvements * improves error reporting of 'for await' loops (https://github.com/sebastienros/esprima-dotnet/issue... — committed to sebastienros/esprima-dotnet by adams85 3 years ago
I’ve merged in the changes as the JS PR seems to be in standstill. Your three examples provided in summary now parse without errors. Let’s iterate more later if needed…
I’ve completed the changes on JS side and also have the relevant code on .NET side ready (actually developed on .NET sided as debugging is waaaay easier). Waiting for acceptance there.
Here’s the draft PR on C# side, I’m working on both JS and C# to see how the implementation works: https://github.com/sebastienros/esprima-dotnet/pull/190
@lahma I can take the other issue (the minor strict mode bug) but I’m not familiar enough with the parser to tackle this one.