enhance properties (#3721)
This commit is contained in:
@@ -7615,9 +7615,11 @@ merge(Compressor.prototype, {
|
|||||||
value = value.fixed_value();
|
value = value.fixed_value();
|
||||||
}
|
}
|
||||||
if (!value) return false;
|
if (!value) return false;
|
||||||
return !(value instanceof AST_Lambda)
|
if (!(value instanceof AST_Lambda)) return true;
|
||||||
|| compressor.parent() instanceof AST_New
|
var parent = compressor.parent();
|
||||||
|| !value.contains_this();
|
if (parent.TYPE != "Call") return true;
|
||||||
|
if (parent.expression !== compressor.self()) return true;
|
||||||
|
return !value.contains_this();
|
||||||
}
|
}
|
||||||
|
|
||||||
OPT(AST_Sub, function(self, compressor) {
|
OPT(AST_Sub, function(self, compressor) {
|
||||||
|
|||||||
@@ -817,6 +817,29 @@ issue_2208_5: {
|
|||||||
expect_stdout: "42"
|
expect_stdout: "42"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2208_6: {
|
||||||
|
options = {
|
||||||
|
inline: true,
|
||||||
|
properties: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
a = 42;
|
||||||
|
console.log(("FAIL", {
|
||||||
|
p: function() {
|
||||||
|
return this.a;
|
||||||
|
}
|
||||||
|
}.p)());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
a = 42;
|
||||||
|
console.log(function() {
|
||||||
|
return this.a;
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "42"
|
||||||
|
}
|
||||||
|
|
||||||
issue_2256: {
|
issue_2256: {
|
||||||
options = {
|
options = {
|
||||||
side_effects: true,
|
side_effects: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user