@@ -216,6 +216,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
|
||||
node.reference(options);
|
||||
});
|
||||
if (old_def.lambda) new_def.lambda = true;
|
||||
if (new_def.undeclared) self.variables.set(name, new_def);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -127,26 +127,34 @@ do_screw_try_catch_undefined: {
|
||||
input: {
|
||||
function a(b) {
|
||||
try {
|
||||
throw 'Stuff';
|
||||
throw "Stuff";
|
||||
} catch (undefined) {
|
||||
console.log('caught: ' + undefined);
|
||||
console.log("caught: " + undefined);
|
||||
}
|
||||
console.log('undefined is ' + undefined);
|
||||
console.log("undefined is " + undefined);
|
||||
return b === undefined;
|
||||
};
|
||||
}
|
||||
console.log(a(42), a(void 0));
|
||||
}
|
||||
expect: {
|
||||
function a(o) {
|
||||
try {
|
||||
throw "Stuff"
|
||||
throw "Stuff";
|
||||
} catch (o) {
|
||||
console.log("caught: "+o)
|
||||
console.log("caught: " + o);
|
||||
}
|
||||
console.log("undefined is " + void 0);
|
||||
return void 0===o
|
||||
return void 0 === o;
|
||||
}
|
||||
console.log(a(42), a(void 0));
|
||||
}
|
||||
expect_stdout: true
|
||||
expect_stdout: [
|
||||
"caught: Stuff",
|
||||
"undefined is undefined",
|
||||
"caught: Stuff",
|
||||
"undefined is undefined",
|
||||
"false true",
|
||||
]
|
||||
}
|
||||
|
||||
dont_screw_try_catch_undefined: {
|
||||
@@ -162,26 +170,35 @@ dont_screw_try_catch_undefined: {
|
||||
input: {
|
||||
function a(b) {
|
||||
try {
|
||||
throw 'Stuff';
|
||||
throw "Stuff";
|
||||
} catch (undefined) {
|
||||
console.log('caught: ' + undefined);
|
||||
console.log("caught: " + undefined);
|
||||
}
|
||||
console.log('undefined is ' + undefined);
|
||||
// IE8: undefined is Stuff
|
||||
console.log("undefined is " + undefined);
|
||||
return b === undefined;
|
||||
};
|
||||
}
|
||||
console.log(a(42), a(void 0));
|
||||
}
|
||||
expect: {
|
||||
function a(n) {
|
||||
try {
|
||||
throw "Stuff"
|
||||
throw "Stuff";
|
||||
} catch (undefined) {
|
||||
console.log("caught: " + undefined)
|
||||
console.log("caught: " + undefined);
|
||||
}
|
||||
console.log("undefined is " + undefined);
|
||||
return n === undefined
|
||||
return n === undefined;
|
||||
}
|
||||
console.log(a(42), a(void 0));
|
||||
}
|
||||
expect_stdout: true
|
||||
expect_stdout: [
|
||||
"caught: Stuff",
|
||||
"undefined is undefined",
|
||||
"caught: Stuff",
|
||||
"undefined is undefined",
|
||||
"false true",
|
||||
]
|
||||
}
|
||||
|
||||
reduce_vars: {
|
||||
@@ -1561,3 +1578,108 @@ issue_3478_2_ie8_toplevel: {
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3482_1: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
ie8: false,
|
||||
}
|
||||
input: {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
var a = +"a";
|
||||
}
|
||||
console.log(a, NaN, 0 / 0);
|
||||
}
|
||||
expect: {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
var a = 0 / 0;
|
||||
}
|
||||
console.log(a, NaN, NaN);
|
||||
}
|
||||
expect_stdout: "NaN NaN NaN"
|
||||
}
|
||||
|
||||
issue_3482_1_ie8: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
ie8: true,
|
||||
}
|
||||
input: {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
var a = +"a";
|
||||
}
|
||||
// IE8: NaN 42 NaN
|
||||
console.log(a, NaN, 0 / 0);
|
||||
}
|
||||
expect: {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
var a = 0 / 0;
|
||||
}
|
||||
console.log(a, NaN, 0 / 0);
|
||||
}
|
||||
expect_stdout: "NaN NaN NaN"
|
||||
}
|
||||
|
||||
issue_3482_2: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
ie8: false,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
a = +"a";
|
||||
}
|
||||
})();
|
||||
console.log(a, NaN, 0 / 0);
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
a = 0 / 0;
|
||||
}
|
||||
})();
|
||||
console.log(a, NaN, NaN);
|
||||
}
|
||||
expect_stdout: "NaN NaN NaN"
|
||||
}
|
||||
|
||||
issue_3482_2_ie8: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
ie8: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
a = +"a";
|
||||
}
|
||||
})();
|
||||
console.log(a, NaN, 0 / 0);
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
try {
|
||||
throw 42;
|
||||
} catch (NaN) {
|
||||
a = 0 / 0;
|
||||
}
|
||||
})();
|
||||
console.log(a, NaN, 0 / 0);
|
||||
}
|
||||
expect_stdout: "NaN NaN NaN"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user