| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2016, 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.md file. | |
| 4 | |
| 5 import 'expect.dart'; | |
| 6 | |
| 7 String log; | |
| 8 init() { log = ''; } | |
| 9 logit(msg) { return log = '$log$msg'; } | |
| 10 | |
| 11 class Base { | |
| 12 var b; | |
| 13 Base.arg0() : b = logit('b') { | |
| 14 logit('B'); | |
| 15 } | |
| 16 Base.arg1(a) : b = logit('b') { | |
| 17 logit('B'); | |
| 18 } | |
| 19 Base.arg2(a, b) : b = logit('b') { | |
| 20 logit('B'); | |
| 21 } | |
| 22 } | |
| 23 | |
| 24 class Sub extends Base { | |
| 25 var x; | |
| 26 var s; | |
| 27 Sub.arg0() : x = logit('x'), super.arg0(), s = logit('s') { | |
| 28 logit('S'); | |
| 29 } | |
| 30 Sub.arg1(a) : x = logit('x'), super.arg1(logit('1')), s = logit('s') { | |
| 31 logit('S'); | |
| 32 } | |
| 33 Sub.arg2(a, b) : x = logit('x'), super.arg2(logit('1'), logit('2')), s = logit
('s') { | |
| 34 logit('S'); | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 test(fun(), String result) { | |
| 39 init(); | |
| 40 fun(); | |
| 41 Expect.isTrue(log == result); | |
| 42 } | |
| 43 | |
| 44 main() { | |
| 45 test(() => new Sub.arg0(), 'xsbBS'); | |
| 46 test(() => new Sub.arg1(1), 'x1sbBS'); | |
| 47 test(() => new Sub.arg2(1, 2), 'x12sbBS'); | |
| 48 } | |
| OLD | NEW |