blob: 851f3241e0fcc806c0a81c9fb15b0e5b9e6795de [file] [log] [blame]
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
import "package:expect/expect.dart";
var string = '';
append(x) {
string += x;
return x;
}
class A {
var x = append('x');
var y;
var z;
// Should append y but not yet x.
A() : this.foo(append('y'));
// Append x and z.
A.foo(this.y) : z = append('z');
}
class B extends A {
var w;
// Call the redirecting constructor using super.
B()
: w = append('w'),
super();
}
main() {
string = '';
new A();
Expect.equals('yxz', string);
string = '';
new B();
Expect.equals('wyxz', string);
}