Bug 933798 - Don't inhibit name optimizations in try blocks. r=bhackett

This commit is contained in:
Jan de Mooij 2013-11-08 10:37:31 +01:00
parent 2662326c9c
commit 7067a85ea3
2 changed files with 31 additions and 5 deletions

View File

@ -1144,12 +1144,8 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn)
// The only statements within a lazy function which can push lexical
// scopes are try/catch blocks. Use generic ops in this case.
for (StmtInfoBCE *stmt = bce->topStmt; stmt; stmt = stmt->down) {
switch (stmt->type) {
case STMT_TRY:
case STMT_FINALLY:
if (stmt->type == STMT_CATCH)
return true;
default:;
}
}
size_t hops = 0;

View File

@ -0,0 +1,30 @@
function test1() {
var BUGNUMBER = '';
var summary = '';
var actual = '';
test(BUGNUMBER);
function test() {
try {
(function () { eval("'foo'.b()", arguments) })();
} catch(ex) {
actual = ex + '';
}
}
assertEq(actual, 'TypeError: "foo".b is not a function');
}
test1();
function test2() {
var BUGNUMBER = '';
var summary = '';
function g() {
'use strict';
try {
eval('function foo() { var a, arguments, b;}');
} catch (x) {
return (x instanceof SyntaxError);
}
};
assertEq(g(), true);
}
test2();