| 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 "package:expect/expect.dart"; |
| 6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; | 6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; |
| 7 import 'dart:_interceptors' show findInterceptorForType; | 7 import 'dart:_interceptors' show 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 // classes. | 10 // classes. |
| 11 | 11 |
| 12 doFoo(r, x) => '$x,${r.oof()}'; | 12 doFoo(r, x) => '$x,${r.oof()}'; |
| 13 | 13 |
| 14 @Native("A") | 14 @Native("A") |
| 15 class A { | 15 class A { |
| 16 foo(x) => (doFoo)(this, x); | 16 foo(x) => (doFoo)(this, x); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 void setup() native r""" | 30 void setup() native r""" |
| 31 function A() {} | 31 function A() {} |
| 32 function B() {} | 32 function B() {} |
| 33 makeA = function(){return new A;}; | 33 makeA = function(){return new A;}; |
| 34 makeB = function(){return new B;}; | 34 makeB = function(){return new B;}; |
| 35 | 35 |
| 36 getBPrototype = function(){return B.prototype;}; | 36 getBPrototype = function(){return B.prototype;}; |
| 37 """; | 37 """; |
| 38 | 38 |
| 39 main() { | 39 main() { |
| 40 nativeTesting(); | |
| 41 setup(); | 40 setup(); |
| 42 | 41 |
| 43 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); | 42 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); |
| 44 | 43 |
| 45 B b = makeB(); | 44 B b = makeB(); |
| 46 Expect.equals('1,B', b.foo(1)); | 45 Expect.equals('1,B', b.foo(1)); |
| 47 } | 46 } |
| OLD | NEW |