[Pkg-javascript-commits] [uglifyjs] 323/491: fix `AST_VarDef.may_throw()` (#2580)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:49 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit ebfd5c5c7480f35af986949f692b01ff7526b97d
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Tue Dec 12 03:30:25 2017 +0800
fix `AST_VarDef.may_throw()` (#2580)
---
lib/compress.js | 1 +
test/compress/collapse_vars.js | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/lib/compress.js b/lib/compress.js
index ce61ce9..14e8361 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2399,6 +2399,7 @@ merge(Compressor.prototype, {
return this.expression.may_throw(compressor);
});
def(AST_VarDef, function(compressor){
+ if (!this.value) return false;
return this.value.may_throw(compressor);
});
})(function(node, func){
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 2136b2f..330667d 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -3785,3 +3785,23 @@ issue_2571_2: {
}
expect_stdout: "undefined"
}
+
+may_throw: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ function f() {
+ var a_2 = function() {
+ var a;
+ }();
+ }
+ }
+ expect: {
+ function f() {
+ var a_2 = function() {
+ var a;
+ }();
+ }
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list