fix crash in may_throw() (#2932)

fixes #2931
This commit is contained in:
Alex Lam S.L
2018-02-18 21:51:27 +08:00
committed by GitHub
parent 2351a672ea
commit 4b5993ff15
2 changed files with 24 additions and 1 deletions

View File

@@ -2864,7 +2864,7 @@ merge(Compressor.prototype, {
return this.value.may_throw(compressor);
});
def(AST_Return, function(compressor){
return this.value.may_throw(compressor);
return this.value && this.value.may_throw(compressor);
});
def(AST_Sequence, function(compressor){
return any(this.expressions, compressor);

View File

@@ -4642,3 +4642,26 @@ issue_805: {
}
}
}
issue_2931: {
options = {
collapse_vars: true,
unused: true,
}
input: {
console.log(function() {
var a = function() {
return;
}();
return a;
}());
}
expect: {
console.log(function() {
return function() {
return;
}();
}());
}
expect_stdout: "undefined"
}