| OLD | NEW |
| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 */ | 501 */ |
| 502 String computeDocumentationComment(); | 502 String computeDocumentationComment(); |
| 503 | 503 |
| 504 /** | 504 /** |
| 505 * Return the element of the given class that most immediately encloses this e
lement, or | 505 * Return the element of the given class that most immediately encloses this e
lement, or |
| 506 * `null` if there is no enclosing element of the given class. | 506 * `null` if there is no enclosing element of the given class. |
| 507 * | 507 * |
| 508 * @param elementClass the class of the element to be returned | 508 * @param elementClass the class of the element to be returned |
| 509 * @return the element that encloses this element | 509 * @return the element that encloses this element |
| 510 */ | 510 */ |
| 511 Element getAncestor(Type elementClass); | 511 Element getAncestor(Predicate<Element> predicate); |
| 512 | 512 |
| 513 /** | 513 /** |
| 514 * Return the analysis context in which this element is defined. | 514 * Return the analysis context in which this element is defined. |
| 515 * | 515 * |
| 516 * @return the analysis context in which this element is defined | 516 * @return the analysis context in which this element is defined |
| 517 */ | 517 */ |
| 518 AnalysisContext get context; | 518 AnalysisContext get context; |
| 519 | 519 |
| 520 /** | 520 /** |
| 521 * Return the display name of this element, or `null` if this element does not
have a name. | 521 * Return the display name of this element, or `null` if this element does not
have a name. |
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 ConstructorElement getNamedConstructor(String name) { | 2611 ConstructorElement getNamedConstructor(String name) { |
| 2612 for (ConstructorElement element in constructors) { | 2612 for (ConstructorElement element in constructors) { |
| 2613 String elementName = element.name; | 2613 String elementName = element.name; |
| 2614 if (elementName != null && elementName == name) { | 2614 if (elementName != null && elementName == name) { |
| 2615 return element; | 2615 return element; |
| 2616 } | 2616 } |
| 2617 } | 2617 } |
| 2618 return null; | 2618 return null; |
| 2619 } | 2619 } |
| 2620 | 2620 |
| 2621 ClassDeclaration get node => getNode2(ClassDeclaration); | 2621 ClassDeclaration get node => getNode2((node) => node is ClassDeclaration); |
| 2622 | 2622 |
| 2623 PropertyAccessorElement getSetter(String setterName) { | 2623 PropertyAccessorElement getSetter(String setterName) { |
| 2624 // TODO (jwren) revisit- should we append '=' here or require clients to inc
lude it? | 2624 // TODO (jwren) revisit- should we append '=' here or require clients to inc
lude it? |
| 2625 // Do we need the check for isSetter below? | 2625 // Do we need the check for isSetter below? |
| 2626 if (!StringUtilities.endsWithChar(setterName, 0x3D)) { | 2626 if (!StringUtilities.endsWithChar(setterName, 0x3D)) { |
| 2627 setterName += '='; | 2627 setterName += '='; |
| 2628 } | 2628 } |
| 2629 for (PropertyAccessorElement accessor in _accessors) { | 2629 for (PropertyAccessorElement accessor in _accessors) { |
| 2630 if (accessor.isSetter && accessor.name == setterName) { | 2630 if (accessor.isSetter && accessor.name == setterName) { |
| 2631 return accessor; | 2631 return accessor; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 } | 2677 } |
| 2678 } | 2678 } |
| 2679 // not found | 2679 // not found |
| 2680 return false; | 2680 return false; |
| 2681 } | 2681 } |
| 2682 | 2682 |
| 2683 bool hasReferenceToSuper() => hasModifier(Modifier.REFERENCES_SUPER); | 2683 bool hasReferenceToSuper() => hasModifier(Modifier.REFERENCES_SUPER); |
| 2684 | 2684 |
| 2685 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 2685 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 2686 | 2686 |
| 2687 bool get isOrInheritsProxy => isOrInheritsProxy2(this, new Set<ClassElement>()
); | 2687 bool get isOrInheritsProxy => safeIsOrInheritsProxy(this, new Set<ClassElement
>()); |
| 2688 | 2688 |
| 2689 bool get isProxy { | 2689 bool get isProxy { |
| 2690 for (ElementAnnotation annotation in metadata) { | 2690 for (ElementAnnotation annotation in metadata) { |
| 2691 if (annotation.isProxy) { | 2691 if (annotation.isProxy) { |
| 2692 return true; | 2692 return true; |
| 2693 } | 2693 } |
| 2694 } | 2694 } |
| 2695 return false; | 2695 return false; |
| 2696 } | 2696 } |
| 2697 | 2697 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2940 for (InterfaceType type in currentElement.mixins) { | 2940 for (InterfaceType type in currentElement.mixins) { |
| 2941 ClassElement element = type.element; | 2941 ClassElement element = type.element; |
| 2942 if (!visitedClasses.contains(element)) { | 2942 if (!visitedClasses.contains(element)) { |
| 2943 supertypes.add(type); | 2943 supertypes.add(type); |
| 2944 } | 2944 } |
| 2945 } | 2945 } |
| 2946 } | 2946 } |
| 2947 } | 2947 } |
| 2948 } | 2948 } |
| 2949 | 2949 |
| 2950 bool isOrInheritsProxy2(ClassElement classElt, Set<ClassElement> visitedClassE
lts) { | 2950 bool safeIsOrInheritsProxy(ClassElement classElt, Set<ClassElement> visitedCla
ssElts) { |
| 2951 if (visitedClassElts.contains(classElt)) { | 2951 if (visitedClassElts.contains(classElt)) { |
| 2952 return false; | 2952 return false; |
| 2953 } | 2953 } |
| 2954 visitedClassElts.add(classElt); | 2954 visitedClassElts.add(classElt); |
| 2955 if (classElt.isProxy) { | 2955 if (classElt.isProxy) { |
| 2956 return true; | 2956 return true; |
| 2957 } else if (classElt.supertype != null && isOrInheritsProxy2(classElt.superty
pe.element, visitedClassElts)) { | 2957 } else if (classElt.supertype != null && safeIsOrInheritsProxy(classElt.supe
rtype.element, visitedClassElts)) { |
| 2958 return true; | 2958 return true; |
| 2959 } | 2959 } |
| 2960 List<InterfaceType> supertypes = classElt.interfaces; | 2960 List<InterfaceType> supertypes = classElt.interfaces; |
| 2961 for (int i = 0; i < supertypes.length; i++) { | 2961 for (int i = 0; i < supertypes.length; i++) { |
| 2962 if (isOrInheritsProxy2(supertypes[i].element, visitedClassElts)) { | 2962 if (safeIsOrInheritsProxy(supertypes[i].element, visitedClassElts)) { |
| 2963 return true; | 2963 return true; |
| 2964 } | 2964 } |
| 2965 } | 2965 } |
| 2966 supertypes = classElt.mixins; | 2966 supertypes = classElt.mixins; |
| 2967 for (int i = 0; i < supertypes.length; i++) { | 2967 for (int i = 0; i < supertypes.length; i++) { |
| 2968 if (isOrInheritsProxy2(supertypes[i].element, visitedClassElts)) { | 2968 if (safeIsOrInheritsProxy(supertypes[i].element, visitedClassElts)) { |
| 2969 return true; | 2969 return true; |
| 2970 } | 2970 } |
| 2971 } | 2971 } |
| 2972 return false; | 2972 return false; |
| 2973 } | 2973 } |
| 2974 } | 2974 } |
| 2975 | 2975 |
| 2976 /** | 2976 /** |
| 2977 * Instances of the class `CompilationUnitElementImpl` implement a | 2977 * Instances of the class `CompilationUnitElementImpl` implement a |
| 2978 * [CompilationUnitElement]. | 2978 * [CompilationUnitElement]. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3322 * declaration of this element | 3322 * declaration of this element |
| 3323 */ | 3323 */ |
| 3324 ConstructorElementImpl.con2(String name, int nameOffset) : super.con2(name, na
meOffset); | 3324 ConstructorElementImpl.con2(String name, int nameOffset) : super.con2(name, na
meOffset); |
| 3325 | 3325 |
| 3326 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 3326 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 3327 | 3327 |
| 3328 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 3328 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| 3329 | 3329 |
| 3330 ElementKind get kind => ElementKind.CONSTRUCTOR; | 3330 ElementKind get kind => ElementKind.CONSTRUCTOR; |
| 3331 | 3331 |
| 3332 ConstructorDeclaration get node => getNode2(ConstructorDeclaration); | 3332 ConstructorDeclaration get node => getNode2((node) => node is ConstructorDecla
ration); |
| 3333 | 3333 |
| 3334 bool get isConst => hasModifier(Modifier.CONST); | 3334 bool get isConst => hasModifier(Modifier.CONST); |
| 3335 | 3335 |
| 3336 bool get isDefaultConstructor { | 3336 bool get isDefaultConstructor { |
| 3337 // unnamed | 3337 // unnamed |
| 3338 String name = this.name; | 3338 String name = this.name; |
| 3339 if (name != null && name.length != 0) { | 3339 if (name != null && name.length != 0) { |
| 3340 return false; | 3340 return false; |
| 3341 } | 3341 } |
| 3342 // no required parameters | 3342 // no required parameters |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3614 bool operator ==(Object object) { | 3614 bool operator ==(Object object) { |
| 3615 if (identical(this, object)) { | 3615 if (identical(this, object)) { |
| 3616 return true; | 3616 return true; |
| 3617 } | 3617 } |
| 3618 if (object == null || hashCode != object.hashCode) { | 3618 if (object == null || hashCode != object.hashCode) { |
| 3619 return false; | 3619 return false; |
| 3620 } | 3620 } |
| 3621 return object.runtimeType == runtimeType && (object as Element).location ==
location; | 3621 return object.runtimeType == runtimeType && (object as Element).location ==
location; |
| 3622 } | 3622 } |
| 3623 | 3623 |
| 3624 Element getAncestor(Type elementClass) { | 3624 Element getAncestor(Predicate<Element> predicate) { |
| 3625 Element ancestor = _enclosingElement; | 3625 Element ancestor = _enclosingElement; |
| 3626 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { | 3626 while (ancestor != null && !predicate(ancestor)) { |
| 3627 ancestor = ancestor.enclosingElement; | 3627 ancestor = ancestor.enclosingElement; |
| 3628 } | 3628 } |
| 3629 return ancestor; | 3629 return ancestor; |
| 3630 } | 3630 } |
| 3631 | 3631 |
| 3632 /** | 3632 /** |
| 3633 * Return the child of this element that is uniquely identified by the given i
dentifier, or | 3633 * Return the child of this element that is uniquely identified by the given i
dentifier, or |
| 3634 * `null` if there is no such child. | 3634 * `null` if there is no such child. |
| 3635 * | 3635 * |
| 3636 * @param identifier the identifier used to select a child | 3636 * @param identifier the identifier used to select a child |
| 3637 * @return the child of this element with the given identifier | 3637 * @return the child of this element with the given identifier |
| 3638 */ | 3638 */ |
| 3639 ElementImpl getChild(String identifier) => null; | 3639 ElementImpl getChild(String identifier) => null; |
| 3640 | 3640 |
| 3641 AnalysisContext get context { | 3641 AnalysisContext get context { |
| 3642 if (_enclosingElement == null) { | 3642 if (_enclosingElement == null) { |
| 3643 return null; | 3643 return null; |
| 3644 } | 3644 } |
| 3645 return _enclosingElement.context; | 3645 return _enclosingElement.context; |
| 3646 } | 3646 } |
| 3647 | 3647 |
| 3648 String get displayName => _name; | 3648 String get displayName => _name; |
| 3649 | 3649 |
| 3650 Element get enclosingElement => _enclosingElement; | 3650 Element get enclosingElement => _enclosingElement; |
| 3651 | 3651 |
| 3652 LibraryElement get library => getAncestor(LibraryElement); | 3652 LibraryElement get library => getAncestor((element) => element is LibraryEleme
nt); |
| 3653 | 3653 |
| 3654 ElementLocation get location => new ElementLocationImpl.con1(this); | 3654 ElementLocation get location => new ElementLocationImpl.con1(this); |
| 3655 | 3655 |
| 3656 String get name => _name; | 3656 String get name => _name; |
| 3657 | 3657 |
| 3658 AstNode get node => getNode2(AstNode); | 3658 AstNode get node => getNode2((node) => node is AstNode); |
| 3659 | 3659 |
| 3660 Source get source { | 3660 Source get source { |
| 3661 if (_enclosingElement == null) { | 3661 if (_enclosingElement == null) { |
| 3662 return null; | 3662 return null; |
| 3663 } | 3663 } |
| 3664 return _enclosingElement.source; | 3664 return _enclosingElement.source; |
| 3665 } | 3665 } |
| 3666 | 3666 |
| 3667 CompilationUnit get unit => context.resolveCompilationUnit(source, library); | 3667 CompilationUnit get unit => context.resolveCompilationUnit(source, library); |
| 3668 | 3668 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3758 * Return an identifier that uniquely identifies this element among the childr
en of this element's | 3758 * Return an identifier that uniquely identifies this element among the childr
en of this element's |
| 3759 * parent. | 3759 * parent. |
| 3760 * | 3760 * |
| 3761 * @return an identifier that uniquely identifies this element relative to its
parent | 3761 * @return an identifier that uniquely identifies this element relative to its
parent |
| 3762 */ | 3762 */ |
| 3763 String get identifier => name; | 3763 String get identifier => name; |
| 3764 | 3764 |
| 3765 /** | 3765 /** |
| 3766 * Return the resolved [AstNode] of the given type enclosing [getNameOffset]. | 3766 * Return the resolved [AstNode] of the given type enclosing [getNameOffset]. |
| 3767 */ | 3767 */ |
| 3768 AstNode getNode2(Type clazz) { | 3768 AstNode getNode2(Predicate<AstNode> predicate) { |
| 3769 CompilationUnit unit = this.unit; | 3769 CompilationUnit unit = this.unit; |
| 3770 if (unit == null) { | 3770 if (unit == null) { |
| 3771 return null; | 3771 return null; |
| 3772 } | 3772 } |
| 3773 int offset = nameOffset; | 3773 int offset = nameOffset; |
| 3774 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); | 3774 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); |
| 3775 if (node == null) { | 3775 if (node == null) { |
| 3776 return null; | 3776 return null; |
| 3777 } | 3777 } |
| 3778 return node.getAncestor(clazz); | 3778 return node.getAncestor(predicate); |
| 3779 } | 3779 } |
| 3780 | 3780 |
| 3781 /** | 3781 /** |
| 3782 * Return `true` if this element has the given modifier associated with it. | 3782 * Return `true` if this element has the given modifier associated with it. |
| 3783 * | 3783 * |
| 3784 * @param modifier the modifier being tested for | 3784 * @param modifier the modifier being tested for |
| 3785 * @return `true` if this element has the given modifier associated with it | 3785 * @return `true` if this element has the given modifier associated with it |
| 3786 */ | 3786 */ |
| 3787 bool hasModifier(Modifier modifier) => BooleanArray.get(_modifiers, modifier); | 3787 bool hasModifier(Modifier modifier) => BooleanArray.get(_modifiers, modifier); |
| 3788 | 3788 |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4459 * | 4459 * |
| 4460 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 4460 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 4461 * declaration of this element | 4461 * declaration of this element |
| 4462 */ | 4462 */ |
| 4463 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); | 4463 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); |
| 4464 | 4464 |
| 4465 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); | 4465 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
| 4466 | 4466 |
| 4467 ElementKind get kind => ElementKind.FUNCTION; | 4467 ElementKind get kind => ElementKind.FUNCTION; |
| 4468 | 4468 |
| 4469 FunctionDeclaration get node => getNode2(FunctionDeclaration); | 4469 FunctionDeclaration get node => getNode2((node) => node is FunctionDeclaration
); |
| 4470 | 4470 |
| 4471 SourceRange get visibleRange { | 4471 SourceRange get visibleRange { |
| 4472 if (_visibleRangeLength < 0) { | 4472 if (_visibleRangeLength < 0) { |
| 4473 return null; | 4473 return null; |
| 4474 } | 4474 } |
| 4475 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4475 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 4476 } | 4476 } |
| 4477 | 4477 |
| 4478 bool get isStatic => enclosingElement is CompilationUnitElement; | 4478 bool get isStatic => enclosingElement is CompilationUnitElement; |
| 4479 | 4479 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4551 return typeParameter as TypeParameterElementImpl; | 4551 return typeParameter as TypeParameterElementImpl; |
| 4552 } | 4552 } |
| 4553 } | 4553 } |
| 4554 return null; | 4554 return null; |
| 4555 } | 4555 } |
| 4556 | 4556 |
| 4557 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; | 4557 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; |
| 4558 | 4558 |
| 4559 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; | 4559 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
| 4560 | 4560 |
| 4561 FunctionTypeAlias get node => getNode2(FunctionTypeAlias); | 4561 FunctionTypeAlias get node => getNode2((node) => node is FunctionTypeAlias); |
| 4562 | 4562 |
| 4563 List<ParameterElement> get parameters => _parameters; | 4563 List<ParameterElement> get parameters => _parameters; |
| 4564 | 4564 |
| 4565 List<TypeParameterElement> get typeParameters => _typeParameters; | 4565 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 4566 | 4566 |
| 4567 /** | 4567 /** |
| 4568 * Set the parameters defined by this type alias to the given parameters. | 4568 * Set the parameters defined by this type alias to the given parameters. |
| 4569 * | 4569 * |
| 4570 * @param parameters the parameters defined by this type alias | 4570 * @param parameters the parameters defined by this type alias |
| 4571 */ | 4571 */ |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5237 } | 5237 } |
| 5238 } | 5238 } |
| 5239 | 5239 |
| 5240 /** | 5240 /** |
| 5241 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE
lement`. | 5241 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE
lement`. |
| 5242 */ | 5242 */ |
| 5243 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { | 5243 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { |
| 5244 /** | 5244 /** |
| 5245 * Is `true` if this variable is potentially mutated somewhere in its scope. | 5245 * Is `true` if this variable is potentially mutated somewhere in its scope. |
| 5246 */ | 5246 */ |
| 5247 bool _isPotentiallyMutatedInScope2 = false; | 5247 bool _potentiallyMutatedInScope = false; |
| 5248 | 5248 |
| 5249 /** | 5249 /** |
| 5250 * Is `true` if this variable is potentially mutated somewhere in closure. | 5250 * Is `true` if this variable is potentially mutated somewhere in closure. |
| 5251 */ | 5251 */ |
| 5252 bool _isPotentiallyMutatedInClosure2 = false; | 5252 bool _potentiallyMutatedInClosure = false; |
| 5253 | 5253 |
| 5254 /** | 5254 /** |
| 5255 * The offset to the beginning of the visible range for this element. | 5255 * The offset to the beginning of the visible range for this element. |
| 5256 */ | 5256 */ |
| 5257 int _visibleRangeOffset = 0; | 5257 int _visibleRangeOffset = 0; |
| 5258 | 5258 |
| 5259 /** | 5259 /** |
| 5260 * The length of the visible range for this element, or `-1` if this element d
oes not have a | 5260 * The length of the visible range for this element, or `-1` if this element d
oes not have a |
| 5261 * visible range. | 5261 * visible range. |
| 5262 */ | 5262 */ |
| 5263 int _visibleRangeLength = -1; | 5263 int _visibleRangeLength = -1; |
| 5264 | 5264 |
| 5265 /** | 5265 /** |
| 5266 * An empty array of field elements. | 5266 * An empty array of field elements. |
| 5267 */ | 5267 */ |
| 5268 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); | 5268 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); |
| 5269 | 5269 |
| 5270 /** | 5270 /** |
| 5271 * Initialize a newly created local variable element to have the given name. | 5271 * Initialize a newly created local variable element to have the given name. |
| 5272 * | 5272 * |
| 5273 * @param name the name of this element | 5273 * @param name the name of this element |
| 5274 */ | 5274 */ |
| 5275 LocalVariableElementImpl(Identifier name) : super.con1(name); | 5275 LocalVariableElementImpl(Identifier name) : super.con1(name); |
| 5276 | 5276 |
| 5277 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); | 5277 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); |
| 5278 | 5278 |
| 5279 ElementKind get kind => ElementKind.LOCAL_VARIABLE; | 5279 ElementKind get kind => ElementKind.LOCAL_VARIABLE; |
| 5280 | 5280 |
| 5281 List<ToolkitObjectElement> get toolkitObjects { | 5281 List<ToolkitObjectElement> get toolkitObjects { |
| 5282 CompilationUnitElementImpl unit = getAncestor(CompilationUnitElementImpl); | 5282 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil
ationUnitElementImpl); |
| 5283 if (unit == null) { | 5283 if (unit == null) { |
| 5284 return ToolkitObjectElement.EMPTY_ARRAY; | 5284 return ToolkitObjectElement.EMPTY_ARRAY; |
| 5285 } | 5285 } |
| 5286 return unit.getToolkitObjects(this); | 5286 return unit.getToolkitObjects(this); |
| 5287 } | 5287 } |
| 5288 | 5288 |
| 5289 SourceRange get visibleRange { | 5289 SourceRange get visibleRange { |
| 5290 if (_visibleRangeLength < 0) { | 5290 if (_visibleRangeLength < 0) { |
| 5291 return null; | 5291 return null; |
| 5292 } | 5292 } |
| 5293 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 5293 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 5294 } | 5294 } |
| 5295 | 5295 |
| 5296 bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure2; | 5296 bool get isPotentiallyMutatedInClosure => _potentiallyMutatedInClosure; |
| 5297 | 5297 |
| 5298 bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope2; | 5298 bool get isPotentiallyMutatedInScope => _potentiallyMutatedInScope; |
| 5299 | 5299 |
| 5300 /** | 5300 /** |
| 5301 * Specifies that this variable is potentially mutated somewhere in closure. | 5301 * Specifies that this variable is potentially mutated somewhere in closure. |
| 5302 */ | 5302 */ |
| 5303 void markPotentiallyMutatedInClosure() { | 5303 void markPotentiallyMutatedInClosure() { |
| 5304 _isPotentiallyMutatedInClosure2 = true; | 5304 _potentiallyMutatedInClosure = true; |
| 5305 } | 5305 } |
| 5306 | 5306 |
| 5307 /** | 5307 /** |
| 5308 * Specifies that this variable is potentially mutated somewhere in its scope. | 5308 * Specifies that this variable is potentially mutated somewhere in its scope. |
| 5309 */ | 5309 */ |
| 5310 void markPotentiallyMutatedInScope() { | 5310 void markPotentiallyMutatedInScope() { |
| 5311 _isPotentiallyMutatedInScope2 = true; | 5311 _potentiallyMutatedInScope = true; |
| 5312 } | 5312 } |
| 5313 | 5313 |
| 5314 /** | 5314 /** |
| 5315 * Set the toolkit specific information objects attached to this variable. | 5315 * Set the toolkit specific information objects attached to this variable. |
| 5316 * | 5316 * |
| 5317 * @param toolkitObjects the toolkit objects attached to this variable | 5317 * @param toolkitObjects the toolkit objects attached to this variable |
| 5318 */ | 5318 */ |
| 5319 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) { | 5319 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) { |
| 5320 CompilationUnitElementImpl unit = getAncestor(CompilationUnitElementImpl); | 5320 CompilationUnitElementImpl unit = getAncestor((element) => element is Compil
ationUnitElementImpl); |
| 5321 if (unit == null) { | 5321 if (unit == null) { |
| 5322 return; | 5322 return; |
| 5323 } | 5323 } |
| 5324 unit.setToolkitObjects(this, toolkitObjects); | 5324 unit.setToolkitObjects(this, toolkitObjects); |
| 5325 } | 5325 } |
| 5326 | 5326 |
| 5327 /** | 5327 /** |
| 5328 * Set the visible range for this element to the range starting at the given o
ffset with the given | 5328 * Set the visible range for this element to the range starting at the given o
ffset with the given |
| 5329 * length. | 5329 * length. |
| 5330 * | 5330 * |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5380 String get name { | 5380 String get name { |
| 5381 String name = super.name; | 5381 String name = super.name; |
| 5382 if (isOperator && name == "-") { | 5382 if (isOperator && name == "-") { |
| 5383 if (parameters.length == 0) { | 5383 if (parameters.length == 0) { |
| 5384 return "unary-"; | 5384 return "unary-"; |
| 5385 } | 5385 } |
| 5386 } | 5386 } |
| 5387 return super.name; | 5387 return super.name; |
| 5388 } | 5388 } |
| 5389 | 5389 |
| 5390 MethodDeclaration get node => getNode2(MethodDeclaration); | 5390 MethodDeclaration get node => getNode2((node) => node is MethodDeclaration); |
| 5391 | 5391 |
| 5392 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 5392 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 5393 | 5393 |
| 5394 bool get isOperator { | 5394 bool get isOperator { |
| 5395 String name = displayName; | 5395 String name = displayName; |
| 5396 if (name.isEmpty) { | 5396 if (name.isEmpty) { |
| 5397 return false; | 5397 return false; |
| 5398 } | 5398 } |
| 5399 int first = name.codeUnitAt(0); | 5399 int first = name.codeUnitAt(0); |
| 5400 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A
) || first == 0x5F || first == 0x24); | 5400 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A
) || first == 0x5F || first == 0x24); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5582 * @param conflictingElements the elements that conflict | 5582 * @param conflictingElements the elements that conflict |
| 5583 */ | 5583 */ |
| 5584 MultiplyDefinedElementImpl(this.context, this.conflictingElements) { | 5584 MultiplyDefinedElementImpl(this.context, this.conflictingElements) { |
| 5585 _name = conflictingElements[0].name; | 5585 _name = conflictingElements[0].name; |
| 5586 } | 5586 } |
| 5587 | 5587 |
| 5588 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 5588 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
| 5589 | 5589 |
| 5590 String computeDocumentationComment() => null; | 5590 String computeDocumentationComment() => null; |
| 5591 | 5591 |
| 5592 Element getAncestor(Type elementClass) => null; | 5592 Element getAncestor(Predicate<Element> predicate) => null; |
| 5593 | 5593 |
| 5594 String get displayName => _name; | 5594 String get displayName => _name; |
| 5595 | 5595 |
| 5596 Element get enclosingElement => null; | 5596 Element get enclosingElement => null; |
| 5597 | 5597 |
| 5598 ElementKind get kind => ElementKind.ERROR; | 5598 ElementKind get kind => ElementKind.ERROR; |
| 5599 | 5599 |
| 5600 LibraryElement get library => null; | 5600 LibraryElement get library => null; |
| 5601 | 5601 |
| 5602 ElementLocation get location => null; | 5602 ElementLocation get location => null; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5702 } | 5702 } |
| 5703 } | 5703 } |
| 5704 | 5704 |
| 5705 /** | 5705 /** |
| 5706 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. | 5706 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. |
| 5707 */ | 5707 */ |
| 5708 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { | 5708 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { |
| 5709 /** | 5709 /** |
| 5710 * Is `true` if this variable is potentially mutated somewhere in its scope. | 5710 * Is `true` if this variable is potentially mutated somewhere in its scope. |
| 5711 */ | 5711 */ |
| 5712 bool _isPotentiallyMutatedInScope3 = false; | 5712 bool _potentiallyMutatedInScope = false; |
| 5713 | 5713 |
| 5714 /** | 5714 /** |
| 5715 * Is `true` if this variable is potentially mutated somewhere in closure. | 5715 * Is `true` if this variable is potentially mutated somewhere in closure. |
| 5716 */ | 5716 */ |
| 5717 bool _isPotentiallyMutatedInClosure3 = false; | 5717 bool _potentiallyMutatedInClosure = false; |
| 5718 | 5718 |
| 5719 /** | 5719 /** |
| 5720 * An array containing all of the parameters defined by this parameter element
. There will only be | 5720 * An array containing all of the parameters defined by this parameter element
. There will only be |
| 5721 * parameters if this parameter is a function typed parameter. | 5721 * parameters if this parameter is a function typed parameter. |
| 5722 */ | 5722 */ |
| 5723 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 5723 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 5724 | 5724 |
| 5725 /** | 5725 /** |
| 5726 * The kind of this parameter. | 5726 * The kind of this parameter. |
| 5727 */ | 5727 */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5785 | 5785 |
| 5786 SourceRange get visibleRange { | 5786 SourceRange get visibleRange { |
| 5787 if (_visibleRangeLength < 0) { | 5787 if (_visibleRangeLength < 0) { |
| 5788 return null; | 5788 return null; |
| 5789 } | 5789 } |
| 5790 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 5790 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 5791 } | 5791 } |
| 5792 | 5792 |
| 5793 bool get isInitializingFormal => false; | 5793 bool get isInitializingFormal => false; |
| 5794 | 5794 |
| 5795 bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure3; | 5795 bool get isPotentiallyMutatedInClosure => _potentiallyMutatedInClosure; |
| 5796 | 5796 |
| 5797 bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope3; | 5797 bool get isPotentiallyMutatedInScope => _potentiallyMutatedInScope; |
| 5798 | 5798 |
| 5799 /** | 5799 /** |
| 5800 * Specifies that this variable is potentially mutated somewhere in closure. | 5800 * Specifies that this variable is potentially mutated somewhere in closure. |
| 5801 */ | 5801 */ |
| 5802 void markPotentiallyMutatedInClosure() { | 5802 void markPotentiallyMutatedInClosure() { |
| 5803 _isPotentiallyMutatedInClosure3 = true; | 5803 _potentiallyMutatedInClosure = true; |
| 5804 } | 5804 } |
| 5805 | 5805 |
| 5806 /** | 5806 /** |
| 5807 * Specifies that this variable is potentially mutated somewhere in its scope. | 5807 * Specifies that this variable is potentially mutated somewhere in its scope. |
| 5808 */ | 5808 */ |
| 5809 void markPotentiallyMutatedInScope() { | 5809 void markPotentiallyMutatedInScope() { |
| 5810 _isPotentiallyMutatedInScope3 = true; | 5810 _potentiallyMutatedInScope = true; |
| 5811 } | 5811 } |
| 5812 | 5812 |
| 5813 /** | 5813 /** |
| 5814 * Set the range of the default value for this parameter to the range starting
at the given offset | 5814 * Set the range of the default value for this parameter to the range starting
at the given offset |
| 5815 * with the given length. | 5815 * with the given length. |
| 5816 * | 5816 * |
| 5817 * @param offset the offset to the beginning of the default value range for th
is element | 5817 * @param offset the offset to the beginning of the default value range for th
is element |
| 5818 * @param length the length of the default value range for this element, or `-
1` if this | 5818 * @param length the length of the default value range for this element, or `-
1` if this |
| 5819 * element does not have a default value | 5819 * element does not have a default value |
| 5820 */ | 5820 */ |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5996 return "${super.name}="; | 5996 return "${super.name}="; |
| 5997 } | 5997 } |
| 5998 return super.name; | 5998 return super.name; |
| 5999 } | 5999 } |
| 6000 | 6000 |
| 6001 AstNode get node { | 6001 AstNode get node { |
| 6002 if (isSynthetic) { | 6002 if (isSynthetic) { |
| 6003 return null; | 6003 return null; |
| 6004 } | 6004 } |
| 6005 if (enclosingElement is ClassElement) { | 6005 if (enclosingElement is ClassElement) { |
| 6006 return getNode2(MethodDeclaration); | 6006 return getNode2((node) => node is MethodDeclaration); |
| 6007 } | 6007 } |
| 6008 if (enclosingElement is CompilationUnitElement) { | 6008 if (enclosingElement is CompilationUnitElement) { |
| 6009 return getNode2(FunctionDeclaration); | 6009 return getNode2((node) => node is FunctionDeclaration); |
| 6010 } | 6010 } |
| 6011 return null; | 6011 return null; |
| 6012 } | 6012 } |
| 6013 | 6013 |
| 6014 int get hashCode => ObjectUtilities.combineHashCodes(super.hashCode, isGetter
? 1 : 2); | 6014 int get hashCode => ObjectUtilities.combineHashCodes(super.hashCode, isGetter
? 1 : 2); |
| 6015 | 6015 |
| 6016 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 6016 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 6017 | 6017 |
| 6018 bool get isGetter => hasModifier(Modifier.GETTER); | 6018 bool get isGetter => hasModifier(Modifier.GETTER); |
| 6019 | 6019 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6262 * Return the result of evaluating this variable's initializer as a compile-ti
me constant | 6262 * Return the result of evaluating this variable's initializer as a compile-ti
me constant |
| 6263 * expression, or `null` if this variable is not a 'const' variable, if it doe
s not have an | 6263 * expression, or `null` if this variable is not a 'const' variable, if it doe
s not have an |
| 6264 * initializer, or if the compilation unit containing the variable has not bee
n resolved. | 6264 * initializer, or if the compilation unit containing the variable has not bee
n resolved. |
| 6265 * | 6265 * |
| 6266 * @return the result of evaluating this variable's initializer | 6266 * @return the result of evaluating this variable's initializer |
| 6267 */ | 6267 */ |
| 6268 EvaluationResultImpl get evaluationResult => null; | 6268 EvaluationResultImpl get evaluationResult => null; |
| 6269 | 6269 |
| 6270 FunctionElement get initializer => _initializer; | 6270 FunctionElement get initializer => _initializer; |
| 6271 | 6271 |
| 6272 VariableDeclaration get node => getNode2(VariableDeclaration); | 6272 VariableDeclaration get node => getNode2((node) => node is VariableDeclaration
); |
| 6273 | 6273 |
| 6274 bool get isConst => hasModifier(Modifier.CONST); | 6274 bool get isConst => hasModifier(Modifier.CONST); |
| 6275 | 6275 |
| 6276 bool get isFinal => hasModifier(Modifier.FINAL); | 6276 bool get isFinal => hasModifier(Modifier.FINAL); |
| 6277 | 6277 |
| 6278 /** | 6278 /** |
| 6279 * Return `true` if this variable is potentially mutated somewhere in a closur
e. This | 6279 * Return `true` if this variable is potentially mutated somewhere in a closur
e. This |
| 6280 * information is only available for local variables (including parameters) an
d only after the | 6280 * information is only available for local variables (including parameters) an
d only after the |
| 6281 * compilation unit containing the variable has been resolved. | 6281 * compilation unit containing the variable has been resolved. |
| 6282 * | 6282 * |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7046 * @param baseElement the element on which the parameterized element was creat
ed | 7046 * @param baseElement the element on which the parameterized element was creat
ed |
| 7047 * @param definingType the type in which the element is defined | 7047 * @param definingType the type in which the element is defined |
| 7048 */ | 7048 */ |
| 7049 Member(Element baseElement, ParameterizedType definingType) { | 7049 Member(Element baseElement, ParameterizedType definingType) { |
| 7050 this._baseElement = baseElement; | 7050 this._baseElement = baseElement; |
| 7051 this._definingType = definingType; | 7051 this._definingType = definingType; |
| 7052 } | 7052 } |
| 7053 | 7053 |
| 7054 String computeDocumentationComment() => _baseElement.computeDocumentationComme
nt(); | 7054 String computeDocumentationComment() => _baseElement.computeDocumentationComme
nt(); |
| 7055 | 7055 |
| 7056 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass
); | 7056 Element getAncestor(Predicate<Element> predicate) => baseElement.getAncestor(p
redicate); |
| 7057 | 7057 |
| 7058 /** | 7058 /** |
| 7059 * Return the element on which the parameterized element was created. | 7059 * Return the element on which the parameterized element was created. |
| 7060 * | 7060 * |
| 7061 * @return the element on which the parameterized element was created | 7061 * @return the element on which the parameterized element was created |
| 7062 */ | 7062 */ |
| 7063 Element get baseElement => _baseElement; | 7063 Element get baseElement => _baseElement; |
| 7064 | 7064 |
| 7065 AnalysisContext get context => _baseElement.context; | 7065 AnalysisContext get context => _baseElement.context; |
| 7066 | 7066 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7280 /** | 7280 /** |
| 7281 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. | 7281 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. |
| 7282 * | 7282 * |
| 7283 * @param baseElement the element on which the parameterized element was creat
ed | 7283 * @param baseElement the element on which the parameterized element was creat
ed |
| 7284 * @param definingType the type in which the element is defined | 7284 * @param definingType the type in which the element is defined |
| 7285 */ | 7285 */ |
| 7286 ParameterMember(ParameterElement baseElement, ParameterizedType definingType)
: super(baseElement, definingType); | 7286 ParameterMember(ParameterElement baseElement, ParameterizedType definingType)
: super(baseElement, definingType); |
| 7287 | 7287 |
| 7288 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); | 7288 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
| 7289 | 7289 |
| 7290 Element getAncestor(Type elementClass) { | 7290 Element getAncestor(Predicate<Element> predicate) { |
| 7291 Element element = baseElement.getAncestor(elementClass); | 7291 Element element = baseElement.getAncestor(predicate); |
| 7292 ParameterizedType definingType = this.definingType; | 7292 ParameterizedType definingType = this.definingType; |
| 7293 if (definingType is InterfaceType) { | 7293 if (definingType is InterfaceType) { |
| 7294 InterfaceType definingInterfaceType = definingType; | 7294 InterfaceType definingInterfaceType = definingType; |
| 7295 if (element is ConstructorElement) { | 7295 if (element is ConstructorElement) { |
| 7296 return ConstructorMember.from(element, definingInterfaceType); | 7296 return ConstructorMember.from(element, definingInterfaceType); |
| 7297 } else if (element is MethodElement) { | 7297 } else if (element is MethodElement) { |
| 7298 return MethodMember.from(element, definingInterfaceType); | 7298 return MethodMember.from(element, definingInterfaceType); |
| 7299 } else if (element is PropertyAccessorElement) { | 7299 } else if (element is PropertyAccessorElement) { |
| 7300 return PropertyAccessorMember.from(element, definingInterfaceType); | 7300 return PropertyAccessorMember.from(element, definingInterfaceType); |
| 7301 } | 7301 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7780 return DynamicTypeImpl.instance; | 7780 return DynamicTypeImpl.instance; |
| 7781 } | 7781 } |
| 7782 return baseReturnType.substitute2(typeArguments, TypeParameterTypeImpl.getTy
pes(typeParameters)); | 7782 return baseReturnType.substitute2(typeArguments, TypeParameterTypeImpl.getTy
pes(typeParameters)); |
| 7783 } | 7783 } |
| 7784 | 7784 |
| 7785 List<TypeParameterElement> get typeParameters { | 7785 List<TypeParameterElement> get typeParameters { |
| 7786 Element element = this.element; | 7786 Element element = this.element; |
| 7787 if (element is FunctionTypeAliasElement) { | 7787 if (element is FunctionTypeAliasElement) { |
| 7788 return element.typeParameters; | 7788 return element.typeParameters; |
| 7789 } | 7789 } |
| 7790 ClassElement definingClass = element.getAncestor(ClassElement); | 7790 ClassElement definingClass = element.getAncestor((element) => element is Cla
ssElement); |
| 7791 if (definingClass != null) { | 7791 if (definingClass != null) { |
| 7792 return definingClass.typeParameters; | 7792 return definingClass.typeParameters; |
| 7793 } | 7793 } |
| 7794 return TypeParameterElementImpl.EMPTY_ARRAY; | 7794 return TypeParameterElementImpl.EMPTY_ARRAY; |
| 7795 } | 7795 } |
| 7796 | 7796 |
| 7797 int get hashCode { | 7797 int get hashCode { |
| 7798 if (element == null) { | 7798 if (element == null) { |
| 7799 return 0; | 7799 return 0; |
| 7800 } | 7800 } |
| (...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9797 TypeParameterElement get element; | 9797 TypeParameterElement get element; |
| 9798 } | 9798 } |
| 9799 | 9799 |
| 9800 /** | 9800 /** |
| 9801 * The interface `VoidType` defines the behavior of the unique object representi
ng the type | 9801 * The interface `VoidType` defines the behavior of the unique object representi
ng the type |
| 9802 * `void`. | 9802 * `void`. |
| 9803 */ | 9803 */ |
| 9804 abstract class VoidType implements Type2 { | 9804 abstract class VoidType implements Type2 { |
| 9805 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 9805 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 9806 } | 9806 } |
| OLD | NEW |