OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Regression test for --fast-startup. The compiler used to emit inherit calls | 5 /// Regression test for --fast-startup. The compiler used to emit inherit calls |
6 /// on each fragment even for classes that were already loaded on a different | 6 /// on each fragment even for classes that were already loaded on a different |
7 /// fragment. As a result, the inheritance chain was overwritten in non-chrome | 7 /// fragment. As a result, the inheritance chain was overwritten in non-chrome |
8 /// browsers (by using __proto__, we evaded this issue in Chrome). | 8 /// browsers (by using __proto__, we evaded this issue in Chrome). |
9 library deferred_inheritance_test; | 9 library deferred_inheritance_test; |
10 | 10 |
11 import 'deferred_inheritance_lib2.dart'; | 11 import 'deferred_inheritance_lib2.dart'; |
12 import 'deferred_inheritance_lib1.dart' deferred as d; | 12 import 'deferred_inheritance_lib1.dart' deferred as d; |
13 | 13 |
14 import 'package:expect/expect.dart'; | 14 import 'package:expect/expect.dart'; |
15 | 15 |
16 class B extends A {} | 16 class B extends A {} |
17 | 17 |
18 /// If the check `y is A` is generated as `y.$isA` then the issue is not | 18 /// If the check `y is A` is generated as `y.$isA` then the issue is not |
19 /// exposed. We use `AssumeDynamic` to ensure that we generate as `y instanceof | 19 /// exposed. We use `AssumeDynamic` to ensure that we generate as `y instanceof |
20 /// A` in JS. | 20 /// A` in JS. |
21 @NoInline() @AssumeDynamic() | 21 @NoInline() |
| 22 @AssumeDynamic() |
22 check(y) => Expect.isTrue(y is A); | 23 check(y) => Expect.isTrue(y is A); |
23 | 24 |
24 main() { | 25 main() { |
25 check(new B()); | 26 check(new B()); |
26 d.loadLibrary().then((_) { | 27 d.loadLibrary().then((_) { |
27 check(new d.C()); | 28 check(new d.C()); |
28 check(new B()); // This fails if we overwrite the inheritance chain. | 29 check(new B()); // This fails if we overwrite the inheritance chain. |
29 }); | 30 }); |
30 } | 31 } |
OLD | NEW |