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