OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 'native_testing.dart'; | 5 import 'native_testing.dart'; |
6 | 6 |
7 class A { | 7 class A { |
8 int a; | 8 int a; |
9 } | 9 } |
10 | 10 |
11 class B extends A { | 11 class B extends A { |
12 int b; | 12 int b; |
13 } | 13 } |
14 | 14 |
15 @NoInline() | 15 @NoInline() |
16 escape(v) { g = v; } | 16 escape(v) { |
| 17 g = v; |
| 18 } |
| 19 |
17 var g; | 20 var g; |
18 | 21 |
19 main() { | 22 main() { |
20 g = new A(); | 23 g = new A(); |
21 var a = JS('returns:A;new:true', '(1,#)', new B()); | 24 var a = JS('returns:A;new:true', '(1,#)', new B()); |
22 | 25 |
23 a.a = 1; | 26 a.a = 1; |
24 if (a is B) { | 27 if (a is B) { |
25 escape(a); // Here we need to escape 'a' not the refinement of a to B. | 28 escape(a); // Here we need to escape 'a' not the refinement of a to B. |
26 g.a = 2; | 29 g.a = 2; |
27 Expect.equals(2, a.a); | 30 Expect.equals(2, a.a); |
28 } | 31 } |
29 } | 32 } |
OLD | NEW |