fix for-of loop with const iterator (#1899)

This commit is contained in:
kzc
2017-05-09 23:36:03 -04:00
committed by Alex Lam S.L
parent 6ddb5bd94d
commit 9d59c693c2
2 changed files with 35 additions and 3 deletions

View File

@@ -1785,7 +1785,7 @@ function parse($TEXT, options) {
name : as_symbol(sym_type),
value : is("operator", "=")
? (next(), expression(false, no_in))
: kind === "const" && S.input.has_directive("use strict")
: !no_in && kind === "const" && S.input.has_directive("use strict")
? croak("Missing initializer in const declaration") : null,
end : prev()
})
@@ -1814,10 +1814,10 @@ function parse($TEXT, options) {
});
};
var const_ = function() {
var const_ = function(no_in) {
return new AST_Const({
start : prev(),
definitions : vardefs(false, "const"),
definitions : vardefs(no_in, "const"),
end : prev()
});
};