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 // Test that native classes can use ordinary Dart classes with fields | 8 // Test that native classes can use ordinary Dart classes with fields |
8 // as mixins. | 9 // as mixins. |
9 | 10 |
10 class A native "A" { | 11 @Native("A") |
| 12 class A { |
11 var foo; | 13 var foo; |
12 } | 14 } |
13 | 15 |
14 class B extends A with M1, M2 native "B" { | 16 @Native("B") |
| 17 class B extends A with M1, M2 { |
15 var bar; | 18 var bar; |
16 } | 19 } |
17 | 20 |
18 class M1 { | 21 class M1 { |
19 var baz; // This field is not a native field, even when mixed in. | 22 var baz; // This field is not a native field, even when mixed in. |
20 } | 23 } |
21 | 24 |
22 class M2 { | 25 class M2 { |
23 var bar; | 26 var bar; |
24 var buz; | 27 var buz; |
(...skipping 29 matching lines...) Expand all Loading... |
54 Expect.throws(() => m1.bar, (e) => e is NoSuchMethodError); | 57 Expect.throws(() => m1.bar, (e) => e is NoSuchMethodError); |
55 Expect.isNull(m1.baz); | 58 Expect.isNull(m1.baz); |
56 Expect.throws(() => m1.buz, (e) => e is NoSuchMethodError); | 59 Expect.throws(() => m1.buz, (e) => e is NoSuchMethodError); |
57 | 60 |
58 M2 m2 = new M2(); | 61 M2 m2 = new M2(); |
59 Expect.throws(() => m2.foo, (e) => e is NoSuchMethodError); | 62 Expect.throws(() => m2.foo, (e) => e is NoSuchMethodError); |
60 Expect.isNull(m2.bar); | 63 Expect.isNull(m2.bar); |
61 Expect.throws(() => m2.baz, (e) => e is NoSuchMethodError); | 64 Expect.throws(() => m2.baz, (e) => e is NoSuchMethodError); |
62 Expect.isNull(m2.buz); | 65 Expect.isNull(m2.buz); |
63 } | 66 } |
OLD | NEW |