- `dead_code` (default: `true`) -- remove unreachable code
+- `default_values` (default: `true`) -- drop overshadowed default values
+
- `directives` (default: `true`) -- remove redundant or non-standard directives
- `drop_console` (default: `false`) -- Pass `true` to discard calls to
}
if (!(fn instanceof AST_Lambda)) return true;
if (def && recursive_ref(compressor, def)) return true;
- if (!all(fn.argnames, function(argname) {
- return !(argname instanceof AST_Destructured);
- })) return true;
if (fn.collapse_scanning) return false;
fn.collapse_scanning = true;
var replace = can_replace;
can_replace = false;
var after = stop_after;
var if_hit = stop_if_hit;
- if (fn instanceof AST_Arrow && fn.value) {
+ if (!all(fn.argnames, function(argname) {
+ if (argname instanceof AST_DefaultValue) {
+ argname.value.transform(scanner);
+ if (abort) return false;
+ argname = argname.name;
+ }
+ return !(argname instanceof AST_Destructured);
+ })) {
+ abort = true;
+ } else if (fn instanceof AST_Arrow && fn.value) {
fn.value.transform(scanner);
} else for (var i = 0; !abort && i < fn.body.length; i++) {
var stat = fn.body[i];
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4444: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = "PASS";
+ console.log(function(b) {
+ b = a;
+ (function(c = b.p) {})();
+ return a;
+ }());
+ }
+ expect: {
+ var a = "PASS";
+ console.log(function(b) {
+ b = a;
+ (function(c = b.p) {})();
+ return a;
+ }());
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}