123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- labels_1: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- out: {
- if (foo) break out;
- console.log("bar");
- }
- };
- expect: {
- foo || console.log("bar");
- }
- }
- labels_2: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- out: {
- if (foo) print("stuff");
- else break out;
- console.log("here");
- }
- };
- expect: {
- if (foo) {
- print("stuff");
- console.log("here");
- }
- }
- }
- labels_3: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- for (var i = 0; i < 5; ++i) {
- if (i < 3) continue;
- console.log(i);
- }
- };
- expect: {
- for (var i = 0; i < 5; ++i)
- i < 3 || console.log(i);
- }
- }
- labels_4: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- out: for (var i = 0; i < 5; ++i) {
- if (i < 3) continue out;
- console.log(i);
- }
- };
- expect: {
- for (var i = 0; i < 5; ++i)
- i < 3 || console.log(i);
- }
- }
- labels_5: {
- options = { if_return: true, conditionals: true, dead_code: true };
- // should keep the break-s in the following
- input: {
- while (foo) {
- if (bar) break;
- console.log("foo");
- }
- out: while (foo) {
- if (bar) break out;
- console.log("foo");
- }
- };
- expect: {
- while (foo) {
- if (bar) break;
- console.log("foo");
- }
- out: while (foo) {
- if (bar) break out;
- console.log("foo");
- }
- }
- }
- labels_6: {
- input: {
- out: break out;
- };
- expect: {}
- }
- labels_7: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- while (foo) {
- x();
- y();
- continue;
- }
- };
- expect: {
- while (foo) {
- x();
- y();
- }
- }
- }
- labels_8: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- while (foo) {
- x();
- y();
- break;
- }
- };
- expect: {
- while (foo) {
- x();
- y();
- break;
- }
- }
- }
- labels_9: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- out: while (foo) {
- x();
- y();
- continue out;
- z();
- k();
- }
- };
- expect: {
- while (foo) {
- x();
- y();
- }
- }
- }
- labels_10: {
- options = { if_return: true, conditionals: true, dead_code: true };
- input: {
- out: while (foo) {
- x();
- y();
- break out;
- z();
- k();
- }
- };
- expect: {
- out: while (foo) {
- x();
- y();
- break out;
- }
- }
- }
|