| OLD | NEW |
| (Empty) |
| 1 // Expectation for test: | |
| 2 // // This test illustrates an opportunity to remove redundant code by | |
| 3 // // propagating inforamtion after inlining. | |
| 4 // // | |
| 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 | |
| 7 // // removed entirely. | |
| 8 // | |
| 9 // import 'package:expect/expect.dart'; | |
| 10 // | |
| 11 // main() { | |
| 12 // var a = nextNumber(); | |
| 13 // action(foo(a)); | |
| 14 // action(foo(a)); | |
| 15 // } | |
| 16 // | |
| 17 // foo(x) { | |
| 18 // if (x is! int) throw "error 1"; | |
| 19 // return x + 5 % 100; | |
| 20 // } | |
| 21 // | |
| 22 // @NoInline() @AssumeDynamic() | |
| 23 // nextNumber() => int.parse('33'); | |
| 24 // | |
| 25 // @NoInline() | |
| 26 // action(v) => print(v); | |
| 27 | |
| 28 function() { | |
| 29 var a = V.nextNumber(); | |
| 30 if (typeof a !== "number" || Math.floor(a) !== a) | |
| 31 throw H.wrapException("error 1"); | |
| 32 a += 5; | |
| 33 V.action(a); | |
| 34 V.action(a); | |
| 35 } | |
| OLD | NEW |