Bug 1181354 - Account for initaliasedlexical in this one weird const cutout in jit::SetProperty. (r=jandem)

This commit is contained in:
Shu-yu Guo 2015-07-09 05:35:44 -07:00
parent 7b509de733
commit 70b1b66aff
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,9 @@
for (a of []) {}
var log = "";
(function() {
for (a of [,0]) {}
const y = "FOO";
log += y;
function inner() { log += y; }
})()
assertEq(log, "FOO");

View File

@ -414,7 +414,7 @@ SetProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, HandleValu
JSOp op = JSOp(*pc);
if (op == JSOP_SETALIASEDVAR) {
if (op == JSOP_SETALIASEDVAR || op == JSOP_INITALIASEDLEXICAL) {
// Aliased var assigns ignore readonly attributes on the property, as
// required for initializing 'const' closure variables.
Shape* shape = obj->as<NativeObject>().lookup(cx, name);