| 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 "native_testing.dart"; | 5 import "native_testing.dart"; |
| 6 | 6 |
| 7 // This is a similar test to NativeCallArity1FrogTest, but makes sure | 7 // This is a similar test to NativeCallArity1FrogTest, but makes sure |
| 8 // that subclasses also get the right number of arguments. | 8 // that subclasses also get the right number of arguments. |
| 9 | 9 |
| 10 @Native("A") | 10 @Native("A") |
| 11 class A { | 11 class A { |
| 12 int foo([x, y]) native ; | 12 int foo([x, y]) native; |
| 13 } | 13 } |
| 14 | 14 |
| 15 @Native("B") | 15 @Native("B") |
| 16 class B extends A { | 16 class B extends A { |
| 17 int foo([x, y]) native ; | 17 int foo([x, y]) native; |
| 18 } | 18 } |
| 19 | 19 |
| 20 makeA() native ; | 20 makeA() native; |
| 21 makeB() native ; | 21 makeB() native; |
| 22 | 22 |
| 23 void setup() native """ | 23 void setup() native """ |
| 24 function inherits(child, parent) { | 24 function inherits(child, parent) { |
| 25 if (child.prototype.__proto__) { | 25 if (child.prototype.__proto__) { |
| 26 child.prototype.__proto__ = parent.prototype; | 26 child.prototype.__proto__ = parent.prototype; |
| 27 } else { | 27 } else { |
| 28 function tmp() {}; | 28 function tmp() {}; |
| 29 tmp.prototype = parent.prototype; | 29 tmp.prototype = parent.prototype; |
| 30 child.prototype = new tmp(); | 30 child.prototype = new tmp(); |
| 31 child.prototype.constructor = child; | 31 child.prototype.constructor = child; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 Expect.equals(2, b.foo(null, 20)); | 90 Expect.equals(2, b.foo(null, 20)); |
| 91 Expect.throws(() => b.foo(10, 20, 30)); | 91 Expect.throws(() => b.foo(10, 20, 30)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 main() { | 94 main() { |
| 95 nativeTesting(); | 95 nativeTesting(); |
| 96 setup(); | 96 setup(); |
| 97 testDynamicContext(); | 97 testDynamicContext(); |
| 98 testStaticContext(); | 98 testStaticContext(); |
| 99 } | 99 } |
| OLD | NEW |