From 992b6b9fcce47ca67ecb14675f10b172ce7a99b5 Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Wed, 11 Feb 2015 21:05:49 +0100 Subject: Fix invalid removal of left side in && and || compression See #637. This does not produce the optimal result, but it does prevent the removal of non-side-effect-free code. --- test/compress/issue-637.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/compress/issue-637.js (limited to 'test/compress') diff --git a/test/compress/issue-637.js b/test/compress/issue-637.js new file mode 100644 index 00000000..45fd2481 --- /dev/null +++ b/test/compress/issue-637.js @@ -0,0 +1,22 @@ +wrongly_optimized: { + options = { + conditionals: true, + booleans: true, + evaluate: true + }; + input: { + function func() { + foo(); + } + if (func() || true) { + bar(); + } + } + expect: { + function func() { + foo(); + } + // TODO: optimize to `func(), bar()` + (func(), 0) || bar(); + } +} -- cgit v1.2.3