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

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

Issue 263913003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/engine.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 // 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 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 /** 2711 /**
2712 * Return the element that either physically or logically encloses this elemen t. This will be 2712 * Return the element that either physically or logically encloses this elemen t. This will be
2713 * `null` if this element is a library because libraries are the top-level ele ments in the 2713 * `null` if this element is a library because libraries are the top-level ele ments in the
2714 * model. 2714 * model.
2715 * 2715 *
2716 * @return the element that encloses this element 2716 * @return the element that encloses this element
2717 */ 2717 */
2718 Element get enclosingElement; 2718 Element get enclosingElement;
2719 2719
2720 /** 2720 /**
2721 * Return a display name for the given element that includes the path to the c ompilation unit in
2722 * which the type is defined.
2723 *
2724 * @param type the type for which an extended display name is to be returned
2725 * @return a display name that can help distinguish between two types with the same name
2726 */
2727 String get extendedDisplayName;
2728
2729 /**
2721 * Return the kind of element that this is. 2730 * Return the kind of element that this is.
2722 * 2731 *
2723 * @return the kind of this element 2732 * @return the kind of this element
2724 */ 2733 */
2725 ElementKind get kind; 2734 ElementKind get kind;
2726 2735
2727 /** 2736 /**
2728 * Return the library that contains this element. This will be the element its elf if it is a 2737 * Return the library that contains this element. This will be the element its elf if it is a
2729 * library element. This will be `null` if this element is an HTML file becaus e HTML files 2738 * library element. This will be `null` if this element is an HTML file becaus e HTML files
2730 * are not contained in libraries. 2739 * are not contained in libraries.
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 return _enclosingElement.context; 3097 return _enclosingElement.context;
3089 } 3098 }
3090 3099
3091 @override 3100 @override
3092 String get displayName => _name; 3101 String get displayName => _name;
3093 3102
3094 @override 3103 @override
3095 Element get enclosingElement => _enclosingElement; 3104 Element get enclosingElement => _enclosingElement;
3096 3105
3097 @override 3106 @override
3107 String get extendedDisplayName {
3108 String displayName = this.displayName;
3109 Source source = this.source;
3110 if (source != null) {
3111 return "${displayName} (${source.fullName})";
3112 }
3113 return displayName;
3114 }
3115
3116 @override
3098 LibraryElement get library => getAncestor((element) => element is LibraryEleme nt); 3117 LibraryElement get library => getAncestor((element) => element is LibraryEleme nt);
3099 3118
3100 @override 3119 @override
3101 ElementLocation get location => new ElementLocationImpl.con1(this); 3120 ElementLocation get location => new ElementLocationImpl.con1(this);
3102 3121
3103 @override 3122 @override
3104 String get name => _name; 3123 String get name => _name;
3105 3124
3106 @override 3125 @override
3107 AstNode get node => getNodeMatching((node) => node is AstNode); 3126 AstNode get node => getNodeMatching((node) => node is AstNode);
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4439 4458
4440 @override 4459 @override
4441 InterfaceType get definingType => super.definingType as InterfaceType; 4460 InterfaceType get definingType => super.definingType as InterfaceType;
4442 } 4461 }
4443 4462
4444 /** 4463 /**
4445 * The interface `FunctionElement` defines the behavior of elements representing a function. 4464 * The interface `FunctionElement` defines the behavior of elements representing a function.
4446 */ 4465 */
4447 abstract class FunctionElement implements ExecutableElement, LocalElement { 4466 abstract class FunctionElement implements ExecutableElement, LocalElement {
4448 /** 4467 /**
4468 * The name of the method that can be implemented by a class to allow its inst ances to be invoked
4469 * as if they were a function.
4470 */
4471 static final String CALL_METHOD_NAME = "call";
4472
4473 /**
4474 * The name of the method that will be invoked if an attempt is made to invoke an undefined method
4475 * on an object.
4476 */
4477 static final String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod";
4478
4479 /**
4449 * The name of the synthetic function defined for libraries that are deferred. 4480 * The name of the synthetic function defined for libraries that are deferred.
4450 */ 4481 */
4451 static final String LOAD_LIBRARY_NAME = "loadLibrary"; 4482 static final String LOAD_LIBRARY_NAME = "loadLibrary";
4452 4483
4453 /** 4484 /**
4454 * Return the resolved [FunctionDeclaration] node that declares this [Function Element] 4485 * Return the resolved [FunctionDeclaration] node that declares this [Function Element]
4455 * . 4486 * .
4456 * 4487 *
4457 * This method is expensive, because resolved AST might be evicted from cache, so parsing and 4488 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
4458 * resolving will be performed. 4489 * resolving will be performed.
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
5019 @override 5050 @override
5020 Map<String, DartType> get namedParameterTypes { 5051 Map<String, DartType> get namedParameterTypes {
5021 LinkedHashMap<String, DartType> namedParameterTypes = new LinkedHashMap<Stri ng, DartType>(); 5052 LinkedHashMap<String, DartType> namedParameterTypes = new LinkedHashMap<Stri ng, DartType>();
5022 List<ParameterElement> parameters = baseParameters; 5053 List<ParameterElement> parameters = baseParameters;
5023 if (parameters.length == 0) { 5054 if (parameters.length == 0) {
5024 return namedParameterTypes; 5055 return namedParameterTypes;
5025 } 5056 }
5026 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters); 5057 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters);
5027 for (ParameterElement parameter in parameters) { 5058 for (ParameterElement parameter in parameters) {
5028 if (parameter.parameterKind == ParameterKind.NAMED) { 5059 if (parameter.parameterKind == ParameterKind.NAMED) {
5029 namedParameterTypes[parameter.name] = parameter.type.substitute2(typeArg uments, typeParameters); 5060 DartType type = parameter.type;
5061 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) {
5062 type = type.substitute2(typeArguments, typeParameters);
5063 }
5064 namedParameterTypes[parameter.name] = type;
5030 } 5065 }
5031 } 5066 }
5032 return namedParameterTypes; 5067 return namedParameterTypes;
5033 } 5068 }
5034 5069
5035 @override 5070 @override
5036 List<DartType> get normalParameterTypes { 5071 List<DartType> get normalParameterTypes {
5037 List<ParameterElement> parameters = baseParameters; 5072 List<ParameterElement> parameters = baseParameters;
5038 if (parameters.length == 0) { 5073 if (parameters.length == 0) {
5039 return TypeImpl.EMPTY_ARRAY; 5074 return TypeImpl.EMPTY_ARRAY;
5040 } 5075 }
5041 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters); 5076 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters);
5042 List<DartType> types = new List<DartType>(); 5077 List<DartType> types = new List<DartType>();
5043 for (ParameterElement parameter in parameters) { 5078 for (ParameterElement parameter in parameters) {
5044 if (parameter.parameterKind == ParameterKind.REQUIRED) { 5079 if (parameter.parameterKind == ParameterKind.REQUIRED) {
5045 types.add(parameter.type.substitute2(typeArguments, typeParameters)); 5080 DartType type = parameter.type;
5081 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) {
5082 type = type.substitute2(typeArguments, typeParameters);
5083 }
5084 types.add(type);
5046 } 5085 }
5047 } 5086 }
5048 return new List.from(types); 5087 return new List.from(types);
5049 } 5088 }
5050 5089
5051 @override 5090 @override
5052 List<DartType> get optionalParameterTypes { 5091 List<DartType> get optionalParameterTypes {
5053 List<ParameterElement> parameters = baseParameters; 5092 List<ParameterElement> parameters = baseParameters;
5054 if (parameters.length == 0) { 5093 if (parameters.length == 0) {
5055 return TypeImpl.EMPTY_ARRAY; 5094 return TypeImpl.EMPTY_ARRAY;
5056 } 5095 }
5057 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters); 5096 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters);
5058 List<DartType> types = new List<DartType>(); 5097 List<DartType> types = new List<DartType>();
5059 for (ParameterElement parameter in parameters) { 5098 for (ParameterElement parameter in parameters) {
5060 if (parameter.parameterKind == ParameterKind.POSITIONAL) { 5099 if (parameter.parameterKind == ParameterKind.POSITIONAL) {
5061 types.add(parameter.type.substitute2(typeArguments, typeParameters)); 5100 DartType type = parameter.type;
5101 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) {
5102 type = type.substitute2(typeArguments, typeParameters);
5103 }
5104 types.add(type);
5062 } 5105 }
5063 } 5106 }
5064 return new List.from(types); 5107 return new List.from(types);
5065 } 5108 }
5066 5109
5067 @override 5110 @override
5068 List<ParameterElement> get parameters { 5111 List<ParameterElement> get parameters {
5069 List<ParameterElement> baseParameters = this.baseParameters; 5112 List<ParameterElement> baseParameters = this.baseParameters;
5070 // no parameters, quick return 5113 // no parameters, quick return
5071 int parameterCount = baseParameters.length; 5114 int parameterCount = baseParameters.length;
5072 if (parameterCount == 0) { 5115 if (parameterCount == 0) {
5073 return baseParameters; 5116 return baseParameters;
5074 } 5117 }
5075 // create specialized parameters 5118 // create specialized parameters
5076 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa rameterCount); 5119 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa rameterCount);
5077 for (int i = 0; i < parameterCount; i++) { 5120 for (int i = 0; i < parameterCount; i++) {
5078 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); 5121 specializedParameters[i] = ParameterMember.from(baseParameters[i], this);
5079 } 5122 }
5080 return specializedParameters; 5123 return specializedParameters;
5081 } 5124 }
5082 5125
5083 @override 5126 @override
5084 DartType get returnType { 5127 DartType get returnType {
5085 DartType baseReturnType = this.baseReturnType; 5128 DartType baseReturnType = this.baseReturnType;
5086 if (baseReturnType == null) { 5129 if (baseReturnType == null) {
5087 // TODO(brianwilkerson) This is a patch. The return type should never be n ull and we need to 5130 // TODO(brianwilkerson) This is a patch. The return type should never be n ull and we need to
5088 // understand why it is and fix it. 5131 // understand why it is and fix it.
5089 return DynamicTypeImpl.instance; 5132 return DynamicTypeImpl.instance;
5090 } 5133 }
5134 // If there are no arguments to substitute, or if the arguments size doesn't match the parameter
5135 // size, return the base return type.
5136 if (typeArguments.length == 0 || typeArguments.length != typeParameters.leng th) {
5137 return baseReturnType;
5138 }
5091 return baseReturnType.substitute2(typeArguments, TypeParameterTypeImpl.getTy pes(typeParameters)); 5139 return baseReturnType.substitute2(typeArguments, TypeParameterTypeImpl.getTy pes(typeParameters));
5092 } 5140 }
5093 5141
5094 @override 5142 @override
5095 List<TypeParameterElement> get typeParameters { 5143 List<TypeParameterElement> get typeParameters {
5096 Element element = this.element; 5144 Element element = this.element;
5097 if (element is FunctionTypeAliasElement) { 5145 if (element is FunctionTypeAliasElement) {
5098 return element.typeParameters; 5146 return element.typeParameters;
5099 } 5147 }
5100 ClassElement definingClass = element.getAncestor((element) => element is Cla ssElement); 5148 ClassElement definingClass = element.getAncestor((element) => element is Cla ssElement);
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
6620 @override 6668 @override
6621 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember .from((element as ClassElementImpl).getSetter(setterName), this); 6669 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember .from((element as ClassElementImpl).getSetter(setterName), this);
6622 6670
6623 @override 6671 @override
6624 InterfaceType get superclass { 6672 InterfaceType get superclass {
6625 ClassElement classElement = element; 6673 ClassElement classElement = element;
6626 InterfaceType supertype = classElement.supertype; 6674 InterfaceType supertype = classElement.supertype;
6627 if (supertype == null) { 6675 if (supertype == null) {
6628 return null; 6676 return null;
6629 } 6677 }
6630 return supertype.substitute2(typeArguments, classElement.type.typeArguments) ; 6678 List<DartType> typeParameters = classElement.type.typeArguments;
6679 if (typeArguments.length == 0 || typeArguments.length != typeParameters.leng th) {
6680 return supertype;
6681 }
6682 return supertype.substitute2(typeArguments, typeParameters);
6631 } 6683 }
6632 6684
6633 @override 6685 @override
6634 List<TypeParameterElement> get typeParameters => element.typeParameters; 6686 List<TypeParameterElement> get typeParameters => element.typeParameters;
6635 6687
6636 @override 6688 @override
6637 int get hashCode { 6689 int get hashCode {
6638 ClassElement element = this.element; 6690 ClassElement element = this.element;
6639 if (element == null) { 6691 if (element == null) {
6640 return 0; 6692 return 0;
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
7906 */ 7958 */
7907 Element get baseElement => _baseElement; 7959 Element get baseElement => _baseElement;
7908 7960
7909 @override 7961 @override
7910 AnalysisContext get context => _baseElement.context; 7962 AnalysisContext get context => _baseElement.context;
7911 7963
7912 @override 7964 @override
7913 String get displayName => _baseElement.displayName; 7965 String get displayName => _baseElement.displayName;
7914 7966
7915 @override 7967 @override
7968 String get extendedDisplayName => _baseElement.extendedDisplayName;
7969
7970 @override
7916 ElementKind get kind => _baseElement.kind; 7971 ElementKind get kind => _baseElement.kind;
7917 7972
7918 @override 7973 @override
7919 LibraryElement get library => _baseElement.library; 7974 LibraryElement get library => _baseElement.library;
7920 7975
7921 @override 7976 @override
7922 ElementLocation get location => _baseElement.location; 7977 ElementLocation get location => _baseElement.location;
7923 7978
7924 @override 7979 @override
7925 List<ElementAnnotation> get metadata => _baseElement.metadata; 7980 List<ElementAnnotation> get metadata => _baseElement.metadata;
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
8426 @override 8481 @override
8427 Element getAncestor(Predicate<Element> predicate) => null; 8482 Element getAncestor(Predicate<Element> predicate) => null;
8428 8483
8429 @override 8484 @override
8430 String get displayName => _name; 8485 String get displayName => _name;
8431 8486
8432 @override 8487 @override
8433 Element get enclosingElement => null; 8488 Element get enclosingElement => null;
8434 8489
8435 @override 8490 @override
8491 String get extendedDisplayName => displayName;
8492
8493 @override
8436 ElementKind get kind => ElementKind.ERROR; 8494 ElementKind get kind => ElementKind.ERROR;
8437 8495
8438 @override 8496 @override
8439 LibraryElement get library => null; 8497 LibraryElement get library => null;
8440 8498
8441 @override 8499 @override
8442 ElementLocation get location => null; 8500 ElementLocation get location => null;
8443 8501
8444 @override 8502 @override
8445 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY; 8503 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY;
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
10394 * Instances of the class `TypeParameterTypeImpl` defines the behavior of object s representing 10452 * Instances of the class `TypeParameterTypeImpl` defines the behavior of object s representing
10395 * the type introduced by a type parameter. 10453 * the type introduced by a type parameter.
10396 */ 10454 */
10397 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType { 10455 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
10398 /** 10456 /**
10399 * An empty array of type parameter types. 10457 * An empty array of type parameter types.
10400 */ 10458 */
10401 static List<TypeParameterType> EMPTY_ARRAY = new List<TypeParameterType>(0); 10459 static List<TypeParameterType> EMPTY_ARRAY = new List<TypeParameterType>(0);
10402 10460
10403 /** 10461 /**
10462 * The name of the type Type from dart.core.
10463 */
10464 static String _TYPE_CLASS_NAME = "Type";
10465
10466 /**
10404 * Return an array containing the type parameter types defined by the given ar ray of type 10467 * Return an array containing the type parameter types defined by the given ar ray of type
10405 * parameter elements. 10468 * parameter elements.
10406 * 10469 *
10407 * @param typeParameters the type parameter elements defining the type paramet er types to be 10470 * @param typeParameters the type parameter elements defining the type paramet er types to be
10408 * returned 10471 * returned
10409 * @return the type parameter types defined by the type parameter elements 10472 * @return the type parameter types defined by the type parameter elements
10410 */ 10473 */
10411 static List<TypeParameterType> getTypes(List<TypeParameterElement> typeParamet ers) { 10474 static List<TypeParameterType> getTypes(List<TypeParameterElement> typeParamet ers) {
10412 int count = typeParameters.length; 10475 int count = typeParameters.length;
10413 if (count == 0) { 10476 if (count == 0) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
10472 if (s.isDynamic) { 10535 if (s.isDynamic) {
10473 return true; 10536 return true;
10474 } 10537 }
10475 return _isMoreSpecificThan(s, new Set<DartType>(), withDynamic, visitedTypeP airs); 10538 return _isMoreSpecificThan(s, new Set<DartType>(), withDynamic, visitedTypeP airs);
10476 } 10539 }
10477 10540
10478 @override 10541 @override
10479 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair s) => isMoreSpecificThan2(type, true, new Set<TypeImpl_TypePair>()); 10542 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair s) => isMoreSpecificThan2(type, true, new Set<TypeImpl_TypePair>());
10480 10543
10481 bool _isMoreSpecificThan(DartType s, Set<DartType> visitedTypes, bool withDyna mic, Set<TypeImpl_TypePair> visitedTypePairs) { 10544 bool _isMoreSpecificThan(DartType s, Set<DartType> visitedTypes, bool withDyna mic, Set<TypeImpl_TypePair> visitedTypePairs) {
10545 //
10546 // If s is of type Type from dart.core, return true
10547 //
10548 Element sElement = s.element;
10549 LibraryElement sLibrary = sElement != null ? sElement.library : null;
10550 if (sLibrary != null && sLibrary.isDartCore && s.name == _TYPE_CLASS_NAME) {
10551 return true;
10552 }
10553 //
10482 // T is a type parameter and S is the upper bound of T. 10554 // T is a type parameter and S is the upper bound of T.
10483 // 10555 //
10484 DartType bound = element.bound; 10556 DartType bound = element.bound;
10485 if (s == bound) { 10557 if (s == bound) {
10486 return true; 10558 return true;
10487 } 10559 }
10560 //
10488 // T is a type parameter and S is Object. 10561 // T is a type parameter and S is Object.
10489 // 10562 //
10490 if (s.isObject) { 10563 if (s.isObject) {
10491 return true; 10564 return true;
10492 } 10565 }
10493 // We need upper bound to continue. 10566 // We need upper bound to continue.
10494 if (bound == null) { 10567 if (bound == null) {
10495 return false; 10568 return false;
10496 } 10569 }
10497 // 10570 //
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
10851 10924
10852 @override 10925 @override
10853 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id entical(object, this); 10926 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id entical(object, this);
10854 10927
10855 @override 10928 @override
10856 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_ TypePair> visitedTypePairs) => isSubtypeOf(type); 10929 bool internalIsMoreSpecificThan(DartType type, bool withDynamic, Set<TypeImpl_ TypePair> visitedTypePairs) => isSubtypeOf(type);
10857 10930
10858 @override 10931 @override
10859 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair s) => identical(type, this) || identical(type, DynamicTypeImpl.instance); 10932 bool internalIsSubtypeOf(DartType type, Set<TypeImpl_TypePair> visitedTypePair s) => identical(type, this) || identical(type, DynamicTypeImpl.instance);
10860 } 10933 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698