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 and plain classes can access methods defined only by | 8 // Test that native classes and plain classes can access methods defined only by |
8 // the same mixin. | 9 // the same mixin. |
9 | 10 |
10 | 11 |
11 class D extends Object with M1, M2, M3 { | 12 class D extends Object with M1, M2, M3 { |
12 } | 13 } |
13 | 14 |
14 class E extends D { | 15 class E extends D { |
15 foo() => 'E.foo'; | 16 foo() => 'E.foo'; |
16 } | 17 } |
17 | 18 |
18 class M1 { } | 19 class M1 { } |
19 | 20 |
20 class M2 { | 21 class M2 { |
21 foo() => 'M2.foo'; | 22 foo() => 'M2.foo'; |
22 } | 23 } |
23 | 24 |
24 class M3 { } | 25 class M3 { } |
25 | 26 |
26 class A native "A" { | 27 @Native("A") |
| 28 class A { |
27 foo() => 'A.foo'; | 29 foo() => 'A.foo'; |
28 } | 30 } |
29 | 31 |
30 class B extends A with M1, M2, M3 native "B" {} | 32 @Native("B") |
| 33 class B extends A with M1, M2, M3 {} |
31 | 34 |
32 class C extends B native "C" { | 35 @Native("C") |
| 36 class C extends B { |
33 foo() => 'C.foo'; | 37 foo() => 'C.foo'; |
34 } | 38 } |
35 | 39 |
36 makeA() native; | 40 makeA() native; |
37 makeB() native; | 41 makeB() native; |
38 makeC() native; | 42 makeC() native; |
39 | 43 |
40 void setup() native """ | 44 void setup() native """ |
41 function A() {} | 45 function A() {} |
42 function B() {} | 46 function B() {} |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 var e = x[4]; | 80 var e = x[4]; |
77 | 81 |
78 var f = callFoo; | 82 var f = callFoo; |
79 | 83 |
80 Expect.equals('A.foo', f(a)); | 84 Expect.equals('A.foo', f(a)); |
81 Expect.equals('M2.foo', f(b)); | 85 Expect.equals('M2.foo', f(b)); |
82 Expect.equals('C.foo', f(c)); | 86 Expect.equals('C.foo', f(c)); |
83 Expect.equals('M2.foo', f(d)); | 87 Expect.equals('M2.foo', f(d)); |
84 Expect.equals('E.foo', f(e)); | 88 Expect.equals('E.foo', f(e)); |
85 } | 89 } |
OLD | NEW |