| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // corresponding forwarding constructor in the subclass. | 97 // corresponding forwarding constructor in the subclass. |
| 98 // Named mixin applications already have constructors, so only build the | 98 // Named mixin applications already have constructors, so only build the |
| 99 // constructors for anonymous mixin applications. | 99 // constructors for anonymous mixin applications. |
| 100 if (class_.constructors.isEmpty) { | 100 if (class_.constructors.isEmpty) { |
| 101 var superclassSubstitution = getSubstitutionMap(class_.supertype); | 101 var superclassSubstitution = getSubstitutionMap(class_.supertype); |
| 102 var superclassCloner = | 102 var superclassCloner = |
| 103 new CloneVisitor(typeSubstitution: superclassSubstitution); | 103 new CloneVisitor(typeSubstitution: superclassSubstitution); |
| 104 for (var superclassConstructor in class_.superclass.constructors) { | 104 for (var superclassConstructor in class_.superclass.constructors) { |
| 105 var forwardingConstructor = | 105 var forwardingConstructor = |
| 106 buildForwardingConstructor(superclassCloner, superclassConstructor); | 106 buildForwardingConstructor(superclassCloner, superclassConstructor); |
| 107 class_.constructors.add(forwardingConstructor..parent = class_); | 107 class_.addMember(forwardingConstructor); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 // This class implements the mixin type. | 111 // This class implements the mixin type. |
| 112 class_.implementedTypes.add(class_.mixedInType); | 112 class_.implementedTypes.add(class_.mixedInType); |
| 113 | 113 |
| 114 // This class is now a normal class. | 114 // This class is now a normal class. |
| 115 class_.mixedInType = null; | 115 class_.mixedInType = null; |
| 116 } | 116 } |
| 117 | 117 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 return null; | 360 return null; |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 throw new Exception( | 364 throw new Exception( |
| 365 'Could not find a generative constructor named "${constructor.name}" ' | 365 'Could not find a generative constructor named "${constructor.name}" ' |
| 366 'in lookup class "${lookupClass.name}"!'); | 366 'in lookup class "${lookupClass.name}"!'); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 } | 369 } |
| OLD | NEW |