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 "native_testing.dart"; | 5 import "native_testing.dart"; |
6 | 6 |
7 // Test that native classes and ordinary Dart classes can both use the same | 7 // Test that native classes and ordinary Dart classes can both use the same |
8 // ordinary Dart classes as a mixin. | 8 // ordinary Dart classes as a mixin. |
9 | 9 |
10 @Native("A") | 10 @Native("A") |
(...skipping 19 matching lines...) Expand all Loading... |
30 final String cc = 'cc'; | 30 final String cc = 'cc'; |
31 foo() => 'C-foo $cc'; | 31 foo() => 'C-foo $cc'; |
32 baz() => 'C-baz $cc'; | 32 baz() => 'C-baz $cc'; |
33 } | 33 } |
34 | 34 |
35 class D extends C with M { | 35 class D extends C with M { |
36 bar() => 'D-bar -> ${baz()}'; | 36 bar() => 'D-bar -> ${baz()}'; |
37 get mm => 'D.mm($cc)'; | 37 get mm => 'D.mm($cc)'; |
38 } | 38 } |
39 | 39 |
40 makeA() native ; | 40 makeA() native; |
41 makeB() native ; | 41 makeB() native; |
42 | 42 |
43 void setup() native """ | 43 void setup() native """ |
44 function A() {this.aa = 'aa'} | 44 function A() {this.aa = 'aa'} |
45 function B() {this.aa = 'bb'} | 45 function B() {this.aa = 'bb'} |
46 makeA = function(){return new A;}; | 46 makeA = function(){return new A;}; |
47 makeB = function(){return new B;}; | 47 makeB = function(){return new B;}; |
48 | 48 |
49 self.nativeConstructor(A); | 49 self.nativeConstructor(A); |
50 self.nativeConstructor(B); | 50 self.nativeConstructor(B); |
51 """; | 51 """; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 Expect.equals("M-foo D.mm(cc)", d.foo()); | 101 Expect.equals("M-foo D.mm(cc)", d.foo()); |
102 Expect.equals("D-bar -> C-baz cc", d.bar()); | 102 Expect.equals("D-bar -> C-baz cc", d.bar()); |
103 Expect.equals("C-baz cc", d.baz()); | 103 Expect.equals("C-baz cc", d.baz()); |
104 Expect.isFalse(d is A); | 104 Expect.isFalse(d is A); |
105 Expect.isFalse(d is B); | 105 Expect.isFalse(d is B); |
106 Expect.isTrue(d is C); | 106 Expect.isTrue(d is C); |
107 Expect.isTrue(d is D); | 107 Expect.isTrue(d is D); |
108 Expect.isTrue(d is M); | 108 Expect.isTrue(d is M); |
109 } | 109 } |
OLD | NEW |