2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -7,7 +7,7 @@ jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
node: [ '0.10', '0.12', '4', '6', '8', '10', '12', '14', '16', latest ]
|
||||
node: [ '0.10', '0.12', '4', '6', '8', '10', '12', '14', '16', '18' ]
|
||||
os: [ ubuntu-latest, windows-latest ]
|
||||
script: [ compress, mocha, release/benchmark, release/jetstream ]
|
||||
name: ${{ matrix.node }} ${{ matrix.os }} ${{ matrix.script }}
|
||||
|
||||
@@ -7498,6 +7498,7 @@ Compressor.prototype.compress = function(node) {
|
||||
});
|
||||
body.push(defun);
|
||||
if (value !== fn) [].push.apply(side_effects, value.expressions.slice(0, -1));
|
||||
sym.eliminated++;
|
||||
} else {
|
||||
if (drop_sym
|
||||
&& var_defs[sym.id] > 1
|
||||
@@ -14065,8 +14066,12 @@ Compressor.prototype.compress = function(node) {
|
||||
def.single_use = false;
|
||||
if (!in_loop) return;
|
||||
if (def.references.length == def.replaced) return;
|
||||
if (def.orig.length == def.eliminated) return;
|
||||
if (def.orig.length == 1 && fn.functions.has(name)) return;
|
||||
switch (def.orig.length - def.eliminated) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
if (fn.functions.has(name)) return;
|
||||
}
|
||||
if (!all(def.orig, function(sym) {
|
||||
if (sym instanceof AST_SymbolConst) return false;
|
||||
if (sym instanceof AST_SymbolFunarg) return !sym.unused && def.scope.resolve() !== fn;
|
||||
|
||||
@@ -8741,3 +8741,79 @@ issue_5692: {
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_5766_1: {
|
||||
options = {
|
||||
booleans: true,
|
||||
evaluate: true,
|
||||
functions: true,
|
||||
inline: true,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
log = function(a) {
|
||||
console.log(typeof a);
|
||||
};
|
||||
do {
|
||||
(function() {
|
||||
try {
|
||||
var f = function() {};
|
||||
log(f && f);
|
||||
} catch (e) {}
|
||||
})();
|
||||
} while (0);
|
||||
}
|
||||
expect: {
|
||||
log = function(a) {
|
||||
console.log(typeof a);
|
||||
};
|
||||
do {
|
||||
try {
|
||||
function f() {}
|
||||
log(f);
|
||||
} catch (e) {}
|
||||
} while (0);
|
||||
}
|
||||
expect_stdout: "function"
|
||||
}
|
||||
|
||||
issue_5766_2: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
functions: true,
|
||||
inline: true,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
log = function(a) {
|
||||
console.log(typeof a);
|
||||
};
|
||||
do {
|
||||
(function() {
|
||||
try {
|
||||
var f = function() {};
|
||||
log(f && f);
|
||||
} catch (e) {}
|
||||
})();
|
||||
} while (0);
|
||||
}
|
||||
expect: {
|
||||
log = function(a) {
|
||||
console.log(typeof a);
|
||||
};
|
||||
do {
|
||||
try {
|
||||
function f() {}
|
||||
log(f);
|
||||
} catch (e) {}
|
||||
} while (0);
|
||||
}
|
||||
expect_stdout: "function"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user