diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-10-22 11:49:58 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-10-22 11:58:06 +0300 |
commit | 30faaf13edca3a4db6867e8faf0f0b68c6ac11e0 (patch) | |
tree | 64f82f6c9979427ba17b99603197d5b327b12c04 /test/compress | |
parent | 41be8632d3ec2ac0bae566aab97f40d7d7146142 (diff) | |
download | tracifyjs-30faaf13edca3a4db6867e8faf0f0b68c6ac11e0.tar.gz tracifyjs-30faaf13edca3a4db6867e8faf0f0b68c6ac11e0.zip |
more sequence optimizations (lift some sequences above binary/unary expressions so that we can avoid parens)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/sequences.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/compress/sequences.js b/test/compress/sequences.js index 513bc84b..d48eced2 100644 --- a/test/compress/sequences.js +++ b/test/compress/sequences.js @@ -87,3 +87,43 @@ make_sequences_4: { with (x = 5, obj); } } + +lift_sequences_1: { + options = { sequences: true }; + input: { + foo = !(x(), y(), bar()); + } + expect: { + x(), y(), foo = !bar(); + } +} + +lift_sequences_2: { + options = { sequences: true, evaluate: true }; + input: { + q = 1 + (foo(), bar(), 5) + 7 * (5 / (3 - (a(), (QW=ER), c(), 2))) - (x(), y(), 5); + } + expect: { + foo(), bar(), a(), QW = ER, c(), x(), y(), q = 36 + } +} + +lift_sequences_3: { + options = { sequences: true, conditionals: true }; + input: { + x = (foo(), bar(), baz()) ? 10 : 20; + } + expect: { + foo(), bar(), x = baz() ? 10 : 20; + } +} + +lift_sequences_4: { + options = { side_effects: true }; + input: { + x = (foo, bar, baz); + } + expect: { + x = baz; + } +} |