| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 7 void main() { |
| 8 var hva = new HasValueA(); |
| 9 hva.value = '42'; |
| 10 Expect.equals('42', hva.value); |
| 11 |
| 12 var hvb = new HasValueB(); |
| 13 hvb.value = '87'; |
| 14 Expect.equals('87', hvb.value); |
| 15 |
| 16 var hvc = new HasValueC(); |
| 17 hvc.value = '99'; |
| 18 Expect.equals('99', hvc.value); |
| 19 } |
| 20 |
| 21 abstract class Delegate { |
| 22 String invoke(String value); |
| 23 } |
| 24 |
| 25 abstract class DelegateMixin { |
| 26 String invoke(String value) => value; |
| 27 } |
| 28 |
| 29 abstract class HasValueMixin implements Delegate { |
| 30 String _value; |
| 31 set value(String value) { _value = invoke(value); } |
| 32 String get value => _value; |
| 33 } |
| 34 |
| 35 class HasValueA extends Object with HasValueMixin, DelegateMixin { |
| 36 } |
| 37 |
| 38 class HasValueB extends Object with DelegateMixin, HasValueMixin { |
| 39 } |
| 40 |
| 41 class HasValueC extends Object with HasValueMixin { |
| 42 String invoke(String value) => value; |
| 43 } |
| OLD | NEW |