mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 07:31:33 +00:00
07b9df22ac
No behavioral changes, just getting rid of a lot of redundant closures and helper functions. Change-Id: I55c52c2cc9e5505bb64203c31aad8d76847f8eeb Reviewed-on: https://dart-review.googlesource.com/14320 Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: William Hesse <whesse@google.com>
55 lines
1.2 KiB
Dart
55 lines
1.2 KiB
Dart
// Copyright (c) 2013, 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.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class S {
|
|
foo() => "S-foo";
|
|
baz() => "S-baz";
|
|
}
|
|
|
|
class M1 {
|
|
bar() => "M1-bar";
|
|
}
|
|
|
|
class M2 {
|
|
bar() => "M2-bar";
|
|
baz() => "M2-baz";
|
|
fez() => "M2-fez";
|
|
}
|
|
|
|
class C = S with M1;
|
|
class D = S with M1, M2;
|
|
class E = S with M2, M1;
|
|
|
|
class F extends E {
|
|
fez() => "F-fez";
|
|
}
|
|
|
|
main() {
|
|
dynamic c = new C();
|
|
Expect.equals("S-foo", c.foo());
|
|
Expect.equals("M1-bar", c.bar());
|
|
Expect.equals("S-baz", c.baz());
|
|
Expect.throwsNoSuchMethodError(() => c.fez());
|
|
|
|
var d = new D();
|
|
Expect.equals("S-foo", d.foo());
|
|
Expect.equals("M2-bar", d.bar());
|
|
Expect.equals("M2-baz", d.baz());
|
|
Expect.equals("M2-fez", d.fez());
|
|
|
|
var e = new E();
|
|
Expect.equals("S-foo", e.foo());
|
|
Expect.equals("M1-bar", e.bar());
|
|
Expect.equals("M2-baz", e.baz());
|
|
Expect.equals("M2-fez", e.fez());
|
|
|
|
var f = new F();
|
|
Expect.equals("S-foo", f.foo());
|
|
Expect.equals("M1-bar", f.bar());
|
|
Expect.equals("M2-baz", f.baz());
|
|
Expect.equals("F-fez", f.fez());
|
|
}
|