@@ -2390,6 +2390,10 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (node instanceof AST_This && self instanceof AST_Arrow) {
|
||||||
|
result = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
@@ -4582,7 +4586,7 @@ merge(Compressor.prototype, {
|
|||||||
if (fixed instanceof AST_Defun) {
|
if (fixed instanceof AST_Defun) {
|
||||||
d.fixed = fixed = make_node(AST_Function, fixed, fixed);
|
d.fixed = fixed = make_node(AST_Function, fixed, fixed);
|
||||||
}
|
}
|
||||||
if (d.single_use && fixed instanceof AST_Function) {
|
if (d.single_use && is_func_expr(fixed)) {
|
||||||
if (d.scope !== self.scope
|
if (d.scope !== self.scope
|
||||||
&& (!compressor.option("reduce_funcs")
|
&& (!compressor.option("reduce_funcs")
|
||||||
|| d.escaped
|
|| d.escaped
|
||||||
@@ -4595,7 +4599,7 @@ merge(Compressor.prototype, {
|
|||||||
if (d.single_use == "f") {
|
if (d.single_use == "f") {
|
||||||
var scope = self.scope;
|
var scope = self.scope;
|
||||||
do {
|
do {
|
||||||
if (scope instanceof AST_Defun || scope instanceof AST_Function) {
|
if (scope instanceof AST_Defun || is_func_expr(scope)) {
|
||||||
scope.inlined = true;
|
scope.inlined = true;
|
||||||
}
|
}
|
||||||
} while (scope = scope.parent_scope);
|
} while (scope = scope.parent_scope);
|
||||||
|
|||||||
@@ -4819,3 +4819,54 @@ issue_2485: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "6"
|
expect_stdout: "6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2496: {
|
||||||
|
options = {
|
||||||
|
passes: 2,
|
||||||
|
reduce_funcs: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function execute(callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
class Foo {
|
||||||
|
constructor(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
go() {
|
||||||
|
this.message = "PASS";
|
||||||
|
console.log(this.message);
|
||||||
|
}
|
||||||
|
run() {
|
||||||
|
execute(() => {
|
||||||
|
this.go();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new Foo("FAIL").run();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
class Foo {
|
||||||
|
constructor(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
go() {
|
||||||
|
this.message = "PASS";
|
||||||
|
console.log(this.message);
|
||||||
|
}
|
||||||
|
run() {
|
||||||
|
(function(callback) {
|
||||||
|
callback();
|
||||||
|
})(() => {
|
||||||
|
this.go();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new Foo("FAIL").run();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user