@@ -2466,6 +2466,13 @@ Compressor.prototype.compress = function(node) {
|
||||
abort = false;
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_Class) {
|
||||
if (!in_try) return false;
|
||||
var base = node.extends;
|
||||
if (!base) return false;
|
||||
if (base instanceof AST_SymbolRef) base = base.fixed_value();
|
||||
return !safe_for_extends(base);
|
||||
}
|
||||
if (node instanceof AST_Exit) {
|
||||
if (in_try) {
|
||||
if (in_try.bfinally) return true;
|
||||
|
||||
@@ -2852,3 +2852,33 @@ issue_5436: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
issue_5481: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
"use strict";
|
||||
var a = "FAIL 1", log = console.log;
|
||||
try {
|
||||
a = "PASS";
|
||||
(class extends 42 {});
|
||||
log("FAIL 2", a);
|
||||
} catch (e) {
|
||||
log(a);
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
var a = "FAIL 1", log = console.log;
|
||||
try {
|
||||
a = "PASS";
|
||||
(class extends 42 {});
|
||||
log("FAIL 2", a);
|
||||
} catch (e) {
|
||||
log(a);
|
||||
}
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
@@ -2398,7 +2398,7 @@ function patch_try_catch(orig, toplevel) {
|
||||
"throw " + match[1] + ";",
|
||||
].join("\n");
|
||||
}
|
||||
var new_code = code.slice(0, index) + insert + code.slice(index) + tail_throw;
|
||||
var new_code = code.slice(0, index) + insert + code.slice(index) + tail_throw + "var UFUZZ_ERROR;";
|
||||
var result = run_code(new_code, toplevel);
|
||||
if (!sandbox.is_error(result)) {
|
||||
if (!stack.filled && match[1]) stack.push({
|
||||
|
||||
Reference in New Issue
Block a user