introduce unsafe_Func (#2033)

Separate flag for #203 functionality.
This commit is contained in:
Alex Lam S.L
2017-05-31 03:38:00 +08:00
committed by GitHub
parent 55b5f2a8aa
commit e9645e017f
4 changed files with 83 additions and 58 deletions

View File

@@ -245,3 +245,25 @@ hoist_funs_strict: {
]
node_version: ">=4"
}
issue_203: {
options = {
keep_fargs: false,
side_effects: true,
unsafe_Func: true,
unused: true,
}
input: {
var m = {};
var fn = Function("require", "module", "exports", "module.exports = 42;");
fn(null, m, m.exports);
console.log(m.exports);
}
expect: {
var m = {};
var fn = Function("a", "b", "b.exports=42");
fn(null, m, m.exports);
console.log(m.exports);
}
expect_stdout: "42"
}