OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 void main() { | 7 void main() { |
8 var hva = new HasValueA(); | 8 var hva = new HasValueA(); |
9 hva.value = '42'; | 9 hva.value = '42'; |
10 Expect.equals('42', hva.value); | 10 Expect.equals('42', hva.value); |
(...skipping 10 matching lines...) Expand all Loading... |
21 abstract class Delegate { | 21 abstract class Delegate { |
22 String invoke(String value); | 22 String invoke(String value); |
23 } | 23 } |
24 | 24 |
25 abstract class DelegateMixin { | 25 abstract class DelegateMixin { |
26 String invoke(String value) => value; | 26 String invoke(String value) => value; |
27 } | 27 } |
28 | 28 |
29 abstract class HasValueMixin implements Delegate { | 29 abstract class HasValueMixin implements Delegate { |
30 String _value; | 30 String _value; |
31 set value(String value) { _value = invoke(value); } | 31 set value(String value) { |
| 32 _value = invoke(value); |
| 33 } |
| 34 |
32 String get value => _value; | 35 String get value => _value; |
33 } | 36 } |
34 | 37 |
35 class HasValueA extends Object with HasValueMixin, DelegateMixin { | 38 class HasValueA extends Object with HasValueMixin, DelegateMixin {} |
36 } | |
37 | 39 |
38 class HasValueB extends Object with DelegateMixin, HasValueMixin { | 40 class HasValueB extends Object with DelegateMixin, HasValueMixin {} |
39 } | |
40 | 41 |
41 class HasValueC extends Object with HasValueMixin { | 42 class HasValueC extends Object with HasValueMixin { |
42 String invoke(String value) => value; | 43 String invoke(String value) => value; |
43 } | 44 } |
OLD | NEW |