OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // Check that initializers are not duplicated |
| 5 |
| 6 |
| 7 class Class { |
| 8 Class(var v) |
| 9 : field_ = v |
| 10 // Test against duplicate final field initializaion in initializing list. |
| 11 , field_ = 2 /// 01: compile-time error |
| 12 ; |
| 13 Class.field(this.field_) |
| 14 // Test against duplicate final field initialization between initializing |
| 15 // formals and initializer list. |
| 16 : field_ = 2 /// 02: compile-time error |
| 17 ; |
| 18 final field_; |
| 19 } |
| 20 |
| 21 main() { |
| 22 new Class(42); |
| 23 new Class.field(42); |
| 24 } |
OLD | NEW |