extend function inlining safety checks (#2430)
This commit is contained in:
@@ -1109,11 +1109,11 @@ var_catch_toplevel: {
|
||||
}
|
||||
}
|
||||
|
||||
issue_2105: {
|
||||
issue_2105_1: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
inline: true,
|
||||
passes: 3,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
unused: true,
|
||||
@@ -1139,17 +1139,50 @@ issue_2105: {
|
||||
});
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
var quux = function() {
|
||||
({
|
||||
prop: function() {
|
||||
console.log;
|
||||
console.log("PASS");
|
||||
};
|
||||
return {
|
||||
prop: function() {
|
||||
console.log;
|
||||
quux();
|
||||
}
|
||||
}).prop();
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_2105_2: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
inline: true,
|
||||
passes: 2,
|
||||
properties: true,
|
||||
pure_getters: "strict",
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
unsafe: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
!function(factory) {
|
||||
factory();
|
||||
}( function() {
|
||||
return function(fn) {
|
||||
fn()().prop();
|
||||
}( function() {
|
||||
function bar() {
|
||||
var quux = function() {
|
||||
console.log("PASS");
|
||||
}, foo = function() {
|
||||
console.log;
|
||||
quux();
|
||||
};
|
||||
return { prop: foo };
|
||||
}
|
||||
};
|
||||
})().prop();
|
||||
return bar;
|
||||
} );
|
||||
});
|
||||
}
|
||||
expect: {
|
||||
console.log("PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
@@ -3397,6 +3397,10 @@ issue_2423_1: {
|
||||
p();
|
||||
p();
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"1",
|
||||
]
|
||||
}
|
||||
|
||||
issue_2423_2: {
|
||||
@@ -3417,6 +3421,10 @@ issue_2423_2: {
|
||||
p();
|
||||
p();
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"1",
|
||||
]
|
||||
}
|
||||
|
||||
issue_2423_3: {
|
||||
@@ -3433,12 +3441,14 @@ issue_2423_3: {
|
||||
expect: {
|
||||
(function() { console.log(function() { return 1; }()); })();
|
||||
}
|
||||
expect_stdout: "1"
|
||||
}
|
||||
|
||||
issue_2423_4: {
|
||||
options = {
|
||||
inline: true,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
@@ -3448,6 +3458,87 @@ issue_2423_4: {
|
||||
p();
|
||||
}
|
||||
expect: {
|
||||
void console.log(1);
|
||||
console.log(1);
|
||||
}
|
||||
expect_stdout: "1"
|
||||
}
|
||||
|
||||
issue_2423_5: {
|
||||
options = {
|
||||
inline: true,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
function y() {
|
||||
console.log(1);
|
||||
}
|
||||
function z() {
|
||||
function y() {
|
||||
console.log(2);
|
||||
}
|
||||
x();
|
||||
}
|
||||
z();
|
||||
z();
|
||||
}
|
||||
expect: {
|
||||
function z() {
|
||||
console.log(1);
|
||||
}
|
||||
z();
|
||||
z();
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"1",
|
||||
]
|
||||
}
|
||||
|
||||
issue_2423_6: {
|
||||
options = {
|
||||
inline: true,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
function y() {
|
||||
console.log(1);
|
||||
}
|
||||
function z() {
|
||||
function y() {
|
||||
console.log(2);
|
||||
}
|
||||
x();
|
||||
y();
|
||||
}
|
||||
z();
|
||||
z();
|
||||
}
|
||||
expect: {
|
||||
function z(){
|
||||
console.log(1);
|
||||
console.log(2);
|
||||
}
|
||||
z();
|
||||
z();
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"1",
|
||||
"2",
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user