mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 05:51:37 +00:00
6d7b2a169e
This change: - Removes the need to create synthesized nodes for the default constructor. - Treats the default constructor and forwarding constructors in mixins uniformaly: they both are synthesized constructors that call a super constructor. - Makes the compiler aware that some elements may not have nodes, and acts accordingly. Before, the default constructor had a synthesized node, so the compiler was happy with it. And the forwarding constructors were handled specially to just skip to a non-synthesized constructor. The latter behavior was the cause of issue 11822, and type inference problems. - Makes the resolver implement what is specified in the specification for forwarding constructors: we create one synthesized constructor per generative constructor of the super class. - Implements forwarding constructor in named (aka typedef) mixin applications. See builder.dart, and mixin_typedef_constructor_test.dart - Implements const classes in the presence of mixins: tests/language/const_constructor_mixin_test.dart. - Fixes type inference in the presence of forwarding constructors: tests/language/inference_mixin_field_test.dart. R=ahe@google.com, karlklose@google.com Review URL: https://codereview.chromium.org//19754002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25148 260f80e4-7a28-3924-810f-c04153c831b5
32 lines
666 B
Dart
32 lines
666 B
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";
|
|
|
|
abstract class Mixin1 {
|
|
var mixin1Field = 1;
|
|
}
|
|
|
|
abstract class Mixin2 {
|
|
var mixin2Field = 2;
|
|
}
|
|
|
|
class A {
|
|
var superField;
|
|
A(foo) : superField = foo;
|
|
}
|
|
|
|
class B extends A with Mixin1, Mixin2 {
|
|
var field = 4;
|
|
B(unused) : super(3);
|
|
}
|
|
|
|
main() {
|
|
var b = new B(null);
|
|
Expect.equals(1, b.mixin1Field);
|
|
Expect.equals(2, b.mixin2Field);
|
|
Expect.equals(3, b.superField);
|
|
Expect.equals(4, b.field);
|
|
}
|