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 ordinary Dart classes can both use the same | 8 // Test that native classes and ordinary Dart classes can both use the same |
8 // ordinary Dart classes as a mixin. | 9 // ordinary Dart classes as a mixin. |
9 | 10 |
10 class A native "A" { | 11 @Native("A") |
| 12 class A { |
11 final String aa; | 13 final String aa; |
12 foo() => "A-foo $aa"; | 14 foo() => "A-foo $aa"; |
13 baz() => "A-baz $aa"; | 15 baz() => "A-baz $aa"; |
14 } | 16 } |
15 | 17 |
16 class B extends A with M native "B" { | 18 @Native("B") |
| 19 class B extends A with M { |
17 bar() => 'B-bar -> ${baz()}'; | 20 bar() => 'B-bar -> ${baz()}'; |
18 get mm => 'B.mm($aa)'; | 21 get mm => 'B.mm($aa)'; |
19 } | 22 } |
20 | 23 |
21 class M { | 24 class M { |
22 foo() => "M-foo ${this.mm}"; | 25 foo() => "M-foo ${this.mm}"; |
23 bar() => "M-bar ${this.mm}"; | 26 bar() => "M-bar ${this.mm}"; |
24 get mm => 'M.mm'; | 27 get mm => 'M.mm'; |
25 } | 28 } |
26 | 29 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 Expect.equals("M-foo D.mm(cc)", d.foo()); | 99 Expect.equals("M-foo D.mm(cc)", d.foo()); |
97 Expect.equals("D-bar -> C-baz cc", d.bar()); | 100 Expect.equals("D-bar -> C-baz cc", d.bar()); |
98 Expect.equals("C-baz cc", d.baz()); | 101 Expect.equals("C-baz cc", d.baz()); |
99 Expect.isFalse(d is A); | 102 Expect.isFalse(d is A); |
100 Expect.isFalse(d is B); | 103 Expect.isFalse(d is B); |
101 Expect.isTrue(d is C); | 104 Expect.isTrue(d is C); |
102 Expect.isTrue(d is D); | 105 Expect.isTrue(d is D); |
103 Expect.isTrue(d is M); | 106 Expect.isTrue(d is M); |
104 | 107 |
105 } | 108 } |
OLD | NEW |