| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 @AssumeDynamic() |
| 8 @NoInline() |
| 9 confuse(x) => x; |
| 10 |
| 7 class A { | 11 class A { |
| 8 bar([var optional = 1]) => 498 + optional; | 12 bar([var optional = 1]) => 498 + optional; |
| 9 bar2({ namedOptional: 2 }) => 40 + namedOptional; | 13 bar2({ namedOptional: 2 }) => 40 + namedOptional; |
| 10 bar3(x, [var optional = 3]) => x + 498 + optional; | 14 bar3(x, [var optional = 3]) => x + 498 + optional; |
| 11 bar4(x, { namedOptional: 4 }) => 422 + x + namedOptional; | 15 bar4(x, { namedOptional: 4 }) => 422 + x + namedOptional; |
| 12 | 16 |
| 13 // Gee is the same as bar, but we make sure that gee is used. Potentially | 17 // Gee is the same as bar, but we make sure that gee is used. Potentially |
| 14 // this yields different code if the redirecting stub exists. | 18 // this yields different code if the redirecting stub exists. |
| 15 gee([var optional = 1]) => 498 + optional; | 19 gee([var optional = 1]) => 498 + optional; |
| 16 gee2({ namedOptional: 2 }) => 40 + namedOptional; | 20 gee2({ namedOptional: 2 }) => 40 + namedOptional; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 trim({ namedOptional: 22 }) => -1; | 90 trim({ namedOptional: 22 }) => -1; |
| 87 sublist(x, [optional = 44]) => -1; | 91 sublist(x, [optional = 44]) => -1; |
| 88 splitMapJoin(x, { onMatch: 55, onNonMatch: 66}) => -1; | 92 splitMapJoin(x, { onMatch: 55, onNonMatch: 66}) => -1; |
| 89 | 93 |
| 90 shuffle([var optional = 121]) => -1; | 94 shuffle([var optional = 121]) => -1; |
| 91 toList({ growable: 2233 }) => -1; | 95 toList({ growable: 2233 }) => -1; |
| 92 lastIndexOf(x, [optional = 424]) => -1; | 96 lastIndexOf(x, [optional = 424]) => -1; |
| 93 lastWhere(x, { orElse: 555 }) => -1; | 97 lastWhere(x, { orElse: 555 }) => -1; |
| 94 } | 98 } |
| 95 | 99 |
| 96 confuse(x) { | |
| 97 if (new DateTime.now().millisecondsSinceEpoch == 42) return confuse(x - 1); | |
| 98 return x; | |
| 99 } | |
| 100 | |
| 101 main() { | 100 main() { |
| 102 var list = [new A(), new B(), [], "foo" ]; | 101 var list = [new A(), new B(), [], "foo" ]; |
| 103 var a = list[confuse(0)]; | 102 var a = list[confuse(0)]; |
| 104 var b = list[confuse(1)]; | 103 var b = list[confuse(1)]; |
| 105 var ignored = list[confuse(2)]; | 104 var ignored = list[confuse(2)]; |
| 106 var ignored2 = list[confuse(3)]; | 105 var ignored2 = list[confuse(3)]; |
| 107 | 106 |
| 108 var t = b.gee() + b.gee2() + b.gee3(9) + b.gee4(19); | 107 var t = b.gee() + b.gee2() + b.gee3(9) + b.gee4(19); |
| 109 Expect.equals(-4, t); /// 01: continued | 108 Expect.equals(-4, t); /// 01: continued |
| 110 t = b.shuffle() + b.toList() + b.lastIndexOf(1) + b.lastWhere(2); | 109 t = b.shuffle() + b.toList() + b.lastIndexOf(1) + b.lastWhere(2); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 139 | 138 |
| 140 Expect.equals(12463, b.fooIntercept21()); | 139 Expect.equals(12463, b.fooIntercept21()); |
| 141 Expect.equals(12344, b.fooIntercept22()); | 140 Expect.equals(12344, b.fooIntercept22()); |
| 142 Expect.equals(15364, b.fooIntercept23()); | 141 Expect.equals(15364, b.fooIntercept23()); |
| 143 Expect.equals(13208, b.fooIntercept24()); | 142 Expect.equals(13208, b.fooIntercept24()); |
| 144 Expect.equals(14742, b.fooIntercept25()); | 143 Expect.equals(14742, b.fooIntercept25()); |
| 145 Expect.equals(14291, b.fooIntercept26()); | 144 Expect.equals(14291, b.fooIntercept26()); |
| 146 Expect.equals(1768, b.fooIntercept27()); | 145 Expect.equals(1768, b.fooIntercept27()); |
| 147 Expect.equals(1771, b.fooIntercept28()); | 146 Expect.equals(1771, b.fooIntercept28()); |
| 148 } | 147 } |
| OLD | NEW |