| 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 // Test that type checks occur on native methods. | 7 // Test that type checks occur on native methods. |
| 8 | 8 |
| 9 @Native("A") | 9 @Native("A") |
| 10 class A { | 10 class A { |
| 11 int foo(int x) native ; | 11 int foo(int x) native; |
| 12 int cmp(A other) native ; | 12 int cmp(A other) native; |
| 13 } | 13 } |
| 14 | 14 |
| 15 @Native("B") | 15 @Native("B") |
| 16 class B { | 16 class B { |
| 17 String foo(String x) native ; | 17 String foo(String x) native; |
| 18 int cmp(B other) native ; | 18 int cmp(B other) native; |
| 19 } | 19 } |
| 20 | 20 |
| 21 A makeA() native ; | 21 A makeA() native; |
| 22 B makeB() native ; | 22 B makeB() native; |
| 23 | 23 |
| 24 void setup() native """ | 24 void setup() native """ |
| 25 function A() {} | 25 function A() {} |
| 26 A.prototype.foo = function (x) { return x + 1; }; | 26 A.prototype.foo = function (x) { return x + 1; }; |
| 27 A.prototype.cmp = function (x) { return 0; }; | 27 A.prototype.cmp = function (x) { return 0; }; |
| 28 | 28 |
| 29 function B() {} | 29 function B() {} |
| 30 B.prototype.foo = function (x) { return x + 'ha!'; }; | 30 B.prototype.foo = function (x) { return x + 'ha!'; }; |
| 31 B.prototype.cmp = function (x) { return 1; }; | 31 B.prototype.cmp = function (x) { return 1; }; |
| 32 | 32 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 main() { | 139 main() { |
| 140 nativeTesting(); | 140 nativeTesting(); |
| 141 setup(); | 141 setup(); |
| 142 | 142 |
| 143 if (isCheckedMode()) { | 143 if (isCheckedMode()) { |
| 144 checkedModeTest(); | 144 checkedModeTest(); |
| 145 } else { | 145 } else { |
| 146 uncheckedModeTest(); | 146 uncheckedModeTest(); |
| 147 } | 147 } |
| 148 } | 148 } |
| OLD | NEW |