Bug 942804 - Ion-compile scripts with unaliased let bindings. r=jandem

This commit is contained in:
Andy Wingo 2013-12-18 14:45:09 +01:00
parent 401190b73d
commit f5e8b17e6b
2 changed files with 19 additions and 2 deletions

View File

@ -46,8 +46,6 @@ function check(expr, expected=expr) {
Function("o", "undef", "let (o, undef) { " + statement + " }"),
// Let in a switch
Function("var x = 4; switch (x) { case 4: let o, undef;" + statement + "\ncase 6: break;}"),
// Let in for-in
Function("var undef, o; for (let z in [1, 2]) { " + statement + " }"),
// The more lets the merrier
Function("let (x=4, y=5) { x + y; }\nlet (a, b, c) { a + b - c; }\nlet (o, undef) {" + statement + " }"),
// Let destructuring
@ -55,6 +53,22 @@ function check(expr, expected=expr) {
// Try-catch blocks
Function("o", "undef", "try { let q = 4; try { let p = 4; } catch (e) {} } catch (e) {} let (o, undef) { " + statement + " }")
];
try {
// Let in for-in
check_one(expected,
Function("var undef, o; for (let z in [1, 2]) { " + statement + " }"),
err);
} catch (ex) {
// Bug 831120. See bug 942804 comment 5.
if (expected == 'undef' && err == ' is undefined')
check_one(expected + end,
Function("var undef, o; for (let z in [1, 2]) { " + statement + " }"),
err);
else
throw ex;
}
for (var f of cases) {
check_one(expected, f, err);
}

View File

@ -1768,6 +1768,9 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_INSTANCEOF:
return jsop_instanceof();
case JSOP_DEBUGLEAVEBLOCK:
return true;
default:
#ifdef DEBUG
return abort("Unsupported opcode: %s (line %d)", js_CodeName[op], info().lineno(pc));