| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord; | 6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; |
| 7 import 'dart:_interceptors' show findInterceptorForType; | 7 import 'dart:_interceptors' show findInterceptorForType; |
| 8 | 8 |
| 9 // Test that subclasses of native classes can be defined by setting the dispatch | 9 // Test that subclasses of native classes can be defined by setting the dispatch |
| 10 // record. | 10 // record. |
| 11 | 11 |
| 12 class A native "A" { | 12 @Native("A") |
| 13 class A { |
| 13 foo(x) => '$x,${this.oof()}'; | 14 foo(x) => '$x,${this.oof()}'; |
| 14 oof() => 'A'; | 15 oof() => 'A'; |
| 15 } | 16 } |
| 16 | 17 |
| 17 class B extends A { | 18 class B extends A { |
| 18 oof() => 'B'; | 19 oof() => 'B'; |
| 19 } | 20 } |
| 20 | 21 |
| 21 B makeB1() native; | 22 B makeB1() native; |
| 22 B makeB2() native; | 23 B makeB2() native; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 | 50 |
| 50 B b1 = makeB1(); | 51 B b1 = makeB1(); |
| 51 Expect.equals('1,B', b1.foo(1)); | 52 Expect.equals('1,B', b1.foo(1)); |
| 52 | 53 |
| 53 B b2 = makeB2(); | 54 B b2 = makeB2(); |
| 54 Expect.equals('2,B', b2.foo(2)); | 55 Expect.equals('2,B', b2.foo(2)); |
| 55 | 56 |
| 56 B b3 = makeC(); | 57 B b3 = makeC(); |
| 57 Expect.equals('3,B', b3.foo(3)); | 58 Expect.equals('3,B', b3.foo(3)); |
| 58 } | 59 } |
| OLD | NEW |