-
Notifications
You must be signed in to change notification settings - Fork 5
[WIP] Parse Async Generators #19
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
[WIP] Parse Async Generators #19
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! One change request and a few additional tests that I imagine should be straightforward.
I can't remember, does anything else need to happen for this?
src/plugins/lightscript.js
Outdated
case "=*>": case "-*>": | ||
node.generator = true; | ||
break; | ||
case "=/*>": case "-/*>": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, could we do =*/>
and -*/>
instead? I prefer it visually and it's less likely to trip up syntax highlighters who think it's a comment. Unless there's a reason you prefer this style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=/*>
is what came naturally to me, but sure, I can change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
return this.finishToken(tt.arrow, "-*>"); | ||
} | ||
|
||
if (this.hasPlugin("asyncGenerators")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, this looks good!
@@ -0,0 +1,2 @@ | |||
fn() -/*> | |||
yield await x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these look good – let's also add the following tests:
f() =*/>
yield <- g()
f() =*/>
yield <!- g()
f() =*/>
x = yield <- g()
These tests will also probably need to be copied into the plugin's test suite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also probably test that this raises a SyntaxError:
f() =*/>
<- yield g()
If it doesn't do that by default, let's make it a friendly one 😄
Hey @mikeyhew are you still interested in taking this over the finish line? I can help if not! |
(note that there are likely to be significant merge conflicts, which I can help you with as they're fairly straightforward) |
@rattrayalex Sorry, I got sucked into Rust. (The programming language, not the game. 🙂 ) I'll see what I can get done tonight, and then after that I'll let you take over since I have school starting up again. |
@rattrayalex I'll leave it for you to finish. I think I got the conflict sorted out. There's still those tests to add that you suggested; plus the tests that I wrote aren't passing anymore, and I didn't really understand the error message - "Did not expect a property 'delegate' (expression/0/body/body/0/body/program)". I wanted to point out about the one negative test you suggested:
You're allowed to have |
Awesome! I can take it from here then. The delegate thing is probably from the upgrade - removing the expected.json file and then re-running the test suite is probably the easiest way to fix it. |
@mikeyhew finally merged, sorry this took me so long to get to! Thanks for the contribution! |
@rattrayalex no worries, thanks for finishing it up for me! |
So far this supports parsing
-/*>
and=/*>
. There are two new tests, both of which only test parsing, and only for the named function syntax.I didn't wrap the new parsing code in an
if
statement because I wasn't sure which plugin name to use. This file would suggest that it isasyncGenerators
, is that correct?