-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Parser error on Asynchronous iteration and Asynchronous generators #183
Comments
I think this is a problem also in the original Esprima JS project so maybe need to file an issue there. |
@lahma You mean it has to be fixed in the original Esprima first? That'd be a bummer because this is kinda blocking for my lib... BTW, have you seen this comment? Could you re-open that issue? (Unfortunately I can't.) |
Can be fixed on either side first, just a good practice to get the fix ported also to the other side to keep code consistent between the implementations.
Would you like to submit a PR to fix remaining issue(s)? (sorry I fat-fingered and edited your comment first) |
@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. |
Seems that there's already a work item on Esprima side. |
By a cursory look it's enough to change:
to
in two places. Breaks two (now invalid) test cases and lacks test cases and JSON trees for results. Edit: requires some more changes for async generator methods. |
@lahma Now this is the only blocking issue left for me. Are you working on this? If not, I might give it a shot. |
I have some work done, it should be pretty close to be PR ready against the JS version. Got to get my thoughts back together and check where I left the work.. |
Great news! BTW, in the meantime I realized that I was mistaken about the Asynchronous iterations bug. It's parsed alright in async contexts, just the error message is not too helpful. I'll update the issue description. However, I noticed that the parser skates over invalid usages of (async () => {
for await (;;) { }
})() is accepted without an error. I've been making some progress on this though, I'll submit it as a PR soon. |
Here's the draft PR on C# side, I'm working on both JS and C# to see how the implementation works: #190 |
It's not even implemented on esprima's side? |
Hey welcome back @sebastienros ! Not yet implemented, I'm working on both sides to see what is missing: jquery/esprima#2101 |
That's awesome! |
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. |
@lahma May I expect a 2.x release after these changes get accepted and merged? I'd like to know that to be able to decide whether or not to stall releasing one of my libs depending on Esprima.NET. |
I'd be happy to have a 2.x release with these fixes that have landed and including this too (unless @sebastienros objects). If we don't hear back from JS side for a while we can also consider merging beforehand and fixing later if needed. |
Excellent, thank you! |
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... |
And the JS PR was also just merged. |
* minor code readability improvements * improves error reporting of 'for await' loops (#183) Co-authored-by: Sébastien Ros <[email protected]>
* minor code readability improvements * improves error reporting of 'for await' loops (sebastienros/esprima-dotnet#183) Co-authored-by: Sébastien Ros <[email protected]>
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:results in error as expected but is parsed fine in async contexts:
Asynchronous generators results in in
ParserException
regardless theParserOptions.Tolerant
setting. Sample input:Library version: 2.0.2
The text was updated successfully, but these errors were encountered: