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 // Regression test for issue 17483. | 7 // Regression test for issue 17483. |
8 | 8 |
9 confuse(x) { | 9 |
10 if (new DateTime.now().millisecondsSinceEpoch == 42) return confuse(x); | 10 @AssumeDynamic() @NoInline() |
11 return x; | 11 confuse(x) => x; |
12 } | |
13 | 12 |
14 foo(trace) { | 13 foo(trace) { |
15 trace.add("foo"); | 14 trace.add("foo"); |
16 return "foo"; | 15 return "foo"; |
17 } | 16 } |
18 bar(trace) { | 17 bar(trace) { |
19 trace.add("bar"); | 18 trace.add("bar"); |
20 return "bar"; | 19 return "bar"; |
21 } | 20 } |
22 | 21 |
23 main() { | 22 main() { |
24 var f = confuse(foo); | 23 var f = confuse(foo); |
25 var b = confuse(bar); | 24 var b = confuse(bar); |
26 | 25 |
27 var trace = []; | 26 var trace = []; |
28 // Dart2js must keep the order of t1 and t2. | 27 // Dart2js must keep the order of t1 and t2. |
29 var t1 = f(trace); | 28 var t1 = f(trace); |
30 var t2 = b(trace); | 29 var t2 = b(trace); |
31 var t3 = identical(t2, "foo"); | 30 var t3 = identical(t2, "foo"); |
32 var t4 = trace.add(t1); | 31 var t4 = trace.add(t1); |
33 trace.add(t3); | 32 trace.add(t3); |
34 trace.add(t3); | 33 trace.add(t3); |
35 Expect.listEquals(["foo", "bar", "foo", false, false], trace); | 34 Expect.listEquals(["foo", "bar", "foo", false, false], trace); |
36 } | 35 } |
OLD | NEW |