Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: lib/transformations/mixin_full_resolution.dart

Issue 2473223003: Do not duplicate constructors for named mixin applications. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | testcases/spec-mode/redirecting_factory.baseline.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/transformations/mixin_full_resolution.dart
diff --git a/lib/transformations/mixin_full_resolution.dart b/lib/transformations/mixin_full_resolution.dart
index dfcc3c8174690aac765a9fd16a5c524a4bc50e48..f0c5cc38fcd4db15cb8c78172710cbd7c20ff7b2 100644
--- a/lib/transformations/mixin_full_resolution.dart
+++ b/lib/transformations/mixin_full_resolution.dart
@@ -95,13 +95,17 @@ class MixinFullResolution {
}
// For each generative constructor in the superclass we make a
// corresponding forwarding constructor in the subclass.
- var superclassSubstitution = getSubstitutionMap(class_.supertype);
- var superclassCloner =
- new CloneVisitor(typeSubstitution: superclassSubstitution);
- for (var superclassConstructor in class_.superclass.constructors) {
- var forwardingConstructor =
- buildForwardingConstructor(superclassCloner, superclassConstructor);
- class_.constructors.add(forwardingConstructor..parent = class_);
+ // Named mixin applications already have constructors, so only build the
+ // constructors for anonymous mixin applications.
+ if (class_.constructors.isEmpty) {
+ var superclassSubstitution = getSubstitutionMap(class_.supertype);
+ var superclassCloner =
+ new CloneVisitor(typeSubstitution: superclassSubstitution);
+ for (var superclassConstructor in class_.superclass.constructors) {
+ var forwardingConstructor =
+ buildForwardingConstructor(superclassCloner, superclassConstructor);
+ class_.constructors.add(forwardingConstructor..parent = class_);
+ }
}
// This class implements the mixin type.
« no previous file with comments | « no previous file | testcases/spec-mode/redirecting_factory.baseline.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698