Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: F谩bio Santos <fabiosantosart@gmail.com>
  • Loading branch information
jridgewell and fabiosantoscode committed Sep 13, 2021
1 parent 2eea0e4 commit 841d0ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/compress/evaluate.js
Expand Up @@ -83,7 +83,7 @@ function def_eval(node, func) {
}

// Used to propagate a nullish short-circuit signal upwards through the chain.
const nullish = {};
const nullish = Symbol("This AST_Chain is nullish");

// If the node has been successfully reduced to a constant,
// then its value is returned; otherwise the element itself
Expand Down
4 changes: 2 additions & 2 deletions lib/compress/inference.js
Expand Up @@ -249,7 +249,7 @@ function is_nullish_shortcircuit(node, compressor) {
|| is_nullish_shortcircuit(node.expression, compressor)
);
}
if (node instanceof AST_Chain) return is_nullish_shortcircuit(node.expression);
if (node instanceof AST_Chain) return is_nullish_shortcircuit(node.expression, compressor);
return false;
}

Expand Down Expand Up @@ -440,7 +440,7 @@ export function is_nullish(node, compressor) {
return any(this.body, compressor);
});
def_may_throw(AST_Call, function(compressor) {
if (is_nullish(this.expression, compressor)) return false;
if (is_nullish(this, compressor)) return false;
if (any(this.args, compressor)) return true;
if (this.is_callee_pure(compressor)) return false;
if (this.expression.may_throw(compressor)) return true;
Expand Down

0 comments on commit 841d0ce

Please sign in to comment.