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 assignment to fields of native methods. | 7 // Test that type checks occur on assignment to fields of native methods. |
8 | 8 |
9 @Native("A") | 9 @Native("A") |
10 class A { | 10 class A { |
11 int foo; | 11 int foo; |
12 } | 12 } |
13 | 13 |
14 @Native("B") | 14 @Native("B") |
15 class B { | 15 class B { |
16 String foo; | 16 String foo; |
17 } | 17 } |
18 | 18 |
19 A makeA() native ; | 19 A makeA() native; |
20 B makeB() native ; | 20 B makeB() native; |
21 | 21 |
22 void setup() native """ | 22 void setup() native """ |
23 function A() {} | 23 function A() {} |
24 | 24 |
25 function B() {} | 25 function B() {} |
26 | 26 |
27 makeA = function(){return new A;}; | 27 makeA = function(){return new A;}; |
28 makeB = function(){return new B;}; | 28 makeB = function(){return new B;}; |
29 | 29 |
30 self.nativeConstructor(A); | 30 self.nativeConstructor(A); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 main() { | 113 main() { |
114 nativeTesting(); | 114 nativeTesting(); |
115 setup(); | 115 setup(); |
116 | 116 |
117 if (isCheckedMode()) { | 117 if (isCheckedMode()) { |
118 checkedModeTest(); | 118 checkedModeTest(); |
119 } else { | 119 } else { |
120 uncheckedModeTest(); | 120 uncheckedModeTest(); |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |