Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 library object_field_initializers_test; | 5 library object_field_initializers_test; |
| 6 | 6 |
| 7 /// Simple program creating an object with instance field initializers in the | 7 /// Simple program creating an object with instance field initializers in the |
| 8 /// declaration of the class. | 8 /// declaration of the class. |
| 9 /// | 9 /// |
| 10 /// The static function `fieldInitializer` is used to ensure the fields are | 10 /// The static function `fieldInitializer` is used to ensure the fields are |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 String foo4 = fieldInitializer(5, 'foo4'); | 53 String foo4 = fieldInitializer(5, 'foo4'); |
| 54 | 54 |
| 55 B(String foo1, String foo2) { | 55 B(String foo1, String foo2) { |
| 56 this.foo1 = foo1; | 56 this.foo1 = foo1; |
| 57 this.foo2 = foo2; | 57 this.foo2 = foo2; |
| 58 this.foo4 = fieldInitializer(6, 'bar4'); | 58 this.foo4 = fieldInitializer(6, 'bar4'); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 class C { | 62 class C { |
| 63 static String staticFoo = 'foo'; | |
|
Dmitry Stefantsov
2017/08/21 09:40:33
Looks like this update didn't change anything in t
| |
| 63 String foo1 = fieldInitializer(1, 'foo1'); | 64 String foo1 = fieldInitializer(1, 'foo1'); |
| 64 String foo2; | 65 String foo2; |
| 65 String foo3 = fieldInitializer(2, 'foo3'); | 66 String foo3 = fieldInitializer(2, 'foo3'); |
| 66 | 67 |
| 67 C(this.foo1, this.foo2) { | 68 C(this.foo1, this.foo2) { |
| 68 foo3 = fieldInitializer(3, 'foo3'); | 69 foo3 = fieldInitializer(3, 'foo3'); |
| 69 } | 70 } |
| 70 } | 71 } |
| 71 | 72 |
| 72 String fieldInitializer(int f, String s) { | 73 String fieldInitializer(int f, String s) { |
| 73 print('$s: $f'); | 74 print('$s: $f'); |
| 74 return '$s: $f'; | 75 return '$s: $f'; |
| 75 } | 76 } |
| OLD | NEW |