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 // Dart test program for testing setting/getting of instance fields. | 4 // Dart test program for testing setting/getting of instance fields. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import "package:meta/meta.dart" show virtual; |
7 | 8 |
8 class First { | 9 class First { |
9 First() {} | 10 First() {} |
10 var a; | 11 @virtual var a; |
11 var b; | 12 @virtual var b; |
12 | 13 |
13 addFields() { | 14 addFields() { |
14 return a + b; | 15 return a + b; |
15 } | 16 } |
16 | 17 |
17 setValues() { | 18 setValues() { |
18 a = 24; | 19 a = 24; |
19 b = 10; | 20 b = 10; |
20 return a + b; | 21 return a + b; |
21 } | 22 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 static testMain() { | 65 static testMain() { |
65 // FieldTest.one(); | 66 // FieldTest.one(); |
66 FieldTest.two(); | 67 FieldTest.two(); |
67 } | 68 } |
68 } | 69 } |
69 | 70 |
70 | 71 |
71 main() { | 72 main() { |
72 FieldTest.testMain(); | 73 FieldTest.testMain(); |
73 } | 74 } |
OLD | NEW |