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 // Test that field initializers are evaluated in the right order. | 5 // Test that field initializers are evaluated in the right order. |
6 | 6 |
7 int counter = 0; | 7 int counter = 0; |
8 | 8 |
9 class Mark { | 9 class Mark { |
10 static StringBuffer buffer; | 10 static StringBuffer buffer; |
11 Mark(value) { | 11 Mark(value) { |
12 buffer.add('$value.'); | 12 buffer.write('$value.'); |
13 } | 13 } |
14 } | 14 } |
15 | 15 |
16 class OneField { | 16 class OneField { |
17 var a = new Mark('a'); | 17 var a = new Mark('a'); |
18 | 18 |
19 OneField(); | 19 OneField(); |
20 | 20 |
21 OneField.init() : a = new Mark('ai'); | 21 OneField.init() : a = new Mark('ai'); |
22 } | 22 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 new InheritOneField())); | 67 new InheritOneField())); |
68 Expect.equals('b.bi.a.', run(() => | 68 Expect.equals('b.bi.a.', run(() => |
69 new InheritOneField.init())); | 69 new InheritOneField.init())); |
70 Expect.equals('b.a.ai.', run(() => | 70 Expect.equals('b.a.ai.', run(() => |
71 new InheritOneField.superWithInit())); | 71 new InheritOneField.superWithInit())); |
72 Expect.equals('b.bi.a.ai.', run(() => | 72 Expect.equals('b.bi.a.ai.', run(() => |
73 new InheritOneField.initWithSuperInit())); | 73 new InheritOneField.initWithSuperInit())); |
74 Expect.equals('b.a.ai.bi.', run(() => | 74 Expect.equals('b.a.ai.bi.', run(() => |
75 new InheritOneField.initWithSuperInit2())); | 75 new InheritOneField.initWithSuperInit2())); |
76 } | 76 } |
OLD | NEW |