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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord; | 6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; |
7 import 'dart:_interceptors' show Interceptor, findInterceptorForType; | 7 import 'dart:_interceptors' show Interceptor, findInterceptorForType; |
8 | 8 |
9 // Test calling convention of methods introduced on subclasses of native | 9 // Test calling convention of methods introduced on subclasses of native |
10 // class of mixin. | 10 // class of mixin. |
11 | 11 |
12 doFoo(r, x) => '$x,${r.oof()},${r.miz()}'; | 12 doFoo(r, x) => '$x,${r.oof()},${r.miz()}'; |
13 | 13 |
14 class M { | 14 class M { |
15 miz() => 'M'; | 15 miz() => 'M'; |
16 } | 16 } |
17 | 17 |
18 class N native "N" { | 18 @Native("N") |
| 19 class N { |
19 foo(x) => (doFoo)(this, x); | 20 foo(x) => (doFoo)(this, x); |
20 } | 21 } |
21 | 22 |
22 class A extends N {} | 23 class A extends N {} |
23 | 24 |
24 class B extends A with M { | 25 class B extends A with M { |
25 // [oof] is introduced only on this subclass of a native class. It should | 26 // [oof] is introduced only on this subclass of a native class. It should |
26 // have interceptor calling convention. | 27 // have interceptor calling convention. |
27 oof() => 'B'; | 28 oof() => 'B'; |
28 // [miz] is introduced only on the mixin-application A+M. | 29 // [miz] is introduced only on the mixin-application A+M. |
(...skipping 12 matching lines...) Expand all Loading... |
41 """; | 42 """; |
42 | 43 |
43 main() { | 44 main() { |
44 setup(); | 45 setup(); |
45 | 46 |
46 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); | 47 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); |
47 | 48 |
48 B b = makeB(); | 49 B b = makeB(); |
49 Expect.equals('1,B,M', b.foo(1)); | 50 Expect.equals('1,B,M', b.foo(1)); |
50 } | 51 } |
OLD | NEW |