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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1837523002: Fixes for using _DeferredClassElement and SDK summary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 visitedClasses = <ClassElementImpl>[this]; 672 visitedClasses = <ClassElementImpl>[this];
673 } else { 673 } else {
674 if (visitedClasses.contains(this)) { 674 if (visitedClasses.contains(this)) {
675 // Loop in the class hierarchy. Don't try to forward any 675 // Loop in the class hierarchy. Don't try to forward any
676 // constructors. 676 // constructors.
677 return <ConstructorElement>[]; 677 return <ConstructorElement>[];
678 } 678 }
679 visitedClasses.add(this); 679 visitedClasses.add(this);
680 } 680 }
681 try { 681 try {
682 ClassElement superclass = supertype.element; 682 constructorsToForward = getImpl(supertype.element)
683 if (superclass is ClassElementHandle) {
684 superclass = (superclass as ClassElementHandle).actualElement;
685 }
686 constructorsToForward = (superclass as ClassElementImpl)
687 ._computeMixinAppConstructors(visitedClasses); 683 ._computeMixinAppConstructors(visitedClasses);
688 } finally { 684 } finally {
689 visitedClasses.removeLast(); 685 visitedClasses.removeLast();
690 } 686 }
691 } 687 }
692 688
693 // Figure out the type parameter substitution we need to perform in order 689 // Figure out the type parameter substitution we need to perform in order
694 // to produce constructors for this class. We want to be robust in the 690 // to produce constructors for this class. We want to be robust in the
695 // face of errors, so drop any extra type arguments and fill in any missing 691 // face of errors, so drop any extra type arguments and fill in any missing
696 // ones with `dynamic`. 692 // ones with `dynamic`.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 return implicitConstructor; 734 return implicitConstructor;
739 }).toList(); 735 }).toList();
740 } 736 }
741 737
742 PropertyAccessorElement _internalLookUpConcreteGetter( 738 PropertyAccessorElement _internalLookUpConcreteGetter(
743 String getterName, LibraryElement library, bool includeThisClass) { 739 String getterName, LibraryElement library, bool includeThisClass) {
744 PropertyAccessorElement getter = 740 PropertyAccessorElement getter =
745 _internalLookUpGetter(getterName, library, includeThisClass); 741 _internalLookUpGetter(getterName, library, includeThisClass);
746 while (getter != null && getter.isAbstract) { 742 while (getter != null && getter.isAbstract) {
747 Element definingClass = getter.enclosingElement; 743 Element definingClass = getter.enclosingElement;
748 if (definingClass is! ClassElementImpl) { 744 if (definingClass is! ClassElement) {
749 return null; 745 return null;
750 } 746 }
751 getter = (definingClass as ClassElementImpl) 747 getter = getImpl(definingClass)
752 ._internalLookUpGetter(getterName, library, false); 748 ._internalLookUpGetter(getterName, library, false);
753 } 749 }
754 return getter; 750 return getter;
755 } 751 }
756 752
757 MethodElement _internalLookUpConcreteMethod( 753 MethodElement _internalLookUpConcreteMethod(
758 String methodName, LibraryElement library, bool includeThisClass) { 754 String methodName, LibraryElement library, bool includeThisClass) {
759 MethodElement method = 755 MethodElement method =
760 _internalLookUpMethod(methodName, library, includeThisClass); 756 _internalLookUpMethod(methodName, library, includeThisClass);
761 while (method != null && method.isAbstract) { 757 while (method != null && method.isAbstract) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 897 }
902 } 898 }
903 supertypes = classElt.mixins; 899 supertypes = classElt.mixins;
904 for (int i = 0; i < supertypes.length; i++) { 900 for (int i = 0; i < supertypes.length; i++) {
905 if (_safeIsOrInheritsProxy(supertypes[i].element, visitedClassElts)) { 901 if (_safeIsOrInheritsProxy(supertypes[i].element, visitedClassElts)) {
906 return true; 902 return true;
907 } 903 }
908 } 904 }
909 return false; 905 return false;
910 } 906 }
907
908 /**
909 * Return the [ClassElementImpl] of the given [classElement]. May throw an
910 * exception if the [ClassElementImpl] cannot be provided (should not happen
911 * though).
912 */
913 static ClassElementImpl getImpl(ClassElement classElement) {
914 if (classElement is ClassElementHandle) {
915 return getImpl(classElement.actualElement);
916 }
917 return classElement as ClassElementImpl;
918 }
911 } 919 }
912 920
913 /** 921 /**
914 * A concrete implementation of a [CompilationUnitElement]. 922 * A concrete implementation of a [CompilationUnitElement].
915 */ 923 */
916 class CompilationUnitElementImpl extends UriReferencedElementImpl 924 class CompilationUnitElementImpl extends UriReferencedElementImpl
917 implements CompilationUnitElement { 925 implements CompilationUnitElement {
918 /** 926 /**
919 * The source that corresponds to this compilation unit. 927 * The source that corresponds to this compilation unit.
920 */ 928 */
(...skipping 4029 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 4958
4951 @override 4959 @override
4952 void visitElement(Element element) { 4960 void visitElement(Element element) {
4953 int offset = element.nameOffset; 4961 int offset = element.nameOffset;
4954 if (offset != -1) { 4962 if (offset != -1) {
4955 map[offset] = element; 4963 map[offset] = element;
4956 } 4964 }
4957 super.visitElement(element); 4965 super.visitElement(element);
4958 } 4966 }
4959 } 4967 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698