OLD | NEW |
| (Empty) |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 import 'expect.dart'; | |
6 | |
7 class A { | |
8 var field; | |
9 | |
10 get getField { | |
11 return field; | |
12 } | |
13 | |
14 set setField(value) { | |
15 field = value; | |
16 return null; | |
17 } | |
18 } | |
19 | |
20 main() { | |
21 var result; | |
22 var a = new A(); | |
23 | |
24 Expect.isTrue(a.field == null); | |
25 Expect.isTrue(a.getField == null); | |
26 | |
27 result = (a.field = 42); | |
28 Expect.isTrue(result == 42); | |
29 Expect.isTrue(a.field == 42); | |
30 Expect.isTrue(a.getField == 42); | |
31 | |
32 result = (a.setField = 99); | |
33 Expect.isTrue(result == 99); | |
34 Expect.isTrue(a.field == 99); | |
35 Expect.isTrue(a.getField == 99); | |
36 } | |
OLD | NEW |