inline functions with AST_Var (#2688)
This commit is contained in:
@@ -1694,3 +1694,234 @@ loop_init_arg: {
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
inline_false: {
|
||||
options = {
|
||||
inline: false,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
]
|
||||
}
|
||||
|
||||
inline_0: {
|
||||
options = {
|
||||
inline: 0,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
]
|
||||
}
|
||||
|
||||
inline_1: {
|
||||
options = {
|
||||
inline: 1,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect: {
|
||||
console.log(1);
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
]
|
||||
}
|
||||
|
||||
inline_2: {
|
||||
options = {
|
||||
inline: 2,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect: {
|
||||
console.log(1);
|
||||
a = 2, console.log(a);
|
||||
var a;
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
]
|
||||
}
|
||||
|
||||
inline_3: {
|
||||
options = {
|
||||
inline: 3,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect: {
|
||||
console.log(1);
|
||||
a = 2, console.log(a);
|
||||
var a;
|
||||
b = 3, c = b, console.log(c);
|
||||
var b, c;
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
]
|
||||
}
|
||||
|
||||
inline_true: {
|
||||
options = {
|
||||
inline: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
console.log(1);
|
||||
})();
|
||||
(function(a) {
|
||||
console.log(a);
|
||||
})(2);
|
||||
(function(b) {
|
||||
var c = b;
|
||||
console.log(c);
|
||||
})(3);
|
||||
}
|
||||
expect: {
|
||||
console.log(1);
|
||||
a = 2, console.log(a);
|
||||
var a;
|
||||
b = 3, c = b, console.log(c);
|
||||
var b, c;
|
||||
}
|
||||
expect_stdout: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
]
|
||||
}
|
||||
|
||||
use_before_init_in_loop: {
|
||||
options = {
|
||||
inline: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
var a = "PASS";
|
||||
for (var b = 2; --b >= 0;) (function() {
|
||||
var c = function() {
|
||||
return 1;
|
||||
}(c && (a = "FAIL"));
|
||||
})();
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
var a = "PASS";
|
||||
for (var b = 2; --b >= 0;) (function() {
|
||||
var c = (c && (a = "FAIL"), 1);
|
||||
})();
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user