123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- make_sequences_1: {
- options = {
- sequences: true
- };
- input: {
- foo();
- bar();
- baz();
- }
- expect: {
- foo(),bar(),baz();
- }
- }
- make_sequences_2: {
- options = {
- sequences: true
- };
- input: {
- if (boo) {
- foo();
- bar();
- baz();
- } else {
- x();
- y();
- z();
- }
- }
- expect: {
- if (boo) foo(),bar(),baz();
- else x(),y(),z();
- }
- }
- make_sequences_3: {
- options = {
- sequences: true
- };
- input: {
- function f() {
- foo();
- bar();
- return baz();
- }
- function g() {
- foo();
- bar();
- throw new Error();
- }
- }
- expect: {
- function f() {
- return foo(), bar(), baz();
- }
- function g() {
- throw foo(), bar(), new Error();
- }
- }
- }
- make_sequences_4: {
- options = {
- sequences: true
- };
- input: {
- x = 5;
- if (y) z();
- x = 5;
- for (i = 0; i < 5; i++) console.log(i);
- x = 5;
- for (; i < 5; i++) console.log(i);
- x = 5;
- switch (y) {}
- x = 5;
- with (obj) {}
- }
- expect: {
- if (x = 5, y) z();
- for (x = 5, i = 0; i < 5; i++) console.log(i);
- for (x = 5; i < 5; i++) console.log(i);
- switch (x = 5, y) {}
- 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;
- }
- }
- for_sequences: {
- options = { sequences: true };
- input: {
- // 1
- foo();
- bar();
- for (; false;);
- // 2
- foo();
- bar();
- for (x = 5; false;);
- // 3
- x = (foo in bar);
- for (; false;);
- // 4
- x = (foo in bar);
- for (y = 5; false;);
- }
- expect: {
- // 1
- for (foo(), bar(); false;);
- // 2
- for (foo(), bar(), x = 5; false;);
- // 3
- x = (foo in bar);
- for (; false;);
- // 4
- x = (foo in bar);
- for (y = 5; false;);
- }
- }
|