OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 | 4 |
5 library dart2js.resolution.class_hierarchy; | 5 library dart2js.resolution.class_hierarchy; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Feature; | 8 import '../common/resolution.dart' show Feature; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../core_types.dart' show CoreClasses, CoreTypes; | 10 import '../core_types.dart' show CoreClasses, CoreTypes; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 link = link.tail; | 296 link = link.tail; |
297 } | 297 } |
298 doApplyMixinTo(element, supertype, checkMixinType(link.head)); | 298 doApplyMixinTo(element, supertype, checkMixinType(link.head)); |
299 return element.computeType(resolution); | 299 return element.computeType(resolution); |
300 } | 300 } |
301 | 301 |
302 DartType applyMixin(DartType supertype, DartType mixinType, Node node) { | 302 DartType applyMixin(DartType supertype, DartType mixinType, Node node) { |
303 String superName = supertype.name; | 303 String superName = supertype.name; |
304 String mixinName = mixinType.name; | 304 String mixinName = mixinType.name; |
305 MixinApplicationElementX mixinApplication = | 305 MixinApplicationElementX mixinApplication = |
306 new UnnamedMixinApplicationElementX( | 306 new UnnamedMixinApplicationElementX("${superName}+${mixinName}", |
307 "${superName}+${mixinName}", | 307 element, compiler.idGenerator.getNextFreeId(), node); |
308 element, | |
309 compiler.idGenerator.getNextFreeId(), | |
310 node); | |
311 // Create synthetic type variables for the mixin application. | 308 // Create synthetic type variables for the mixin application. |
312 List<DartType> typeVariables = <DartType>[]; | 309 List<DartType> typeVariables = <DartType>[]; |
313 int index = 0; | 310 int index = 0; |
314 for (TypeVariableType type in element.typeVariables) { | 311 for (TypeVariableType type in element.typeVariables) { |
315 TypeVariableElementX typeVariableElement = new TypeVariableElementX( | 312 TypeVariableElementX typeVariableElement = new TypeVariableElementX( |
316 type.name, mixinApplication, index, type.element.node); | 313 type.name, mixinApplication, index, type.element.node); |
317 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); | 314 TypeVariableType typeVariable = new TypeVariableType(typeVariableElement); |
318 typeVariables.add(typeVariable); | 315 typeVariables.add(typeVariable); |
319 index++; | 316 index++; |
320 } | 317 } |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 Identifier selector = node.selector.asIdentifier(); | 645 Identifier selector = node.selector.asIdentifier(); |
649 var e = prefixElement.lookupLocalMember(selector.source); | 646 var e = prefixElement.lookupLocalMember(selector.source); |
650 if (e == null || !e.impliesType) { | 647 if (e == null || !e.impliesType) { |
651 reporter.reportErrorMessage(node.selector, | 648 reporter.reportErrorMessage(node.selector, |
652 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); | 649 MessageKind.CANNOT_RESOLVE_TYPE, {'typeName': node.selector}); |
653 return; | 650 return; |
654 } | 651 } |
655 loadSupertype(e, node); | 652 loadSupertype(e, node); |
656 } | 653 } |
657 } | 654 } |
OLD | NEW |