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
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:
leta=[1,2,3];for(iofa){console.log(i);}
The expected output is:
123
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?
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:
pubenumIterableForLoopKind{In,Of}structInnerIterableForLoop{kind:IterableForLoopKind,variable:SingleVarLetOrConstDecl,// or somethingobject:Node,body:Node}
Note that #670 would also be closed, as for..in is simply a for..of with a built-in iterator.
Activity
Lan2u commentedon Jul 19, 2020
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)
dvtkrlbs commentedon Aug 30, 2020
I can take a look at this. Does this include the for-in statement too?
joshwd36 commentedon Aug 30, 2020
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.
jcdickinson commentedon Aug 31, 2020
Dropping #671 for whoever wants to take this on. See my comments there, as there is a tricky design question. My current thoughts are:
Note that #670 would also be closed, as
for..inis simply afor..ofwith a built-in iterator.