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 "dart:_js_helper"; |
5 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
6 | 7 |
7 // Native classes can have subclasses that are not declared to the program. The | 8 // Native classes can have subclasses that are not declared to the program. The |
8 // subclasses are indistinguishable from the base class. This means that | 9 // subclasses are indistinguishable from the base class. This means that |
9 // abstract native classes can appear to have instances. | 10 // abstract native classes can appear to have instances. |
10 | 11 |
11 abstract class A native "A" { | 12 @Native("A") |
| 13 abstract class A { |
12 } | 14 } |
13 | 15 |
14 abstract class B native "B" { | 16 @Native("B") |
| 17 abstract class B { |
15 foo() native; | 18 foo() native; |
16 } | 19 } |
17 | 20 |
18 class C {} | 21 class C {} |
19 | 22 |
20 makeA() native; | 23 makeA() native; |
21 makeB() native; | 24 makeB() native; |
22 | 25 |
23 void setup() native """ | 26 void setup() native """ |
24 // This code is all inside 'setup' and so not accesible from the global scope. | 27 // This code is all inside 'setup' and so not accesible from the global scope. |
(...skipping 21 matching lines...) Expand all Loading... |
46 Expect.isFalse(a is B); | 49 Expect.isFalse(a is B); |
47 Expect.isTrue(b is B); | 50 Expect.isTrue(b is B); |
48 Expect.isFalse(c is B); | 51 Expect.isFalse(c is B); |
49 | 52 |
50 Expect.isFalse(a is C); | 53 Expect.isFalse(a is C); |
51 Expect.isFalse(b is C); | 54 Expect.isFalse(b is C); |
52 Expect.isTrue(c is C); | 55 Expect.isTrue(c is C); |
53 | 56 |
54 Expect.equals('B.foo', b.foo()); | 57 Expect.equals('B.foo', b.foo()); |
55 } | 58 } |
OLD | NEW |