OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // When attempting to call a nonexistent static method, getter or setter, check | 5 // When attempting to call a nonexistent static method, getter or setter, check |
6 // that a NoSuchMethodError is thrown. | 6 // that a NoSuchMethodError is thrown. |
7 | 7 |
8 class C {} | 8 class C {} |
9 | 9 |
10 class D { | 10 class D { |
11 get hest => 1; /// 04: continued | 11 get hest => 1; /// 04: continued |
12 set hest(val) {} /// 05: continued | 12 set hest(val) {} /// 05: continued |
13 } | 13 } |
14 | 14 |
15 get fisk => 2; /// 09: continued | 15 get fisk => 2; /// 09: continued |
16 set fisk(val) {} /// 10: continued | 16 set fisk(val) {} /// 10: continued |
17 | 17 |
18 expectNsme([void fun()]) { | 18 expectNsme([void fun()]) { |
19 if (fun != null) { | 19 if (fun != null) { |
20 Expect.throws(fun, (e) => e is NoSuchMethodError); | 20 Expect.throws(fun, (e) => e is NoSuchMethodError); |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
24 alwaysThrows() { | 24 alwaysThrows() { |
25 throw new NoSuchMethodError(null, 'foo', [], {}); | 25 throw new NoSuchMethodError(null, 'foo', []); |
26 } | 26 } |
27 | 27 |
28 test01() { | 28 test01() { |
29 C.hest = 1; /// 01: static type warning | 29 C.hest = 1; /// 01: static type warning |
30 } | 30 } |
31 | 31 |
32 test02() { | 32 test02() { |
33 C.hest; /// 02: static type warning | 33 C.hest; /// 02: static type warning |
34 } | 34 } |
35 | 35 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 expectNsme( | 91 expectNsme( |
92 test08 /// 08: continued | 92 test08 /// 08: continued |
93 ); | 93 ); |
94 expectNsme( | 94 expectNsme( |
95 test09 /// 09: continued | 95 test09 /// 09: continued |
96 ); | 96 ); |
97 expectNsme( | 97 expectNsme( |
98 test10 /// 10: continued | 98 test10 /// 10: continued |
99 ); | 99 ); |
100 } | 100 } |
OLD | NEW |