-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Implement for...of syntax for Iterables #576
Comments
You could make a branch-based from #559 if you wanted to get started right away, I expect that most of the work regarding this would be in the parser (syntax/parser/statement/iteration) and exec (exec/iteration/mod.rs). In terms of the lexer I think you will just need to add a new 'of' keyword (syntax/ast/keyword) |
I can take a look at this. Does this include the for-in statement too? |
I've made a start on it already, but haven't been able to work on it recently. I should have more time this week though so I'll try and finish it then, if not I'm happy to transfer what I've done over to you. |
Dropping #671 for whoever wants to take this on. See my comments there, as there is a tricky design question. My current thoughts are: pub enum IterableForLoopKind {
In,
Of
}
struct InnerIterableForLoop {
kind: IterableForLoopKind,
variable: SingleVarLetOrConstDecl, // or something
object: Node,
body: Node
} Note that #670 would also be closed, as |
As more collections are added, it would be useful to implement the
for...of
syntax for Iterables, and adding iterables to the String, Array, and Map types. ECMAScript specification.This code should now work and give the expected result:
The expected output is:
I'm happy to have a go at this myself, although as this will be my first time adding syntax features, I'm wondering whether I should wait for #559 to land or just go right ahead with the current lexer?
The text was updated successfully, but these errors were encountered: