Annex E does not cover the changed lhs evaluation order in for-in statements.
ES5: Prints "in loop"
ES6: Does not print "in loop"
---
var o = {a: 0};
var p = {
get q() {
delete o.a;
return {};
}
};
for (p.q.v in o) {
print("in loop");
}
---
I think this is a legacy compatibility bug that needs to be corrected and for consistency for-of also needs to work that same way.
This basically means that in 13.7.5.13 that steps 5.c-g need to move to the top of the loop.
fixed in rev39 publication draft
Was the implicit try-finally scope also changed to the rev29 bounds? Errors in rev38, 13.7.5.13 ForIn/OfBodyEvaluation steps 5.a-b don't call IteratorClose; in rev29 an error in those steps did call IteratorClose.
Simple example for the rev38 behaviour:
js> function* g(){try { yield } finally { print("finally!") }}
js> for (null[0] of g());
uncaught exception: TypeError: cannot convert "null" or "undefined" to object
at (typein:2)
js> for ({set prop(_){throw null}}.prop of g());
finally!
uncaught exception: null
at set prop (typein:3)
at (typein:3)
In rev29, the first for-of loop also calls IteratorClose before re-throwing the TypeError.
(In reply to André Bargull from comment #3)
> Was the implicit try-finally scope also changed to the rev29 bounds? Errors
> in rev38, 13.7.5.13 ForIn/OfBodyEvaluation steps 5.a-b don't call
> IteratorClose; in rev29 an error in those steps did call IteratorClose.
>
Yes