| OLD | NEW |
| 1 // Expectation for test: | 1 // Expectation for test: |
| 2 // // This test illustrates an opportunity to remove redundant code by | 2 // // This test illustrates an opportunity to remove redundant code by |
| 3 // // propagating inforamtion after inlining. | 3 // // propagating inforamtion after inlining. |
| 4 // // | 4 // // |
| 5 // // The code below inlines `foo` twice, but we don't propagate that we already | 5 // // The code below inlines `foo` twice, but we don't propagate that we already |
| 6 // // know from the first `foo` that `a` is an int, so the second check can be | 6 // // know from the first `foo` that `a` is an int, so the second check can be |
| 7 // // removed entirely. | 7 // // removed entirely. |
| 8 // | 8 // |
| 9 // import 'package:expect/expect.dart'; | 9 // import 'package:expect/expect.dart'; |
| 10 // | 10 // |
| 11 // main() { | 11 // main() { |
| 12 // var a = nextNumber(); | 12 // var a = nextNumber(); |
| 13 // action(foo(a)); | 13 // action(foo(a)); |
| 14 // action(foo(a)); | 14 // action(foo(a)); |
| 15 // } | 15 // } |
| 16 // | 16 // |
| 17 // foo(x) { | 17 // foo(x) { |
| 18 // if (x is! int) throw "error 1"; | 18 // if (x is! int) throw "error 1"; |
| 19 // return x + 5 % 100; | 19 // return x + 5 % 100; |
| 20 // } | 20 // } |
| 21 // | 21 // |
| 22 // @NoInline() @AssumeDynamic() | 22 // @NoInline() @AssumeDynamic() |
| 23 // nextNumber() => int.parse('33'); | 23 // nextNumber() => int.parse('33'); |
| 24 // | 24 // |
| 25 // @NoInline() | 25 // @NoInline() |
| 26 // action(v) => print(v); | 26 // action(v) => print(v); |
| 27 | 27 |
| 28 function() { | 28 function() { |
| 29 var a = V.nextNumber(), v0; | 29 var a = V.nextNumber(); |
| 30 if (!(typeof a === "number" && Math.floor(a) === a)) | 30 if (!(typeof a === "number" && Math.floor(a) === a)) |
| 31 throw H.wrapException("error 1"); | 31 throw H.wrapException("error 1"); |
| 32 v0 = a + 5; | 32 a += 5; |
| 33 V.action(v0); | 33 V.action(a); |
| 34 V.action(v0); | 34 V.action(a); |
| 35 } | 35 } |
| OLD | NEW |