OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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; | 5 library dart2js.resolution; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 DartType resolveReturnType(Element element, TypeAnnotation annotation) { | 410 DartType resolveReturnType(Element element, TypeAnnotation annotation) { |
411 if (annotation == null) return const DynamicType(); | 411 if (annotation == null) return const DynamicType(); |
412 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 412 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
413 if (result == null) { | 413 if (result == null) { |
414 // TODO(karklose): warning. | 414 // TODO(karklose): warning. |
415 return const DynamicType(); | 415 return const DynamicType(); |
416 } | 416 } |
417 return result; | 417 return result; |
418 } | 418 } |
419 | 419 |
420 void resolveRedirectionChain( | 420 void resolveRedirectionChain(ConstructorElement constructor, Spannable node) { |
421 ConstructorElement constructor, Spannable node) { | |
422 ConstructorElement target = constructor; | 421 ConstructorElement target = constructor; |
423 InterfaceType targetType; | 422 InterfaceType targetType; |
424 List<Element> seen = new List<Element>(); | 423 List<Element> seen = new List<Element>(); |
425 bool isMalformed = false; | 424 bool isMalformed = false; |
426 // Follow the chain of redirections and check for cycles. | 425 // Follow the chain of redirections and check for cycles. |
427 while (target.isRedirectingFactory || target.isPatched) { | 426 while (target.isRedirectingFactory || target.isPatched) { |
428 if (target.hasEffectiveTarget) { | 427 if (target.hasEffectiveTarget) { |
429 // We found a constructor that already has been processed. | 428 // We found a constructor that already has been processed. |
430 // TODO(johnniwinther): Should `effectiveTargetType` be part of the | 429 // TODO(johnniwinther): Should `effectiveTargetType` be part of the |
431 // interface? | 430 // interface? |
432 targetType = target.computeEffectiveTargetType( | 431 targetType = |
433 target.enclosingClass.thisType); | 432 target.computeEffectiveTargetType(target.enclosingClass.thisType); |
434 assert(invariant(target, targetType != null, | 433 assert(invariant(target, targetType != null, |
435 message: 'Redirection target type has not been computed for ' | 434 message: 'Redirection target type has not been computed for ' |
436 '$target')); | 435 '$target')); |
437 target = target.effectiveTarget; | 436 target = target.effectiveTarget; |
438 break; | 437 break; |
439 } | 438 } |
440 | 439 |
441 Element nextTarget; | 440 Element nextTarget; |
442 if (target.isPatched) { | 441 if (target.isPatched) { |
443 nextTarget = target.patch; | 442 nextTarget = target.patch; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 metadata.ensureResolved(resolution); | 660 metadata.ensureResolved(resolution); |
662 } | 661 } |
663 }); | 662 }); |
664 } | 663 } |
665 }); | 664 }); |
666 | 665 |
667 computeClassMember(element, Identifiers.call); | 666 computeClassMember(element, Identifiers.call); |
668 } | 667 } |
669 | 668 |
670 void computeClassMembers(ClassElement element) { | 669 void computeClassMembers(ClassElement element) { |
671 MembersCreator.computeAllClassMembers(compiler, element); | 670 MembersCreator.computeAllClassMembers(resolution, element); |
672 } | 671 } |
673 | 672 |
674 void computeClassMember(ClassElement element, String name) { | 673 void computeClassMember(ClassElement element, String name) { |
675 MembersCreator.computeClassMembersByName(compiler, element, name); | 674 MembersCreator.computeClassMembersByName(resolution, element, name); |
676 } | 675 } |
677 | 676 |
678 void checkClass(ClassElement element) { | 677 void checkClass(ClassElement element) { |
679 computeClassMembers(element); | 678 computeClassMembers(element); |
680 if (element.isMixinApplication) { | 679 if (element.isMixinApplication) { |
681 checkMixinApplication(element); | 680 checkMixinApplication(element); |
682 } else { | 681 } else { |
683 checkClassMembers(element); | 682 checkClassMembers(element); |
684 } | 683 } |
685 } | 684 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 TreeElements get treeElements { | 1099 TreeElements get treeElements { |
1101 assert(invariant(this, _treeElements != null, | 1100 assert(invariant(this, _treeElements != null, |
1102 message: "TreeElements have not been computed for $this.")); | 1101 message: "TreeElements have not been computed for $this.")); |
1103 return _treeElements; | 1102 return _treeElements; |
1104 } | 1103 } |
1105 | 1104 |
1106 void reuseElement() { | 1105 void reuseElement() { |
1107 _treeElements = null; | 1106 _treeElements = null; |
1108 } | 1107 } |
1109 } | 1108 } |
OLD | NEW |