OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 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 | 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 library kernel.transformations.mixin_full_resolution; | 4 library kernel.transformations.mixin_full_resolution; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../class_hierarchy.dart'; | 7 import '../class_hierarchy.dart'; |
8 import '../clone.dart'; | 8 import '../clone.dart'; |
9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
10 import '../type_algebra.dart'; | 10 import '../type_algebra.dart'; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // corresponding forwarding constructor in the subclass. | 108 // corresponding forwarding constructor in the subclass. |
109 // Named mixin applications already have constructors, so only build the | 109 // Named mixin applications already have constructors, so only build the |
110 // constructors for anonymous mixin applications. | 110 // constructors for anonymous mixin applications. |
111 if (class_.constructors.isEmpty) { | 111 if (class_.constructors.isEmpty) { |
112 var superclassSubstitution = getSubstitutionMap(class_.supertype); | 112 var superclassSubstitution = getSubstitutionMap(class_.supertype); |
113 var superclassCloner = | 113 var superclassCloner = |
114 new CloneVisitor(typeSubstitution: superclassSubstitution); | 114 new CloneVisitor(typeSubstitution: superclassSubstitution); |
115 for (var superclassConstructor in class_.superclass.constructors) { | 115 for (var superclassConstructor in class_.superclass.constructors) { |
116 var forwardingConstructor = | 116 var forwardingConstructor = |
117 buildForwardingConstructor(superclassCloner, superclassConstructor); | 117 buildForwardingConstructor(superclassCloner, superclassConstructor); |
118 class_.constructors.add(forwardingConstructor..parent = class_); | 118 class_.addMember(forwardingConstructor); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 // This class implements the mixin type. | 122 // This class implements the mixin type. |
123 class_.implementedTypes.add(class_.mixedInType); | 123 class_.implementedTypes.add(class_.mixedInType); |
124 | 124 |
125 // This class is now a normal class. | 125 // This class is now a normal class. |
126 class_.mixedInType = null; | 126 class_.mixedInType = null; |
127 } | 127 } |
128 | 128 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 return null; | 371 return null; |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 throw new Exception( | 375 throw new Exception( |
376 'Could not find a generative constructor named "${constructor.name}" ' | 376 'Could not find a generative constructor named "${constructor.name}" ' |
377 'in lookup class "${lookupClass.name}"!'); | 377 'in lookup class "${lookupClass.name}"!'); |
378 } | 378 } |
379 } | 379 } |
380 } | 380 } |
OLD | NEW |