| // This code was auto-generated, is not intended to be edited, and is subject to |
| // significant change. Please see the README file for more information. |
| |
| library engine.element; |
| |
| import 'dart:collection'; |
| import 'java_core.dart'; |
| import 'java_engine.dart'; |
| import 'source.dart'; |
| import 'scanner.dart' show Keyword; |
| import 'ast.dart' show Identifier, LibraryIdentifier; |
| import 'sdk.dart' show DartSdk; |
| import 'html.dart' show XmlTagNode; |
| import 'engine.dart' show AnalysisContext; |
| import 'constant.dart' show EvaluationResultImpl; |
| import 'utilities_dart.dart'; |
| |
| /** |
| * The interface {@code Annotation} defines the behavior of objects representing a single annotation |
| * associated with an element. |
| * @coverage dart.engine.element |
| */ |
| abstract class Annotation { |
| /** |
| * Return the element representing the field, variable, or const constructor being used as an |
| * annotation. |
| * @return the field, variable, or constructor being used as an annotation |
| */ |
| Element get element; |
| } |
| /** |
| * The interface {@code ClassElement} defines the behavior of elements that represent a class. |
| * @coverage dart.engine.element |
| */ |
| abstract class ClassElement implements Element { |
| /** |
| * Return an array containing all of the accessors (getters and setters) declared in this class. |
| * @return the accessors declared in this class |
| */ |
| List<PropertyAccessorElement> get accessors; |
| /** |
| * Return an array containing all the supertypes defined for this class and its supertypes. |
| * @return all the supertypes of this class, including mixins |
| */ |
| List<InterfaceType> get allSupertypes; |
| /** |
| * Return an array containing all of the constructors declared in this class. |
| * @return the constructors declared in this class |
| */ |
| List<ConstructorElement> get constructors; |
| /** |
| * Return an array containing all of the fields declared in this class. |
| * @return the fields declared in this class |
| */ |
| List<FieldElement> get fields; |
| /** |
| * Return an array containing all of the interfaces that are implemented by this class. |
| * @return the interfaces that are implemented by this class |
| */ |
| List<InterfaceType> get interfaces; |
| /** |
| * Return an array containing all of the methods declared in this class. |
| * @return the methods declared in this class |
| */ |
| List<MethodElement> get methods; |
| /** |
| * Return an array containing all of the mixins that are applied to the class being extended in |
| * order to derive the superclass of this class. |
| * @return the mixins that are applied to derive the superclass of this class |
| */ |
| List<InterfaceType> get mixins; |
| /** |
| * Return the named constructor declared in this class with the given name, or {@code null} if |
| * this class does not declare a named constructor with the given name. |
| * @param name the name of the constructor to be returned |
| * @return the element representing the specified constructor |
| */ |
| ConstructorElement getNamedConstructor(String name); |
| /** |
| * Return the superclass of this class, or {@code null} if the class represents the class |
| * 'Object'. All other classes will have a non-{@code null} superclass. If the superclass was not |
| * explicitly declared then the implicit superclass 'Object' will be returned. |
| * @return the superclass of this class |
| */ |
| InterfaceType get supertype; |
| /** |
| * Return the type defined by the class. |
| * @return the type defined by the class |
| */ |
| InterfaceType get type; |
| /** |
| * Return an array containing all of the type variables declared for this class. |
| * @return the type variables declared for this class |
| */ |
| List<TypeVariableElement> get typeVariables; |
| /** |
| * Return the unnamed constructor declared in this class, or {@code null} if this class does not |
| * declare an unnamed constructor but does declare named constructors. The returned constructor |
| * will be synthetic if this class does not declare any constructors, in which case it will |
| * represent the default constructor for the class. |
| * @return the unnamed constructor defined in this class |
| */ |
| ConstructorElement get unnamedConstructor; |
| /** |
| * Return {@code true} if this class is abstract. A class is abstract if it has an explicit{@code abstract} modifier. Note, that this definition of <i>abstract</i> is different from |
| * <i>has unimplemented members</i>. |
| * @return {@code true} if this class is abstract |
| */ |
| bool isAbstract(); |
| /** |
| * Return {@code true} if this class is defined by a typedef construct. |
| * @return {@code true} if this class is defined by a typedef construct |
| */ |
| bool isTypedef(); |
| /** |
| * Return {@code true} if this class can validly be used as a mixin when defining another class. |
| * The behavior of this method is defined by the Dart Language Specification in section 9: |
| * <blockquote>It is a compile-time error if a declared or derived mixin refers to super. It is a |
| * compile-time error if a declared or derived mixin explicitly declares a constructor. It is a |
| * compile-time error if a mixin is derived from a class whose superclass is not |
| * Object.</blockquote> |
| * @return {@code true} if this class can validly be used as a mixin |
| */ |
| bool isValidMixin(); |
| /** |
| * Return the element representing the getter that results from looking up the given getter in |
| * this class with respect to the given library, or {@code null} if the look up fails. The |
| * behavior of this method is defined by the Dart Language Specification in section 12.15.1: |
| * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> |
| * with respect to library <i>L</i> is: |
| * <ul> |
| * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>m</i> that is |
| * accessible to <i>L</i>, then that getter (respectively setter) is the result of the lookup. |
| * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lookup is the result |
| * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect to <i>L</i>. |
| * Otherwise, we say that the lookup has failed.</li> |
| * </ul> |
| * </blockquote> |
| * @param getterName the name of the getter being looked up |
| * @param library the library with respect to which the lookup is being performed |
| * @return the result of looking up the given getter in this class with respect to the given |
| * library |
| */ |
| PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library); |
| /** |
| * Return the element representing the method that results from looking up the given method in |
| * this class with respect to the given library, or {@code null} if the look up fails. The |
| * behavior of this method is defined by the Dart Language Specification in section 12.15.1: |
| * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> with respect to library |
| * <i>L</i> is: |
| * <ul> |
| * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then |
| * that method is the result of the lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then |
| * the result of the lookup is the result of looking up method <i>m</i> in <i>S</i> with respect |
| * to <i>L</i>. Otherwise, we say that the lookup has failed.</li> |
| * </ul> |
| * </blockquote> |
| * @param methodName the name of the method being looked up |
| * @param library the library with respect to which the lookup is being performed |
| * @return the result of looking up the given method in this class with respect to the given |
| * library |
| */ |
| MethodElement lookUpMethod(String methodName, LibraryElement library); |
| /** |
| * Return the element representing the setter that results from looking up the given setter in |
| * this class with respect to the given library, or {@code null} if the look up fails. The |
| * behavior of this method is defined by the Dart Language Specification in section 12.16: |
| * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> |
| * with respect to library <i>L</i> is: |
| * <ul> |
| * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>m</i> that is |
| * accessible to <i>L</i>, then that getter (respectively setter) is the result of the lookup. |
| * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lookup is the result |
| * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect to <i>L</i>. |
| * Otherwise, we say that the lookup has failed.</li> |
| * </ul> |
| * </blockquote> |
| * @param setterName the name of the setter being looked up |
| * @param library the library with respect to which the lookup is being performed |
| * @return the result of looking up the given setter in this class with respect to the given |
| * library |
| */ |
| PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library); |
| } |
| /** |
| * The interface {@code CompilationUnitElement} defines the behavior of elements representing a |
| * compilation unit. |
| * @coverage dart.engine.element |
| */ |
| abstract class CompilationUnitElement implements Element { |
| /** |
| * Return an array containing all of the top-level accessors (getters and setters) contained in |
| * this compilation unit. |
| * @return the top-level accessors contained in this compilation unit |
| */ |
| List<PropertyAccessorElement> get accessors; |
| /** |
| * Return the library in which this compilation unit is defined. |
| * @return the library in which this compilation unit is defined |
| */ |
| LibraryElement get enclosingElement; |
| /** |
| * Return an array containing all of the top-level functions contained in this compilation unit. |
| * @return the top-level functions contained in this compilation unit |
| */ |
| List<FunctionElement> get functions; |
| /** |
| * Return an array containing all of the function type aliases contained in this compilation unit. |
| * @return the function type aliases contained in this compilation unit |
| */ |
| List<FunctionTypeAliasElement> get functionTypeAliases; |
| /** |
| * Return an array containing all of the top-level variables contained in this compilation unit. |
| * @return the top-level variables contained in this compilation unit |
| */ |
| List<TopLevelVariableElement> get topLevelVariables; |
| /** |
| * Return the class defined in this compilation unit that has the given name, or {@code null} if |
| * this compilation unit does not define a class with the given name. |
| * @param className the name of the class to be returned |
| * @return the class with the given name that is defined in this compilation unit |
| */ |
| ClassElement getType(String className); |
| /** |
| * Return an array containing all of the classes contained in this compilation unit. |
| * @return the classes contained in this compilation unit |
| */ |
| List<ClassElement> get types; |
| } |
| /** |
| * The interface {@code ConstructorElement} defines the behavior of elements representing a |
| * constructor or a factory method defined within a type. |
| * @coverage dart.engine.element |
| */ |
| abstract class ConstructorElement implements ExecutableElement { |
| /** |
| * Return the type in which this constructor is defined. |
| * @return the type in which this constructor is defined |
| */ |
| ClassElement get enclosingElement; |
| /** |
| * Return {@code true} if this constructor is a const constructor. |
| * @return {@code true} if this constructor is a const constructor |
| */ |
| bool isConst(); |
| /** |
| * Return {@code true} if this constructor represents a factory constructor. |
| * @return {@code true} if this constructor represents a factory constructor |
| */ |
| bool isFactory(); |
| } |
| /** |
| * The interface {@code Element} defines the behavior common to all of the elements in the element |
| * model. Generally speaking, the element model is a semantic model of the program that represents |
| * things that are declared with a name and hence can be referenced elsewhere in the code. |
| * <p> |
| * There are two exceptions to the general case. First, there are elements in the element model that |
| * are created for the convenience of various kinds of analysis but that do not have any |
| * corresponding declaration within the source code. Such elements are marked as being |
| * <i>synthetic</i>. Examples of synthetic elements include |
| * <ul> |
| * <li>default constructors in classes that do not define any explicit constructors, |
| * <li>getters and setters that are induced by explicit field declarations, |
| * <li>fields that are induced by explicit declarations of getters and setters, and |
| * <li>functions representing the initialization expression for a variable. |
| * </ul> |
| * <p> |
| * Second, there are elements in the element model that do not have a name. These correspond to |
| * unnamed functions and exist in order to more accurately represent the semantic structure of the |
| * program. |
| * @coverage dart.engine.element |
| */ |
| abstract class Element { |
| /** |
| * A comparator that can be used to sort elements by their name offset. Elements with a smaller |
| * offset will be sorted to be before elements with a larger name offset. |
| */ |
| static Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Element secondElement) => firstElement.nameOffset - secondElement.nameOffset; |
| /** |
| * Use the given visitor to visit this element. |
| * @param visitor the visitor that will visit this element |
| * @return the value returned by the visitor as a result of visiting this element |
| */ |
| accept(ElementVisitor visitor); |
| /** |
| * Return the element of the given class that most immediately encloses this element, or{@code null} if there is no enclosing element of the given class. |
| * @param elementClass the class of the element to be returned |
| * @return the element that encloses this element |
| */ |
| Element getAncestor(Type elementClass); |
| /** |
| * Return the analysis context in which this element is defined. |
| * @return the analysis context in which this element is defined |
| */ |
| AnalysisContext get context; |
| /** |
| * Return the element that either physically or logically encloses this element. This will be{@code null} if this element is a library because libraries are the top-level elements in the |
| * model. |
| * @return the element that encloses this element |
| */ |
| Element get enclosingElement; |
| /** |
| * Return the kind of element that this is. |
| * @return the kind of this element |
| */ |
| ElementKind get kind; |
| /** |
| * Return the library that contains this element. This will be the element itself if it is a |
| * library element. This will be {@code null} if this element is an HTML file because HTML files |
| * are not contained in libraries. |
| * @return the library that contains this element |
| */ |
| LibraryElement get library; |
| /** |
| * Return an object representing the location of this element in the element model. The object can |
| * be used to locate this element at a later time. |
| * @return the location of this element in the element model |
| */ |
| ElementLocation get location; |
| /** |
| * Return an array containing all of the metadata associated with this element. |
| * @return the metadata associated with this element |
| */ |
| List<Annotation> get metadata; |
| /** |
| * Return the name of this element, or {@code null} if this element does not have a name. |
| * @return the name of this element |
| */ |
| String get name; |
| /** |
| * Return the offset of the name of this element in the file that contains the declaration of this |
| * element, or {@code -1} if this element is synthetic, does not have a name, or otherwise does |
| * not have an offset. |
| * @return the offset of the name of this element |
| */ |
| int get nameOffset; |
| /** |
| * Return the source that contains this element, or {@code null} if this element is not contained |
| * in a source. |
| * @return the source that contains this element |
| */ |
| Source get source; |
| /** |
| * Return {@code true} if this element, assuming that it is within scope, is accessible to code in |
| * the given library. This is defined by the Dart Language Specification in section 3.2: |
| * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i>m</i> is declared |
| * in <i>L</i> or if <i>m</i> is public. </blockquote> |
| * @param library the library in which a possible reference to this element would occur |
| * @return {@code true} if this element is accessible to code in the given library |
| */ |
| bool isAccessibleIn(LibraryElement library); |
| /** |
| * Return {@code true} if this element is synthetic. A synthetic element is an element that is not |
| * represented in the source code explicitly, but is implied by the source code, such as the |
| * default constructor for a class that does not explicitly define any constructors. |
| * @return {@code true} if this element is synthetic |
| */ |
| bool isSynthetic(); |
| /** |
| * Use the given visitor to visit all of the children of this element. There is no guarantee of |
| * the order in which the children will be visited. |
| * @param visitor the visitor that will be used to visit the children of this element |
| */ |
| void visitChildren(ElementVisitor<Object> visitor); |
| } |
| /** |
| * The enumeration {@code ElementKind} defines the various kinds of elements in the element model. |
| * @coverage dart.engine.element |
| */ |
| class ElementKind implements Comparable<ElementKind> { |
| static final ElementKind CLASS = new ElementKind('CLASS', 0, "class"); |
| static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT', 1, "compilation unit"); |
| static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "constructor"); |
| static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>"); |
| static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML_SCRIPT', 4, "embedded html script"); |
| static final ElementKind ERROR = new ElementKind('ERROR', 5, "<error>"); |
| static final ElementKind EXPORT = new ElementKind('EXPORT', 6, "export directive"); |
| static final ElementKind EXTERNAL_HTML_SCRIPT = new ElementKind('EXTERNAL_HTML_SCRIPT', 7, "external html script"); |
| static final ElementKind FIELD = new ElementKind('FIELD', 8, "field"); |
| static final ElementKind FUNCTION = new ElementKind('FUNCTION', 9, "function"); |
| static final ElementKind GETTER = new ElementKind('GETTER', 10, "getter"); |
| static final ElementKind HTML = new ElementKind('HTML', 11, "html"); |
| static final ElementKind IMPORT = new ElementKind('IMPORT', 12, "import directive"); |
| static final ElementKind LABEL = new ElementKind('LABEL', 13, "label"); |
| static final ElementKind LIBRARY = new ElementKind('LIBRARY', 14, "library"); |
| static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 15, "local variable"); |
| static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); |
| static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); |
| static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "parameter"); |
| static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix"); |
| static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); |
| static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIABLE', 21, "top level variable"); |
| static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_ALIAS', 22, "function type alias"); |
| static final ElementKind TYPE_VARIABLE = new ElementKind('TYPE_VARIABLE', 23, "type variable"); |
| static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe>"); |
| static final List<ElementKind> values = [CLASS, COMPILATION_UNIT, CONSTRUCTOR, DYNAMIC, EMBEDDED_HTML_SCRIPT, ERROR, EXPORT, EXTERNAL_HTML_SCRIPT, FIELD, FUNCTION, GETTER, HTML, IMPORT, LABEL, LIBRARY, LOCAL_VARIABLE, METHOD, NAME, PARAMETER, PREFIX, SETTER, TOP_LEVEL_VARIABLE, FUNCTION_TYPE_ALIAS, TYPE_VARIABLE, UNIVERSE]; |
| final String __name; |
| final int __ordinal; |
| int get ordinal => __ordinal; |
| String _displayName; |
| ElementKind(this.__name, this.__ordinal, String displayName) { |
| this._displayName = displayName; |
| } |
| /** |
| * @return the name of this {@link ElementKind} to display in UI. |
| */ |
| String get displayName => _displayName; |
| int compareTo(ElementKind other) => __ordinal - other.__ordinal; |
| String toString() => __name; |
| } |
| /** |
| * The interface {@code ElementLocation} defines the behavior of objects that represent the location |
| * of an element within the element model. |
| * @coverage dart.engine.element |
| */ |
| abstract class ElementLocation { |
| /** |
| * Return an encoded representation of this location that can be used to create a location that is |
| * equal to this location. |
| * @return an encoded representation of this location |
| */ |
| String get encoding; |
| } |
| /** |
| * The interface {@code ElementVisitor} defines the behavior of objects that can be used to visit an |
| * element structure. |
| * @coverage dart.engine.element |
| */ |
| abstract class ElementVisitor<R> { |
| R visitClassElement(ClassElement element); |
| R visitCompilationUnitElement(CompilationUnitElement element); |
| R visitConstructorElement(ConstructorElement element); |
| R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); |
| R visitExportElement(ExportElement element); |
| R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element); |
| R visitFieldElement(FieldElement element); |
| R visitFieldFormalParameterElement(FieldFormalParameterElement element); |
| R visitFunctionElement(FunctionElement element); |
| R visitFunctionTypeAliasElement(FunctionTypeAliasElement element); |
| R visitHtmlElement(HtmlElement element); |
| R visitImportElement(ImportElement element); |
| R visitLabelElement(LabelElement element); |
| R visitLibraryElement(LibraryElement element); |
| R visitLocalVariableElement(LocalVariableElement element); |
| R visitMethodElement(MethodElement element); |
| R visitMultiplyDefinedElement(MultiplyDefinedElement element); |
| R visitParameterElement(ParameterElement element); |
| R visitPrefixElement(PrefixElement element); |
| R visitPropertyAccessorElement(PropertyAccessorElement element); |
| R visitTopLevelVariableElement(TopLevelVariableElement element); |
| R visitTypeVariableElement(TypeVariableElement element); |
| } |
| /** |
| * The interface {@code EmbeddedHtmlScriptElement} defines the behavior of elements representing a |
| * script tag in an HTML file having content that defines a Dart library. |
| * @coverage dart.engine.element |
| */ |
| abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { |
| /** |
| * Return the library element defined by the content of the script tag. |
| * @return the library element (not {@code null}) |
| */ |
| LibraryElement get scriptLibrary; |
| } |
| /** |
| * The interface {@code ExecutableElement} defines the behavior of elements representing an |
| * executable object, including functions, methods, constructors, getters, and setters. |
| * @coverage dart.engine.element |
| */ |
| abstract class ExecutableElement implements Element { |
| /** |
| * Return an array containing all of the functions defined within this executable element. |
| * @return the functions defined within this executable element |
| */ |
| List<FunctionElement> get functions; |
| /** |
| * Return an array containing all of the labels defined within this executable element. |
| * @return the labels defined within this executable element |
| */ |
| List<LabelElement> get labels; |
| /** |
| * Return an array containing all of the local variables defined within this executable element. |
| * @return the local variables defined within this executable element |
| */ |
| List<LocalVariableElement> get localVariables; |
| /** |
| * Return an array containing all of the parameters defined by this executable element. |
| * @return the parameters defined by this executable element |
| */ |
| List<ParameterElement> get parameters; |
| /** |
| * Return the type of function defined by this executable element. |
| * @return the type of function defined by this executable element |
| */ |
| FunctionType get type; |
| /** |
| * Return {@code true} if this executable element is an operator. The test may be based on the |
| * name of the executable element, in which case the result will be correct when the name is |
| * legal. |
| * @return {@code true} if this executable element is an operator |
| */ |
| bool isOperator(); |
| /** |
| * Return {@code true} if this element is a static element. A static element is an element that is |
| * not associated with a particular instance, but rather with an entire library or class. |
| * @return {@code true} if this executable element is a static element |
| */ |
| bool isStatic(); |
| } |
| /** |
| * The interface {@code ExportElement} defines the behavior of objects representing information |
| * about a single export directive within a library. |
| * @coverage dart.engine.element |
| */ |
| abstract class ExportElement implements Element { |
| /** |
| * An empty array of export elements. |
| */ |
| static List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); |
| /** |
| * Return an array containing the combinators that were specified as part of the export directive |
| * in the order in which they were specified. |
| * @return the combinators specified in the export directive |
| */ |
| List<NamespaceCombinator> get combinators; |
| /** |
| * Return the library that is exported from this library by this export directive. |
| * @return the library that is exported from this library |
| */ |
| LibraryElement get exportedLibrary; |
| } |
| /** |
| * The interface {@code ExternalHtmlScriptElement} defines the behavior of elements representing a |
| * script tag in an HTML file having a {@code source} attribute that references a Dart library |
| * source file. |
| * @coverage dart.engine.element |
| */ |
| abstract class ExternalHtmlScriptElement implements HtmlScriptElement { |
| /** |
| * Return the source referenced by this element, or {@code null} if this element does not |
| * reference a Dart library source file. |
| * @return the source for the external Dart library |
| */ |
| Source get scriptSource; |
| } |
| /** |
| * The interface {@code FieldElement} defines the behavior of elements representing a field defined |
| * within a type. |
| * @coverage dart.engine.element |
| */ |
| abstract class FieldElement implements PropertyInducingElement { |
| /** |
| * Return the type in which this field is defined. |
| * @return the type in which this field is defined |
| */ |
| ClassElement get enclosingElement; |
| } |
| /** |
| * The interface {@code FieldFormalParameterElement} defines the behavior of elements representing a |
| * field formal parameter defined within a constructor element. |
| */ |
| abstract class FieldFormalParameterElement implements ParameterElement { |
| /** |
| * Return the field element associated with this field formal parameter, or {@code null} if the |
| * parameter references a field that doesn't exist. |
| * @return the field element associated with this field formal parameter |
| */ |
| FieldElement get field; |
| } |
| /** |
| * The interface {@code FunctionElement} defines the behavior of elements representing a function. |
| * @coverage dart.engine.element |
| */ |
| abstract class FunctionElement implements ExecutableElement, LocalElement { |
| } |
| /** |
| * The interface {@code FunctionTypeAliasElement} defines the behavior of elements representing a |
| * function type alias ({@code typedef}). |
| * @coverage dart.engine.element |
| */ |
| abstract class FunctionTypeAliasElement implements Element { |
| /** |
| * Return the compilation unit in which this type alias is defined. |
| * @return the compilation unit in which this type alias is defined |
| */ |
| CompilationUnitElement get enclosingElement; |
| /** |
| * Return an array containing all of the parameters defined by this type alias. |
| * @return the parameters defined by this type alias |
| */ |
| List<ParameterElement> get parameters; |
| /** |
| * Return the type of function defined by this type alias. |
| * @return the type of function defined by this type alias |
| */ |
| FunctionType get type; |
| /** |
| * Return an array containing all of the type variables defined for this type. |
| * @return the type variables defined for this type |
| */ |
| List<TypeVariableElement> get typeVariables; |
| } |
| /** |
| * The interface {@code HideCombinator} defines the behavior of combinators that cause some of the |
| * names in a namespace to be hidden when being imported. |
| * @coverage dart.engine.element |
| */ |
| abstract class HideCombinator implements NamespaceCombinator { |
| /** |
| * Return an array containing the names that are not to be made visible in the importing library |
| * even if they are defined in the imported library. |
| * @return the names from the imported library that are hidden from the importing library |
| */ |
| List<String> get hiddenNames; |
| } |
| /** |
| * The interface {@code HtmlElement} defines the behavior of elements representing an HTML file. |
| * @coverage dart.engine.element |
| */ |
| abstract class HtmlElement implements Element { |
| /** |
| * Return an array containing all of the script elements contained in the HTML file. This includes |
| * scripts with libraries that are defined by the content of a script tag as well as libraries |
| * that are referenced in the {@core source} attribute of a script tag. |
| * @return the script elements in the HTML file (not {@code null}, contains no {@code null}s) |
| */ |
| List<HtmlScriptElement> get scripts; |
| } |
| /** |
| * The interface {@code HtmlScriptElement} defines the behavior of elements representing a script |
| * tag in an HTML file. |
| * @see EmbeddedHtmlScriptElement |
| * @see ExternalHtmlScriptElement |
| * @coverage dart.engine.element |
| */ |
| abstract class HtmlScriptElement implements Element { |
| } |
| /** |
| * The interface {@code ImportElement} defines the behavior of objects representing information |
| * about a single import directive within a library. |
| * @coverage dart.engine.element |
| */ |
| abstract class ImportElement implements Element { |
| /** |
| * An empty array of import elements. |
| */ |
| static List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0); |
| /** |
| * Return an array containing the combinators that were specified as part of the import directive |
| * in the order in which they were specified. |
| * @return the combinators specified in the import directive |
| */ |
| List<NamespaceCombinator> get combinators; |
| /** |
| * Return the library that is imported into this library by this import directive. |
| * @return the library that is imported into this library |
| */ |
| LibraryElement get importedLibrary; |
| /** |
| * Return the prefix that was specified as part of the import directive, or {@code null} if there |
| * was no prefix specified. |
| * @return the prefix that was specified as part of the import directive |
| */ |
| PrefixElement get prefix; |
| } |
| /** |
| * The interface {@code LabelElement} defines the behavior of elements representing a label |
| * associated with a statement. |
| * @coverage dart.engine.element |
| */ |
| abstract class LabelElement implements Element { |
| /** |
| * Return the executable element in which this label is defined. |
| * @return the executable element in which this label is defined |
| */ |
| ExecutableElement get enclosingElement; |
| } |
| /** |
| * The interface {@code LibraryElement} defines the behavior of elements representing a library. |
| * @coverage dart.engine.element |
| */ |
| abstract class LibraryElement implements Element { |
| /** |
| * Return the compilation unit that defines this library. |
| * @return the compilation unit that defines this library |
| */ |
| CompilationUnitElement get definingCompilationUnit; |
| /** |
| * Return the entry point for this library, or {@code null} if this library does not have an entry |
| * point. The entry point is defined to be a zero argument top-level function whose name is{@code main}. |
| * @return the entry point for this library |
| */ |
| FunctionElement get entryPoint; |
| /** |
| * Return an array containing all of the libraries that are exported from this library. |
| * @return an array containing all of the libraries that are exported from this library |
| */ |
| List<LibraryElement> get exportedLibraries; |
| /** |
| * Return an array containing all of the exports defined in this library. |
| * @return the exports defined in this library |
| */ |
| List<ExportElement> get exports; |
| /** |
| * Return an array containing all of the libraries that are imported into this library. This |
| * includes all of the libraries that are imported using a prefix (also available through the |
| * prefixes returned by {@link #getPrefixes()}) and those that are imported without a prefix. |
| * @return an array containing all of the libraries that are imported into this library |
| */ |
| List<LibraryElement> get importedLibraries; |
| /** |
| * Return an array containing all of the imports defined in this library. |
| * @return the imports defined in this library |
| */ |
| List<ImportElement> get imports; |
| /** |
| * Return an array containing all of the compilation units that are included in this library using |
| * a {@code part} directive. This does not include the defining compilation unit that contains the{@code part} directives. |
| * @return the compilation units that are included in this library |
| */ |
| List<CompilationUnitElement> get parts; |
| /** |
| * Return an array containing elements for each of the prefixes used to {@code import} libraries |
| * into this library. Each prefix can be used in more than one {@code import} directive. |
| * @return the prefixes used to {@code import} libraries into this library |
| */ |
| List<PrefixElement> get prefixes; |
| /** |
| * Return the class defined in this library that has the given name, or {@code null} if this |
| * library does not define a class with the given name. |
| * @param className the name of the class to be returned |
| * @return the class with the given name that is defined in this library |
| */ |
| ClassElement getType(String className); |
| /** |
| * Answer {@code true} if this library is an application that can be run in the browser. |
| * @return {@code true} if this library is an application that can be run in the browser |
| */ |
| bool isBrowserApplication(); |
| /** |
| * Return {@code true} if this library is the dart:core library. |
| * @return {@code true} if this library is the dart:core library |
| */ |
| bool isDartCore(); |
| /** |
| * Return {@code true} if this library is up to date with respect to the given time stamp. If any |
| * transitively referenced Source is newer than the time stamp, this method returns false. |
| * @param timeStamp the time stamp to compare against |
| * @return {@code true} if this library is up to date with respect to the given time stamp |
| */ |
| bool isUpToDate2(int timeStamp); |
| } |
| /** |
| * The interface {@code LocalElement} defines the behavior of elements that can be (but are not |
| * required to be) defined within a method or function (an {@link ExecutableElement}). |
| * @coverage dart.engine.element |
| */ |
| abstract class LocalElement implements Element { |
| /** |
| * Return a source range that covers the approximate portion of the source in which the name of |
| * this element is visible, or {@code null} if there is no single range of characters within which |
| * the element name is visible. |
| * <ul> |
| * <li>For a local variable, this includes everything from the end of the variable's initializer |
| * to the end of the block that encloses the variable declaration.</li> |
| * <li>For a parameter, this includes the body of the method or function that declares the |
| * parameter.</li> |
| * <li>For a local function, this includes everything from the beginning of the function's body to |
| * the end of the block that encloses the function declaration.</li> |
| * <li>For top-level functions, {@code null} will be returned because they are potentially visible |
| * in multiple sources.</li> |
| * </ul> |
| * @return the range of characters in which the name of this element is visible |
| */ |
| SourceRange get visibleRange; |
| } |
| /** |
| * The interface {@code LocalVariableElement} defines the behavior common to elements that represent |
| * a local variable. |
| * @coverage dart.engine.element |
| */ |
| abstract class LocalVariableElement implements LocalElement, VariableElement { |
| } |
| /** |
| * The interface {@code MethodElement} defines the behavior of elements that represent a method |
| * defined within a type. |
| * @coverage dart.engine.element |
| */ |
| abstract class MethodElement implements ExecutableElement { |
| /** |
| * Return the type in which this method is defined. |
| * @return the type in which this method is defined |
| */ |
| ClassElement get enclosingElement; |
| /** |
| * Return {@code true} if this method is abstract. Methods are abstract if they are not external |
| * and have no body. |
| * @return {@code true} if this method is abstract |
| */ |
| bool isAbstract(); |
| } |
| /** |
| * The interface {@code MultiplyDefinedElement} defines the behavior of pseudo-elements that |
| * represent multiple elements defined within a single scope that have the same name. This situation |
| * is not allowed by the language, so objects implementing this interface always represent an error. |
| * As a result, most of the normal operations on elements do not make sense and will return useless |
| * results. |
| * @coverage dart.engine.element |
| */ |
| abstract class MultiplyDefinedElement implements Element { |
| /** |
| * Return an array containing all of the elements that were defined within the scope to have the |
| * same name. |
| * @return the elements that were defined with the same name |
| */ |
| List<Element> get conflictingElements; |
| } |
| /** |
| * The interface {@code NamespaceCombinator} defines the behavior common to objects that control how |
| * namespaces are combined. |
| * @coverage dart.engine.element |
| */ |
| abstract class NamespaceCombinator { |
| /** |
| * An empty array of namespace combinators. |
| */ |
| static List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombinator>(0); |
| } |
| /** |
| * The interface {@code ParameterElement} defines the behavior of elements representing a parameter |
| * defined within an executable element. |
| * @coverage dart.engine.element |
| */ |
| abstract class ParameterElement implements LocalElement, VariableElement { |
| /** |
| * Return the kind of this parameter. |
| * @return the kind of this parameter |
| */ |
| ParameterKind get parameterKind; |
| /** |
| * Return an array containing all of the parameters defined by this parameter. A parameter will |
| * only define other parameters if it is a function typed parameter. |
| * @return the parameters defined by this parameter element |
| */ |
| List<ParameterElement> get parameters; |
| /** |
| * Return {@code true} if this parameter is an initializing formal parameter. |
| * @return {@code true} if this parameter is an initializing formal parameter |
| */ |
| bool isInitializingFormal(); |
| } |
| /** |
| * The interface {@code PrefixElement} defines the behavior common to elements that represent a |
| * prefix used to import one or more libraries into another library. |
| * @coverage dart.engine.element |
| */ |
| abstract class PrefixElement implements Element { |
| /** |
| * Return the library into which other libraries are imported using this prefix. |
| * @return the library into which other libraries are imported using this prefix |
| */ |
| LibraryElement get enclosingElement; |
| /** |
| * Return an array containing all of the libraries that are imported using this prefix. |
| * @return the libraries that are imported using this prefix |
| */ |
| List<LibraryElement> get importedLibraries; |
| } |
| /** |
| * The interface {@code PropertyAccessorElement} defines the behavior of elements representing a |
| * getter or a setter. Note that explicitly defined property accessors implicitly define a synthetic |
| * field. Symmetrically, synthetic accessors are implicitly created for explicitly defined fields. |
| * The following rules apply: |
| * <ul> |
| * <li>Every explicit field is represented by a non-synthetic {@link FieldElement}. |
| * <li>Every explicit field induces a getter and possibly a setter, both of which are represented by |
| * synthetic {@link PropertyAccessorElement}s. |
| * <li>Every explicit getter or setter is represented by a non-synthetic{@link PropertyAccessorElement}. |
| * <li>Every explicit getter or setter (or pair thereof if they have the same name) induces a field |
| * that is represented by a synthetic {@link FieldElement}. |
| * </ul> |
| * @coverage dart.engine.element |
| */ |
| abstract class PropertyAccessorElement implements ExecutableElement { |
| /** |
| * Return the field or top-level variable associated with this accessor. If this accessor was |
| * explicitly defined (is not synthetic) then the variable associated with it will be synthetic. |
| * @return the variable associated with this accessor |
| */ |
| PropertyInducingElement get variable; |
| /** |
| * Return {@code true} if this accessor represents a getter. |
| * @return {@code true} if this accessor represents a getter |
| */ |
| bool isGetter(); |
| /** |
| * Return {@code true} if this accessor represents a setter. |
| * @return {@code true} if this accessor represents a setter |
| */ |
| bool isSetter(); |
| } |
| /** |
| * The interface {@code PropertyInducingElement} defines the behavior of elements representing a |
| * variable that has an associated getter and possibly a setter. Note that explicitly defined |
| * variables implicitly define a synthetic getter and that non-{@code final} explicitly defined |
| * variables implicitly define a synthetic setter. Symmetrically, synthetic fields are implicitly |
| * created for explicitly defined getters and setters. The following rules apply: |
| * <ul> |
| * <li>Every explicit variable is represented by a non-synthetic {@link PropertyInducingElement}. |
| * <li>Every explicit variable induces a getter and possibly a setter, both of which are represented |
| * by synthetic {@link PropertyAccessorElement}s. |
| * <li>Every explicit getter or setter is represented by a non-synthetic{@link PropertyAccessorElement}. |
| * <li>Every explicit getter or setter (or pair thereof if they have the same name) induces a |
| * variable that is represented by a synthetic {@link PropertyInducingElement}. |
| * </ul> |
| * @coverage dart.engine.element |
| */ |
| abstract class PropertyInducingElement implements VariableElement { |
| /** |
| * Return the getter associated with this variable. If this variable was explicitly defined (is |
| * not synthetic) then the getter associated with it will be synthetic. |
| * @return the getter associated with this variable |
| */ |
| PropertyAccessorElement get getter; |
| /** |
| * Return the setter associated with this variable, or {@code null} if the variable is effectively{@code final} and therefore does not have a setter associated with it. (This can happen either |
| * because the variable is explicitly defined as being {@code final} or because the variable is |
| * induced by an explicit getter that does not have a corresponding setter.) If this variable was |
| * explicitly defined (is not synthetic) then the setter associated with it will be synthetic. |
| * @return the setter associated with this variable |
| */ |
| PropertyAccessorElement get setter; |
| /** |
| * Return {@code true} if this element is a static element. A static element is an element that is |
| * not associated with a particular instance, but rather with an entire library or class. |
| * @return {@code true} if this executable element is a static element |
| */ |
| bool isStatic(); |
| } |
| /** |
| * The interface {@code ShowCombinator} defines the behavior of combinators that cause some of the |
| * names in a namespace to be visible (and the rest hidden) when being imported. |
| * @coverage dart.engine.element |
| */ |
| abstract class ShowCombinator implements NamespaceCombinator { |
| /** |
| * Return an array containing the names that are to be made visible in the importing library if |
| * they are defined in the imported library. |
| * @return the names from the imported library that are visible in the importing library |
| */ |
| List<String> get shownNames; |
| } |
| /** |
| * The interface {@code TopLevelVariableElement} defines the behavior of elements representing a |
| * top-level variable. |
| * @coverage dart.engine.element |
| */ |
| abstract class TopLevelVariableElement implements PropertyInducingElement { |
| } |
| /** |
| * The interface {@code TypeVariableElement} defines the behavior of elements representing a type |
| * variable. |
| * @coverage dart.engine.element |
| */ |
| abstract class TypeVariableElement implements Element { |
| /** |
| * Return the type representing the bound associated with this variable, or {@code null} if this |
| * variable does not have an explicit bound. |
| * @return the type representing the bound associated with this variable |
| */ |
| Type2 get bound; |
| /** |
| * Return the type defined by this type variable. |
| * @return the type defined by this type variable |
| */ |
| TypeVariableType get type; |
| } |
| /** |
| * The interface {@code UndefinedElement} defines the behavior of pseudo-elements that represent |
| * names that are undefined. This situation is not allowed by the language, so objects implementing |
| * this interface always represent an error. As a result, most of the normal operations on elements |
| * do not make sense and will return useless results. |
| * @coverage dart.engine.element |
| */ |
| abstract class UndefinedElement implements Element { |
| } |
| /** |
| * The interface {@code VariableElement} defines the behavior common to elements that represent a |
| * variable. |
| * @coverage dart.engine.element |
| */ |
| abstract class VariableElement implements Element { |
| /** |
| * Return a synthetic function representing this variable's initializer, or {@code null} if this |
| * variable does not have an initializer. The function will have no parameters. The return type of |
| * the function will be the compile-time type of the initialization expression. |
| * @return a synthetic function representing this variable's initializer |
| */ |
| FunctionElement get initializer; |
| /** |
| * Return the declared type of this variable, or {@code null} if the variable did not have a |
| * declared type (such as if it was declared using the keyword 'var'). |
| * @return the declared type of this variable |
| */ |
| Type2 get type; |
| /** |
| * Return {@code true} if this variable was declared with the 'const' modifier. |
| * @return {@code true} if this variable was declared with the 'const' modifier |
| */ |
| bool isConst(); |
| /** |
| * Return {@code true} if this variable was declared with the 'final' modifier. Variables that are |
| * declared with the 'const' modifier will return {@code false} even though they are implicitly |
| * final. |
| * @return {@code true} if this variable was declared with the 'final' modifier |
| */ |
| bool isFinal(); |
| } |
| /** |
| * Instances of the class {@code GeneralizingElementVisitor} implement an element visitor that will |
| * recursively visit all of the elements in an element model (like instances of the class{@link RecursiveElementVisitor}). In addition, when an element of a specific type is visited not |
| * only will the visit method for that specific type of element be invoked, but additional methods |
| * for the supertypes of that element will also be invoked. For example, using an instance of this |
| * class to visit a {@link MethodElement} will cause the method{@link #visitMethodElement(MethodElement)} to be invoked but will also cause the methods{@link #visitExecutableElement(ExecutableElement)} and {@link #visitElement(Element)} to be |
| * subsequently invoked. This allows visitors to be written that visit all executable elements |
| * without needing to override the visit method for each of the specific subclasses of{@link ExecutableElement}. |
| * <p> |
| * Note, however, that unlike many visitors, element visitors visit objects based on the interfaces |
| * implemented by those elements. Because interfaces form a graph structure rather than a tree |
| * structure the way classes do, and because it is generally undesirable for an object to be visited |
| * more than once, this class flattens the interface graph into a pseudo-tree. In particular, this |
| * class treats elements as if the element types were structured in the following way: |
| * <p> |
| * <pre> |
| * Element |
| * ClassElement |
| * CompilationUnitElement |
| * ExecutableElement |
| * ConstructorElement |
| * LocalElement |
| * FunctionElement |
| * MethodElement |
| * PropertyAccessorElement |
| * ExportElement |
| * HtmlElement |
| * ImportElement |
| * LabelElement |
| * LibraryElement |
| * MultiplyDefinedElement |
| * PrefixElement |
| * TypeAliasElement |
| * TypeVariableElement |
| * UndefinedElement |
| * VariableElement |
| * PropertyInducingElement |
| * FieldElement |
| * TopLevelVariableElement |
| * LocalElement |
| * LocalVariableElement |
| * ParameterElement |
| * FieldFormalParameterElement |
| * </pre> |
| * <p> |
| * Subclasses that override a visit method must either invoke the overridden visit method or |
| * explicitly invoke the more general visit method. Failure to do so will cause the visit methods |
| * for superclasses of the element to not be invoked and will cause the children of the visited node |
| * to not be visited. |
| * @coverage dart.engine.element |
| */ |
| class GeneralizingElementVisitor<R> implements ElementVisitor<R> { |
| R visitClassElement(ClassElement element) => visitElement(element); |
| R visitCompilationUnitElement(CompilationUnitElement element) => visitElement(element); |
| R visitConstructorElement(ConstructorElement element) => visitExecutableElement(element); |
| R visitElement(Element element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => visitHtmlScriptElement(element); |
| R visitExecutableElement(ExecutableElement element) => visitElement(element); |
| R visitExportElement(ExportElement element) => visitElement(element); |
| R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => visitHtmlScriptElement(element); |
| R visitFieldElement(FieldElement element) => visitPropertyInducingElement(element); |
| R visitFieldFormalParameterElement(FieldFormalParameterElement element) => visitParameterElement(element); |
| R visitFunctionElement(FunctionElement element) => visitLocalElement(element); |
| R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => visitElement(element); |
| R visitHtmlElement(HtmlElement element) => visitElement(element); |
| R visitHtmlScriptElement(HtmlScriptElement element) => visitElement(element); |
| R visitImportElement(ImportElement element) => visitElement(element); |
| R visitLabelElement(LabelElement element) => visitElement(element); |
| R visitLibraryElement(LibraryElement element) => visitElement(element); |
| R visitLocalElement(LocalElement element) { |
| if (element is LocalVariableElement) { |
| return visitVariableElement((element as LocalVariableElement)); |
| } else if (element is ParameterElement) { |
| return visitVariableElement((element as ParameterElement)); |
| } else if (element is FunctionElement) { |
| return visitExecutableElement((element as FunctionElement)); |
| } |
| return null; |
| } |
| R visitLocalVariableElement(LocalVariableElement element) => visitLocalElement(element); |
| R visitMethodElement(MethodElement element) => visitExecutableElement(element); |
| R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(element); |
| R visitParameterElement(ParameterElement element) => visitLocalElement(element); |
| R visitPrefixElement(PrefixElement element) => visitElement(element); |
| R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecutableElement(element); |
| R visitPropertyInducingElement(PropertyInducingElement element) => visitVariableElement(element); |
| R visitTopLevelVariableElement(TopLevelVariableElement element) => visitPropertyInducingElement(element); |
| R visitTypeVariableElement(TypeVariableElement element) => visitElement(element); |
| R visitVariableElement(VariableElement element) => visitElement(element); |
| } |
| /** |
| * Instances of the class {@code RecursiveElementVisitor} implement an element visitor that will |
| * recursively visit all of the element in an element model. For example, using an instance of this |
| * class to visit a {@link CompilationUnitElement} will also cause all of the types in the |
| * compilation unit to be visited. |
| * <p> |
| * Subclasses that override a visit method must either invoke the overridden visit method or must |
| * explicitly ask the visited element to visit its children. Failure to do so will cause the |
| * children of the visited element to not be visited. |
| * @coverage dart.engine.element |
| */ |
| class RecursiveElementVisitor<R> implements ElementVisitor<R> { |
| R visitClassElement(ClassElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitCompilationUnitElement(CompilationUnitElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitConstructorElement(ConstructorElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitExportElement(ExportElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitFieldElement(FieldElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitFieldFormalParameterElement(FieldFormalParameterElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitFunctionElement(FunctionElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitHtmlElement(HtmlElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitImportElement(ImportElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitLabelElement(LabelElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitLibraryElement(LibraryElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitLocalVariableElement(LocalVariableElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitMethodElement(MethodElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitMultiplyDefinedElement(MultiplyDefinedElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitParameterElement(ParameterElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitPrefixElement(PrefixElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitPropertyAccessorElement(PropertyAccessorElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitTopLevelVariableElement(TopLevelVariableElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| R visitTypeVariableElement(TypeVariableElement element) { |
| element.visitChildren(this); |
| return null; |
| } |
| } |
| /** |
| * Instances of the class {@code SimpleElementVisitor} implement an element visitor that will do |
| * nothing when visiting an element. It is intended to be a superclass for classes that use the |
| * visitor pattern primarily as a dispatch mechanism (and hence don't need to recursively visit a |
| * whole structure) and that only need to visit a small number of element types. |
| * @coverage dart.engine.element |
| */ |
| class SimpleElementVisitor<R> implements ElementVisitor<R> { |
| R visitClassElement(ClassElement element) => null; |
| R visitCompilationUnitElement(CompilationUnitElement element) => null; |
| R visitConstructorElement(ConstructorElement element) => null; |
| R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null; |
| R visitExportElement(ExportElement element) => null; |
| R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => null; |
| R visitFieldElement(FieldElement element) => null; |
| R visitFieldFormalParameterElement(FieldFormalParameterElement element) => null; |
| R visitFunctionElement(FunctionElement element) => null; |
| R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null; |
| R visitHtmlElement(HtmlElement element) => null; |
| R visitImportElement(ImportElement element) => null; |
| R visitLabelElement(LabelElement element) => null; |
| R visitLibraryElement(LibraryElement element) => null; |
| R visitLocalVariableElement(LocalVariableElement element) => null; |
| R visitMethodElement(MethodElement element) => null; |
| R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; |
| R visitParameterElement(ParameterElement element) => null; |
| R visitPrefixElement(PrefixElement element) => null; |
| R visitPropertyAccessorElement(PropertyAccessorElement element) => null; |
| R visitTopLevelVariableElement(TopLevelVariableElement element) => null; |
| R visitTypeVariableElement(TypeVariableElement element) => null; |
| } |
| /** |
| * Instances of the class {@code AnnotationImpl} implement an {@link Annotation}. |
| * @coverage dart.engine.element |
| */ |
| class AnnotationImpl implements Annotation { |
| /** |
| * The element representing the field, variable, or constructor being used as an annotation. |
| */ |
| Element _element; |
| /** |
| * An empty array of annotations. |
| */ |
| static List<AnnotationImpl> EMPTY_ARRAY = new List<AnnotationImpl>(0); |
| /** |
| * Initialize a newly created annotation. |
| * @param element the element representing the field, variable, or constructor being used as an |
| * annotation |
| */ |
| AnnotationImpl(Element element) { |
| this._element = element; |
| } |
| Element get element => _element; |
| String toString() => "@${_element.toString()}"; |
| } |
| /** |
| * Instances of the class {@code ClassElementImpl} implement a {@code ClassElement}. |
| * @coverage dart.engine.element |
| */ |
| class ClassElementImpl extends ElementImpl implements ClassElement { |
| /** |
| * An array containing all of the accessors (getters and setters) contained in this class. |
| */ |
| List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the constructors contained in this class. |
| */ |
| List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the fields contained in this class. |
| */ |
| List<FieldElement> _fields = FieldElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the mixins that are applied to the class being extended in order to |
| * derive the superclass of this class. |
| */ |
| List<InterfaceType> _mixins = InterfaceTypeImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the interfaces that are implemented by this class. |
| */ |
| List<InterfaceType> _interfaces = InterfaceTypeImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the methods contained in this class. |
| */ |
| List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; |
| /** |
| * The superclass of the class, or {@code null} if the class does not have an explicit superclass. |
| */ |
| InterfaceType _supertype; |
| /** |
| * The type defined by the class. |
| */ |
| InterfaceType _type; |
| /** |
| * An array containing all of the type variables defined for this class. |
| */ |
| List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY; |
| /** |
| * An empty array of type elements. |
| */ |
| static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); |
| /** |
| * Initialize a newly created class element to have the given name. |
| * @param name the name of this element |
| */ |
| ClassElementImpl(Identifier name) : super.con1(name) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitClassElement(this); |
| List<PropertyAccessorElement> get accessors => _accessors; |
| List<InterfaceType> get allSupertypes { |
| Set<InterfaceType> list = new Set<InterfaceType>(); |
| collectAllSupertypes(list); |
| return new List.from(list); |
| } |
| ElementImpl getChild(String identifier2) { |
| for (PropertyAccessorElement accessor in _accessors) { |
| if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2) { |
| return accessor as PropertyAccessorElementImpl; |
| } |
| } |
| for (ConstructorElement constructor in _constructors) { |
| if (((constructor as ConstructorElementImpl)).identifier == identifier2) { |
| return constructor as ConstructorElementImpl; |
| } |
| } |
| for (FieldElement field in _fields) { |
| if (((field as FieldElementImpl)).identifier == identifier2) { |
| return field as FieldElementImpl; |
| } |
| } |
| for (MethodElement method in _methods) { |
| if (((method as MethodElementImpl)).identifier == identifier2) { |
| return method as MethodElementImpl; |
| } |
| } |
| for (TypeVariableElement typeVariable in _typeVariables) { |
| if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2) { |
| return typeVariable as TypeVariableElementImpl; |
| } |
| } |
| return null; |
| } |
| List<ConstructorElement> get constructors => _constructors; |
| /** |
| * Given some name, this returns the {@link FieldElement} with the matching name, if there is no |
| * such field, then {@code null} is returned. |
| * @param name some name to lookup a field element with |
| * @return the matching field element, or {@code null} if no such element was found |
| */ |
| FieldElement getField(String name2) { |
| for (FieldElement fieldElement in _fields) { |
| if (name2 == fieldElement.name) { |
| return fieldElement; |
| } |
| } |
| return null; |
| } |
| List<FieldElement> get fields => _fields; |
| /** |
| * Return the element representing the getter with the given name that is declared in this class, |
| * or {@code null} if this class does not declare a getter with the given name. |
| * @param getterName the name of the getter to be returned |
| * @return the getter declared in this class with the given name |
| */ |
| PropertyAccessorElement getGetter(String getterName) { |
| for (PropertyAccessorElement accessor in _accessors) { |
| if (accessor.isGetter() && accessor.name == getterName) { |
| return accessor; |
| } |
| } |
| return null; |
| } |
| List<InterfaceType> get interfaces => _interfaces; |
| ElementKind get kind => ElementKind.CLASS; |
| /** |
| * Return the element representing the method with the given name that is declared in this class, |
| * or {@code null} if this class does not declare a method with the given name. |
| * @param methodName the name of the method to be returned |
| * @return the method declared in this class with the given name |
| */ |
| MethodElement getMethod(String methodName) { |
| for (MethodElement method in _methods) { |
| if (method.name == methodName) { |
| return method; |
| } |
| } |
| return null; |
| } |
| List<MethodElement> get methods => _methods; |
| List<InterfaceType> get mixins => _mixins; |
| ConstructorElement getNamedConstructor(String name2) { |
| for (ConstructorElement element in constructors) { |
| String elementName = element.name; |
| if (elementName != null && elementName == name2) { |
| return element; |
| } |
| } |
| return null; |
| } |
| /** |
| * Return the element representing the setter with the given name that is declared in this class, |
| * or {@code null} if this class does not declare a setter with the given name. |
| * @param setterName the name of the getter to be returned |
| * @return the setter declared in this class with the given name |
| */ |
| PropertyAccessorElement getSetter(String setterName) { |
| for (PropertyAccessorElement accessor in _accessors) { |
| if (accessor.isSetter() && accessor.name == setterName) { |
| return accessor; |
| } |
| } |
| return null; |
| } |
| InterfaceType get supertype => _supertype; |
| InterfaceType get type => _type; |
| List<TypeVariableElement> get typeVariables => _typeVariables; |
| ConstructorElement get unnamedConstructor { |
| for (ConstructorElement element in constructors) { |
| String name2 = element.name; |
| if (name2 == null || name2.isEmpty) { |
| return element; |
| } |
| } |
| return null; |
| } |
| bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
| bool isTypedef() => hasModifier(Modifier.TYPEDEF); |
| bool isValidMixin() => hasModifier(Modifier.MIXIN); |
| PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library) { |
| PropertyAccessorElement element = getGetter(getterName); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| for (InterfaceType mixin in _mixins) { |
| ClassElement mixinElement = mixin.element; |
| if (mixinElement != null) { |
| element = ((mixinElement as ClassElementImpl)).getGetter(getterName); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| } |
| } |
| if (_supertype != null) { |
| ClassElement supertypeElement = _supertype.element; |
| if (supertypeElement != null) { |
| element = supertypeElement.lookUpGetter(getterName, library); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| } |
| } |
| return null; |
| } |
| MethodElement lookUpMethod(String methodName, LibraryElement library) { |
| MethodElement element = getMethod(methodName); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| for (InterfaceType mixin in _mixins) { |
| ClassElement mixinElement = mixin.element; |
| if (mixinElement != null) { |
| element = ((mixinElement as ClassElementImpl)).getMethod(methodName); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| } |
| } |
| if (_supertype != null) { |
| ClassElement supertypeElement = _supertype.element; |
| if (supertypeElement != null) { |
| element = supertypeElement.lookUpMethod(methodName, library); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| } |
| } |
| return null; |
| } |
| PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library) { |
| PropertyAccessorElement element = getSetter(setterName); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| for (InterfaceType mixin in _mixins) { |
| ClassElement mixinElement = mixin.element; |
| if (mixinElement != null) { |
| element = ((mixinElement as ClassElementImpl)).getSetter(setterName); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| } |
| } |
| if (_supertype != null) { |
| ClassElement supertypeElement = _supertype.element; |
| if (supertypeElement != null) { |
| element = supertypeElement.lookUpSetter(setterName, library); |
| if (element != null && element.isAccessibleIn(library)) { |
| return element; |
| } |
| } |
| } |
| return null; |
| } |
| /** |
| * Set whether this class is abstract to correspond to the given value. |
| * @param isAbstract {@code true} if the class is abstract |
| */ |
| void set abstract(bool isAbstract) { |
| setModifier(Modifier.ABSTRACT, isAbstract); |
| } |
| /** |
| * Set the accessors contained in this class to the given accessors. |
| * @param accessors the accessors contained in this class |
| */ |
| void set accessors(List<PropertyAccessorElement> accessors2) { |
| for (PropertyAccessorElement accessor in accessors2) { |
| ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; |
| } |
| this._accessors = accessors2; |
| } |
| /** |
| * Set the constructors contained in this class to the given constructors. |
| * @param constructors the constructors contained in this class |
| */ |
| void set constructors(List<ConstructorElement> constructors2) { |
| for (ConstructorElement constructor in constructors2) { |
| ((constructor as ConstructorElementImpl)).enclosingElement = this; |
| } |
| this._constructors = constructors2; |
| } |
| /** |
| * Set the fields contained in this class to the given fields. |
| * @param fields the fields contained in this class |
| */ |
| void set fields(List<FieldElement> fields2) { |
| for (FieldElement field in fields2) { |
| ((field as FieldElementImpl)).enclosingElement = this; |
| } |
| this._fields = fields2; |
| } |
| /** |
| * Set the interfaces that are implemented by this class to the given types. |
| * @param the interfaces that are implemented by this class |
| */ |
| void set interfaces(List<InterfaceType> interfaces2) { |
| this._interfaces = interfaces2; |
| } |
| /** |
| * Set the methods contained in this class to the given methods. |
| * @param methods the methods contained in this class |
| */ |
| void set methods(List<MethodElement> methods2) { |
| for (MethodElement method in methods2) { |
| ((method as MethodElementImpl)).enclosingElement = this; |
| } |
| this._methods = methods2; |
| } |
| /** |
| * Set the mixins that are applied to the class being extended in order to derive the superclass |
| * of this class to the given types. |
| * @param mixins the mixins that are applied to derive the superclass of this class |
| */ |
| void set mixins(List<InterfaceType> mixins2) { |
| this._mixins = mixins2; |
| } |
| /** |
| * Set the superclass of the class to the given type. |
| * @param supertype the superclass of the class |
| */ |
| void set supertype(InterfaceType supertype2) { |
| this._supertype = supertype2; |
| } |
| /** |
| * Set the type defined by the class to the given type. |
| * @param type the type defined by the class |
| */ |
| void set type(InterfaceType type2) { |
| this._type = type2; |
| } |
| /** |
| * Set whether this class is defined by a typedef construct to correspond to the given value. |
| * @param isTypedef {@code true} if the class is defined by a typedef construct |
| */ |
| void set typedef(bool isTypedef) { |
| setModifier(Modifier.TYPEDEF, isTypedef); |
| } |
| /** |
| * Set the type variables defined for this class to the given type variables. |
| * @param typeVariables the type variables defined for this class |
| */ |
| void set typeVariables(List<TypeVariableElement> typeVariables2) { |
| for (TypeVariableElement typeVariable in typeVariables2) { |
| ((typeVariable as TypeVariableElementImpl)).enclosingElement = this; |
| } |
| this._typeVariables = typeVariables2; |
| } |
| /** |
| * Set whether this class is a valid mixin to correspond to the given value. |
| * @param isValidMixin {@code true} if this class can be used as a mixin |
| */ |
| void set validMixin(bool isValidMixin) { |
| setModifier(Modifier.MIXIN, isValidMixin); |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| super.visitChildren(visitor); |
| safelyVisitChildren(_accessors, visitor); |
| safelyVisitChildren(_constructors, visitor); |
| safelyVisitChildren(_fields, visitor); |
| safelyVisitChildren(_methods, visitor); |
| safelyVisitChildren(_typeVariables, visitor); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| String name2 = name; |
| if (name2 == null) { |
| builder.append("{unnamed class}"); |
| } else { |
| builder.append(name2); |
| } |
| int variableCount = _typeVariables.length; |
| if (variableCount > 0) { |
| builder.append("<"); |
| for (int i = 0; i < variableCount; i++) { |
| if (i > 0) { |
| builder.append(", "); |
| } |
| ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); |
| } |
| builder.append(">"); |
| } |
| } |
| void collectAllSupertypes(Set<InterfaceType> list) { |
| if (_supertype == null || list.contains(_supertype)) { |
| return; |
| } |
| javaSetAdd(list, _supertype); |
| ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list); |
| for (InterfaceType type in interfaces) { |
| if (!list.contains(type)) { |
| javaSetAdd(list, type); |
| ((type.element as ClassElementImpl)).collectAllSupertypes(list); |
| } |
| } |
| for (InterfaceType type in mixins) { |
| if (!list.contains(type)) { |
| javaSetAdd(list, type); |
| } |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code CompilationUnitElementImpl} implement a{@link CompilationUnitElement}. |
| * @coverage dart.engine.element |
| */ |
| class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitElement { |
| /** |
| * An array containing all of the top-level accessors (getters and setters) contained in this |
| * compilation unit. |
| */ |
| List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the top-level functions contained in this compilation unit. |
| */ |
| List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the variables contained in this compilation unit. |
| */ |
| List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_ARRAY; |
| /** |
| * The source that corresponds to this compilation unit. |
| */ |
| Source _source; |
| /** |
| * An array containing all of the function type aliases contained in this compilation unit. |
| */ |
| List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the types contained in this compilation unit. |
| */ |
| List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; |
| /** |
| * An empty array of compilation unit elements. |
| */ |
| static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElement>(0); |
| /** |
| * Initialize a newly created compilation unit element to have the given name. |
| * @param name the name of this element |
| */ |
| CompilationUnitElementImpl(String name) : super.con2(name, -1) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); |
| bool operator ==(Object object) => object != null && runtimeType == object.runtimeType && _source == ((object as CompilationUnitElementImpl)).source; |
| List<PropertyAccessorElement> get accessors => _accessors; |
| ElementImpl getChild(String identifier2) { |
| for (PropertyAccessorElement accessor in _accessors) { |
| if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2) { |
| return accessor as PropertyAccessorElementImpl; |
| } |
| } |
| for (VariableElement variable in _variables) { |
| if (((variable as VariableElementImpl)).identifier == identifier2) { |
| return variable as VariableElementImpl; |
| } |
| } |
| for (ExecutableElement function in _functions) { |
| if (((function as ExecutableElementImpl)).identifier == identifier2) { |
| return function as ExecutableElementImpl; |
| } |
| } |
| for (FunctionTypeAliasElement typeAlias in _typeAliases) { |
| if (((typeAlias as FunctionTypeAliasElementImpl)).identifier == identifier2) { |
| return typeAlias as FunctionTypeAliasElementImpl; |
| } |
| } |
| for (ClassElement type in _types) { |
| if (((type as ClassElementImpl)).identifier == identifier2) { |
| return type as ClassElementImpl; |
| } |
| } |
| return null; |
| } |
| LibraryElement get enclosingElement => super.enclosingElement as LibraryElement; |
| List<FunctionElement> get functions => _functions; |
| List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; |
| String get identifier => source.encoding; |
| ElementKind get kind => ElementKind.COMPILATION_UNIT; |
| Source get source => _source; |
| List<TopLevelVariableElement> get topLevelVariables => _variables; |
| ClassElement getType(String className) { |
| for (ClassElement type in _types) { |
| if (type.name == className) { |
| return type; |
| } |
| } |
| return null; |
| } |
| List<ClassElement> get types => _types; |
| int get hashCode => _source.hashCode; |
| /** |
| * Set the top-level accessors (getters and setters) contained in this compilation unit to the |
| * given accessors. |
| * @param the top-level accessors (getters and setters) contained in this compilation unit |
| */ |
| void set accessors(List<PropertyAccessorElement> accessors2) { |
| for (PropertyAccessorElement accessor in accessors2) { |
| ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; |
| } |
| this._accessors = accessors2; |
| } |
| /** |
| * Set the top-level functions contained in this compilation unit to the given functions. |
| * @param functions the top-level functions contained in this compilation unit |
| */ |
| void set functions(List<FunctionElement> functions2) { |
| for (FunctionElement function in functions2) { |
| ((function as FunctionElementImpl)).enclosingElement = this; |
| } |
| this._functions = functions2; |
| } |
| /** |
| * Set the source that corresponds to this compilation unit to the given source. |
| * @param source the source that corresponds to this compilation unit |
| */ |
| void set source(Source source2) { |
| this._source = source2; |
| } |
| /** |
| * Set the top-level variables contained in this compilation unit to the given variables. |
| * @param variables the top-level variables contained in this compilation unit |
| */ |
| void set topLevelVariables(List<TopLevelVariableElement> variables2) { |
| for (TopLevelVariableElement field in variables2) { |
| ((field as TopLevelVariableElementImpl)).enclosingElement = this; |
| } |
| this._variables = variables2; |
| } |
| /** |
| * Set the function type aliases contained in this compilation unit to the given type aliases. |
| * @param typeAliases the function type aliases contained in this compilation unit |
| */ |
| void set typeAliases(List<FunctionTypeAliasElement> typeAliases2) { |
| for (FunctionTypeAliasElement typeAlias in typeAliases2) { |
| ((typeAlias as FunctionTypeAliasElementImpl)).enclosingElement = this; |
| } |
| this._typeAliases = typeAliases2; |
| } |
| /** |
| * Set the types contained in this compilation unit to the given types. |
| * @param types types contained in this compilation unit |
| */ |
| void set types(List<ClassElement> types2) { |
| for (ClassElement type in types2) { |
| ((type as ClassElementImpl)).enclosingElement = this; |
| } |
| this._types = types2; |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| super.visitChildren(visitor); |
| safelyVisitChildren(_accessors, visitor); |
| safelyVisitChildren(_functions, visitor); |
| safelyVisitChildren(_typeAliases, visitor); |
| safelyVisitChildren(_types, visitor); |
| safelyVisitChildren(_variables, visitor); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| if (_source == null) { |
| builder.append("{compilation unit}"); |
| } else { |
| builder.append(_source.fullName); |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code ConstFieldElementImpl} implement a {@code FieldElement} for a |
| * 'const' field that has an initializer. |
| */ |
| class ConstFieldElementImpl extends FieldElementImpl { |
| /** |
| * The result of evaluating this variable's initializer. |
| */ |
| EvaluationResultImpl _result; |
| /** |
| * Initialize a newly created field element to have the given name. |
| * @param name the name of this element |
| */ |
| ConstFieldElementImpl(Identifier name) : super.con1(name) { |
| } |
| EvaluationResultImpl get evaluationResult => _result; |
| void set evaluationResult(EvaluationResultImpl result2) { |
| this._result = result2; |
| } |
| } |
| /** |
| * Instances of the class {@code ConstLocalVariableElementImpl} implement a{@code LocalVariableElement} for a local 'const' variable that has an initializer. |
| * @coverage dart.engine.element |
| */ |
| class ConstLocalVariableElementImpl extends LocalVariableElementImpl { |
| /** |
| * The result of evaluating this variable's initializer. |
| */ |
| EvaluationResultImpl _result; |
| /** |
| * Initialize a newly created local variable element to have the given name. |
| * @param name the name of this element |
| */ |
| ConstLocalVariableElementImpl(Identifier name) : super(name) { |
| } |
| EvaluationResultImpl get evaluationResult => _result; |
| void set evaluationResult(EvaluationResultImpl result2) { |
| this._result = result2; |
| } |
| } |
| /** |
| * Instances of the class {@code ConstParameterElementImpl} implement a {@code ParameterElement} for |
| * a 'const' parameter that has an initializer. |
| * @coverage dart.engine.element |
| */ |
| class ConstParameterElementImpl extends ParameterElementImpl { |
| /** |
| * The result of evaluating this variable's initializer. |
| */ |
| EvaluationResultImpl _result; |
| /** |
| * Initialize a newly created parameter element to have the given name. |
| * @param name the name of this element |
| */ |
| ConstParameterElementImpl(Identifier name) : super(name) { |
| } |
| EvaluationResultImpl get evaluationResult => _result; |
| void set evaluationResult(EvaluationResultImpl result2) { |
| this._result = result2; |
| } |
| } |
| /** |
| * Instances of the class {@code ConstTopLevelVariableElementImpl} implement a{@code TopLevelVariableElement} for a top-level 'const' variable that has an initializer. |
| */ |
| class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl { |
| /** |
| * The result of evaluating this variable's initializer. |
| */ |
| EvaluationResultImpl _result; |
| /** |
| * Initialize a newly created top-level variable element to have the given name. |
| * @param name the name of this element |
| */ |
| ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name) { |
| } |
| EvaluationResultImpl get evaluationResult => _result; |
| void set evaluationResult(EvaluationResultImpl result2) { |
| this._result = result2; |
| } |
| } |
| /** |
| * Instances of the class {@code ConstructorElementImpl} implement a {@code ConstructorElement}. |
| * @coverage dart.engine.element |
| */ |
| class ConstructorElementImpl extends ExecutableElementImpl implements ConstructorElement { |
| /** |
| * An empty array of constructor elements. |
| */ |
| static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); |
| /** |
| * Initialize a newly created constructor element to have the given name. |
| * @param name the name of this element |
| */ |
| ConstructorElementImpl(Identifier name) : super.con1(name) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| ElementKind get kind => ElementKind.CONSTRUCTOR; |
| bool isConst() => hasModifier(Modifier.CONST); |
| bool isFactory() => hasModifier(Modifier.FACTORY); |
| bool isStatic() => false; |
| /** |
| * Set whether this constructor represents a 'const' constructor to the given value. |
| * @param isConst {@code true} if this constructor represents a 'const' constructor |
| */ |
| void set const2(bool isConst) { |
| setModifier(Modifier.CONST, isConst); |
| } |
| /** |
| * Set whether this constructor represents a factory method to the given value. |
| * @param isFactory {@code true} if this constructor represents a factory method |
| */ |
| void set factory(bool isFactory) { |
| setModifier(Modifier.FACTORY, isFactory); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| builder.append(enclosingElement.name); |
| String name2 = name; |
| if (name2 != null && !name2.isEmpty) { |
| builder.append("."); |
| builder.append(name2); |
| } |
| super.appendTo(builder); |
| } |
| } |
| /** |
| * Instances of the class {@code DynamicElementImpl} represent the synthetic element representing |
| * the declaration of the type {@code dynamic}. |
| * @coverage dart.engine.element |
| */ |
| class DynamicElementImpl extends ElementImpl { |
| /** |
| * Return the unique instance of this class. |
| * @return the unique instance of this class |
| */ |
| static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as DynamicElementImpl; |
| /** |
| * The type defined by this element. |
| */ |
| DynamicTypeImpl _type; |
| /** |
| * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be |
| * created except as part of creating the type associated with this element. The single instance |
| * of this class should be accessed through the method {@link #getInstance()}. |
| */ |
| DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { |
| setModifier(Modifier.SYNTHETIC, true); |
| } |
| accept(ElementVisitor visitor) => null; |
| ElementKind get kind => ElementKind.DYNAMIC; |
| /** |
| * Return the type defined by this element. |
| * @return the type defined by this element |
| */ |
| DynamicTypeImpl get type => _type; |
| /** |
| * Set the type defined by this element to the given type. |
| * @param type the type defined by this element |
| */ |
| void set type(DynamicTypeImpl type2) { |
| this._type = type2; |
| } |
| } |
| /** |
| * The abstract class {@code ElementImpl} implements the behavior common to objects that implement |
| * an {@link Element}. |
| * @coverage dart.engine.element |
| */ |
| abstract class ElementImpl implements Element { |
| /** |
| * The enclosing element of this element, or {@code null} if this element is at the root of the |
| * element structure. |
| */ |
| ElementImpl _enclosingElement; |
| /** |
| * The name of this element. |
| */ |
| String _name; |
| /** |
| * The offset of the name of this element in the file that contains the declaration of this |
| * element. |
| */ |
| int _nameOffset = 0; |
| /** |
| * A bit-encoded form of the modifiers associated with this element. |
| */ |
| Set<Modifier> _modifiers; |
| /** |
| * An array containing all of the metadata associated with this element. |
| */ |
| List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY; |
| /** |
| * A cached copy of the calculated hashCode for this element. |
| */ |
| int _cachedHashCode = 0; |
| /** |
| * Initialize a newly created element to have the given name. |
| * @param name the name of this element |
| */ |
| ElementImpl.con1(Identifier name2) { |
| _jtd_constructor_188_impl(name2); |
| } |
| _jtd_constructor_188_impl(Identifier name2) { |
| _jtd_constructor_189_impl(name2 == null ? "" : name2.name, name2 == null ? -1 : name2.offset); |
| } |
| /** |
| * Initialize a newly created element to have the given name. |
| * @param name the name of this element |
| * @param nameOffset the offset of the name of this element in the file that contains the |
| * declaration of this element |
| */ |
| ElementImpl.con2(String name2, int nameOffset2) { |
| _jtd_constructor_189_impl(name2, nameOffset2); |
| } |
| _jtd_constructor_189_impl(String name2, int nameOffset2) { |
| this._name = StringUtilities.intern(name2); |
| this._nameOffset = nameOffset2; |
| } |
| bool operator ==(Object object) => object != null && object.runtimeType == runtimeType && ((object as Element)).location == location; |
| Element getAncestor(Type elementClass) { |
| Element ancestor = _enclosingElement; |
| while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { |
| ancestor = ancestor.enclosingElement; |
| } |
| return ancestor as Element; |
| } |
| /** |
| * Return the child of this element that is uniquely identified by the given identifier, or{@code null} if there is no such child. |
| * @param identifier the identifier used to select a child |
| * @return the child of this element with the given identifier |
| */ |
| ElementImpl getChild(String identifier) => null; |
| AnalysisContext get context { |
| if (_enclosingElement == null) { |
| return null; |
| } |
| return _enclosingElement.context; |
| } |
| Element get enclosingElement => _enclosingElement; |
| LibraryElement get library => getAncestor(LibraryElement); |
| ElementLocation get location => new ElementLocationImpl.con1(this); |
| List<Annotation> get metadata => _metadata; |
| String get name => _name; |
| int get nameOffset => _nameOffset; |
| Source get source { |
| if (_enclosingElement == null) { |
| return null; |
| } |
| return _enclosingElement.source; |
| } |
| int get hashCode { |
| if (_cachedHashCode == 0) { |
| _cachedHashCode = location.hashCode; |
| } |
| return _cachedHashCode; |
| } |
| bool isAccessibleIn(LibraryElement library2) { |
| if (Identifier.isPrivateName(_name)) { |
| return library2 == library; |
| } |
| return true; |
| } |
| bool isSynthetic() => hasModifier(Modifier.SYNTHETIC); |
| /** |
| * Set the metadata associate with this element to the given array of annotations. |
| * @param metadata the metadata to be associated with this element |
| */ |
| void set metadata(List<Annotation> metadata2) { |
| this._metadata = metadata2; |
| } |
| /** |
| * Set the offset of the name of this element in the file that contains the declaration of this |
| * element to the given value. This is normally done via the constructor, but this method is |
| * provided to support unnamed constructors. |
| * @param nameOffset the offset to the beginning of the name |
| */ |
| void set nameOffset(int nameOffset2) { |
| this._nameOffset = nameOffset2; |
| } |
| /** |
| * Set whether this element is synthetic to correspond to the given value. |
| * @param isSynthetic {@code true} if the element is synthetic |
| */ |
| void set synthetic(bool isSynthetic) { |
| setModifier(Modifier.SYNTHETIC, isSynthetic); |
| } |
| String toString() { |
| JavaStringBuilder builder = new JavaStringBuilder(); |
| appendTo(builder); |
| return builder.toString(); |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| } |
| /** |
| * Append a textual representation of this type to the given builder. |
| * @param builder the builder to which the text is to be appended |
| */ |
| void appendTo(JavaStringBuilder builder) { |
| if (_name == null) { |
| builder.append("<unnamed "); |
| builder.append(runtimeType.toString()); |
| builder.append(">"); |
| } else { |
| builder.append(_name); |
| } |
| } |
| /** |
| * Return an identifier that uniquely identifies this element among the children of this element's |
| * parent. |
| * @return an identifier that uniquely identifies this element relative to its parent |
| */ |
| String get identifier => name; |
| /** |
| * Return {@code true} if this element has the given modifier associated with it. |
| * @param modifier the modifier being tested for |
| * @return {@code true} if this element has the given modifier associated with it |
| */ |
| bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contains(modifier); |
| /** |
| * If the given child is not {@code null}, use the given visitor to visit it. |
| * @param child the child to be visited |
| * @param visitor the visitor to be used to visit the child |
| */ |
| void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { |
| if (child != null) { |
| child.accept(visitor); |
| } |
| } |
| /** |
| * Use the given visitor to visit all of the children in the given array. |
| * @param children the children to be visited |
| * @param visitor the visitor being used to visit the children |
| */ |
| void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visitor) { |
| if (children != null) { |
| for (Element child in children) { |
| child.accept(visitor); |
| } |
| } |
| } |
| /** |
| * Set the enclosing element of this element to the given element. |
| * @param element the enclosing element of this element |
| */ |
| void set enclosingElement(ElementImpl element) { |
| _enclosingElement = element; |
| } |
| /** |
| * Set whether the given modifier is associated with this element to correspond to the given |
| * value. |
| * @param modifier the modifier to be set |
| * @param value {@code true} if the modifier is to be associated with this element |
| */ |
| void setModifier(Modifier modifier, bool value) { |
| if (value) { |
| if (_modifiers == null) { |
| _modifiers = new Set(); |
| } |
| _modifiers.add(modifier); |
| } else { |
| if (_modifiers != null) { |
| _modifiers.remove(modifier); |
| if (_modifiers.isEmpty) { |
| _modifiers = null; |
| } |
| } |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code ElementLocationImpl} implement an {@link ElementLocation}. |
| * @coverage dart.engine.element |
| */ |
| class ElementLocationImpl implements ElementLocation { |
| /** |
| * The path to the element whose location is represented by this object. |
| */ |
| List<String> _components; |
| /** |
| * The character used to separate components in the encoded form. |
| */ |
| static int _SEPARATOR_CHAR = 0x3B; |
| /** |
| * Initialize a newly created location to represent the given element. |
| * @param element the element whose location is being represented |
| */ |
| ElementLocationImpl.con1(Element element) { |
| _jtd_constructor_190_impl(element); |
| } |
| _jtd_constructor_190_impl(Element element) { |
| List<String> components = new List<String>(); |
| Element ancestor = element; |
| while (ancestor != null) { |
| components.insert(0, ((ancestor as ElementImpl)).identifier); |
| ancestor = ancestor.enclosingElement; |
| } |
| this._components = new List.from(components); |
| } |
| /** |
| * Initialize a newly created location from the given encoded form. |
| * @param encoding the encoded form of a location |
| */ |
| ElementLocationImpl.con2(String encoding) { |
| _jtd_constructor_191_impl(encoding); |
| } |
| _jtd_constructor_191_impl(String encoding) { |
| this._components = decode(encoding); |
| } |
| bool operator ==(Object object) { |
| if (object is! ElementLocationImpl) { |
| return false; |
| } |
| ElementLocationImpl location = object as ElementLocationImpl; |
| return JavaArrays.equals(_components, location._components); |
| } |
| /** |
| * Return the path to the element whose location is represented by this object. |
| * @return the path to the element whose location is represented by this object |
| */ |
| List<String> get components => _components; |
| String get encoding { |
| JavaStringBuilder builder = new JavaStringBuilder(); |
| int length2 = _components.length; |
| for (int i = 0; i < length2; i++) { |
| if (i > 0) { |
| builder.appendChar(_SEPARATOR_CHAR); |
| } |
| encode(builder, _components[i]); |
| } |
| return builder.toString(); |
| } |
| int get hashCode => JavaArrays.makeHashCode(_components); |
| String toString() => encoding; |
| /** |
| * Decode the encoded form of a location into an array of components. |
| * @param encoding the encoded form of a location |
| * @return the components that were encoded |
| */ |
| List<String> decode(String encoding) { |
| List<String> components = new List<String>(); |
| JavaStringBuilder builder = new JavaStringBuilder(); |
| int index = 0; |
| int length2 = encoding.length; |
| while (index < length2) { |
| int currentChar = encoding.codeUnitAt(index); |
| if (currentChar == _SEPARATOR_CHAR) { |
| if (index + 1 < length2 && encoding.codeUnitAt(index + 1) == _SEPARATOR_CHAR) { |
| builder.appendChar(_SEPARATOR_CHAR); |
| index += 2; |
| } else { |
| components.add(builder.toString()); |
| builder.length = 0; |
| index++; |
| } |
| } else { |
| builder.appendChar(currentChar); |
| index++; |
| } |
| } |
| if (builder.length > 0) { |
| components.add(builder.toString()); |
| } |
| return new List.from(components); |
| } |
| /** |
| * Append an encoded form of the given component to the given builder. |
| * @param builder the builder to which the encoded component is to be appended |
| * @param component the component to be appended to the builder |
| */ |
| void encode(JavaStringBuilder builder, String component) { |
| int length2 = component.length; |
| for (int i = 0; i < length2; i++) { |
| int currentChar = component.codeUnitAt(i); |
| if (currentChar == _SEPARATOR_CHAR) { |
| builder.appendChar(_SEPARATOR_CHAR); |
| } |
| builder.appendChar(currentChar); |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code EmbeddedHtmlScriptElementImpl} implement an{@link EmbeddedHtmlScriptElement}. |
| * @coverage dart.engine.element |
| */ |
| class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements EmbeddedHtmlScriptElement { |
| /** |
| * The library defined by the script tag's content. |
| */ |
| LibraryElement _scriptLibrary; |
| /** |
| * Initialize a newly created script element to have the specified tag name and offset. |
| * @param node the XML node from which this element is derived (not {@code null}) |
| */ |
| EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this); |
| ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT; |
| LibraryElement get scriptLibrary => _scriptLibrary; |
| /** |
| * Set the script library defined by the script tag's content. |
| * @param scriptLibrary the library or {@code null} if none |
| */ |
| void set scriptLibrary(LibraryElementImpl scriptLibrary2) { |
| scriptLibrary2.enclosingElement = this; |
| this._scriptLibrary = scriptLibrary2; |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| safelyVisitChild(_scriptLibrary, visitor); |
| } |
| } |
| /** |
| * The abstract class {@code ExecutableElementImpl} implements the behavior common to{@code ExecutableElement}s. |
| * @coverage dart.engine.element |
| */ |
| abstract class ExecutableElementImpl extends ElementImpl implements ExecutableElement { |
| /** |
| * An array containing all of the functions defined within this executable element. |
| */ |
| List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the labels defined within this executable element. |
| */ |
| List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the local variables defined within this executable element. |
| */ |
| List<LocalVariableElement> _localVariables = LocalVariableElementImpl.EMPTY_ARRAY; |
| /** |
| * An array containing all of the parameters defined by this executable element. |
| */ |
| List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| /** |
| * The type of function defined by this executable element. |
| */ |
| FunctionType _type; |
| /** |
| * An empty array of executable elements. |
| */ |
| static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); |
| /** |
| * Initialize a newly created executable element to have the given name. |
| * @param name the name of this element |
| */ |
| ExecutableElementImpl.con1(Identifier name) : super.con1(name) { |
| _jtd_constructor_193_impl(name); |
| } |
| _jtd_constructor_193_impl(Identifier name) { |
| } |
| /** |
| * Initialize a newly created executable element to have the given name. |
| * @param name the name of this element |
| * @param nameOffset the offset of the name of this element in the file that contains the |
| * declaration of this element |
| */ |
| ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) { |
| _jtd_constructor_194_impl(name, nameOffset); |
| } |
| _jtd_constructor_194_impl(String name, int nameOffset) { |
| } |
| ElementImpl getChild(String identifier2) { |
| for (ExecutableElement function in _functions) { |
| if (((function as ExecutableElementImpl)).identifier == identifier2) { |
| return function as ExecutableElementImpl; |
| } |
| } |
| for (LabelElement label in _labels) { |
| if (((label as LabelElementImpl)).identifier == identifier2) { |
| return label as LabelElementImpl; |
| } |
| } |
| for (VariableElement variable in _localVariables) { |
| if (((variable as VariableElementImpl)).identifier == identifier2) { |
| return variable as VariableElementImpl; |
| } |
| } |
| for (ParameterElement parameter in _parameters) { |
| if (((parameter as ParameterElementImpl)).identifier == identifier2) { |
| return parameter as ParameterElementImpl; |
| } |
| } |
| return null; |
| } |
| List<FunctionElement> get functions => _functions; |
| List<LabelElement> get labels => _labels; |
| List<LocalVariableElement> get localVariables => _localVariables; |
| List<ParameterElement> get parameters => _parameters; |
| FunctionType get type => _type; |
| bool isOperator() => false; |
| /** |
| * Set the functions defined within this executable element to the given functions. |
| * @param functions the functions defined within this executable element |
| */ |
| void set functions(List<FunctionElement> functions2) { |
| for (FunctionElement function in functions2) { |
| ((function as FunctionElementImpl)).enclosingElement = this; |
| } |
| this._functions = functions2; |
| } |
| /** |
| * Set the labels defined within this executable element to the given labels. |
| * @param labels the labels defined within this executable element |
| */ |
| void set labels(List<LabelElement> labels2) { |
| for (LabelElement label in labels2) { |
| ((label as LabelElementImpl)).enclosingElement = this; |
| } |
| this._labels = labels2; |
| } |
| /** |
| * Set the local variables defined within this executable element to the given variables. |
| * @param localVariables the local variables defined within this executable element |
| */ |
| void set localVariables(List<LocalVariableElement> localVariables2) { |
| for (LocalVariableElement variable in localVariables2) { |
| ((variable as LocalVariableElementImpl)).enclosingElement = this; |
| } |
| this._localVariables = localVariables2; |
| } |
| /** |
| * Set the parameters defined by this executable element to the given parameters. |
| * @param parameters the parameters defined by this executable element |
| */ |
| void set parameters(List<ParameterElement> parameters2) { |
| for (ParameterElement parameter in parameters2) { |
| ((parameter as ParameterElementImpl)).enclosingElement = this; |
| } |
| this._parameters = parameters2; |
| } |
| /** |
| * Set the type of function defined by this executable element to the given type. |
| * @param type the type of function defined by this executable element |
| */ |
| void set type(FunctionType type2) { |
| this._type = type2; |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| super.visitChildren(visitor); |
| safelyVisitChildren(_functions, visitor); |
| safelyVisitChildren(_labels, visitor); |
| safelyVisitChildren(_localVariables, visitor); |
| safelyVisitChildren(_parameters, visitor); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| builder.append("("); |
| int parameterCount = _parameters.length; |
| for (int i = 0; i < parameterCount; i++) { |
| if (i > 0) { |
| builder.append(", "); |
| } |
| ((_parameters[i] as ParameterElementImpl)).appendTo(builder); |
| } |
| builder.append(")"); |
| if (_type != null) { |
| builder.append(" -> "); |
| builder.append(_type.returnType); |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code ExportElementImpl} implement an {@link ExportElement}. |
| * @coverage dart.engine.element |
| */ |
| class ExportElementImpl extends ElementImpl implements ExportElement { |
| /** |
| * The library that is exported from this library by this export directive. |
| */ |
| LibraryElement _exportedLibrary; |
| /** |
| * The combinators that were specified as part of the export directive in the order in which they |
| * were specified. |
| */ |
| List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; |
| /** |
| * Initialize a newly created export element. |
| */ |
| ExportElementImpl() : super.con1(null) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitExportElement(this); |
| List<NamespaceCombinator> get combinators => _combinators; |
| LibraryElement get exportedLibrary => _exportedLibrary; |
| ElementKind get kind => ElementKind.EXPORT; |
| /** |
| * Set the combinators that were specified as part of the export directive to the given array of |
| * combinators. |
| * @param combinators the combinators that were specified as part of the export directive |
| */ |
| void set combinators(List<NamespaceCombinator> combinators2) { |
| this._combinators = combinators2; |
| } |
| /** |
| * Set the library that is exported from this library by this import directive to the given |
| * library. |
| * @param exportedLibrary the library that is exported from this library |
| */ |
| void set exportedLibrary(LibraryElement exportedLibrary2) { |
| this._exportedLibrary = exportedLibrary2; |
| } |
| void appendTo(JavaStringBuilder builder) { |
| builder.append("export "); |
| ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); |
| } |
| } |
| /** |
| * Instances of the class {@code ExternalHtmlScriptElementImpl} implement an{@link ExternalHtmlScriptElement}. |
| * @coverage dart.engine.element |
| */ |
| class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements ExternalHtmlScriptElement { |
| /** |
| * The source specified in the {@code source} attribute or {@code null} if unspecified. |
| */ |
| Source _scriptSource; |
| /** |
| * Initialize a newly created script element to have the specified tag name and offset. |
| * @param node the XML node from which this element is derived (not {@code null}) |
| */ |
| ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this); |
| ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; |
| Source get scriptSource => _scriptSource; |
| /** |
| * Set the source specified in the {@code source} attribute. |
| * @param scriptSource the script source or {@code null} if unspecified |
| */ |
| void set scriptSource(Source scriptSource2) { |
| this._scriptSource = scriptSource2; |
| } |
| } |
| /** |
| * Instances of the class {@code FieldElementImpl} implement a {@code FieldElement}. |
| * @coverage dart.engine.element |
| */ |
| class FieldElementImpl extends PropertyInducingElementImpl implements FieldElement { |
| /** |
| * An empty array of field elements. |
| */ |
| static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); |
| /** |
| * Initialize a newly created field element to have the given name. |
| * @param name the name of this element |
| */ |
| FieldElementImpl.con1(Identifier name) : super.con1(name) { |
| _jtd_constructor_197_impl(name); |
| } |
| _jtd_constructor_197_impl(Identifier name) { |
| } |
| /** |
| * Initialize a newly created synthetic field element to have the given name. |
| * @param name the name of this element |
| */ |
| FieldElementImpl.con2(String name) : super.con2(name) { |
| _jtd_constructor_198_impl(name); |
| } |
| _jtd_constructor_198_impl(String name) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
| ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| ElementKind get kind => ElementKind.FIELD; |
| bool isStatic() => hasModifier(Modifier.STATIC); |
| /** |
| * Set whether this field is static to correspond to the given value. |
| * @param isStatic {@code true} if the field is static |
| */ |
| void set static(bool isStatic) { |
| setModifier(Modifier.STATIC, isStatic); |
| } |
| } |
| /** |
| * Instances of the class {@code FieldFormalParameterElementImpl} extend{@link ParameterElementImpl} to provide the additional information of the {@link FieldElement}associated with the parameter. |
| * @coverage dart.engine.element |
| */ |
| class FieldFormalParameterElementImpl extends ParameterElementImpl implements FieldFormalParameterElement { |
| /** |
| * The field associated with this field formal parameter. |
| */ |
| FieldElement _field; |
| /** |
| * Initialize a newly created parameter element to have the given name. |
| * @param name the name of this element |
| */ |
| FieldFormalParameterElementImpl(Identifier name) : super(name) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(this); |
| FieldElement get field => _field; |
| /** |
| * Set the field element associated with this field formal parameter to the given element. |
| * @param field the new field element |
| */ |
| void set field(FieldElement field2) { |
| this._field = field2; |
| } |
| } |
| /** |
| * Instances of the class {@code FunctionElementImpl} implement a {@code FunctionElement}. |
| * @coverage dart.engine.element |
| */ |
| class FunctionElementImpl extends ExecutableElementImpl implements FunctionElement { |
| /** |
| * The offset to the beginning of the visible range for this element. |
| */ |
| int _visibleRangeOffset = 0; |
| /** |
| * The length of the visible range for this element, or {@code -1} if this element does not have a |
| * visible range. |
| */ |
| int _visibleRangeLength = -1; |
| /** |
| * An empty array of function elements. |
| */ |
| static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>(0); |
| /** |
| * Initialize a newly created synthetic function element. |
| */ |
| FunctionElementImpl() : super.con2("", -1) { |
| _jtd_constructor_200_impl(); |
| } |
| _jtd_constructor_200_impl() { |
| synthetic = true; |
| } |
| /** |
| * Initialize a newly created function element to have the given name. |
| * @param name the name of this element |
| */ |
| FunctionElementImpl.con1(Identifier name) : super.con1(name) { |
| _jtd_constructor_201_impl(name); |
| } |
| _jtd_constructor_201_impl(Identifier name) { |
| } |
| /** |
| * Initialize a newly created function element to have no name and the given offset. This is used |
| * for function expressions, which have no name. |
| * @param nameOffset the offset of the name of this element in the file that contains the |
| * declaration of this element |
| */ |
| FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) { |
| _jtd_constructor_202_impl(nameOffset); |
| } |
| _jtd_constructor_202_impl(int nameOffset) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
| String get identifier => name; |
| ElementKind get kind => ElementKind.FUNCTION; |
| SourceRange get visibleRange { |
| if (_visibleRangeLength < 0) { |
| return null; |
| } |
| return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| } |
| bool isStatic() => enclosingElement is CompilationUnitElement; |
| /** |
| * Set the visible range for this element to the range starting at the given offset with the given |
| * length. |
| * @param offset the offset to the beginning of the visible range for this element |
| * @param length the length of the visible range for this element, or {@code -1} if this element |
| * does not have a visible range |
| */ |
| void setVisibleRange(int offset, int length) { |
| _visibleRangeOffset = offset; |
| _visibleRangeLength = length; |
| } |
| void appendTo(JavaStringBuilder builder) { |
| String name2 = name; |
| if (name2 != null) { |
| builder.append(name2); |
| } |
| super.appendTo(builder); |
| } |
| } |
| /** |
| * Instances of the class {@code FunctionTypeAliasElementImpl} implement a{@code FunctionTypeAliasElement}. |
| * @coverage dart.engine.element |
| */ |
| class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAliasElement { |
| /** |
| * An array containing all of the parameters defined by this type alias. |
| */ |
| List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| /** |
| * The type of function defined by this type alias. |
| */ |
| FunctionType _type; |
| /** |
| * An array containing all of the type variables defined for this type. |
| */ |
| List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY; |
| /** |
| * An empty array of type alias elements. |
| */ |
| static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAliasElement>(0); |
| /** |
| * Initialize a newly created type alias element to have the given name. |
| * @param name the name of this element |
| */ |
| FunctionTypeAliasElementImpl(Identifier name) : super.con1(name) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); |
| ElementImpl getChild(String identifier2) { |
| for (VariableElement parameter in _parameters) { |
| if (((parameter as VariableElementImpl)).identifier == identifier2) { |
| return parameter as VariableElementImpl; |
| } |
| } |
| for (TypeVariableElement typeVariable in _typeVariables) { |
| if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2) { |
| return typeVariable as TypeVariableElementImpl; |
| } |
| } |
| return null; |
| } |
| CompilationUnitElement get enclosingElement => super.enclosingElement as CompilationUnitElement; |
| ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
| List<ParameterElement> get parameters => _parameters; |
| FunctionType get type => _type; |
| List<TypeVariableElement> get typeVariables => _typeVariables; |
| /** |
| * Set the parameters defined by this type alias to the given parameters. |
| * @param parameters the parameters defined by this type alias |
| */ |
| void set parameters(List<ParameterElement> parameters2) { |
| if (parameters2 != null) { |
| for (ParameterElement parameter in parameters2) { |
| ((parameter as ParameterElementImpl)).enclosingElement = this; |
| } |
| } |
| this._parameters = parameters2; |
| } |
| /** |
| * Set the type of function defined by this type alias to the given type. |
| * @param type the type of function defined by this type alias |
| */ |
| void set type(FunctionType type2) { |
| this._type = type2; |
| } |
| /** |
| * Set the type variables defined for this type to the given variables. |
| * @param typeVariables the type variables defined for this type |
| */ |
| void set typeVariables(List<TypeVariableElement> typeVariables2) { |
| for (TypeVariableElement variable in typeVariables2) { |
| ((variable as TypeVariableElementImpl)).enclosingElement = this; |
| } |
| this._typeVariables = typeVariables2; |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| super.visitChildren(visitor); |
| safelyVisitChildren(_parameters, visitor); |
| safelyVisitChildren(_typeVariables, visitor); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| builder.append("typedef "); |
| builder.append(name); |
| int variableCount = _typeVariables.length; |
| if (variableCount > 0) { |
| builder.append("<"); |
| for (int i = 0; i < variableCount; i++) { |
| if (i > 0) { |
| builder.append(", "); |
| } |
| ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); |
| } |
| builder.append(">"); |
| } |
| builder.append("("); |
| int parameterCount = _parameters.length; |
| for (int i = 0; i < parameterCount; i++) { |
| if (i > 0) { |
| builder.append(", "); |
| } |
| ((_parameters[i] as ParameterElementImpl)).appendTo(builder); |
| } |
| builder.append(")"); |
| if (_type != null) { |
| builder.append(" -> "); |
| builder.append(_type.returnType); |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowCombinator}. |
| * @coverage dart.engine.element |
| */ |
| class HideCombinatorImpl implements HideCombinator { |
| /** |
| * The names that are not to be made visible in the importing library even if they are defined in |
| * the imported library. |
| */ |
| List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; |
| /** |
| * Initialize a newly created combinator. |
| */ |
| HideCombinatorImpl() : super() { |
| } |
| List<String> get hiddenNames => _hiddenNames; |
| /** |
| * Set the names that are not to be made visible in the importing library even if they are defined |
| * in the imported library to the given names. |
| * @param hiddenNames the names that are not to be made visible in the importing library |
| */ |
| void set hiddenNames(List<String> hiddenNames2) { |
| this._hiddenNames = hiddenNames2; |
| } |
| String toString() { |
| JavaStringBuilder builder = new JavaStringBuilder(); |
| builder.append("show "); |
| int count = _hiddenNames.length; |
| for (int i = 0; i < count; i++) { |
| if (i > 0) { |
| builder.append(", "); |
| } |
| builder.append(_hiddenNames[i]); |
| } |
| return builder.toString(); |
| } |
| } |
| /** |
| * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElement}. |
| * @coverage dart.engine.element |
| */ |
| class HtmlElementImpl extends ElementImpl implements HtmlElement { |
| /** |
| * An empty array of HTML file elements. |
| */ |
| static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); |
| /** |
| * The analysis context in which this library is defined. |
| */ |
| AnalysisContext _context; |
| /** |
| * The scripts contained in or referenced from script tags in the HTML file. |
| */ |
| List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; |
| /** |
| * The source that corresponds to this HTML file. |
| */ |
| Source _source; |
| /** |
| * Initialize a newly created HTML element to have the given name. |
| * @param context the analysis context in which the HTML file is defined |
| * @param name the name of this element |
| */ |
| HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { |
| this._context = context; |
| } |
| accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); |
| bool operator ==(Object object) => runtimeType == object.runtimeType && _source == ((object as CompilationUnitElementImpl)).source; |
| AnalysisContext get context => _context; |
| ElementKind get kind => ElementKind.HTML; |
| List<HtmlScriptElement> get scripts => _scripts; |
| Source get source => _source; |
| int get hashCode => _source.hashCode; |
| /** |
| * Set the scripts contained in the HTML file to the given scripts. |
| * @param scripts the scripts |
| */ |
| void set scripts(List<HtmlScriptElement> scripts2) { |
| if (scripts2.length == 0) { |
| scripts2 = HtmlScriptElementImpl.EMPTY_ARRAY; |
| } |
| for (HtmlScriptElement script in scripts2) { |
| ((script as HtmlScriptElementImpl)).enclosingElement = this; |
| } |
| this._scripts = scripts2; |
| } |
| /** |
| * Set the source that corresponds to this HTML file to the given source. |
| * @param source the source that corresponds to this HTML file |
| */ |
| void set source(Source source2) { |
| this._source = source2; |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| super.visitChildren(visitor); |
| safelyVisitChildren(_scripts, visitor); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| if (_source == null) { |
| builder.append("{HTML file}"); |
| } else { |
| builder.append(_source.fullName); |
| } |
| } |
| } |
| /** |
| * Instances of the class {@code HtmlScriptElementImpl} implement an {@link HtmlScriptElement}. |
| * @coverage dart.engine.element |
| */ |
| abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptElement { |
| /** |
| * An empty array of HTML script elements. |
| */ |
| static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0); |
| /** |
| * Initialize a newly created script element to have the specified tag name and offset. |
| * @param node the XML node from which this element is derived (not {@code null}) |
| */ |
| HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag.offset) { |
| } |
| } |
| /** |
| * Instances of the class {@code ImportElementImpl} implement an {@link ImportElement}. |
| * @coverage dart.engine.element |
| */ |
| class ImportElementImpl extends ElementImpl implements ImportElement { |
| /** |
| * The library that is imported into this library by this import directive. |
| */ |
| LibraryElement _importedLibrary; |
| /** |
| * The combinators that were specified as part of the import directive in the order in which they |
| * were specified. |
| */ |
| List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; |
| /** |
| * The prefix that was specified as part of the import directive, or {@code null} if there was no |
| * prefix specified. |
| */ |
| PrefixElement _prefix; |
| /** |
| * Initialize a newly created import element. |
| */ |
| ImportElementImpl() : super.con1(null) { |
| } |
| accept(ElementVisitor visitor) => visitor.visitImportElement(this); |
| List<NamespaceCombinator> get combinators => _combinators; |
| LibraryElement get importedLibrary => _importedLibrary; |
| ElementKind get kind => ElementKind.IMPORT; |
| PrefixElement get prefix => _prefix; |
| /** |
| * Set the combinators that were specified as part of the import directive to the given array of |
| * combinators. |
| * @param combinators the combinators that were specified as part of the import directive |
| */ |
| void set combinators(List<NamespaceCombinator> combinators2) { |
| this._combinators = combinators2; |
| } |
| /** |
| * Set the library that is imported into this library by this import directive to the given |
| * library. |
| * @param importedLibrary the library that is imported into this library |
| */ |
| void set importedLibrary(LibraryElement importedLibrary2) { |
| this._importedLibrary = importedLibrary2; |
| } |
| /** |
| * Set the prefix that was specified as part of the import directive to the given prefix. |
| * @param prefix the prefix that was specified as part of the import directive |
| */ |
| void set prefix(PrefixElement prefix2) { |
| this._prefix = prefix2; |
| } |
| void visitChildren(ElementVisitor<Object> visitor) { |
| super.visitChildren(visitor); |
| safelyVisitChild(_prefix, visitor); |
| } |
| void appendTo(JavaStringBuilder builder) { |
| builder.append("import "); |
| ((_importedLibrary as LibraryElementImpl)).appendTo(builder); |
| } |
| } |
| /** |
| * Instances of the class {@code LabelElementImpl} implement a {@code LabelElement}. |
| * @coverage dart.engine.element |
| */ |
| class LabelElementImpl extends ElementImpl implements LabelElement { |
| /** |
| * A flag indicating whether this label is associated with a {@code switch} statement. |
| */ |
| bool _onSwitchStatement = false; |
| /** |
| * A flag indicating whether this label is associated with a {@code switch} member ({@code case}or {@code default}). |
| */ |
| bool _onSwitchMember = false; |
| /** |
| * An empty array of label elements. |
| */ |
| static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); |
| /** |
| * Initialize a newly created label element to have the given name. |
| * @param name the name of this element |
| * @param onSwitchStatement {@code true} if this label is associated with a {@code switch}statement |
| * @param onSwitchMember {@code true} if this label is associated with a {@code switch} member |
| */ |
| LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) { |
| this._onSwitchStatement = onSwitchStatement; |
| this._onSwitchMember = onSwitchMember; |
| } |
| accept(ElementVisitor visitor) => visitor.visitLabelElement(this); |
| ExecutableElement get enclosingElement => super.enclosingElement as ExecutableElement; |
| ElementKind get kind => ElementKind.LABEL; |
| /** |
| * Return {@code true} if this label is associated with a {@code switch} member ({@code case} or{@code default}). |
| * @return {@code true} if this label is associated with a {@code switch} member |
| */ |
| bool isOnSwitchMember() => _onSwitchMember; |
| /** |
| * Return {@code true} if this label is associated with a {@code switch} statement. |
| * @return {@code true} if this label is associated with a {@code switch} statement |
| */ |
| bool isOnSwitchStatement() => _onSwitchStatement; |
| } |
| /** |
| * Instances of the class {@code LibraryElementImpl} implement a {@code LibraryElement}. |
| * @coverage dart.engine.element |
| */ |
| class LibraryElementImpl extends ElementImpl implements LibraryElement { |
| /** |
| * An empty array of library elements. |
| */ |
| static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0); |
| /** |
| * Determine if the given library is up to date with respect to the given time stamp. |
| * @param library the library to process |
| * @param timeStamp the time stamp to check against |
| * @param visitedLibraries the set of visited libraries |
| */ |
| static bool isUpToDate(LibraryElement library, int timeStamp, Set<LibraryElement> visitedLibraries) { |
| if (!visitedLibraries.contains(library)) { |
| javaSetAdd(visitedLibraries, library); |
| if (timeStamp < library.definingCompilationUnit.source.modificationStamp) { |
| return false; |
| } |
| for (CompilationUnitElement element in library.parts) { |
| if (timeStamp < element.source.modificationStamp) { |
| return false; |
| } |
| } |
| for (LibraryElement importedLibrary in library.importedLibraries) { |
| if (!isUpToDate(importedLibrary, timeStamp, visitedLibraries)) { |
| return false; |
| } |
| } |
| for (LibraryElement exportedLibrary in library.exportedLibraries) { |
| if (!isUpToDate(exportedLibrary, timeStamp, visitedLibraries)) { |
| return false; |
| } |
| } |
| } |
| return true; |
| } |
| /** |
| * The analysis context in which this library is defined. |
| */ |
| AnalysisContext _context; |
| /** |
| * The compilation unit that defines this library. |
| */ |
| CompilationUnitElement _definingCompilationUnit; |
| /** |
| * The entry point for this library, or {@code null} if this library does not have an entry point. |
| */ |
| FunctionElement _entryPoint; |
| /** |
| * An array containing specifications of all of the imports defined in this library. |
| */ |
| List<ImportElement> _imports = ImportElement.EMPTY_ARRAY; |
| /** |
| * An array containing specifications of all of the exports defined in this library. |
| */ |
| List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; |
| /** |
| * An array containing all of the compilation units that are included in this library using a{@code part} directive. |
| */ |
| List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; |
| /** |
| * Initialize a newly created library element to have the given name. |
| * @param context the analysis context in which the library is defined |
| * @param name the name of this element |
| */ |
| LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.con1(name) { |
| this._context = context; |
| } |
| accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); |
| bool operator ==(Object object) => object != null && runtimeType == object.runtimeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definingCompilationUnit; |
| ElementImpl getChild(String identifier2) { |
| if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier2) { |
| return _definingCompilationUnit as CompilationUnitElementImpl; |
| } |
| for (CompilationUnitElement part in _parts) { |
| if (((part as CompilationUnitElementImpl)).identifier == identifier2) { |
| return part as CompilationUnitElementImpl; |
| } |
| } |
| return null; |
| } |
| AnalysisContext get context => _context; |
| CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit; |
| FunctionElement get entryPoint => _entryPoint; |
| List<LibraryElement> get exportedLibraries { |
| Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| for (ExportElement element in _exports) { |
| LibraryElement library = element.exportedLibrary; |
| if (library != null) { |
| javaSetAdd(libraries, library); |
| } |
| } |
| return new List.from(libraries); |
| } |
| List<ExportElement> get exports => _exports; |
| String get identifier => _definingCompilationUnit.source.encoding; |
| List<LibraryElement> get importedLibraries { |
| Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| for (ImportElement element in _imports) { |
| LibraryElement library = element.importedLibrary; |
| if (library != null) { |
| javaSetAdd(libraries, library); |
| } |
| } |
| return new List.from(libraries); |
| } |
| List<ImportElement> get imports => _imports; |
| ElementKind get kind => ElementKind.LIBRARY; |
| LibraryElement get library => this; |
| List<CompilationUnitElement> get parts => _parts; |
| List<PrefixElement> get prefixes { |
| Set<PrefixElement> prefixes = new Set<PrefixElement>(); |
| for (ImportElement element in _imports) { |
| PrefixElement prefix2 = element.prefix; |
| if (prefix2 != null) { |
| javaSetAdd(prefixes, prefix2); |
| } |
| } |
| return new List.from(prefixes); |
| } |
| Source get source { |
| if (_definingCompilationUnit == null) { |
| return null; |
| } |
| return _definingCompilationUnit.source; |
| } |
| ClassElement getType(String className) { |
| ClassElement type = _definingCompilationUnit.getType(className); |
| if (type != null) { |
| return type; |
| } |
| for (CompilationUnitElement part in _parts) { |
| type = part.getType( |