@@ -3274,6 +3274,7 @@ merge(Compressor.prototype, {
|
|||||||
&& (def = sym.definition()).escaped != 1
|
&& (def = sym.definition()).escaped != 1
|
||||||
&& !def.single_use
|
&& !def.single_use
|
||||||
&& !def.direct_access
|
&& !def.direct_access
|
||||||
|
&& !compressor.exposed(def)
|
||||||
&& !top_retain(def)
|
&& !top_retain(def)
|
||||||
&& (value = sym.fixed_value()) === node.value
|
&& (value = sym.fixed_value()) === node.value
|
||||||
&& value instanceof AST_Object) {
|
&& value instanceof AST_Object) {
|
||||||
|
|||||||
@@ -827,3 +827,73 @@ issue_2519: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "5.5"
|
expect_stdout: "5.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toplevel_const: {
|
||||||
|
options = {
|
||||||
|
hoist_props: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: false,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
const a = {
|
||||||
|
b: 1,
|
||||||
|
c: 2
|
||||||
|
};
|
||||||
|
console.log(a.b + a.c);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
const a = {
|
||||||
|
b: 1,
|
||||||
|
c: 2
|
||||||
|
};
|
||||||
|
console.log(a.b + a.c);
|
||||||
|
}
|
||||||
|
expect_stdout: "3"
|
||||||
|
}
|
||||||
|
|
||||||
|
toplevel_let: {
|
||||||
|
options = {
|
||||||
|
hoist_props: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: false,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
let a = {
|
||||||
|
b: 1,
|
||||||
|
c: 2
|
||||||
|
};
|
||||||
|
console.log(a.b + a.c);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
let a = {
|
||||||
|
b: 1,
|
||||||
|
c: 2
|
||||||
|
};
|
||||||
|
console.log(a.b + a.c);
|
||||||
|
}
|
||||||
|
expect_stdout: "3"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|
||||||
|
toplevel_var: {
|
||||||
|
options = {
|
||||||
|
hoist_props: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: false,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = {
|
||||||
|
b: 1,
|
||||||
|
c: 2
|
||||||
|
};
|
||||||
|
console.log(a.b + a.c);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = {
|
||||||
|
b: 1,
|
||||||
|
c: 2
|
||||||
|
};
|
||||||
|
console.log(a.b + a.c);
|
||||||
|
}
|
||||||
|
expect_stdout: "3"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user