-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
For-in inheritance #90
Comments
You're totally right! Check out the Would you care to rewrite that method and add a test? I'd really appreciate the contribution (or I can just do it if you're busy). |
That's https://github.com/facebook/regenerator/blob/master/runtime/dev.js to be clear. |
Hmmm, so what I do is first normalize all loops to regular I'm not sure what you mean wrt test case, this is a pretty small and concise test? |
Oh, what I mean is to add this regression test to the test/tests.es6.js file. |
The code I generate for |
@benjamn the point re deletions, it's not only a runtime change. compiler should emit checks after each iterations to handle deleted keys. Similar to length checks there should be: $ctx.t2 = $ctx.t1.pop();
if (!($ctx.t2 in a){
// etc |
try var foo = {a: 1, b:2};
for (var p in foo) {
console.log(p);
delete foo.b
} will run once for the |
Ah sorry, it's 2:40am here. I'm gonna get some z's. If you haven't figured it out before then, I'll have a look tomorrow :) But sounds like you got it. |
[KNOWN FAILURE] Handle inherited properties iteration bug #90
nice |
I can't really see it through the esprima syntax, but is the comma edge case taken care of? for (var key in a,b) {} In my approach I have to wrap the caching of the rhs to a temporary object or it might introduce a syntax error. It's an edge case, but still :) |
As long as that parses to a sequence expression (and it should, if Esprima is doing its job correctly), the AST->code generator (https://github.com/benjamn/recast) should realize that extra parentheses are necessary. |
@qfox Added some tests for the |
The following code does not transform as expected:
Inherited property is not iterated over, though it should be. This only iterates over
foo
.Have a look at http://github.com/qfox/unyield
The text was updated successfully, but these errors were encountered: