fix various for-of bugs (#2800)

- disable `rename` pass on harmony due to problem with for-of loops

fixes #2794
This commit is contained in:
kzc
2018-01-17 01:46:23 -05:00
committed by Alex Lam S.L
parent 1b2e6b81a2
commit 4f57d8746b
4 changed files with 203 additions and 7 deletions

View File

@@ -766,6 +766,7 @@ function OutputStream(options) {
|| p instanceof AST_Arrow // x => (x, x)
|| p instanceof AST_DefaultAssign // x => (x = (0, function(){}))
|| p instanceof AST_Expansion // [...(a, b)]
|| p instanceof AST_ForOf && this === p.object // for (e of (foo, bar)) {}
;
});
@@ -1046,11 +1047,7 @@ function OutputStream(options) {
output.with_parens(function(){
self.init.print(output);
output.space();
if (self instanceof AST_ForOf) {
output.print("of");
} else {
output.print("in");
}
output.print(self instanceof AST_ForOf ? "of" : "in");
output.space();
self.object.print(output);
});