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

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

Issue 243263004: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 3860
3861 /** 3861 /**
3862 * The name of the top-level variable used to mark a method as being expected to override an 3862 * The name of the top-level variable used to mark a method as being expected to override an
3863 * inherited method. 3863 * inherited method.
3864 */ 3864 */
3865 static String _OVERRIDE_VARIABLE_NAME = "override"; 3865 static String _OVERRIDE_VARIABLE_NAME = "override";
3866 3866
3867 /** 3867 /**
3868 * The name of the top-level variable used to mark a class as implementing a p roxy object. 3868 * The name of the top-level variable used to mark a class as implementing a p roxy object.
3869 */ 3869 */
3870 static String _PROXY_VARIABLE_NAME = "proxy"; 3870 static String PROXY_VARIABLE_NAME = "proxy";
3871 3871
3872 /** 3872 /**
3873 * Initialize a newly created annotation. 3873 * Initialize a newly created annotation.
3874 * 3874 *
3875 * @param element the element representing the field, variable, or constructor being used as an 3875 * @param element the element representing the field, variable, or constructor being used as an
3876 * annotation 3876 * annotation
3877 */ 3877 */
3878 ElementAnnotationImpl(this.element); 3878 ElementAnnotationImpl(this.element);
3879 3879
3880 @override 3880 @override
(...skipping 25 matching lines...) Expand all
3906 } 3906 }
3907 } 3907 }
3908 return false; 3908 return false;
3909 } 3909 }
3910 3910
3911 @override 3911 @override
3912 bool get isProxy { 3912 bool get isProxy {
3913 if (element != null) { 3913 if (element != null) {
3914 LibraryElement library = element.library; 3914 LibraryElement library = element.library;
3915 if (library != null && library.isDartCore) { 3915 if (library != null && library.isDartCore) {
3916 if (element is PropertyAccessorElement && element.name == _PROXY_VARIABL E_NAME) { 3916 if (element is PropertyAccessorElement && element.name == PROXY_VARIABLE _NAME) {
3917 return true; 3917 return true;
3918 } 3918 }
3919 } 3919 }
3920 } 3920 }
3921 return false; 3921 return false;
3922 } 3922 }
3923 3923
3924 @override 3924 @override
3925 String toString() => "@${element.toString()}"; 3925 String toString() => "@${element.toString()}";
3926 } 3926 }
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
5894 * @param name the name of this element 5894 * @param name the name of this element
5895 * @param nameOffset the offset of the name of this element in the file that c ontains the 5895 * @param nameOffset the offset of the name of this element in the file that c ontains the
5896 * declaration of this element 5896 * declaration of this element
5897 */ 5897 */
5898 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set); 5898 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set);
5899 5899
5900 @override 5900 @override
5901 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); 5901 accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
5902 5902
5903 @override 5903 @override
5904 String get displayName {
5905 String displayName = super.displayName;
5906 if ("unary-" == displayName) {
5907 return "-";
5908 }
5909 return displayName;
5910 }
5911
5912 @override
5904 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 5913 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
5905 5914
5906 @override 5915 @override
5907 ElementKind get kind => ElementKind.METHOD; 5916 ElementKind get kind => ElementKind.METHOD;
5908 5917
5909 @override 5918 @override
5910 String get name { 5919 String get name {
5911 String name = super.name; 5920 String name = super.name;
5912 if (isOperator && name == "-") { 5921 if (isOperator && name == "-") {
5913 if (parameters.length == 0) { 5922 if (parameters.length == 0) {
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
8488 * @param firstTypes the first map of name/type pairs being compared 8497 * @param firstTypes the first map of name/type pairs being compared
8489 * @param secondTypes the second map of name/type pairs being compared 8498 * @param secondTypes the second map of name/type pairs being compared
8490 * @param visitedElementPairs a set of visited element pairs 8499 * @param visitedElementPairs a set of visited element pairs
8491 * @return `true` if all of the name/type pairs in the first map are equal to the 8500 * @return `true` if all of the name/type pairs in the first map are equal to the
8492 * corresponding name/type pairs in the second map 8501 * corresponding name/type pairs in the second map
8493 */ 8502 */
8494 static bool _equals(Map<String, DartType> firstTypes, Map<String, DartType> se condTypes, Set<ElementPair> visitedElementPairs) { 8503 static bool _equals(Map<String, DartType> firstTypes, Map<String, DartType> se condTypes, Set<ElementPair> visitedElementPairs) {
8495 if (secondTypes.length != firstTypes.length) { 8504 if (secondTypes.length != firstTypes.length) {
8496 return false; 8505 return false;
8497 } 8506 }
8498 MapIterator<String, DartType> firstIterator = SingleMapIterator.forMap(first Types); 8507 JavaIterator<MapEntry<String, DartType>> firstIterator = new JavaIterator(ge tMapEntrySet(firstTypes));
8499 MapIterator<String, DartType> secondIterator = SingleMapIterator.forMap(seco ndTypes); 8508 JavaIterator<MapEntry<String, DartType>> secondIterator = new JavaIterator(g etMapEntrySet(secondTypes));
8500 while (firstIterator.moveNext() && secondIterator.moveNext()) { 8509 while (firstIterator.hasNext) {
8501 if (firstIterator.key != secondIterator.key || !(firstIterator.value as Ty peImpl).internalEquals(secondIterator.value, visitedElementPairs)) { 8510 MapEntry<String, DartType> firstEntry = firstIterator.next();
8511 MapEntry<String, DartType> secondEntry = secondIterator.next();
8512 if (firstEntry.getKey() != secondEntry.getKey() || !(firstEntry.getValue() as TypeImpl).internalEquals(secondEntry.getValue(), visitedElementPairs)) {
8502 return false; 8513 return false;
8503 } 8514 }
8504 } 8515 }
8505 return true; 8516 return true;
8506 } 8517 }
8507 8518
8508 /** 8519 /**
8509 * An array containing the actual types of the type arguments. 8520 * An array containing the actual types of the type arguments.
8510 */ 8521 */
8511 List<DartType> typeArguments = TypeImpl.EMPTY_ARRAY; 8522 List<DartType> typeArguments = TypeImpl.EMPTY_ARRAY;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
8567 } 8578 }
8568 builder.append("]"); 8579 builder.append("]");
8569 needsComma = true; 8580 needsComma = true;
8570 } 8581 }
8571 if (namedParameterTypes.length > 0) { 8582 if (namedParameterTypes.length > 0) {
8572 if (needsComma) { 8583 if (needsComma) {
8573 builder.append(", "); 8584 builder.append(", ");
8574 needsComma = false; 8585 needsComma = false;
8575 } 8586 }
8576 builder.append("{"); 8587 builder.append("{");
8577 for (MapIterator<String, DartType> iter = SingleMapIterator.forMap(named ParameterTypes); iter.moveNext();) { 8588 for (MapEntry<String, DartType> entry in getMapEntrySet(namedParameterTy pes)) {
8578 if (needsComma) { 8589 if (needsComma) {
8579 builder.append(", "); 8590 builder.append(", ");
8580 } else { 8591 } else {
8581 needsComma = true; 8592 needsComma = true;
8582 } 8593 }
8583 builder.append(iter.key); 8594 builder.append(entry.getKey());
8584 builder.append(": "); 8595 builder.append(": ");
8585 builder.append(iter.value.displayName); 8596 builder.append(entry.getValue().displayName);
8586 } 8597 }
8587 builder.append("}"); 8598 builder.append("}");
8588 needsComma = true; 8599 needsComma = true;
8589 } 8600 }
8590 builder.append(")"); 8601 builder.append(")");
8591 builder.append(Element.RIGHT_ARROW); 8602 builder.append(Element.RIGHT_ARROW);
8592 if (returnType == null) { 8603 if (returnType == null) {
8593 builder.append("null"); 8604 builder.append("null");
8594 } else { 8605 } else {
8595 builder.append(returnType.displayName); 8606 builder.append(returnType.displayName);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
8746 } 8757 }
8747 } 8758 }
8748 Map<String, DartType> namedTypesT = t.namedParameterTypes; 8759 Map<String, DartType> namedTypesT = t.namedParameterTypes;
8749 Map<String, DartType> namedTypesS = s.namedParameterTypes; 8760 Map<String, DartType> namedTypesS = s.namedParameterTypes;
8750 // if k >= m is false, return false: the passed function type has more nam ed parameter types than this 8761 // if k >= m is false, return false: the passed function type has more nam ed parameter types than this
8751 if (namedTypesT.length < namedTypesS.length) { 8762 if (namedTypesT.length < namedTypesS.length) {
8752 return false; 8763 return false;
8753 } 8764 }
8754 // Loop through each element in S verifying that T has a matching paramete r name and that the 8765 // Loop through each element in S verifying that T has a matching paramete r name and that the
8755 // corresponding type is more specific then the type in S. 8766 // corresponding type is more specific then the type in S.
8756 MapIterator<String, DartType> iteratorS = SingleMapIterator.forMap(namedTy pesS); 8767 JavaIterator<MapEntry<String, DartType>> iteratorS = new JavaIterator(getM apEntrySet(namedTypesS));
8757 while (iteratorS.moveNext()) { 8768 while (iteratorS.hasNext) {
8758 DartType typeT = namedTypesT[iteratorS.key]; 8769 MapEntry<String, DartType> entryS = iteratorS.next();
8770 DartType typeT = namedTypesT[entryS.getKey()];
8759 if (typeT == null) { 8771 if (typeT == null) {
8760 return false; 8772 return false;
8761 } 8773 }
8762 if (!(typeT as TypeImpl).isMoreSpecificThan2(iteratorS.value, withDynami c, visitedTypePairs)) { 8774 if (!(typeT as TypeImpl).isMoreSpecificThan2(entryS.getValue(), withDyna mic, visitedTypePairs)) {
8763 return false; 8775 return false;
8764 } 8776 }
8765 } 8777 }
8766 } else if (s.namedParameterTypes.length > 0) { 8778 } else if (s.namedParameterTypes.length > 0) {
8767 return false; 8779 return false;
8768 } else { 8780 } else {
8769 // positional parameter case 8781 // positional parameter case
8770 int tArgLength = tTypes.length + tOpTypes.length; 8782 int tArgLength = tTypes.length + tOpTypes.length;
8771 int sArgLength = sTypes.length + sOpTypes.length; 8783 int sArgLength = sTypes.length + sOpTypes.length;
8772 // Check that the total number of parameters in t is greater than or equal to the number of 8784 // Check that the total number of parameters in t is greater than or equal to the number of
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
8865 } 8877 }
8866 builder.append("]"); 8878 builder.append("]");
8867 needsComma = true; 8879 needsComma = true;
8868 } 8880 }
8869 if (namedParameterTypes.length > 0) { 8881 if (namedParameterTypes.length > 0) {
8870 if (needsComma) { 8882 if (needsComma) {
8871 builder.append(", "); 8883 builder.append(", ");
8872 needsComma = false; 8884 needsComma = false;
8873 } 8885 }
8874 builder.append("{"); 8886 builder.append("{");
8875 for (MapIterator<String, DartType> iter = SingleMapIterator.forMap(namedPa rameterTypes); iter.moveNext();) { 8887 for (MapEntry<String, DartType> entry in getMapEntrySet(namedParameterType s)) {
8876 if (needsComma) { 8888 if (needsComma) {
8877 builder.append(", "); 8889 builder.append(", ");
8878 } else { 8890 } else {
8879 needsComma = true; 8891 needsComma = true;
8880 } 8892 }
8881 builder.append(iter.key); 8893 builder.append(entry.getKey());
8882 builder.append(": "); 8894 builder.append(": ");
8883 (iter.value as TypeImpl).appendTo(builder); 8895 (entry.getValue() as TypeImpl).appendTo(builder);
8884 } 8896 }
8885 builder.append("}"); 8897 builder.append("}");
8886 needsComma = true; 8898 needsComma = true;
8887 } 8899 }
8888 builder.append(")"); 8900 builder.append(")");
8889 builder.append(Element.RIGHT_ARROW); 8901 builder.append(Element.RIGHT_ARROW);
8890 if (returnType == null) { 8902 if (returnType == null) {
8891 builder.append("null"); 8903 builder.append("null");
8892 } else { 8904 } else {
8893 (returnType as TypeImpl).appendTo(builder); 8905 (returnType as TypeImpl).appendTo(builder);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
8961 } 8973 }
8962 } 8974 }
8963 Map<String, DartType> namedTypesT = t.namedParameterTypes; 8975 Map<String, DartType> namedTypesT = t.namedParameterTypes;
8964 Map<String, DartType> namedTypesS = s.namedParameterTypes; 8976 Map<String, DartType> namedTypesS = s.namedParameterTypes;
8965 // if k >= m is false, return false: the passed function type has more nam ed parameter types than this 8977 // if k >= m is false, return false: the passed function type has more nam ed parameter types than this
8966 if (namedTypesT.length < namedTypesS.length) { 8978 if (namedTypesT.length < namedTypesS.length) {
8967 return false; 8979 return false;
8968 } 8980 }
8969 // Loop through each element in S verifying that T has a matching paramete r name and that the 8981 // Loop through each element in S verifying that T has a matching paramete r name and that the
8970 // corresponding type is assignable to the type in S. 8982 // corresponding type is assignable to the type in S.
8971 MapIterator<String, DartType> iteratorS = SingleMapIterator.forMap(namedTy pesS); 8983 JavaIterator<MapEntry<String, DartType>> iteratorS = new JavaIterator(getM apEntrySet(namedTypesS));
8972 while (iteratorS.moveNext()) { 8984 while (iteratorS.hasNext) {
8973 DartType typeT = namedTypesT[iteratorS.key]; 8985 MapEntry<String, DartType> entryS = iteratorS.next();
8986 DartType typeT = namedTypesT[entryS.getKey()];
8974 if (typeT == null) { 8987 if (typeT == null) {
8975 return false; 8988 return false;
8976 } 8989 }
8977 if (!(typeT as TypeImpl).isAssignableTo2(iteratorS.value, visitedTypePai rs)) { 8990 if (!(typeT as TypeImpl).isAssignableTo2(entryS.getValue(), visitedTypeP airs)) {
8978 return false; 8991 return false;
8979 } 8992 }
8980 } 8993 }
8981 } else if (s.namedParameterTypes.length > 0) { 8994 } else if (s.namedParameterTypes.length > 0) {
8982 return false; 8995 return false;
8983 } else { 8996 } else {
8984 // positional parameter case 8997 // positional parameter case
8985 int tArgLength = tTypes.length + tOpTypes.length; 8998 int tArgLength = tTypes.length + tOpTypes.length;
8986 int sArgLength = sTypes.length + sOpTypes.length; 8999 int sArgLength = sTypes.length + sOpTypes.length;
8987 // Check that the total number of parameters in t is greater than or equal to the number of 9000 // Check that the total number of parameters in t is greater than or equal to the number of
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
9123 * callers should call the public [computeSuperinterfaceSet]. 9136 * callers should call the public [computeSuperinterfaceSet].
9124 * 9137 *
9125 * @param type the [Type] to compute the set of superinterfaces of 9138 * @param type the [Type] to compute the set of superinterfaces of
9126 * @param set a [HashSet] used recursively by this method 9139 * @param set a [HashSet] used recursively by this method
9127 * @return the [Set] of superinterfaces of the passed [Type] 9140 * @return the [Set] of superinterfaces of the passed [Type]
9128 * @see #computeSuperinterfaceSet(Type) 9141 * @see #computeSuperinterfaceSet(Type)
9129 * @see #getLeastUpperBound(Type) 9142 * @see #getLeastUpperBound(Type)
9130 */ 9143 */
9131 static Set<InterfaceType> _computeSuperinterfaceSet(InterfaceType type, Set<In terfaceType> set) { 9144 static Set<InterfaceType> _computeSuperinterfaceSet(InterfaceType type, Set<In terfaceType> set) {
9132 Element element = type.element; 9145 Element element = type.element;
9133 if (element != null && element is ClassElement) { 9146 if (element != null) {
9134 ClassElement classElement = element; 9147 List<InterfaceType> superinterfaces = type.interfaces;
9135 List<InterfaceType> superinterfaces = classElement.interfaces;
9136 for (InterfaceType superinterface in superinterfaces) { 9148 for (InterfaceType superinterface in superinterfaces) {
9137 if (set.add(superinterface)) { 9149 if (set.add(superinterface)) {
9138 _computeSuperinterfaceSet(superinterface, set); 9150 _computeSuperinterfaceSet(superinterface, set);
9139 } 9151 }
9140 } 9152 }
9141 InterfaceType supertype = classElement.supertype; 9153 InterfaceType supertype = type.superclass;
9142 if (supertype != null) { 9154 if (supertype != null) {
9143 if (set.add(supertype)) { 9155 if (set.add(supertype)) {
9144 _computeSuperinterfaceSet(supertype, set); 9156 _computeSuperinterfaceSet(supertype, set);
9145 } 9157 }
9146 } 9158 }
9147 } 9159 }
9148 return set; 9160 return set;
9149 } 9161 }
9150 9162
9151 /** 9163 /**
9152 * Return the intersection of the given sets of types, where intersection is b ased on the equality 9164 * Return the intersection of the given sets of types, where intersection is b ased on the equality
9153 * of the elements of the types rather than on the equality of the types thems elves. In cases 9165 * of the types themselves.
9154 * where two non-equal types have equal elements, which only happens when the class is
9155 * parameterized, the type that is added to the intersection is the base type with type arguments
9156 * that are the least upper bound of the type arguments of the two types.
9157 * 9166 *
9158 * @param first the first set of types to be intersected 9167 * @param first the first set of types to be intersected
9159 * @param second the second set of types to be intersected 9168 * @param second the second set of types to be intersected
9160 * @return the intersection of the given sets of types 9169 * @return the intersection of the given sets of types
9161 */ 9170 */
9162 static List<InterfaceType> _intersection(Set<InterfaceType> first, Set<Interfa ceType> second) { 9171 static List<InterfaceType> _intersection(Set<InterfaceType> first, Set<Interfa ceType> second) {
9163 Map<ClassElement, InterfaceType> firstMap = new Map<ClassElement, InterfaceT ype>(); 9172 Set<InterfaceType> result = new Set<InterfaceType>.from(first);
9164 for (InterfaceType firstType in first) { 9173 result.retainAll(second);
9165 firstMap[firstType.element] = firstType;
9166 }
9167 Set<InterfaceType> result = new Set<InterfaceType>();
9168 for (InterfaceType secondType in second) {
9169 InterfaceType firstType = firstMap[secondType.element];
9170 if (firstType != null) {
9171 result.add(_leastUpperBound(firstType, secondType));
9172 }
9173 }
9174 return new List.from(result); 9174 return new List.from(result);
9175 } 9175 }
9176 9176
9177 /** 9177 /**
9178 * Return the "least upper bound" of the given types under the assumption that the types have the 9178 * Return the "least upper bound" of the given types under the assumption that the types have the
9179 * same element and differ only in terms of the type arguments. The resulting type is composed by 9179 * same element and differ only in terms of the type arguments. The resulting type is composed by
9180 * comparing the corresponding type arguments, keeping those that are the same , and using 9180 * comparing the corresponding type arguments, keeping those that are the same , and using
9181 * 'dynamic' for those that are different. 9181 * 'dynamic' for those that are different.
9182 * 9182 *
9183 * @param firstType the first type 9183 * @param firstType the first type
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
10766 } 10766 }
10767 10767
10768 /** 10768 /**
10769 * The interface `VoidType` defines the behavior of the unique object representi ng the type 10769 * The interface `VoidType` defines the behavior of the unique object representi ng the type
10770 * `void`. 10770 * `void`.
10771 */ 10771 */
10772 abstract class VoidType implements DartType { 10772 abstract class VoidType implements DartType {
10773 @override 10773 @override
10774 VoidType substitute2(List<DartType> argumentTypes, List<DartType> parameterTyp es); 10774 VoidType substitute2(List<DartType> argumentTypes, List<DartType> parameterTyp es);
10775 } 10775 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698