@@ -3683,10 +3683,13 @@ merge(Compressor.prototype, {
|
|||||||
def(AST_Node, is_strict);
|
def(AST_Node, is_strict);
|
||||||
def(AST_Array, return_false);
|
def(AST_Array, return_false);
|
||||||
def(AST_Assign, function(compressor) {
|
def(AST_Assign, function(compressor) {
|
||||||
if (this.operator != "=") return false;
|
var op = this.operator;
|
||||||
var rhs = this.right;
|
|
||||||
if (!rhs._dot_throw(compressor)) return false;
|
|
||||||
var sym = this.left;
|
var sym = this.left;
|
||||||
|
var rhs = this.right;
|
||||||
|
if (op != "=") {
|
||||||
|
return lazy_op[op.slice(0, -1)] && (sym._dot_throw(compressor) || rhs._dot_throw(compressor));
|
||||||
|
}
|
||||||
|
if (!rhs._dot_throw(compressor)) return false;
|
||||||
if (!(sym instanceof AST_SymbolRef)) return true;
|
if (!(sym instanceof AST_SymbolRef)) return true;
|
||||||
if (rhs instanceof AST_Binary && rhs.operator == "||" && sym.name == rhs.left.name) {
|
if (rhs instanceof AST_Binary && rhs.operator == "||" && sym.name == rhs.left.name) {
|
||||||
return rhs.right._dot_throw(compressor);
|
return rhs.right._dot_throw(compressor);
|
||||||
|
|||||||
@@ -672,3 +672,32 @@ issue_4827_3: {
|
|||||||
expect_stdout: "undefined"
|
expect_stdout: "undefined"
|
||||||
node_version: ">=15"
|
node_version: ">=15"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4876: {
|
||||||
|
options = {
|
||||||
|
pure_getters: "strict",
|
||||||
|
reduce_vars: true,
|
||||||
|
side_effects: true,
|
||||||
|
toplevel: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
try {
|
||||||
|
var a = null;
|
||||||
|
var b = a &&= 42;
|
||||||
|
b.p;
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try {
|
||||||
|
var a = null;
|
||||||
|
var b = a &&= 42;
|
||||||
|
b.p;
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=15"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user