fix crash in may_throw()

fixes #2931
This commit is contained in:
alexlamsl 2018-02-18 20:43:08 +08:00
parent 2351a672ea
commit 7b2fbda330
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"
}