OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Additional Dart code may be 'placed on' hidden native classes. With | 8 // Additional Dart code may be 'placed on' hidden native classes. With |
8 // inheritance, the superclass method must not be reached by a call on the | 9 // inheritance, the superclass method must not be reached by a call on the |
9 // subclass. | 10 // subclass. |
10 | 11 |
11 class A native "A" { | 12 @Native("A") |
| 13 class A { |
12 var _field; | 14 var _field; |
13 | 15 |
14 int get X => _field; | 16 int get X => _field; |
15 void set X(int x) { _field = x; } | 17 void set X(int x) { _field = x; } |
16 | 18 |
17 int method(int z) => _field + z; | 19 int method(int z) => _field + z; |
18 } | 20 } |
19 | 21 |
20 class B extends A native "B" { | 22 @Native("B") |
| 23 class B extends A { |
21 var _field2; | 24 var _field2; |
22 | 25 |
23 int get X => _field2; | 26 int get X => _field2; |
24 void set X(int x) { _field2 = x; } | 27 void set X(int x) { _field2 = x; } |
25 | 28 |
26 int method(int z) => _field2 + z; | 29 int method(int z) => _field2 + z; |
27 } | 30 } |
28 | 31 |
29 A makeA() native { return new A(); } | 32 A makeA() native { return new A(); } |
30 B makeB() native { return new B(); } | 33 B makeB() native { return new B(); } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 141 } |
139 | 142 |
140 main() { | 143 main() { |
141 testBasicA_dynamic(); | 144 testBasicA_dynamic(); |
142 testBasicA_typed(); | 145 testBasicA_typed(); |
143 testBasicB_dynamic(); | 146 testBasicB_dynamic(); |
144 testBasicB_typed(); | 147 testBasicB_typed(); |
145 testAB_dynamic(); | 148 testAB_dynamic(); |
146 testAB_typed(); | 149 testAB_typed(); |
147 } | 150 } |
OLD | NEW |