[Pkg-javascript-commits] [uglifyjs] 53/190: `return undefined` optimization no longer uses `return_void_0` option
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Aug 7 23:17:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to annotated tag upstream/2.7.0
in repository uglifyjs.
commit bd0ae6569fd81f9f53d66b1c696e5394a0fa2bc2
Author: kzc <zaxxon2011 at gmail.com>
Date: Wed Oct 28 17:51:46 2015 -0400
`return undefined` optimization no longer uses `return_void_0` option
---
lib/compress.js | 7 +-
test/compress/return_undefined.js | 143 +-------------------------------------
2 files changed, 3 insertions(+), 147 deletions(-)
diff --git a/lib/compress.js b/lib/compress.js
index ebe7e95..50353fe 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -65,7 +65,6 @@ 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,
@@ -2521,10 +2520,8 @@ merge(Compressor.prototype, {
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;
- }
+ if (self.value instanceof AST_Undefined) {
+ self.value = null;
}
return self;
});
diff --git a/test/compress/return_undefined.js b/test/compress/return_undefined.js
index b1195a7..9662aa5 100644
--- a/test/compress/return_undefined.js
+++ b/test/compress/return_undefined.js
@@ -1,6 +1,5 @@
-return_void_0_true: {
+return_undefined: {
options = {
- return_void_0 : true,
sequences : false,
if_return : true,
evaluate : true,
@@ -123,143 +122,3 @@ return_void_0_true: {
}
}
}
-
-return_void_0_false: {
- options = {
- return_void_0 : false,
- sequences : false,
- if_return : true,
- evaluate : true,
- dead_code : true,
- conditionals : true,
- comparisons : true,
- booleans : true,
- unused : true,
- side_effects : true,
- properties : true,
- drop_debugger : true,
- loops : true,
- hoist_funs : true,
- keep_fargs : true,
- keep_fnames : false,
- hoist_vars : true,
- join_vars : true,
- cascade : true,
- negate_iife : true
- };
- input: {
- function f0() {
- }
- function f1() {
- return undefined;
- }
- function f2() {
- return void 0;
- }
- function f3() {
- return void 123;
- }
- function f4() {
- return;
- }
- function f5(a, b) {
- console.log(a, b);
- baz(a);
- return;
- }
- function f6(a, b) {
- console.log(a, b);
- if (a) {
- foo(b);
- baz(a);
- return a + b;
- }
- return undefined;
- }
- function f7(a, b) {
- console.log(a, b);
- if (a) {
- foo(b);
- baz(a);
- return void 0;
- }
- return a + b;
- }
- function f8(a, b) {
- foo(a);
- bar(b);
- return void 0;
- }
- function f9(a, b) {
- foo(a);
- bar(b);
- return undefined;
- }
- function f10() {
- return false;
- }
- function f11() {
- return null;
- }
- function f12() {
- return 0;
- }
- }
- expect: {
- function f0() {
- }
- function f1() {
- return void 0;
- }
- function f2() {
- return void 0;
- }
- function f3() {
- return void 0;
- }
- function f4() {
- }
- function f5(a, b) {
- console.log(a, b);
- baz(a);
- }
- function f6(a, b) {
- console.log(a, b);
- if (a) {
- foo(b);
- baz(a);
- return a + b;
- }
- return void 0;
- }
- function f7(a, b) {
- console.log(a, b);
- if (a) {
- foo(b);
- baz(a);
- return void 0;
- }
- return a + b;
- }
- function f8(a, b) {
- foo(a);
- bar(b);
- return void 0;
- }
- function f9(a, b) {
- foo(a);
- bar(b);
- return void 0;
- }
- function f10() {
- return !1;
- }
- function f11() {
- return null;
- }
- function f12() {
- return 0;
- }
- }
-}
-
--
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