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