| 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 assignment to fields of native methods. | 5 // Test that type checks occur on assignment to fields of native methods. |
| 6 | 6 |
| 7 class A native "*A" { | 7 @native("*A") |
| 8 class A { |
| 8 int foo; | 9 int foo; |
| 9 } | 10 } |
| 10 | 11 |
| 11 class B native "*B" { | 12 @native("*B") |
| 13 class B { |
| 12 String foo; | 14 String foo; |
| 13 } | 15 } |
| 14 | 16 |
| 15 A makeA() native { return new A(); } | 17 @native A makeA() { return new A(); } |
| 16 B makeB() native { return new B(); } | 18 @native B makeB() { return new B(); } |
| 17 | 19 |
| 18 void setup() native """ | 20 @native(""" |
| 19 function A() {} | 21 function A() {} |
| 20 | 22 |
| 21 function B() {} | 23 function B() {} |
| 22 | 24 |
| 23 makeA = function(){return new A;}; | 25 makeA = function(){return new A;}; |
| 24 makeB = function(){return new B;}; | 26 makeB = function(){return new B;}; |
| 25 """; | 27 """) |
| 28 void setup(); |
| 26 | 29 |
| 27 expectThrows(action()) { | 30 expectThrows(action()) { |
| 28 bool threw = false; | 31 bool threw = false; |
| 29 try { | 32 try { |
| 30 action(); | 33 action(); |
| 31 } catch (var e) { | 34 } catch (var e) { |
| 32 threw = true; | 35 threw = true; |
| 33 } | 36 } |
| 34 Expect.isTrue(threw); | 37 Expect.isTrue(threw); |
| 35 } | 38 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 106 |
| 104 main() { | 107 main() { |
| 105 setup(); | 108 setup(); |
| 106 | 109 |
| 107 if (isCheckedMode()) { | 110 if (isCheckedMode()) { |
| 108 checkedModeTest(); | 111 checkedModeTest(); |
| 109 } else { | 112 } else { |
| 110 uncheckedModeTest(); | 113 uncheckedModeTest(); |
| 111 } | 114 } |
| 112 } | 115 } |
| OLD | NEW |