aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 216aade9..ebe7e957 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -65,6 +65,7 @@ function Compressor(options, false_by_default) {
keep_fnames : false,
hoist_vars : false,
if_return : !false_by_default,
+ return_void_0 : !false_by_default,
join_vars : !false_by_default,
cascade : !false_by_default,
side_effects : !false_by_default,
@@ -2519,4 +2520,13 @@ merge(Compressor.prototype, {
OPT(AST_Object, literals_in_boolean_context);
OPT(AST_RegExp, literals_in_boolean_context);
+ OPT(AST_Return, function(self, compressor){
+ if (compressor.option("return_void_0")) {
+ if (self.value instanceof AST_Undefined) {
+ self.value = null;
+ }
+ }
+ return self;
+ });
+
})();