Index: pkg/analyzer_experimental/lib/src/generated/element.dart |
=================================================================== |
--- pkg/analyzer_experimental/lib/src/generated/element.dart (revision 23549) |
+++ pkg/analyzer_experimental/lib/src/generated/element.dart (working copy) |
@@ -15,12 +15,14 @@ |
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. |
@@ -28,47 +30,83 @@ |
*/ |
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 an array containing all the supertypes defined for this class and its supertypes. This |
+ * includes superclasses, mixins and interfaces. |
* @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 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); |
+ |
+ /** |
* Return an array containing all of the interfaces that are implemented by this class. |
+ * <p> |
+ * <b>Note:</b> Because the element model represents the state of the code, it is possible for it |
+ * to be semantically invalid. In particular, it is not safe to assume that the inheritance |
+ * structure of a class does not contain a cycle. Clients that traverse the inheritance structure |
+ * must explicitly guard against infinite loops. |
* @return the interfaces that are implemented by this class |
*/ |
List<InterfaceType> get interfaces; |
+ |
/** |
+ * 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); |
+ |
+ /** |
* 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. |
+ * <p> |
+ * <b>Note:</b> Because the element model represents the state of the code, it is possible for it |
+ * to be semantically invalid. In particular, it is not safe to assume that the inheritance |
+ * structure of a class does not contain a cycle. Clients that traverse the inheritance structure |
+ * must explicitly guard against infinite loops. |
* @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. |
@@ -76,23 +114,40 @@ |
* @return the element representing the specified constructor |
*/ |
ConstructorElement getNamedConstructor(String name); |
+ |
/** |
+ * 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); |
+ |
+ /** |
* 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. |
+ * <p> |
+ * <b>Note:</b> Because the element model represents the state of the code, it is possible for it |
+ * to be semantically invalid. In particular, it is not safe to assume that the inheritance |
+ * structure of a class does not contain a cycle. Clients that traverse the inheritance structure |
+ * must explicitly guard against infinite loops. |
* @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 |
@@ -101,17 +156,33 @@ |
* @return the unnamed constructor defined in this class |
*/ |
ConstructorElement get unnamedConstructor; |
+ |
/** |
+ * Return {@code true} if this class or its superclass declares a non-final instance field. |
+ * @return {@code true} if this class or its superclass declares a non-final instance field |
+ */ |
+ bool hasNonFinalField(); |
+ |
+ /** |
+ * Return {@code true} if this class has reference to super (so, for example, cannot be used as a |
+ * mixin). |
+ * @return {@code true} if this class has reference to super |
+ */ |
+ bool hasReferenceToSuper(); |
+ |
+ /** |
* 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: |
@@ -122,23 +193,8 @@ |
* @return {@code true} if this class can validly be used as a mixin |
*/ |
bool isValidMixin(); |
+ |
/** |
- * Return the executable element representing the method, getter or setter that results from |
- * looking up the given member in this class with respect to the given library, or {@code null} if |
- * the look up fails. This method is used to determine what member the passed name is inherited |
- * from. The behavior of this method is defined by the Dart Language Specification in section |
- * 8.1.1: Let <i>C</i> be a class declared in library <i>L</i> with superclass <i>S</i> and let |
- * <i>C</i> declare an instance member <i>m</i>, and assume <i>S</i> declares an instance member |
- * </i>m'</i> with the same name as m. Then <i>m</i> overrides m'</i> iff <i>m'</i> is accessible |
- * to <i>L</i>, <i>m</i> has the same name as <i>m'</i> and neither <i>m</i> nor <i>m'</i> are |
- * fields. |
- * @param memberName the name of the member being looked up |
- * @param library the library with respect to which the lookup is being performed |
- * @return the result of looking up the given member in this class with respect to the given |
- * library |
- */ |
- ExecutableElement lookUpExecutable(String memberName, LibraryElement library); |
- /** |
* 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: |
@@ -158,6 +214,7 @@ |
* 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 |
@@ -177,6 +234,7 @@ |
* 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 |
@@ -198,38 +256,45 @@ |
*/ |
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 { |
+abstract class CompilationUnitElement implements Element, UriReferencedElement { |
+ |
/** |
* 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. |
@@ -237,34 +302,46 @@ |
* @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 the constructor to which this constructor is redirecting. |
+ * @return the constructor to which this constructor is redirecting |
+ */ |
+ ConstructorElement get redirectedConstructor; |
+ |
+ /** |
* 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 |
@@ -287,17 +364,20 @@ |
* @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 documentation comment for this element as it appears in the original source |
* (complete with the beginning and ending delimiters), or {@code null} if this element does not |
@@ -308,28 +388,42 @@ |
* analysis could not be performed |
*/ |
String computeDocumentationComment(); |
+ |
/** |
* 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 display name of this element, or {@code null} if this element does not have a name. |
+ * <p> |
+ * In most cases the name and the display name are the same. Differences though are cases such as |
+ * setters where the name of some setter {@code set f(x)} is {@code f=}, instead of {@code f}. |
+ * @return the display name of this element |
+ */ |
+ String get displayName; |
+ |
+ /** |
* 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 |
@@ -337,22 +431,26 @@ |
* @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 |
@@ -360,12 +458,14 @@ |
* @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: |
@@ -375,6 +475,7 @@ |
* @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 |
@@ -382,6 +483,7 @@ |
* @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. |
@@ -389,6 +491,7 @@ |
*/ |
void visitChildren(ElementVisitor<Object> visitor); |
} |
+ |
/** |
* The enumeration {@code ElementKind} defines the various kinds of elements in the element model. |
* @coverage dart.engine.element |
@@ -420,9 +523,13 @@ |
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; |
+ |
+ /// The name of this enum constant, as declared in the enum declaration. |
+ final String name; |
+ |
+ /// The position in the enum declaration. |
+ final int ordinal; |
+ |
/** |
* Return the kind of the given element, or {@link #ERROR} if the element is {@code null}. This is |
* a utility method that can reduce the need for null checks in other places. |
@@ -435,31 +542,36 @@ |
} |
return element.kind; |
} |
+ |
/** |
* The name displayed in the UI for this kind of element. |
*/ |
String _displayName; |
+ |
/** |
* Initialize a newly created element kind to have the given display name. |
* @param displayName the name displayed in the UI for this kind of element |
*/ |
- ElementKind(this.__name, this.__ordinal, String displayName) { |
+ ElementKind(this.name, this.ordinal, String displayName) { |
this._displayName = displayName; |
} |
+ |
/** |
* Return the name displayed in the UI for this kind of element. |
* @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; |
+ 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. |
@@ -467,6 +579,7 @@ |
*/ |
String get encoding; |
} |
+ |
/** |
* The interface {@code ElementVisitor} defines the behavior of objects that can be used to visit an |
* element structure. |
@@ -496,49 +609,58 @@ |
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 |
@@ -546,6 +668,7 @@ |
* @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. |
@@ -553,28 +676,33 @@ |
*/ |
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 { |
+abstract class ExportElement implements Element, UriReferencedElement { |
+ |
/** |
* 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 |
@@ -582,6 +710,7 @@ |
* @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. |
@@ -589,23 +718,27 @@ |
*/ |
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. |
@@ -613,45 +746,53 @@ |
*/ |
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. |
@@ -659,11 +800,13 @@ |
*/ |
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 |
@@ -672,6 +815,7 @@ |
*/ |
List<HtmlScriptElement> get scripts; |
} |
+ |
/** |
* The interface {@code HtmlScriptElement} defines the behavior of elements representing a script |
* tag in an HTML file. |
@@ -681,27 +825,32 @@ |
*/ |
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 { |
+abstract class ImportElement implements Element, UriReferencedElement { |
+ |
/** |
* 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. |
@@ -709,44 +858,52 @@ |
*/ |
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 |
@@ -754,23 +911,27 @@ |
* @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. |
@@ -778,16 +939,19 @@ |
* @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. |
@@ -796,12 +960,14 @@ |
*/ |
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 |
@@ -820,6 +986,7 @@ |
*/ |
SourceRange get visibleRange; |
} |
+ |
/** |
* The interface {@code LocalVariableElement} defines the behavior common to elements that represent |
* a local variable. |
@@ -827,17 +994,20 @@ |
*/ |
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. |
@@ -845,6 +1015,7 @@ |
*/ |
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 |
@@ -854,6 +1025,7 @@ |
* @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. |
@@ -861,57 +1033,67 @@ |
*/ |
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 |
@@ -928,23 +1110,50 @@ |
* @coverage dart.engine.element |
*/ |
abstract class PropertyAccessorElement implements ExecutableElement { |
+ |
/** |
+ * Return the accessor representing the getter that corresponds to (has the same name as) this |
+ * setter, or {@code null} if this accessor is not a setter or if there is no corresponding |
+ * getter. |
+ * @return the getter that corresponds to this setter |
+ */ |
+ PropertyAccessorElement get correspondingGetter; |
+ |
+ /** |
+ * Return the accessor representing the setter that corresponds to (has the same name as) this |
+ * getter, or {@code null} if this accessor is not a getter or if there is no corresponding |
+ * setter. |
+ * @return the setter that corresponds to this getter |
+ */ |
+ PropertyAccessorElement get correspondingSetter; |
+ |
+ /** |
* 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 is abstract. Accessors are abstract if they are not |
+ * external and have no body. |
+ * @return {@code true} if this accessor is abstract |
+ */ |
+ bool isAbstract(); |
+ |
+ /** |
* 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 |
@@ -962,12 +1171,14 @@ |
* @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 |
@@ -976,6 +1187,7 @@ |
* @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. |
@@ -983,12 +1195,14 @@ |
*/ |
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. |
@@ -996,6 +1210,7 @@ |
*/ |
List<String> get shownNames; |
} |
+ |
/** |
* The interface {@code TopLevelVariableElement} defines the behavior of elements representing a |
* top-level variable. |
@@ -1003,24 +1218,28 @@ |
*/ |
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 |
@@ -1030,12 +1249,28 @@ |
*/ |
abstract class UndefinedElement implements Element { |
} |
+ |
/** |
+ * The interface {@code UriReferencedElement} defines the behavior of objects included into a |
+ * library using some URI. |
+ * @coverage dart.engine.element |
+ */ |
+abstract class UriReferencedElement implements Element { |
+ |
+ /** |
+ * Return the URI that is used to include this element into the enclosing library, or {@code null}if this is the defining compilation unit of a library. |
+ * @return the URI that is used to include this element into the enclosing library |
+ */ |
+ String get uri; |
+} |
+ |
+/** |
* 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 |
@@ -1043,17 +1278,20 @@ |
* @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 |
@@ -1062,6 +1300,7 @@ |
*/ |
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 |
@@ -1155,6 +1394,7 @@ |
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 |
@@ -1256,6 +1496,7 @@ |
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 |
@@ -1287,19 +1528,23 @@ |
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 |
@@ -1311,52 +1556,64 @@ |
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 |
@@ -1366,7 +1623,7 @@ |
accept(ElementVisitor visitor) => visitor.visitClassElement(this); |
List<PropertyAccessorElement> get accessors => _accessors; |
List<InterfaceType> get allSupertypes { |
- Set<InterfaceType> list = new Set<InterfaceType>(); |
+ List<InterfaceType> list = new List<InterfaceType>(); |
collectAllSupertypes(list); |
return new List.from(list); |
} |
@@ -1399,22 +1656,8 @@ |
return null; |
} |
List<ConstructorElement> get constructors => _constructors; |
+ |
/** |
- * Return the executable elemement representing the getter, setter or method with the given name |
- * that is declared in this class, or {@code null} if this class does not declare a member with |
- * the given name. |
- * @param memberName the name of the getter to be returned |
- * @return the member declared in this class with the given name |
- */ |
- ExecutableElement getExecutable(String memberName) { |
- for (PropertyAccessorElement accessor in _accessors) { |
- if (accessor.name == memberName) { |
- return accessor; |
- } |
- } |
- return getMethod(memberName); |
- } |
- /** |
* 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 |
@@ -1429,12 +1672,6 @@ |
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) { |
@@ -1445,12 +1682,6 @@ |
} |
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) { |
@@ -1470,13 +1701,10 @@ |
} |
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) { |
+ if (!setterName.endsWith("=")) { |
+ setterName += '='; |
+ } |
for (PropertyAccessorElement accessor in _accessors) { |
if (accessor.isSetter() && accessor.name == setterName) { |
return accessor; |
@@ -1489,105 +1717,123 @@ |
List<TypeVariableElement> get typeVariables => _typeVariables; |
ConstructorElement get unnamedConstructor { |
for (ConstructorElement element in constructors) { |
- String name2 = element.name; |
- if (name2 == null || name2.isEmpty) { |
+ String name = element.displayName; |
+ if (name == null || name.isEmpty) { |
return element; |
} |
} |
return null; |
} |
- bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
- bool isTypedef() => hasModifier(Modifier.TYPEDEF); |
- bool isValidMixin() => hasModifier(Modifier.MIXIN); |
- ExecutableElement lookUpExecutable(String memberName, LibraryElement library) { |
- ExecutableElement element = getExecutable(memberName); |
- if (element != null && element.isAccessibleIn(library)) { |
- return element; |
- } |
- for (InterfaceType mixin in _mixins) { |
- ClassElement mixinElement = mixin.element; |
- if (mixinElement != null) { |
- ClassElementImpl mixinElementImpl = mixinElement as ClassElementImpl; |
- element = mixinElementImpl.getExecutable(memberName); |
- if (element != null && element.isAccessibleIn(library)) { |
- return element; |
+ bool hasNonFinalField() { |
+ List<ClassElement> classesToVisit = new List<ClassElement>(); |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
+ classesToVisit.add(this); |
+ while (!classesToVisit.isEmpty) { |
+ ClassElement currentElement = classesToVisit.removeAt(0); |
+ if (javaSetAdd(visitedClasses, currentElement)) { |
+ for (FieldElement field in currentElement.fields) { |
+ if (!field.isFinal() && !field.isConst() && !field.isStatic() && !field.isSynthetic()) { |
+ return true; |
+ } |
} |
+ for (InterfaceType mixinType in currentElement.mixins) { |
+ ClassElement mixinElement = mixinType.element; |
+ classesToVisit.add(mixinElement); |
+ } |
+ InterfaceType supertype2 = currentElement.supertype; |
+ if (supertype2 != null) { |
+ ClassElement superElement = supertype2.element; |
+ if (superElement != null) { |
+ classesToVisit.add(superElement); |
+ } |
+ } |
} |
} |
- if (_supertype != null) { |
- ClassElement supertypeElement = _supertype.element; |
- if (supertypeElement != null) { |
- return supertypeElement.lookUpExecutable(memberName, library); |
- } |
- } |
- return null; |
+ return false; |
} |
+ bool hasReferenceToSuper() => hasModifier(Modifier.REFERENCES_SUPER); |
+ 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; |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
+ ClassElement currentElement = this; |
+ while (currentElement != null && !visitedClasses.contains(currentElement)) { |
+ javaSetAdd(visitedClasses, currentElement); |
+ PropertyAccessorElement element = currentElement.getGetter(getterName); |
+ if (element != null && element.isAccessibleIn(library)) { |
+ return element; |
+ } |
+ for (InterfaceType mixin in currentElement.mixins) { |
+ ClassElement mixinElement = mixin.element; |
+ if (mixinElement != null) { |
+ element = mixinElement.getGetter(getterName); |
+ if (element != null && element.isAccessibleIn(library)) { |
+ return element; |
+ } |
} |
} |
- } |
- if (_supertype != null) { |
- ClassElement supertypeElement = _supertype.element; |
- if (supertypeElement != null) { |
- return supertypeElement.lookUpGetter(getterName, library); |
+ InterfaceType supertype2 = currentElement.supertype; |
+ if (supertype2 == null) { |
+ return null; |
} |
+ currentElement = supertype2.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; |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
+ ClassElement currentElement = this; |
+ while (currentElement != null && !visitedClasses.contains(currentElement)) { |
+ javaSetAdd(visitedClasses, currentElement); |
+ MethodElement element = currentElement.getMethod(methodName); |
+ if (element != null && element.isAccessibleIn(library)) { |
+ return element; |
+ } |
+ for (InterfaceType mixin in currentElement.mixins) { |
+ ClassElement mixinElement = mixin.element; |
+ if (mixinElement != null) { |
+ element = mixinElement.getMethod(methodName); |
+ if (element != null && element.isAccessibleIn(library)) { |
+ return element; |
+ } |
} |
} |
- } |
- if (_supertype != null) { |
- ClassElement supertypeElement = _supertype.element; |
- if (supertypeElement != null) { |
- return supertypeElement.lookUpMethod(methodName, library); |
+ InterfaceType supertype2 = currentElement.supertype; |
+ if (supertype2 == null) { |
+ return null; |
} |
+ currentElement = supertype2.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; |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
+ ClassElement currentElement = this; |
+ while (currentElement != null && !visitedClasses.contains(currentElement)) { |
+ javaSetAdd(visitedClasses, currentElement); |
+ PropertyAccessorElement element = currentElement.getSetter(setterName); |
+ if (element != null && element.isAccessibleIn(library)) { |
+ return element; |
+ } |
+ for (InterfaceType mixin in currentElement.mixins) { |
+ ClassElement mixinElement = mixin.element; |
+ if (mixinElement != null) { |
+ element = mixinElement.getSetter(setterName); |
+ if (element != null && element.isAccessibleIn(library)) { |
+ return element; |
+ } |
} |
} |
- } |
- if (_supertype != null) { |
- ClassElement supertypeElement = _supertype.element; |
- if (supertypeElement != null) { |
- return supertypeElement.lookUpSetter(setterName, library); |
+ InterfaceType supertype2 = currentElement.supertype; |
+ if (supertype2 == null) { |
+ return null; |
} |
+ currentElement = supertype2.element; |
} |
return null; |
} |
+ |
/** |
* Set whether this class is abstract to correspond to the given value. |
* @param isAbstract {@code true} if the class is abstract |
@@ -1595,6 +1841,7 @@ |
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 |
@@ -1605,6 +1852,7 @@ |
} |
this._accessors = accessors2; |
} |
+ |
/** |
* Set the constructors contained in this class to the given constructors. |
* @param constructors the constructors contained in this class |
@@ -1615,6 +1863,7 @@ |
} |
this._constructors = constructors2; |
} |
+ |
/** |
* Set the fields contained in this class to the given fields. |
* @param fields the fields contained in this class |
@@ -1625,13 +1874,23 @@ |
} |
this._fields = fields2; |
} |
+ |
/** |
+ * Set whether this class references 'super' to the given value. |
+ * @param isReferencedSuper {@code true} references 'super' |
+ */ |
+ void set hasReferenceToSuper2(bool isReferencedSuper) { |
+ setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
+ } |
+ |
+ /** |
* 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 |
@@ -1642,6 +1901,7 @@ |
} |
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. |
@@ -1650,6 +1910,7 @@ |
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 |
@@ -1657,6 +1918,7 @@ |
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 |
@@ -1664,6 +1926,7 @@ |
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 |
@@ -1671,6 +1934,7 @@ |
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 |
@@ -1681,6 +1945,7 @@ |
} |
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 |
@@ -1697,11 +1962,11 @@ |
safelyVisitChildren(_typeVariables, visitor); |
} |
void appendTo(JavaStringBuilder builder) { |
- String name2 = name; |
- if (name2 == null) { |
+ String name = displayName; |
+ if (name == null) { |
builder.append("{unnamed class}"); |
} else { |
- builder.append(name2); |
+ builder.append(name); |
} |
int variableCount = _typeVariables.length; |
if (variableCount > 0) { |
@@ -1715,59 +1980,84 @@ |
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); |
+ void collectAllSupertypes(List<InterfaceType> supertypes) { |
+ List<InterfaceType> typesToVisit = new List<InterfaceType>(); |
+ List<ClassElement> visitedClasses = new List<ClassElement>(); |
+ typesToVisit.add(this.type); |
+ while (!typesToVisit.isEmpty) { |
+ InterfaceType currentType = typesToVisit.removeAt(0); |
+ ClassElement currentElement = currentType.element; |
+ if (!visitedClasses.contains(currentElement)) { |
+ visitedClasses.add(currentElement); |
+ if (currentType != this.type) { |
+ supertypes.add(currentType); |
+ } |
+ InterfaceType supertype = currentType.superclass; |
+ if (supertype != null) { |
+ typesToVisit.add(supertype); |
+ } |
+ for (InterfaceType type in currentElement.interfaces) { |
+ typesToVisit.add(type); |
+ } |
+ for (InterfaceType type in currentElement.mixins) { |
+ ClassElement element2 = type.element; |
+ if (!visitedClasses.contains(element2)) { |
+ supertypes.add(type); |
+ } |
+ } |
} |
} |
- 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 empty array of compilation unit elements. |
+ */ |
+ static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElement>(0); |
+ |
+ /** |
* 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. |
+ * The URI that is specified by the "part" directive in the enclosing library, or {@code null} if |
+ * this is the defining compilation unit of a library. |
*/ |
- static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElement>(0); |
+ String _uri; |
+ |
/** |
* Initialize a newly created compilation unit element to have the given name. |
* @param name the name of this element |
@@ -1821,7 +2111,9 @@ |
return null; |
} |
List<ClassElement> get types => _types; |
+ String get uri => _uri; |
int get hashCode => _source.hashCode; |
+ |
/** |
* Set the top-level accessors (getters and setters) contained in this compilation unit to the |
* given accessors. |
@@ -1833,6 +2125,7 @@ |
} |
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 |
@@ -1843,6 +2136,7 @@ |
} |
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 |
@@ -1850,6 +2144,7 @@ |
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 |
@@ -1860,6 +2155,7 @@ |
} |
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 |
@@ -1870,6 +2166,7 @@ |
} |
this._typeAliases = typeAliases2; |
} |
+ |
/** |
* Set the types contained in this compilation unit to the given types. |
* @param types types contained in this compilation unit |
@@ -1880,6 +2177,14 @@ |
} |
this._types = types2; |
} |
+ |
+ /** |
+ * Set the URI that is specified by the "part" directive in the enclosing library. |
+ * @param uri the URI that is specified by the "part" directive in the enclosing library. |
+ */ |
+ void set uri(String uri2) { |
+ this._uri = uri2; |
+ } |
void visitChildren(ElementVisitor<Object> visitor) { |
super.visitChildren(visitor); |
safelyVisitChildren(_accessors, visitor); |
@@ -1896,15 +2201,18 @@ |
} |
} |
} |
+ |
/** |
* 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 |
@@ -1916,15 +2224,18 @@ |
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 |
@@ -1936,16 +2247,19 @@ |
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 |
@@ -1957,14 +2271,17 @@ |
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 |
@@ -1976,16 +2293,24 @@ |
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); |
+ |
/** |
+ * The constructor to which this constructor is redirecting. |
+ */ |
+ ConstructorElement _redirectedConstructor; |
+ |
+ /** |
* Initialize a newly created constructor element to have the given name. |
* @param name the name of this element |
*/ |
@@ -1994,9 +2319,11 @@ |
accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
ElementKind get kind => ElementKind.CONSTRUCTOR; |
+ ConstructorElement get redirectedConstructor => _redirectedConstructor; |
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 |
@@ -2004,6 +2331,7 @@ |
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 |
@@ -2011,31 +2339,43 @@ |
void set factory(bool isFactory) { |
setModifier(Modifier.FACTORY, isFactory); |
} |
+ |
+ /** |
+ * Sets the constructor to which this constructor is redirecting. |
+ * @param redirectedConstructor the constructor to which this constructor is redirecting |
+ */ |
+ void set redirectedConstructor(ConstructorElement redirectedConstructor2) { |
+ this._redirectedConstructor = redirectedConstructor2; |
+ } |
void appendTo(JavaStringBuilder builder) { |
- builder.append(enclosingElement.name); |
- String name2 = name; |
- if (name2 != null && !name2.isEmpty) { |
+ builder.append(enclosingElement.displayName); |
+ String name = displayName; |
+ if (name != null && !name.isEmpty) { |
builder.append("."); |
- builder.append(name2); |
+ builder.append(name); |
} |
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 |
@@ -2046,11 +2386,13 @@ |
} |
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 |
@@ -2059,48 +2401,57 @@ |
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_189_impl(name2); |
+ _jtd_constructor_193_impl(name2); |
} |
- _jtd_constructor_189_impl(Identifier name2) { |
- _jtd_constructor_190_impl(name2 == null ? "" : name2.name, name2 == null ? -1 : name2.offset); |
+ _jtd_constructor_193_impl(Identifier name2) { |
+ _jtd_constructor_194_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 |
@@ -2108,9 +2459,9 @@ |
* declaration of this element |
*/ |
ElementImpl.con2(String name2, int nameOffset2) { |
- _jtd_constructor_190_impl(name2, nameOffset2); |
+ _jtd_constructor_194_impl(name2, nameOffset2); |
} |
- _jtd_constructor_190_impl(String name2, int nameOffset2) { |
+ _jtd_constructor_194_impl(String name2, int nameOffset2) { |
this._name = StringUtilities.intern(name2); |
this._nameOffset = nameOffset2; |
} |
@@ -2129,6 +2480,7 @@ |
} |
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 |
@@ -2141,6 +2493,7 @@ |
} |
return _enclosingElement.context; |
} |
+ String get displayName => _name; |
Element get enclosingElement => _enclosingElement; |
LibraryElement get library => getAncestor(LibraryElement); |
ElementLocation get location => new ElementLocationImpl.con1(this); |
@@ -2166,6 +2519,7 @@ |
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 |
@@ -2173,6 +2527,7 @@ |
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 |
@@ -2182,6 +2537,7 @@ |
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 |
@@ -2196,6 +2552,7 @@ |
} |
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 |
@@ -2209,18 +2566,21 @@ |
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 |
@@ -2231,6 +2591,7 @@ |
child.accept(visitor); |
} |
} |
+ |
/** |
* Use the given visitor to visit all of the children in the given array. |
* @param children the children to be visited |
@@ -2243,6 +2604,7 @@ |
} |
} |
} |
+ |
/** |
* Set the enclosing element of this element to the given element. |
* @param element the enclosing element of this element |
@@ -2250,6 +2612,7 @@ |
void set enclosingElement(ElementImpl element) { |
_enclosingElement = element; |
} |
+ |
/** |
* Set whether the given modifier is associated with this element to correspond to the given |
* value. |
@@ -2272,27 +2635,31 @@ |
} |
} |
} |
+ |
/** |
* 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_191_impl(element); |
+ _jtd_constructor_195_impl(element); |
} |
- _jtd_constructor_191_impl(Element element) { |
+ _jtd_constructor_195_impl(Element element) { |
List<String> components = new List<String>(); |
Element ancestor = element; |
while (ancestor != null) { |
@@ -2301,14 +2668,15 @@ |
} |
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_192_impl(encoding); |
+ _jtd_constructor_196_impl(encoding); |
} |
- _jtd_constructor_192_impl(String encoding) { |
+ _jtd_constructor_196_impl(String encoding) { |
this._components = decode(encoding); |
} |
bool operator ==(Object object) { |
@@ -2318,6 +2686,7 @@ |
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 |
@@ -2336,6 +2705,7 @@ |
} |
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 |
@@ -2367,6 +2737,7 @@ |
} |
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 |
@@ -2383,15 +2754,18 @@ |
} |
} |
} |
+ |
/** |
* 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}) |
@@ -2401,6 +2775,7 @@ |
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 |
@@ -2413,44 +2788,53 @@ |
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_194_impl(name); |
+ _jtd_constructor_198_impl(name); |
} |
- _jtd_constructor_194_impl(Identifier name) { |
+ _jtd_constructor_198_impl(Identifier name) { |
} |
+ |
/** |
* Initialize a newly created executable element to have the given name. |
* @param name the name of this element |
@@ -2458,9 +2842,9 @@ |
* declaration of this element |
*/ |
ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) { |
- _jtd_constructor_195_impl(name, nameOffset); |
+ _jtd_constructor_199_impl(name, nameOffset); |
} |
- _jtd_constructor_195_impl(String name, int nameOffset) { |
+ _jtd_constructor_199_impl(String name, int nameOffset) { |
} |
ElementImpl getChild(String identifier2) { |
for (ExecutableElement function in _functions) { |
@@ -2491,6 +2875,7 @@ |
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 |
@@ -2501,6 +2886,7 @@ |
} |
this._functions = functions2; |
} |
+ |
/** |
* Set the labels defined within this executable element to the given labels. |
* @param labels the labels defined within this executable element |
@@ -2511,6 +2897,7 @@ |
} |
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 |
@@ -2521,6 +2908,7 @@ |
} |
this._localVariables = localVariables2; |
} |
+ |
/** |
* Set the parameters defined by this executable element to the given parameters. |
* @param parameters the parameters defined by this executable element |
@@ -2531,6 +2919,7 @@ |
} |
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 |
@@ -2561,20 +2950,29 @@ |
} |
} |
} |
+ |
/** |
* Instances of the class {@code ExportElementImpl} implement an {@link ExportElement}. |
* @coverage dart.engine.element |
*/ |
class ExportElementImpl extends ElementImpl implements ExportElement { |
+ |
/** |
+ * The URI that is specified by this directive. |
+ */ |
+ String _uri; |
+ |
+ /** |
* 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. |
*/ |
@@ -2584,6 +2982,8 @@ |
List<NamespaceCombinator> get combinators => _combinators; |
LibraryElement get exportedLibrary => _exportedLibrary; |
ElementKind get kind => ElementKind.EXPORT; |
+ String get uri => _uri; |
+ |
/** |
* Set the combinators that were specified as part of the export directive to the given array of |
* combinators. |
@@ -2592,6 +2992,7 @@ |
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. |
@@ -2600,21 +3001,32 @@ |
void set exportedLibrary(LibraryElement exportedLibrary2) { |
this._exportedLibrary = exportedLibrary2; |
} |
+ |
+ /** |
+ * Set the URI that is specified by this directive. |
+ * @param uri the URI that is specified by this directive. |
+ */ |
+ void set uri(String uri2) { |
+ this._uri = uri2; |
+ } |
void appendTo(JavaStringBuilder builder) { |
builder.append("export "); |
((_exportedLibrary as LibraryElementImpl)).appendTo(builder); |
} |
String get identifier => _exportedLibrary.name; |
} |
+ |
/** |
* 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}) |
@@ -2624,6 +3036,7 @@ |
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 |
@@ -2632,37 +3045,42 @@ |
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_198_impl(name); |
+ _jtd_constructor_202_impl(name); |
} |
- _jtd_constructor_198_impl(Identifier name) { |
+ _jtd_constructor_202_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_199_impl(name); |
+ _jtd_constructor_203_impl(name); |
} |
- _jtd_constructor_199_impl(String name) { |
+ _jtd_constructor_203_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 |
@@ -2671,15 +3089,18 @@ |
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 |
@@ -2688,6 +3109,8 @@ |
} |
accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(this); |
FieldElement get field => _field; |
+ bool isInitializingFormal() => true; |
+ |
/** |
* Set the field element associated with this field formal parameter to the given element. |
* @param field the new field element |
@@ -2696,42 +3119,49 @@ |
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_201_impl(); |
+ _jtd_constructor_205_impl(); |
} |
- _jtd_constructor_201_impl() { |
+ _jtd_constructor_205_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_202_impl(name); |
+ _jtd_constructor_206_impl(name); |
} |
- _jtd_constructor_202_impl(Identifier name) { |
+ _jtd_constructor_206_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. |
@@ -2739,9 +3169,9 @@ |
* declaration of this element |
*/ |
FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) { |
- _jtd_constructor_203_impl(nameOffset); |
+ _jtd_constructor_207_impl(nameOffset); |
} |
- _jtd_constructor_203_impl(int nameOffset) { |
+ _jtd_constructor_207_impl(int nameOffset) { |
} |
accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
String get identifier => name; |
@@ -2753,6 +3183,7 @@ |
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. |
@@ -2765,34 +3196,40 @@ |
_visibleRangeLength = length; |
} |
void appendTo(JavaStringBuilder builder) { |
- String name2 = name; |
- if (name2 != null) { |
- builder.append(name2); |
+ String name = displayName; |
+ if (name != null) { |
+ builder.append(name); |
} |
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 |
@@ -2818,6 +3255,7 @@ |
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 |
@@ -2830,6 +3268,7 @@ |
} |
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 |
@@ -2837,6 +3276,7 @@ |
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 |
@@ -2854,7 +3294,7 @@ |
} |
void appendTo(JavaStringBuilder builder) { |
builder.append("typedef "); |
- builder.append(name); |
+ builder.append(displayName); |
int variableCount = _typeVariables.length; |
if (variableCount > 0) { |
builder.append("<"); |
@@ -2881,22 +3321,20 @@ |
} |
} |
} |
+ |
/** |
* 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. |
@@ -2918,27 +3356,33 @@ |
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 |
@@ -2954,6 +3398,7 @@ |
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 |
@@ -2967,6 +3412,7 @@ |
} |
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 |
@@ -2986,15 +3432,18 @@ |
} |
} |
} |
+ |
/** |
* 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}) |
@@ -3002,25 +3451,35 @@ |
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 URI that is specified by this directive. |
+ */ |
+ String _uri; |
+ |
+ /** |
* 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. |
*/ |
@@ -3031,6 +3490,8 @@ |
LibraryElement get importedLibrary => _importedLibrary; |
ElementKind get kind => ElementKind.IMPORT; |
PrefixElement get prefix => _prefix; |
+ String get uri => _uri; |
+ |
/** |
* Set the combinators that were specified as part of the import directive to the given array of |
* combinators. |
@@ -3039,6 +3500,7 @@ |
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. |
@@ -3047,6 +3509,7 @@ |
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 |
@@ -3054,6 +3517,14 @@ |
void set prefix(PrefixElement prefix2) { |
this._prefix = prefix2; |
} |
+ |
+ /** |
+ * Set the URI that is specified by this directive. |
+ * @param uri the URI that is specified by this directive. |
+ */ |
+ void set uri(String uri2) { |
+ this._uri = uri2; |
+ } |
void visitChildren(ElementVisitor<Object> visitor) { |
super.visitChildren(visitor); |
safelyVisitChild(_prefix, visitor); |
@@ -3062,25 +3533,30 @@ |
builder.append("import "); |
((_importedLibrary as LibraryElementImpl)).appendTo(builder); |
} |
- String get identifier => "${_importedLibrary.name}:${(_prefix == null ? "" : _prefix.name)}"; |
+ String get identifier => ((_importedLibrary as LibraryElementImpl)).identifier; |
} |
+ |
/** |
* 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 |
@@ -3094,26 +3570,31 @@ |
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 |
@@ -3144,30 +3625,37 @@ |
} |
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 |
@@ -3264,6 +3752,7 @@ |
Set<LibraryElement> visitedLibraries = new Set(); |
return isUpToDate(this, timeStamp, visitedLibraries); |
} |
+ |
/** |
* Set the compilation unit that defines this library to the given compilation unit. |
* @param definingCompilationUnit the compilation unit that defines this library |
@@ -3272,6 +3761,7 @@ |
((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement = this; |
this._definingCompilationUnit = definingCompilationUnit2; |
} |
+ |
/** |
* Set the entry point for this library to the given function. |
* @param entryPoint the entry point for this library |
@@ -3279,6 +3769,7 @@ |
void set entryPoint(FunctionElement entryPoint2) { |
this._entryPoint = entryPoint2; |
} |
+ |
/** |
* Set the specifications of all of the exports defined in this library to the given array. |
* @param exports the specifications of all of the exports defined in this library |
@@ -3289,6 +3780,7 @@ |
} |
this._exports = exports2; |
} |
+ |
/** |
* Set the specifications of all of the imports defined in this library to the given array. |
* @param imports the specifications of all of the imports defined in this library |
@@ -3303,6 +3795,7 @@ |
} |
this._imports = imports2; |
} |
+ |
/** |
* Set the compilation units that are included in this library using a {@code part} directive. |
* @param parts the compilation units that are included in this library using a {@code part}directive |
@@ -3320,6 +3813,7 @@ |
safelyVisitChildren(_imports, visitor); |
safelyVisitChildren(_parts, visitor); |
} |
+ |
/** |
* Answer {@code true} if the receiver directly or indirectly imports the dart:html libraries. |
* @return {@code true} if the receiver directly or indirectly imports the dart:html libraries |
@@ -3348,24 +3842,29 @@ |
return false; |
} |
} |
+ |
/** |
* Instances of the class {@code LocalVariableElementImpl} implement a {@code LocalVariableElement}. |
* @coverage dart.engine.element |
*/ |
class LocalVariableElementImpl extends VariableElementImpl implements LocalVariableElement { |
+ |
/** |
* 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 field elements. |
*/ |
static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>(0); |
+ |
/** |
* Initialize a newly created local variable element to have the given name. |
* @param name the name of this element |
@@ -3380,6 +3879,7 @@ |
} |
return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
} |
+ |
/** |
* Set the visible range for this element to the range starting at the given offset with the given |
* length. |
@@ -3394,27 +3894,31 @@ |
void appendTo(JavaStringBuilder builder) { |
builder.append(type); |
builder.append(" "); |
- builder.append(name); |
+ builder.append(displayName); |
} |
} |
+ |
/** |
* Instances of the class {@code MethodElementImpl} implement a {@code MethodElement}. |
* @coverage dart.engine.element |
*/ |
class MethodElementImpl extends ExecutableElementImpl implements MethodElement { |
+ |
/** |
* An empty array of method elements. |
*/ |
static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); |
+ |
/** |
* Initialize a newly created method element to have the given name. |
* @param name the name of this element |
*/ |
MethodElementImpl.con1(Identifier name) : super.con1(name) { |
- _jtd_constructor_212_impl(name); |
+ _jtd_constructor_216_impl(name); |
} |
- _jtd_constructor_212_impl(Identifier name) { |
+ _jtd_constructor_216_impl(Identifier name) { |
} |
+ |
/** |
* Initialize a newly created method element to have the given name. |
* @param name the name of this element |
@@ -3422,23 +3926,33 @@ |
* declaration of this element |
*/ |
MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) { |
- _jtd_constructor_213_impl(name, nameOffset); |
+ _jtd_constructor_217_impl(name, nameOffset); |
} |
- _jtd_constructor_213_impl(String name, int nameOffset) { |
+ _jtd_constructor_217_impl(String name, int nameOffset) { |
} |
accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
ElementKind get kind => ElementKind.METHOD; |
+ String get name { |
+ String name2 = super.name; |
+ if (isOperator() && name2 == "-") { |
+ if (parameters.length == 0) { |
+ return "unary-"; |
+ } |
+ } |
+ return super.name; |
+ } |
bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
bool isOperator() { |
- String name2 = name; |
- if (name2.isEmpty) { |
+ String name = displayName; |
+ if (name.isEmpty) { |
return false; |
} |
- int first = name2.codeUnitAt(0); |
+ int first = name.codeUnitAt(0); |
return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A) || first == 0x5F || first == 0x24); |
} |
bool isStatic() => hasModifier(Modifier.STATIC); |
+ |
/** |
* Set whether this method is abstract to correspond to the given value. |
* @param isAbstract {@code true} if the method is abstract |
@@ -3446,6 +3960,7 @@ |
void set abstract(bool isAbstract) { |
setModifier(Modifier.ABSTRACT, isAbstract); |
} |
+ |
/** |
* Set whether this method is static to correspond to the given value. |
* @param isStatic {@code true} if the method is static |
@@ -3454,12 +3969,13 @@ |
setModifier(Modifier.STATIC, isStatic); |
} |
void appendTo(JavaStringBuilder builder) { |
- builder.append(enclosingElement.name); |
+ builder.append(enclosingElement.displayName); |
builder.append("."); |
- builder.append(name); |
+ builder.append(displayName); |
super.appendTo(builder); |
} |
} |
+ |
/** |
* The enumeration {@code Modifier} defines constants for all of the modifiers defined by the Dart |
* language and for a few additional flags that are useful. |
@@ -3471,39 +3987,47 @@ |
static final Modifier FACTORY = new Modifier('FACTORY', 2); |
static final Modifier FINAL = new Modifier('FINAL', 3); |
static final Modifier GETTER = new Modifier('GETTER', 4); |
- static final Modifier INITIALIZING_FORMAL = new Modifier('INITIALIZING_FORMAL', 5); |
- static final Modifier MIXIN = new Modifier('MIXIN', 6); |
+ static final Modifier MIXIN = new Modifier('MIXIN', 5); |
+ static final Modifier REFERENCES_SUPER = new Modifier('REFERENCES_SUPER', 6); |
static final Modifier SETTER = new Modifier('SETTER', 7); |
static final Modifier STATIC = new Modifier('STATIC', 8); |
static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 9); |
static final Modifier TYPEDEF = new Modifier('TYPEDEF', 10); |
- static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER, INITIALIZING_FORMAL, MIXIN, SETTER, STATIC, SYNTHETIC, TYPEDEF]; |
- final String __name; |
- final int __ordinal; |
- int get ordinal => __ordinal; |
- Modifier(this.__name, this.__ordinal) { |
+ static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER, MIXIN, REFERENCES_SUPER, SETTER, STATIC, SYNTHETIC, TYPEDEF]; |
+ |
+ /// The name of this enum constant, as declared in the enum declaration. |
+ final String name; |
+ |
+ /// The position in the enum declaration. |
+ final int ordinal; |
+ Modifier(this.name, this.ordinal) { |
} |
- int compareTo(Modifier other) => __ordinal - other.__ordinal; |
- String toString() => __name; |
+ int compareTo(Modifier other) => ordinal - other.ordinal; |
+ String toString() => name; |
} |
+ |
/** |
* Instances of the class {@code MultiplyDefinedElementImpl} represent a collection of elements that |
* have the same name within the same scope. |
* @coverage dart.engine.element |
*/ |
class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
+ |
/** |
* The analysis context in which the multiply defined elements are defined. |
*/ |
AnalysisContext _context; |
+ |
/** |
* The name of the conflicting elements. |
*/ |
String _name; |
+ |
/** |
* A list containing all of the elements that conflict. |
*/ |
List<Element> _conflictingElements; |
+ |
/** |
* Initialize a newly created element to represent a list of conflicting elements. |
* @param context the analysis context in which the multiply defined elements are defined |
@@ -3519,6 +4043,7 @@ |
Element getAncestor(Type elementClass) => null; |
List<Element> get conflictingElements => _conflictingElements; |
AnalysisContext get context => _context; |
+ String get displayName => _name; |
Element get enclosingElement => null; |
ElementKind get kind => ElementKind.ERROR; |
LibraryElement get library => null; |
@@ -3551,6 +4076,7 @@ |
} |
void visitChildren(ElementVisitor<Object> visitor) { |
} |
+ |
/** |
* Add the given element to the list of elements. If the element is a multiply-defined element, |
* add all of the conflicting elements that it represents. |
@@ -3566,6 +4092,7 @@ |
elements.add(element); |
} |
} |
+ |
/** |
* Use the given elements to construct an array of conflicting elements. If either of the given |
* elements are multiply-defined elements then the conflicting elements they represent will be |
@@ -3581,33 +4108,40 @@ |
return new List.from(elements); |
} |
} |
+ |
/** |
* Instances of the class {@code ParameterElementImpl} implement a {@code ParameterElement}. |
* @coverage dart.engine.element |
*/ |
class ParameterElementImpl extends VariableElementImpl implements ParameterElement { |
+ |
/** |
* An array containing all of the parameters defined by this parameter element. There will only be |
* parameters if this parameter is a function typed parameter. |
*/ |
List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
+ |
/** |
* The kind of this parameter. |
*/ |
ParameterKind _parameterKind; |
+ |
/** |
* 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 field elements. |
*/ |
static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0); |
+ |
/** |
* Initialize a newly created parameter element to have the given name. |
* @param name the name of this element |
@@ -3624,21 +4158,16 @@ |
} |
return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
} |
- bool isInitializingFormal() => hasModifier(Modifier.INITIALIZING_FORMAL); |
+ bool isInitializingFormal() => false; |
+ |
/** |
- * Set whether this parameter is an initializing formal parameter to match the given value. |
- * @param isInitializingFormal {@code true} if this parameter is an initializing formal parameter |
- */ |
- void set initializingFormal(bool isInitializingFormal) { |
- setModifier(Modifier.INITIALIZING_FORMAL, isInitializingFormal); |
- } |
- /** |
* Set the kind of this parameter to the given kind. |
* @param parameterKind the new kind of this parameter |
*/ |
void set parameterKind(ParameterKind parameterKind2) { |
this._parameterKind = parameterKind2; |
} |
+ |
/** |
* Set the parameters defined by this executable element to the given parameters. |
* @param parameters the parameters defined by this executable element |
@@ -3649,6 +4178,7 @@ |
} |
this._parameters = parameters2; |
} |
+ |
/** |
* Set the visible range for this element to the range starting at the given offset with the given |
* length. |
@@ -3680,23 +4210,27 @@ |
builder.append(left); |
builder.append(type); |
builder.append(" "); |
- builder.append(name); |
+ builder.append(displayName); |
builder.append(right); |
} |
} |
+ |
/** |
* Instances of the class {@code PrefixElementImpl} implement a {@code PrefixElement}. |
* @coverage dart.engine.element |
*/ |
class PrefixElementImpl extends ElementImpl implements PrefixElement { |
+ |
/** |
* An array containing all of the libraries that are imported using this prefix. |
*/ |
List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; |
+ |
/** |
* An empty array of prefix elements. |
*/ |
static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); |
+ |
/** |
* Initialize a newly created prefix element to have the given name. |
* @param name the name of this element |
@@ -3707,6 +4241,7 @@ |
LibraryElement get enclosingElement => super.enclosingElement as LibraryElement; |
List<LibraryElement> get importedLibraries => _importedLibraries; |
ElementKind get kind => ElementKind.PREFIX; |
+ |
/** |
* Set the libraries that are imported using this prefix to the given libraries. |
* @param importedLibraries the libraries that are imported using this prefix |
@@ -3722,59 +4257,93 @@ |
super.appendTo(builder); |
} |
} |
+ |
/** |
* Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}. |
* @coverage dart.engine.element |
*/ |
class PropertyAccessorElementImpl extends ExecutableElementImpl implements PropertyAccessorElement { |
+ |
/** |
* The variable associated with this accessor. |
*/ |
PropertyInducingElement _variable; |
+ |
/** |
* An empty array of property accessor elements. |
*/ |
static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorElement>(0); |
+ |
/** |
* Initialize a newly created property accessor element to have the given name. |
* @param name the name of this element |
*/ |
PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) { |
- _jtd_constructor_218_impl(name); |
+ _jtd_constructor_222_impl(name); |
} |
- _jtd_constructor_218_impl(Identifier name) { |
+ _jtd_constructor_222_impl(Identifier name) { |
} |
+ |
/** |
* Initialize a newly created synthetic property accessor element to be associated with the given |
* variable. |
* @param variable the variable with which this access is associated |
*/ |
- PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : super.con2(variable2.name, -1) { |
- _jtd_constructor_219_impl(variable2); |
+ PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : super.con2(variable2.name, variable2.nameOffset) { |
+ _jtd_constructor_223_impl(variable2); |
} |
- _jtd_constructor_219_impl(PropertyInducingElementImpl variable2) { |
+ _jtd_constructor_223_impl(PropertyInducingElementImpl variable2) { |
this._variable = variable2; |
synthetic = true; |
} |
accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
bool operator ==(Object object) => super == object && identical(isGetter(), ((object as PropertyAccessorElement)).isGetter()); |
+ PropertyAccessorElement get correspondingGetter { |
+ if (isGetter() || _variable == null) { |
+ return null; |
+ } |
+ return _variable.getter; |
+ } |
+ PropertyAccessorElement get correspondingSetter { |
+ if (isSetter() || _variable == null) { |
+ return null; |
+ } |
+ return _variable.setter; |
+ } |
ElementKind get kind { |
if (isGetter()) { |
return ElementKind.GETTER; |
} |
return ElementKind.SETTER; |
} |
+ String get name { |
+ if (isSetter()) { |
+ return "${super.name}="; |
+ } |
+ return super.name; |
+ } |
PropertyInducingElement get variable => _variable; |
+ bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
bool isGetter() => hasModifier(Modifier.GETTER); |
bool isSetter() => hasModifier(Modifier.SETTER); |
- bool isStatic() => variable.isStatic(); |
+ bool isStatic() => hasModifier(Modifier.STATIC); |
+ |
/** |
+ * Set whether this accessor is abstract to correspond to the given value. |
+ * @param isAbstract {@code true} if the accessor is abstract |
+ */ |
+ void set abstract(bool isAbstract) { |
+ setModifier(Modifier.ABSTRACT, isAbstract); |
+ } |
+ |
+ /** |
* Set whether this accessor is a getter to correspond to the given value. |
* @param isGetter {@code true} if the accessor is a getter |
*/ |
void set getter(bool isGetter) { |
setModifier(Modifier.GETTER, isGetter); |
} |
+ |
/** |
* Set whether this accessor is a setter to correspond to the given value. |
* @param isSetter {@code true} if the accessor is a setter |
@@ -3782,7 +4351,16 @@ |
void set setter(bool isSetter) { |
setModifier(Modifier.SETTER, isSetter); |
} |
+ |
/** |
+ * Set whether this accessor is static to correspond to the given value. |
+ * @param isStatic {@code true} if the accessor is static |
+ */ |
+ void set static(bool isStatic) { |
+ setModifier(Modifier.STATIC, isStatic); |
+ } |
+ |
+ /** |
* Set the variable associated with this accessor to the given variable. |
* @param variable the variable associated with this accessor |
*/ |
@@ -3791,48 +4369,55 @@ |
} |
void appendTo(JavaStringBuilder builder) { |
builder.append(isGetter() ? "get " : "set "); |
- builder.append(variable.name); |
+ builder.append(variable.displayName); |
super.appendTo(builder); |
} |
} |
+ |
/** |
* Instances of the class {@code PropertyInducingElementImpl} implement a{@code PropertyInducingElement}. |
* @coverage dart.engine.element |
*/ |
abstract class PropertyInducingElementImpl extends VariableElementImpl implements PropertyInducingElement { |
+ |
/** |
* The getter associated with this element. |
*/ |
PropertyAccessorElement _getter; |
+ |
/** |
* The setter associated with this element, or {@code null} if the element is effectively{@code final} and therefore does not have a setter associated with it. |
*/ |
PropertyAccessorElement _setter; |
+ |
/** |
* An empty array of elements. |
*/ |
static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingElement>(0); |
+ |
/** |
* Initialize a newly created element to have the given name. |
* @param name the name of this element |
*/ |
PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) { |
- _jtd_constructor_220_impl(name); |
+ _jtd_constructor_224_impl(name); |
} |
- _jtd_constructor_220_impl(Identifier name) { |
+ _jtd_constructor_224_impl(Identifier name) { |
} |
+ |
/** |
* Initialize a newly created synthetic element to have the given name. |
* @param name the name of this element |
*/ |
PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { |
- _jtd_constructor_221_impl(name); |
+ _jtd_constructor_225_impl(name); |
} |
- _jtd_constructor_221_impl(String name) { |
+ _jtd_constructor_225_impl(String name) { |
synthetic = true; |
} |
PropertyAccessorElement get getter => _getter; |
PropertyAccessorElement get setter => _setter; |
+ |
/** |
* Set the getter associated with this element to the given accessor. |
* @param getter the getter associated with this element |
@@ -3840,6 +4425,7 @@ |
void set getter(PropertyAccessorElement getter2) { |
this._getter = getter2; |
} |
+ |
/** |
* Set the setter associated with this element to the given accessor. |
* @param setter the setter associated with this element |
@@ -3848,22 +4434,20 @@ |
this._setter = setter2; |
} |
} |
+ |
/** |
* Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowCombinator}. |
* @coverage dart.engine.element |
*/ |
class ShowCombinatorImpl implements ShowCombinator { |
+ |
/** |
* The names that are to be made visible in the importing library if they are defined in the |
* imported library. |
*/ |
List<String> _shownNames = StringUtilities.EMPTY_ARRAY; |
- /** |
- * Initialize a newly created combinator. |
- */ |
- ShowCombinatorImpl() : super() { |
- } |
List<String> get shownNames => _shownNames; |
+ |
/** |
* Set the names that are to be made visible in the importing library if they are defined in the |
* imported library to the given names. |
@@ -3885,55 +4469,64 @@ |
return builder.toString(); |
} |
} |
+ |
/** |
* Instances of the class {@code TopLevelVariableElementImpl} implement a{@code TopLevelVariableElement}. |
* @coverage dart.engine.element |
*/ |
class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement { |
+ |
/** |
* An empty array of top-level variable elements. |
*/ |
static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableElement>(0); |
+ |
/** |
* Initialize a newly created top-level variable element to have the given name. |
* @param name the name of this element |
*/ |
TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) { |
- _jtd_constructor_223_impl(name); |
+ _jtd_constructor_227_impl(name); |
} |
- _jtd_constructor_223_impl(Identifier name) { |
+ _jtd_constructor_227_impl(Identifier name) { |
} |
+ |
/** |
* Initialize a newly created synthetic top-level variable element to have the given name. |
* @param name the name of this element |
*/ |
TopLevelVariableElementImpl.con2(String name) : super.con2(name) { |
- _jtd_constructor_224_impl(name); |
+ _jtd_constructor_228_impl(name); |
} |
- _jtd_constructor_224_impl(String name) { |
+ _jtd_constructor_228_impl(String name) { |
} |
accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); |
ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; |
bool isStatic() => true; |
} |
+ |
/** |
* Instances of the class {@code TypeVariableElementImpl} implement a {@code TypeVariableElement}. |
* @coverage dart.engine.element |
*/ |
class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement { |
+ |
/** |
* The type defined by this type variable. |
*/ |
TypeVariableType _type; |
+ |
/** |
* The type representing the bound associated with this variable, or {@code null} if this variable |
* does not have an explicit bound. |
*/ |
Type2 _bound; |
+ |
/** |
* An empty array of type variable elements. |
*/ |
static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0); |
+ |
/** |
* Initialize a newly created type variable element to have the given name. |
* @param name the name of this element |
@@ -3944,6 +4537,7 @@ |
Type2 get bound => _bound; |
ElementKind get kind => ElementKind.TYPE_VARIABLE; |
TypeVariableType get type => _type; |
+ |
/** |
* Set the type representing the bound associated with this variable to the given type. |
* @param bound the type representing the bound associated with this variable |
@@ -3951,6 +4545,7 @@ |
void set bound(Type2 bound2) { |
this._bound = bound2; |
} |
+ |
/** |
* Set the type defined by this type variable to the given type |
* @param type the type defined by this type variable |
@@ -3959,40 +4554,46 @@ |
this._type = type2; |
} |
void appendTo(JavaStringBuilder builder) { |
- builder.append(name); |
+ builder.append(displayName); |
if (_bound != null) { |
builder.append(" extends "); |
builder.append(_bound); |
} |
} |
} |
+ |
/** |
* Instances of the class {@code VariableElementImpl} implement a {@code VariableElement}. |
* @coverage dart.engine.element |
*/ |
abstract class VariableElementImpl extends ElementImpl implements VariableElement { |
+ |
/** |
* The declared type of this variable. |
*/ |
Type2 _type; |
+ |
/** |
* A synthetic function representing this variable's initializer, or {@code null} if this variable |
* does not have an initializer. |
*/ |
FunctionElement _initializer; |
+ |
/** |
* An empty array of variable elements. |
*/ |
static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0); |
+ |
/** |
* Initialize a newly created variable element to have the given name. |
* @param name the name of this element |
*/ |
VariableElementImpl.con1(Identifier name) : super.con1(name) { |
- _jtd_constructor_226_impl(name); |
+ _jtd_constructor_230_impl(name); |
} |
- _jtd_constructor_226_impl(Identifier name) { |
+ _jtd_constructor_230_impl(Identifier name) { |
} |
+ |
/** |
* Initialize a newly created variable element to have the given name. |
* @param name the name of this element |
@@ -4000,10 +4601,11 @@ |
* declaration of this element |
*/ |
VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) { |
- _jtd_constructor_227_impl(name, nameOffset); |
+ _jtd_constructor_231_impl(name, nameOffset); |
} |
- _jtd_constructor_227_impl(String name, int nameOffset) { |
+ _jtd_constructor_231_impl(String name, int nameOffset) { |
} |
+ |
/** |
* Return the result of evaluating this variable's initializer as a compile-time constant |
* expression, or {@code null} if this variable is not a 'const' variable or does not have an |
@@ -4015,6 +4617,7 @@ |
Type2 get type => _type; |
bool isConst() => hasModifier(Modifier.CONST); |
bool isFinal() => hasModifier(Modifier.FINAL); |
+ |
/** |
* Set whether this variable is const to correspond to the given value. |
* @param isConst {@code true} if the variable is const |
@@ -4022,6 +4625,7 @@ |
void set const3(bool isConst) { |
setModifier(Modifier.CONST, isConst); |
} |
+ |
/** |
* Set the result of evaluating this variable's initializer as a compile-time constant expression |
* to the given result. |
@@ -4030,6 +4634,7 @@ |
void set evaluationResult(EvaluationResultImpl result) { |
throw new IllegalStateException("Invalid attempt to set a compile-time constant result"); |
} |
+ |
/** |
* Set whether this variable is final to correspond to the given value. |
* @param isFinal {@code true} if the variable is final |
@@ -4037,6 +4642,7 @@ |
void set final2(bool isFinal) { |
setModifier(Modifier.FINAL, isFinal); |
} |
+ |
/** |
* Set the function representing this variable's initializer to the given function. |
* @param initializer the function representing this variable's initializer |
@@ -4047,6 +4653,7 @@ |
} |
this._initializer = initializer2; |
} |
+ |
/** |
* Set the declared type of this variable to the given type. |
* @param type the declared type of this variable |
@@ -4061,15 +4668,89 @@ |
void appendTo(JavaStringBuilder builder) { |
builder.append(type); |
builder.append(" "); |
- builder.append(name); |
+ builder.append(displayName); |
} |
} |
+ |
/** |
+ * Instances of the class {@code ConstructorMember} represent a constructor element defined in a |
+ * parameterized type where the values of the type parameters are known. |
+ */ |
+class ConstructorMember extends ExecutableMember implements ConstructorElement { |
+ |
+ /** |
+ * If the given constructor's type is different when any type parameters from the defining type's |
+ * declaration are replaced with the actual type arguments from the defining type, create a |
+ * constructor member representing the given constructor. Return the member that was created, or |
+ * the base constructor if no member was created. |
+ * @param baseConstructor the base constructor for which a member might be created |
+ * @param definingType the type defining the parameters and arguments to be used in the |
+ * substitution |
+ * @return the constructor element that will return the correctly substituted types |
+ */ |
+ static ConstructorElement from(ConstructorElement baseConstructor, InterfaceType definingType) { |
+ if (baseConstructor == null || definingType.typeArguments.length == 0) { |
+ return baseConstructor; |
+ } |
+ FunctionType baseType = baseConstructor.type; |
+ List<Type2> argumentTypes = definingType.typeArguments; |
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.element.typeVariables); |
+ FunctionType substitutedType = baseType.substitute2(argumentTypes, parameterTypes); |
+ if (baseType == substitutedType) { |
+ return baseConstructor; |
+ } |
+ return new ConstructorMember(baseConstructor, definingType); |
+ } |
+ |
+ /** |
+ * Initialize a newly created element to represent a constructor of the given parameterized type. |
+ * @param baseElement the element on which the parameterized element was created |
+ * @param definingType the type in which the element is defined |
+ */ |
+ ConstructorMember(ConstructorElement baseElement, InterfaceType definingType) : super(baseElement, definingType) { |
+ } |
+ accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
+ ConstructorElement get baseElement => super.baseElement as ConstructorElement; |
+ ClassElement get enclosingElement => baseElement.enclosingElement; |
+ ConstructorElement get redirectedConstructor => from(baseElement.redirectedConstructor, definingType); |
+ bool isConst() => baseElement.isConst(); |
+ bool isFactory() => baseElement.isFactory(); |
+ String toString() { |
+ ConstructorElement baseElement2 = baseElement; |
+ List<ParameterElement> parameters2 = parameters; |
+ FunctionType type2 = type; |
+ JavaStringBuilder builder = new JavaStringBuilder(); |
+ builder.append(baseElement2.enclosingElement.displayName); |
+ String name = displayName; |
+ if (name != null && !name.isEmpty) { |
+ builder.append("."); |
+ builder.append(name); |
+ } |
+ builder.append("("); |
+ int parameterCount = parameters2.length; |
+ for (int i = 0; i < parameterCount; i++) { |
+ if (i > 0) { |
+ builder.append(", "); |
+ } |
+ builder.append(parameters2[i]).toString(); |
+ } |
+ builder.append(")"); |
+ if (type2 != null) { |
+ builder.append(" -> "); |
+ builder.append(type2.returnType); |
+ } |
+ return builder.toString(); |
+ } |
+ InterfaceType get definingType => super.definingType as InterfaceType; |
+} |
+ |
+/** |
* The abstract class {@code ExecutableMember} defines the behavior common to members that represent |
* an executable element defined in a parameterized type where the values of the type parameters are |
* known. |
*/ |
abstract class ExecutableMember extends Member implements ExecutableElement { |
+ |
/** |
* Initialize a newly created element to represent an executable element of the given |
* parameterized type. |
@@ -4109,11 +4790,13 @@ |
safelyVisitChildren(parameters, visitor); |
} |
} |
+ |
/** |
* Instances of the class {@code FieldMember} represent a field element defined in a parameterized |
* type where the values of the type parameters are known. |
*/ |
class FieldMember extends VariableMember implements FieldElement { |
+ |
/** |
* If the given field's type is different when any type parameters from the defining type's |
* declaration are replaced with the actual type arguments from the defining type, create a field |
@@ -4140,6 +4823,7 @@ |
} |
return new FieldMember(baseField, definingType); |
} |
+ |
/** |
* Initialize a newly created element to represent a field of the given parameterized type. |
* @param baseElement the element on which the parameterized element was created |
@@ -4153,43 +4837,48 @@ |
PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement.getter, definingType); |
PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement.setter, definingType); |
bool isStatic() => baseElement.isStatic(); |
+ InterfaceType get definingType => super.definingType as InterfaceType; |
} |
+ |
/** |
* The abstract class {@code Member} defines the behavior common to elements that represent members |
* of parameterized types. |
*/ |
abstract class Member implements Element { |
+ |
/** |
* The element on which the parameterized element was created. |
*/ |
Element _baseElement; |
+ |
/** |
* The type in which the element is defined. |
*/ |
- InterfaceType _definingType; |
+ ParameterizedType _definingType; |
+ |
/** |
* Initialize a newly created element to represent the member of the given parameterized type. |
* @param baseElement the element on which the parameterized element was created |
* @param definingType the type in which the element is defined |
*/ |
- Member(Element baseElement, InterfaceType definingType) { |
+ Member(Element baseElement, ParameterizedType definingType) { |
this._baseElement = baseElement; |
this._definingType = definingType; |
} |
String computeDocumentationComment() => _baseElement.computeDocumentationComment(); |
Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass); |
+ |
/** |
* Return the element on which the parameterized element was created. |
* @return the element on which the parameterized element was created |
*/ |
Element get baseElement => _baseElement; |
AnalysisContext get context => _baseElement.context; |
+ String get displayName => _baseElement.displayName; |
ElementKind get kind => _baseElement.kind; |
LibraryElement get library => _baseElement.library; |
ElementLocation get location => _baseElement.location; |
- List<Annotation> get metadata { |
- throw new UnsupportedOperationException(); |
- } |
+ List<Annotation> get metadata => _baseElement.metadata; |
String get name => _baseElement.name; |
int get nameOffset => _baseElement.nameOffset; |
Source get source => _baseElement.source; |
@@ -4197,11 +4886,13 @@ |
bool isSynthetic() => _baseElement.isSynthetic(); |
void visitChildren(ElementVisitor<Object> visitor) { |
} |
+ |
/** |
* Return the type in which the element is defined. |
* @return the type in which the element is defined |
*/ |
- InterfaceType get definingType => _definingType; |
+ ParameterizedType get definingType => _definingType; |
+ |
/** |
* If the given child is not {@code null}, use the given visitor to visit it. |
* @param child the child to be visited |
@@ -4212,6 +4903,7 @@ |
child.accept(visitor); |
} |
} |
+ |
/** |
* Use the given visitor to visit all of the children in the given array. |
* @param children the children to be visited |
@@ -4224,6 +4916,7 @@ |
} |
} |
} |
+ |
/** |
* Return the type that results from replacing the type parameters in the given type with the type |
* arguments. |
@@ -4232,9 +4925,10 @@ |
*/ |
Type2 substituteFor(Type2 type) { |
List<Type2> argumentTypes = _definingType.typeArguments; |
- List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.element.typeVariables); |
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.typeVariables); |
return type.substitute2(argumentTypes, parameterTypes) as Type2; |
} |
+ |
/** |
* Return the array of types that results from replacing the type parameters in the given types |
* with the type arguments. |
@@ -4250,11 +4944,13 @@ |
return substitutedTypes; |
} |
} |
+ |
/** |
* Instances of the class {@code MethodMember} represent a method element defined in a parameterized |
* type where the values of the type parameters are known. |
*/ |
class MethodMember extends ExecutableMember implements MethodElement { |
+ |
/** |
* If the given method's type is different when any type parameters from the defining type's |
* declaration are replaced with the actual type arguments from the defining type, create a method |
@@ -4278,6 +4974,7 @@ |
} |
return new MethodMember(baseMethod, definingType); |
} |
+ |
/** |
* Initialize a newly created element to represent a method of the given parameterized type. |
* @param baseElement the element on which the parameterized element was created |
@@ -4294,9 +4991,9 @@ |
List<ParameterElement> parameters2 = parameters; |
FunctionType type2 = type; |
JavaStringBuilder builder = new JavaStringBuilder(); |
- builder.append(baseElement2.enclosingElement.name); |
+ builder.append(baseElement2.enclosingElement.displayName); |
builder.append("."); |
- builder.append(baseElement2.name); |
+ builder.append(baseElement2.displayName); |
builder.append("("); |
int parameterCount = parameters2.length; |
for (int i = 0; i < parameterCount; i++) { |
@@ -4313,11 +5010,13 @@ |
return builder.toString(); |
} |
} |
+ |
/** |
* Instances of the class {@code ParameterMember} represent a parameter element defined in a |
* parameterized type where the values of the type parameters are known. |
*/ |
class ParameterMember extends VariableMember implements ParameterElement { |
+ |
/** |
* If the given parameter's type is different when any type parameters from the defining type's |
* declaration are replaced with the actual type arguments from the defining type, create a |
@@ -4328,33 +5027,40 @@ |
* substitution |
* @return the parameter element that will return the correctly substituted types |
*/ |
- static ParameterElement from(ParameterElement baseParameter, InterfaceType definingType) { |
+ static ParameterElement from(ParameterElement baseParameter, ParameterizedType definingType) { |
if (baseParameter == null || definingType.typeArguments.length == 0) { |
return baseParameter; |
} |
Type2 baseType = baseParameter.type; |
List<Type2> argumentTypes = definingType.typeArguments; |
- List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.element.typeVariables); |
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.typeVariables); |
Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); |
if (baseType == substitutedType) { |
return baseParameter; |
} |
return new ParameterMember(baseParameter, definingType); |
} |
+ |
/** |
* Initialize a newly created element to represent a parameter of the given parameterized type. |
* @param baseElement the element on which the parameterized element was created |
* @param definingType the type in which the element is defined |
*/ |
- ParameterMember(ParameterElement baseElement, InterfaceType definingType) : super(baseElement, definingType) { |
+ ParameterMember(ParameterElement baseElement, ParameterizedType definingType) : super(baseElement, definingType) { |
} |
accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
Element getAncestor(Type elementClass) { |
Element element = baseElement.getAncestor(elementClass); |
- if (element is MethodElement) { |
- return MethodMember.from((element as MethodElement), definingType) as Element; |
- } else if (element is PropertyAccessorElement) { |
- return PropertyAccessorMember.from((element as PropertyAccessorElement), definingType) as Element; |
+ ParameterizedType definingType2 = definingType; |
+ if (definingType2 is InterfaceType) { |
+ InterfaceType definingInterfaceType = definingType2 as InterfaceType; |
+ if (element is ConstructorElement) { |
+ return ConstructorMember.from((element as ConstructorElement), definingInterfaceType) as Element; |
+ } else if (element is MethodElement) { |
+ return MethodMember.from((element as MethodElement), definingInterfaceType) as Element; |
+ } else if (element is PropertyAccessorElement) { |
+ return PropertyAccessorMember.from((element as PropertyAccessorElement), definingInterfaceType) as Element; |
+ } |
} |
return element; |
} |
@@ -4393,7 +5099,7 @@ |
builder.append(left); |
builder.append(type); |
builder.append(" "); |
- builder.append(baseElement2.name); |
+ builder.append(baseElement2.displayName); |
builder.append(right); |
return builder.toString(); |
} |
@@ -4402,11 +5108,13 @@ |
safelyVisitChildren(parameters, visitor); |
} |
} |
+ |
/** |
* Instances of the class {@code PropertyAccessorMember} represent a property accessor element |
* defined in a parameterized type where the values of the type parameters are known. |
*/ |
class PropertyAccessorMember extends ExecutableMember implements PropertyAccessorElement { |
+ |
/** |
* If the given property accessor's type is different when any type parameters from the defining |
* type's declaration are replaced with the actual type arguments from the defining type, create a |
@@ -4430,6 +5138,7 @@ |
} |
return new PropertyAccessorMember(baseAccessor, definingType); |
} |
+ |
/** |
* Initialize a newly created element to represent a property accessor of the given parameterized |
* type. |
@@ -4440,6 +5149,8 @@ |
} |
accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
PropertyAccessorElement get baseElement => super.baseElement as PropertyAccessorElement; |
+ PropertyAccessorElement get correspondingGetter => from(baseElement.correspondingGetter, definingType); |
+ PropertyAccessorElement get correspondingSetter => from(baseElement.correspondingSetter, definingType); |
Element get enclosingElement => baseElement.enclosingElement; |
PropertyInducingElement get variable { |
PropertyInducingElement variable2 = baseElement.variable; |
@@ -4448,22 +5159,26 @@ |
} |
return variable2; |
} |
+ bool isAbstract() => baseElement.isAbstract(); |
bool isGetter() => baseElement.isGetter(); |
bool isSetter() => baseElement.isSetter(); |
+ InterfaceType get definingType => super.definingType as InterfaceType; |
} |
+ |
/** |
* The abstract class {@code VariableMember} defines the behavior common to members that represent a |
* variable element defined in a parameterized type where the values of the type parameters are |
* known. |
*/ |
abstract class VariableMember extends Member implements VariableElement { |
+ |
/** |
* Initialize a newly created element to represent an executable element of the given |
* parameterized type. |
* @param baseElement the element on which the parameterized element was created |
* @param definingType the type in which the element is defined |
*/ |
- VariableMember(VariableElement baseElement, InterfaceType definingType) : super(baseElement, definingType) { |
+ VariableMember(VariableElement baseElement, ParameterizedType definingType) : super(baseElement, definingType) { |
} |
VariableElement get baseElement => super.baseElement as VariableElement; |
FunctionElement get initializer { |
@@ -4477,20 +5192,48 @@ |
safelyVisitChild(baseElement.initializer, visitor); |
} |
} |
+ |
/** |
+ * Instances of the class {@code AnonymousFunctionTypeImpl} extend the behavior of{@link FunctionTypeImpl} to support anonymous function types created for function typed |
+ * parameters. |
+ * @coverage dart.engine.type |
+ */ |
+class AnonymousFunctionTypeImpl extends FunctionTypeImpl { |
+ |
+ /** |
+ * An array of parameters elements of this type of function. |
+ */ |
+ List<ParameterElement> _baseParameters = ParameterElementImpl.EMPTY_ARRAY; |
+ AnonymousFunctionTypeImpl() : super.con2((null as FunctionTypeAliasElement)) { |
+ } |
+ |
+ /** |
+ * Sets the parameters elements of this type of function. |
+ * @param parameters the parameters elements of this type of function |
+ */ |
+ void set baseParameters(List<ParameterElement> parameters) { |
+ this._baseParameters = parameters; |
+ } |
+ List<ParameterElement> get baseParameters => _baseParameters; |
+} |
+ |
+/** |
* The unique instance of the class {@code BottomTypeImpl} implements the type {@code bottom}. |
* @coverage dart.engine.type |
*/ |
class BottomTypeImpl extends TypeImpl { |
+ |
/** |
* The unique instance of this class. |
*/ |
static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); |
+ |
/** |
* Return the unique instance of this class. |
* @return the unique instance of this class |
*/ |
static BottomTypeImpl get instance => _INSTANCE; |
+ |
/** |
* Prevent the creation of instances of this class. |
*/ |
@@ -4502,20 +5245,24 @@ |
bool isSupertypeOf(Type2 type) => false; |
BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) => this; |
} |
+ |
/** |
* The unique instance of the class {@code DynamicTypeImpl} implements the type {@code dynamic}. |
* @coverage dart.engine.type |
*/ |
class DynamicTypeImpl extends TypeImpl { |
+ |
/** |
* The unique instance of this class. |
*/ |
static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); |
+ |
/** |
* Return the unique instance of this class. |
* @return the unique instance of this class |
*/ |
static DynamicTypeImpl get instance => _INSTANCE; |
+ |
/** |
* Prevent the creation of instances of this class. |
*/ |
@@ -4529,12 +5276,14 @@ |
bool isSupertypeOf(Type2 type) => true; |
DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) => this; |
} |
+ |
/** |
* Instances of the class {@code FunctionTypeImpl} defines the behavior common to objects |
* representing the type of a function, method, constructor, getter, or setter. |
* @coverage dart.engine.type |
*/ |
class FunctionTypeImpl extends TypeImpl implements FunctionType { |
+ |
/** |
* Return {@code true} if all of the name/type pairs in the first map are equal to the |
* corresponding name/type pairs in the second map. The maps are expected to iterate over their |
@@ -4559,6 +5308,7 @@ |
} |
return true; |
} |
+ |
/** |
* Return a map containing the results of using the given argument types and parameter types to |
* perform a substitution on all of the values in the given map. The order of the entries will be |
@@ -4578,49 +5328,56 @@ |
} |
return newTypes; |
} |
+ |
/** |
* An array containing the actual types of the type arguments. |
*/ |
List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; |
+ |
/** |
* An array containing the types of the normal parameters of this type of function. The parameter |
* types are in the same order as they appear in the declaration of the function. |
* @return the types of the normal parameters of this type of function |
*/ |
List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY; |
+ |
/** |
* A table mapping the names of optional (positional) parameters to the types of the optional |
* parameters of this type of function. |
*/ |
List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY; |
+ |
/** |
* A table mapping the names of named parameters to the types of the named parameters of this type |
* of function. |
*/ |
Map<String, Type2> _namedParameterTypes = new Map(); |
+ |
/** |
* The type of object returned by this type of function. |
*/ |
Type2 _returnType = VoidTypeImpl.instance; |
+ |
/** |
* Initialize a newly created function type to be declared by the given element and to have the |
* given name. |
* @param element the element representing the declaration of the function type |
*/ |
FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == null ? null : element.name) { |
- _jtd_constructor_291_impl(element); |
+ _jtd_constructor_298_impl(element); |
} |
- _jtd_constructor_291_impl(ExecutableElement element) { |
+ _jtd_constructor_298_impl(ExecutableElement element) { |
} |
+ |
/** |
* Initialize a newly created function type to be declared by the given element and to have the |
* given name. |
* @param element the element representing the declaration of the function type |
*/ |
FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, element == null ? null : element.name) { |
- _jtd_constructor_292_impl(element); |
+ _jtd_constructor_299_impl(element); |
} |
- _jtd_constructor_292_impl(FunctionTypeAliasElement element) { |
+ _jtd_constructor_299_impl(FunctionTypeAliasElement element) { |
} |
bool operator ==(Object object) { |
if (object is! FunctionTypeImpl) { |
@@ -4629,11 +5386,92 @@ |
FunctionTypeImpl otherType = object as FunctionTypeImpl; |
return element == otherType.element && JavaArrays.equals(_normalParameterTypes, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterTypes, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType._namedParameterTypes) && _returnType == otherType._returnType; |
} |
+ String get displayName { |
+ String name2 = name; |
+ if (name2 == null) { |
+ JavaStringBuilder builder = new JavaStringBuilder(); |
+ builder.append("("); |
+ bool needsComma = false; |
+ if (_normalParameterTypes.length > 0) { |
+ for (Type2 type in _normalParameterTypes) { |
+ if (needsComma) { |
+ builder.append(", "); |
+ } else { |
+ needsComma = true; |
+ } |
+ builder.append(type.displayName); |
+ } |
+ } |
+ if (_optionalParameterTypes.length > 0) { |
+ if (needsComma) { |
+ builder.append(", "); |
+ needsComma = false; |
+ } |
+ builder.append("["); |
+ for (Type2 type in _optionalParameterTypes) { |
+ if (needsComma) { |
+ builder.append(", "); |
+ } else { |
+ needsComma = true; |
+ } |
+ builder.append(type.displayName); |
+ } |
+ builder.append("]"); |
+ needsComma = true; |
+ } |
+ if (_namedParameterTypes.length > 0) { |
+ if (needsComma) { |
+ builder.append(", "); |
+ needsComma = false; |
+ } |
+ builder.append("{"); |
+ for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes)) { |
+ if (needsComma) { |
+ builder.append(", "); |
+ } else { |
+ needsComma = true; |
+ } |
+ builder.append(entry.getKey()); |
+ builder.append(": "); |
+ builder.append(entry.getValue().displayName); |
+ } |
+ builder.append("}"); |
+ needsComma = true; |
+ } |
+ builder.append(") -> "); |
+ if (_returnType == null) { |
+ builder.append("null"); |
+ } else { |
+ builder.append(_returnType.displayName); |
+ } |
+ name2 = builder.toString(); |
+ } |
+ return name2; |
+ } |
Map<String, Type2> get namedParameterTypes => _namedParameterTypes; |
List<Type2> get normalParameterTypes => _normalParameterTypes; |
List<Type2> get optionalParameterTypes => _optionalParameterTypes; |
+ List<ParameterElement> get parameters { |
+ List<ParameterElement> baseParameters2 = baseParameters; |
+ int parameterCount = baseParameters2.length; |
+ if (parameterCount == 0) { |
+ return baseParameters2; |
+ } |
+ List<ParameterElement> specializedParameters = new List<ParameterElement>(parameterCount); |
+ for (int i = 0; i < parameterCount; i++) { |
+ specializedParameters[i] = ParameterMember.from(baseParameters2[i], this); |
+ } |
+ return specializedParameters; |
+ } |
Type2 get returnType => _returnType; |
List<Type2> get typeArguments => _typeArguments; |
+ List<TypeVariableElement> get typeVariables { |
+ Element element2 = element; |
+ if (element2 is FunctionTypeAliasElement) { |
+ return ((element2 as FunctionTypeAliasElement)).typeVariables; |
+ } |
+ return TypeVariableElementImpl.EMPTY_ARRAY; |
+ } |
int get hashCode { |
Element element2 = element; |
if (element2 == null) { |
@@ -4644,7 +5482,7 @@ |
bool isSubtypeOf(Type2 type) { |
if (type == null) { |
return false; |
- } else if (identical(this, type) || type.isDynamic() || type.isDartCoreFunction()) { |
+ } else if (identical(this, type) || type.isDynamic() || type.isDartCoreFunction() || type.isObject()) { |
return true; |
} else if (type is! FunctionType) { |
return false; |
@@ -4703,6 +5541,7 @@ |
} |
return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo(s.returnType); |
} |
+ |
/** |
* Set the mapping of the names of named parameters to the types of the named parameters of this |
* type of function to the given mapping. |
@@ -4712,6 +5551,7 @@ |
void set namedParameterTypes(LinkedHashMap<String, Type2> namedParameterTypes2) { |
this._namedParameterTypes = namedParameterTypes2; |
} |
+ |
/** |
* Set the types of the normal parameters of this type of function to the types in the given |
* array. |
@@ -4720,6 +5560,7 @@ |
void set normalParameterTypes(List<Type2> normalParameterTypes2) { |
this._normalParameterTypes = normalParameterTypes2; |
} |
+ |
/** |
* Set the types of the optional parameters of this type of function to the types in the given |
* array. |
@@ -4728,6 +5569,7 @@ |
void set optionalParameterTypes(List<Type2> optionalParameterTypes2) { |
this._optionalParameterTypes = optionalParameterTypes2; |
} |
+ |
/** |
* Set the type of object returned by this type of function to the given type. |
* @param returnType the type of object returned by this type of function |
@@ -4735,6 +5577,7 @@ |
void set returnType(Type2 returnType2) { |
this._returnType = returnType2; |
} |
+ |
/** |
* Set the actual types of the type arguments to the given types. |
* @param typeArguments the actual types of the type arguments |
@@ -4756,6 +5599,7 @@ |
newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, argumentTypes, parameterTypes); |
newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes, argumentTypes, parameterTypes); |
newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTypes, parameterTypes); |
+ newType.typeArguments = argumentTypes; |
return newType; |
} |
void appendTo(JavaStringBuilder builder) { |
@@ -4814,7 +5658,20 @@ |
((_returnType as TypeImpl)).appendTo(builder); |
} |
} |
+ |
+ /** |
+ * @return the base parameter elements of this function element, not {@code null}. |
+ */ |
+ List<ParameterElement> get baseParameters { |
+ Element element2 = element; |
+ if (element2 is ExecutableElement) { |
+ return ((element2 as ExecutableElement)).parameters; |
+ } else { |
+ return ((element2 as FunctionTypeAliasElement)).parameters; |
+ } |
+ } |
} |
+ |
/** |
* Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects |
* representing the type introduced by either a class or an interface, or a reference to such a |
@@ -4822,58 +5679,68 @@ |
* @coverage dart.engine.type |
*/ |
class InterfaceTypeImpl extends TypeImpl implements InterfaceType { |
+ |
/** |
* An empty array of types. |
*/ |
static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0); |
+ |
/** |
* This method computes the longest inheritance path from some passed {@link Type} to Object. |
* @param type the {@link Type} to compute the longest inheritance path of from the passed{@link Type} to Object |
* @return the computed longest inheritance path to Object |
- * @see #computeLongestInheritancePathToObject(Type,int) |
* @see InterfaceType#getLeastUpperBound(Type) |
*/ |
- static int computeLongestInheritancePathToObject(InterfaceType type) => computeLongestInheritancePathToObject2(type, 0); |
+ static int computeLongestInheritancePathToObject(InterfaceType type) => computeLongestInheritancePathToObject2(type, 0, new Set<ClassElement>()); |
+ |
/** |
* Returns the set of all superinterfaces of the passed {@link Type}. |
* @param type the {@link Type} to compute the set of superinterfaces of |
* @return the {@link Set} of superinterfaces of the passed {@link Type} |
- * @see #computeSuperinterfaceSet(Type,HashSet) |
* @see #getLeastUpperBound(Type) |
*/ |
static Set<InterfaceType> computeSuperinterfaceSet(InterfaceType type) => computeSuperinterfaceSet2(type, new Set<InterfaceType>()); |
+ List<TypeVariableElement> get typeVariables => element.typeVariables; |
+ |
/** |
* This method computes the longest inheritance path from some passed {@link Type} to Object. This |
* method calls itself recursively, callers should use the public method{@link #computeLongestInheritancePathToObject(Type)}. |
* @param type the {@link Type} to compute the longest inheritance path of from the passed{@link Type} to Object |
* @param depth a field used recursively |
+ * @param visitedClasses the classes that have already been visited |
* @return the computed longest inheritance path to Object |
* @see #computeLongestInheritancePathToObject(Type) |
* @see #getLeastUpperBound(Type) |
*/ |
- static int computeLongestInheritancePathToObject2(InterfaceType type, int depth) { |
+ static int computeLongestInheritancePathToObject2(InterfaceType type, int depth, Set<ClassElement> visitedClasses) { |
ClassElement classElement = type.element; |
- if (classElement.supertype == null) { |
+ if (classElement.supertype == null || visitedClasses.contains(classElement)) { |
return depth; |
} |
- List<InterfaceType> superinterfaces = classElement.interfaces; |
int longestPath = 1; |
- int pathLength; |
- if (superinterfaces.length > 0) { |
- for (InterfaceType superinterface in superinterfaces) { |
- pathLength = computeLongestInheritancePathToObject2(superinterface, depth + 1); |
- if (pathLength > longestPath) { |
- longestPath = pathLength; |
+ try { |
+ javaSetAdd(visitedClasses, classElement); |
+ List<InterfaceType> superinterfaces = classElement.interfaces; |
+ int pathLength; |
+ if (superinterfaces.length > 0) { |
+ for (InterfaceType superinterface in superinterfaces) { |
+ pathLength = computeLongestInheritancePathToObject2(superinterface, depth + 1, visitedClasses); |
+ if (pathLength > longestPath) { |
+ longestPath = pathLength; |
+ } |
} |
} |
+ InterfaceType supertype2 = classElement.supertype; |
+ pathLength = computeLongestInheritancePathToObject2(supertype2, depth + 1, visitedClasses); |
+ if (pathLength > longestPath) { |
+ longestPath = pathLength; |
+ } |
+ } finally { |
+ visitedClasses.remove(classElement); |
} |
- InterfaceType supertype2 = classElement.supertype; |
- pathLength = computeLongestInheritancePathToObject2(supertype2, depth + 1); |
- if (pathLength > longestPath) { |
- longestPath = pathLength; |
- } |
return longestPath; |
} |
+ |
/** |
* Returns the set of all superinterfaces of the passed {@link Type}. This is a recursive method, |
* callers should call the public {@link #computeSuperinterfaceSet(Type)}. |
@@ -4889,17 +5756,20 @@ |
ClassElement classElement = element2 as ClassElement; |
List<InterfaceType> superinterfaces = classElement.interfaces; |
for (InterfaceType superinterface in superinterfaces) { |
- javaSetAdd(set, superinterface); |
- computeSuperinterfaceSet2(superinterface, set); |
+ if (javaSetAdd(set, superinterface)) { |
+ computeSuperinterfaceSet2(superinterface, set); |
+ } |
} |
InterfaceType supertype2 = classElement.supertype; |
if (supertype2 != null) { |
- javaSetAdd(set, supertype2); |
- computeSuperinterfaceSet2(supertype2, set); |
+ if (javaSetAdd(set, supertype2)) { |
+ computeSuperinterfaceSet2(supertype2, set); |
+ } |
} |
} |
return set; |
} |
+ |
/** |
* Return the intersection of the given sets of types, where intersection is based on the equality |
* of the elements of the types rather than on the equality of the types themselves. In cases |
@@ -4924,10 +5794,12 @@ |
} |
return new List.from(result); |
} |
+ |
/** |
* Return the "least upper bound" of the given types under the assumption that the types have the |
* same element and differ only in terms of the type arguments. The resulting type is composed by |
- * using the least upper bound of the corresponding type arguments. |
+ * comparing the corresponding type arguments, keeping those that are the same, and using |
+ * 'dynamic' for those that are different. |
* @param firstType the first type |
* @param secondType the second type |
* @return the "least upper bound" of the given types |
@@ -4944,7 +5816,9 @@ |
} |
List<Type2> lubArguments = new List<Type2>(argumentCount); |
for (int i = 0; i < argumentCount; i++) { |
- lubArguments[i] = firstArguments[i].getLeastUpperBound(secondArguments[i]); |
+ if (firstArguments[i] == secondArguments[i]) { |
+ lubArguments[i] = firstArguments[i]; |
+ } |
if (lubArguments[i] == null) { |
lubArguments[i] = DynamicTypeImpl.instance; |
} |
@@ -4953,28 +5827,31 @@ |
lub.typeArguments = lubArguments; |
return lub; |
} |
+ |
/** |
* An array containing the actual types of the type arguments. |
*/ |
List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; |
+ |
/** |
* Initialize a newly created type to be declared by the given element. |
* @param element the element representing the declaration of the type |
*/ |
- InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) { |
- _jtd_constructor_293_impl(element); |
+ InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayName) { |
+ _jtd_constructor_300_impl(element); |
} |
- _jtd_constructor_293_impl(ClassElement element) { |
+ _jtd_constructor_300_impl(ClassElement element) { |
} |
+ |
/** |
* Initialize a newly created type to have the given name. This constructor should only be used in |
* cases where there is no declaration of the type. |
* @param name the name of the type |
*/ |
InterfaceTypeImpl.con2(String name) : super(null, name) { |
- _jtd_constructor_294_impl(name); |
+ _jtd_constructor_301_impl(name); |
} |
- _jtd_constructor_294_impl(String name) { |
+ _jtd_constructor_301_impl(String name) { |
} |
bool operator ==(Object object) { |
if (object is! InterfaceTypeImpl) { |
@@ -5105,33 +5982,9 @@ |
} else if (type is! InterfaceType) { |
return false; |
} |
- InterfaceType s = type as InterfaceType; |
- if (this == s) { |
- return true; |
- } |
- if (s.isDirectSupertypeOf(this)) { |
- return true; |
- } |
- ClassElement tElement = element; |
- ClassElement sElement = s.element; |
- if (tElement == sElement) { |
- List<Type2> tArguments = typeArguments; |
- List<Type2> sArguments = s.typeArguments; |
- if (tArguments.length != sArguments.length) { |
- return false; |
- } |
- for (int i = 0; i < tArguments.length; i++) { |
- if (!tArguments[i].isMoreSpecificThan(sArguments[i])) { |
- return false; |
- } |
- } |
- return true; |
- } |
- if (element.supertype == null) { |
- return false; |
- } |
- return element.supertype.isMoreSpecificThan(type); |
+ return isMoreSpecificThan2((type as InterfaceType), new Set<ClassElement>()); |
} |
+ bool isObject() => element.supertype == null; |
bool isSubtypeOf(Type2 type) { |
if (identical(type, DynamicTypeImpl.instance)) { |
return true; |
@@ -5142,60 +5995,40 @@ |
} else if (this == type) { |
return true; |
} |
- InterfaceType typeT = this; |
- InterfaceType typeS = type as InterfaceType; |
- ClassElement elementT = element; |
- if (elementT == null) { |
- return false; |
+ return isSubtypeOf2((type as InterfaceType), new Set<ClassElement>()); |
+ } |
+ ConstructorElement lookUpConstructor(String constructorName, LibraryElement library) { |
+ ConstructorElement constructorElement; |
+ if (constructorName == null) { |
+ constructorElement = element.unnamedConstructor; |
+ } else { |
+ constructorElement = element.getNamedConstructor(constructorName); |
} |
- typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.typeVariables)); |
- if (typeT == typeS) { |
- return true; |
- } else if (elementT == typeS.element) { |
- List<Type2> typeTArgs = typeT.typeArguments; |
- List<Type2> typeSArgs = typeS.typeArguments; |
- if (typeTArgs.length != typeSArgs.length) { |
- return false; |
- } |
- for (int i = 0; i < typeTArgs.length; i++) { |
- if (!typeTArgs[i].isSubtypeOf(typeSArgs[i])) { |
- return false; |
- } |
- } |
- return true; |
+ if (constructorElement == null || !constructorElement.isAccessibleIn(library)) { |
+ return null; |
} |
- Type2 supertype2 = elementT.supertype; |
- if (supertype2 == null) { |
- return false; |
- } |
- List<Type2> interfaceTypes = elementT.interfaces; |
- for (Type2 interfaceType in interfaceTypes) { |
- if (interfaceType.isSubtypeOf(typeS)) { |
- return true; |
- } |
- } |
- List<Type2> mixinTypes = elementT.mixins; |
- for (Type2 mixinType in mixinTypes) { |
- if (mixinType == typeS) { |
- return true; |
- } |
- } |
- return supertype2.isSubtypeOf(typeS); |
+ return ConstructorMember.from(constructorElement, this); |
} |
PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library) { |
PropertyAccessorElement element = getGetter(getterName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
+ return lookUpGetterInSuperclass(getterName, library); |
+ } |
+ PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryElement library) { |
for (InterfaceType mixin in mixins) { |
- element = mixin.getGetter(getterName); |
+ PropertyAccessorElement element = mixin.getGetter(getterName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
} |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
InterfaceType supertype = superclass; |
- while (supertype != null) { |
- element = supertype.getGetter(getterName); |
+ ClassElement supertypeElement = supertype == null ? null : supertype.element; |
+ while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
+ javaSetAdd(visitedClasses, supertypeElement); |
+ PropertyAccessorElement element = supertype.getGetter(getterName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
@@ -5206,6 +6039,7 @@ |
} |
} |
supertype = supertype.superclass; |
+ supertypeElement = supertype == null ? null : supertype.element; |
} |
return null; |
} |
@@ -5214,15 +6048,21 @@ |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
+ return lookUpMethodInSuperclass(methodName, library); |
+ } |
+ MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement library) { |
for (InterfaceType mixin in mixins) { |
- element = mixin.getMethod(methodName); |
+ MethodElement element = mixin.getMethod(methodName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
} |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
InterfaceType supertype = superclass; |
- while (supertype != null) { |
- element = supertype.getMethod(methodName); |
+ ClassElement supertypeElement = supertype == null ? null : supertype.element; |
+ while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
+ javaSetAdd(visitedClasses, supertypeElement); |
+ MethodElement element = supertype.getMethod(methodName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
@@ -5233,6 +6073,7 @@ |
} |
} |
supertype = supertype.superclass; |
+ supertypeElement = supertype == null ? null : supertype.element; |
} |
return null; |
} |
@@ -5241,15 +6082,21 @@ |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
+ return lookUpSetterInSuperclass(setterName, library); |
+ } |
+ PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryElement library) { |
for (InterfaceType mixin in mixins) { |
- element = mixin.getSetter(setterName); |
+ PropertyAccessorElement element = mixin.getSetter(setterName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
} |
+ Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
InterfaceType supertype = superclass; |
- while (supertype != null) { |
- element = supertype.getSetter(setterName); |
+ ClassElement supertypeElement = supertype == null ? null : supertype.element; |
+ while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
+ javaSetAdd(visitedClasses, supertypeElement); |
+ PropertyAccessorElement element = supertype.getSetter(setterName); |
if (element != null && element.isAccessibleIn(library)) { |
return element; |
} |
@@ -5260,9 +6107,11 @@ |
} |
} |
supertype = supertype.superclass; |
+ supertypeElement = supertype == null ? null : supertype.element; |
} |
return null; |
} |
+ |
/** |
* Set the actual types of the type arguments to those in the given array. |
* @param typeArguments the actual types of the type arguments |
@@ -5296,13 +6145,100 @@ |
builder.append(">"); |
} |
} |
+ bool isMoreSpecificThan2(InterfaceType s, Set<ClassElement> visitedClasses) { |
+ if (this == s) { |
+ return true; |
+ } |
+ if (s.isDirectSupertypeOf(this)) { |
+ return true; |
+ } |
+ ClassElement tElement = element; |
+ ClassElement sElement = s.element; |
+ if (tElement == sElement) { |
+ List<Type2> tArguments = typeArguments; |
+ List<Type2> sArguments = s.typeArguments; |
+ if (tArguments.length != sArguments.length) { |
+ return false; |
+ } |
+ for (int i = 0; i < tArguments.length; i++) { |
+ if (!tArguments[i].isMoreSpecificThan(sArguments[i])) { |
+ return false; |
+ } |
+ } |
+ return true; |
+ } |
+ ClassElement element2 = element; |
+ if (element2 == null || visitedClasses.contains(element2)) { |
+ return false; |
+ } |
+ javaSetAdd(visitedClasses, element2); |
+ InterfaceType supertype2 = element2.supertype; |
+ if (supertype2 != null && ((supertype2 as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses)) { |
+ return true; |
+ } |
+ for (InterfaceType interfaceType in element2.interfaces) { |
+ if (((interfaceType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses)) { |
+ return true; |
+ } |
+ } |
+ for (InterfaceType mixinType in element2.mixins) { |
+ if (((mixinType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClasses)) { |
+ return true; |
+ } |
+ } |
+ return false; |
+ } |
+ bool isSubtypeOf2(InterfaceType type, Set<ClassElement> visitedClasses) { |
+ InterfaceType typeT = this; |
+ InterfaceType typeS = type; |
+ ClassElement elementT = element; |
+ if (elementT == null || visitedClasses.contains(elementT)) { |
+ return false; |
+ } |
+ javaSetAdd(visitedClasses, elementT); |
+ typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.typeVariables)); |
+ if (typeT == typeS) { |
+ return true; |
+ } else if (elementT == typeS.element) { |
+ List<Type2> typeTArgs = typeT.typeArguments; |
+ List<Type2> typeSArgs = typeS.typeArguments; |
+ if (typeTArgs.length != typeSArgs.length) { |
+ return false; |
+ } |
+ for (int i = 0; i < typeTArgs.length; i++) { |
+ if (!typeTArgs[i].isSubtypeOf(typeSArgs[i])) { |
+ return false; |
+ } |
+ } |
+ return true; |
+ } |
+ InterfaceType supertype2 = elementT.supertype; |
+ if (supertype2 != null && ((supertype2 as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) { |
+ return true; |
+ } |
+ List<InterfaceType> interfaceTypes = elementT.interfaces; |
+ for (InterfaceType interfaceType in interfaceTypes) { |
+ if (((interfaceType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) { |
+ return true; |
+ } |
+ } |
+ List<InterfaceType> mixinTypes = elementT.mixins; |
+ for (InterfaceType mixinType in mixinTypes) { |
+ if (((mixinType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) { |
+ return true; |
+ } |
+ } |
+ return false; |
+ } |
} |
+ |
/** |
* The abstract class {@code TypeImpl} implements the behavior common to objects representing the |
* declared type of elements in the element model. |
* @coverage dart.engine.type |
*/ |
abstract class TypeImpl implements Type2 { |
+ |
/** |
* Return an array containing the results of using the given argument types and parameter types to |
* perform a substitution on all of the given types. |
@@ -5322,19 +6258,23 @@ |
} |
return newTypes; |
} |
+ |
/** |
* The element representing the declaration of this type, or {@code null} if the type has not, or |
* cannot, be associated with an element. |
*/ |
Element _element; |
+ |
/** |
* The name of this type, or {@code null} if the type does not have a name. |
*/ |
String _name; |
+ |
/** |
* An empty array of types. |
*/ |
static List<Type2> EMPTY_ARRAY = new List<Type2>(0); |
+ |
/** |
* Initialize a newly created type to be declared by the given element and to have the given name. |
* @param element the element representing the declaration of the type |
@@ -5344,6 +6284,7 @@ |
this._element = element; |
this._name = name; |
} |
+ String get displayName => name; |
Element get element => _element; |
Type2 getLeastUpperBound(Type2 type) => null; |
String get name => _name; |
@@ -5351,6 +6292,7 @@ |
bool isDartCoreFunction() => false; |
bool isDynamic() => false; |
bool isMoreSpecificThan(Type2 type) => false; |
+ bool isObject() => false; |
bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); |
bool isVoid() => false; |
String toString() { |
@@ -5358,6 +6300,7 @@ |
appendTo(builder); |
return builder.toString(); |
} |
+ |
/** |
* Append a textual representation of this type to the given builder. |
* @param builder the builder to which the text is to be appended |
@@ -5370,12 +6313,14 @@ |
} |
} |
} |
+ |
/** |
* Instances of the class {@code TypeVariableTypeImpl} defines the behavior of objects representing |
* the type introduced by a type variable. |
* @coverage dart.engine.type |
*/ |
class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { |
+ |
/** |
* Return an array containing the type variable types defined by the given array of type variable |
* elements. |
@@ -5390,6 +6335,7 @@ |
} |
return types; |
} |
+ |
/** |
* Initialize a newly created type variable to be declared by the given element and to have the |
* given name. |
@@ -5415,20 +6361,24 @@ |
return this; |
} |
} |
+ |
/** |
* The unique instance of the class {@code VoidTypeImpl} implements the type {@code void}. |
* @coverage dart.engine.type |
*/ |
class VoidTypeImpl extends TypeImpl implements VoidType { |
+ |
/** |
* The unique instance of this class. |
*/ |
static VoidTypeImpl _INSTANCE = new VoidTypeImpl(); |
+ |
/** |
* Return the unique instance of this class. |
* @return the unique instance of this class |
*/ |
static VoidTypeImpl get instance => _INSTANCE; |
+ |
/** |
* Prevent the creation of instances of this class. |
*/ |
@@ -5439,6 +6389,7 @@ |
bool isVoid() => true; |
VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) => this; |
} |
+ |
/** |
* The interface {@code FunctionType} defines the behavior common to objects representing the type |
* of a function, method, constructor, getter, or setter. Function types come in three variations: |
@@ -5448,13 +6399,13 @@ |
* <li>The types of functions with optional positional parameters. These have the general form |
* <i>(T<sub>1</sub>, …, T<sub>n</sub>, \[T<sub>n+1</sub>, …, T<sub>n+k</sub>\]) → |
* T</i>.</li> |
- * <li>The types of functions with named positional parameters. These have the general form |
- * <i>(T<sub>1</sub>, …, T<sub>n</sub>, {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) |
- * → T</i>.</li> |
+ * <li>The types of functions with named parameters. These have the general form <i>(T<sub>1</sub>, |
+ * …, T<sub>n</sub>, {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) → T</i>.</li> |
* </ol> |
* @coverage dart.engine.type |
*/ |
-abstract class FunctionType implements Type2 { |
+abstract class FunctionType implements ParameterizedType { |
+ |
/** |
* Return a map from the names of named parameters to the types of the named parameters of this |
* type of function. The entries in the map will be iterated in the same order as the order in |
@@ -5463,12 +6414,14 @@ |
* @return a map from the name to the types of the named parameters of this type of function |
*/ |
Map<String, Type2> get namedParameterTypes; |
+ |
/** |
* Return an array containing the types of the normal parameters of this type of function. The |
* parameter types are in the same order as they appear in the declaration of the function. |
* @return the types of the normal parameters of this type of function |
*/ |
List<Type2> get normalParameterTypes; |
+ |
/** |
* Return a map from the names of optional (positional) parameters to the types of the optional |
* parameters of this type of function. The entries in the map will be iterated in the same order |
@@ -5477,21 +6430,21 @@ |
* @return a map from the name to the types of the optional parameters of this type of function |
*/ |
List<Type2> get optionalParameterTypes; |
+ |
/** |
+ * Return an array containing the parameters elements of this type of function. The parameter |
+ * types are in the same order as they appear in the declaration of the function. |
+ * @return the parameters elements of this type of function |
+ */ |
+ List<ParameterElement> get parameters; |
+ |
+ /** |
* Return the type of object returned by this type of function. |
* @return the type of object returned by this type of function |
*/ |
Type2 get returnType; |
+ |
/** |
- * Return an array containing the actual types of the type arguments. If this type's element does |
- * not have type parameters, then the array should be empty (although it is possible for type |
- * arguments to be erroneously declared). If the element has type parameters and the actual type |
- * does not explicitly include argument values, then the type "dynamic" will be automatically |
- * provided. |
- * @return the actual types of the type arguments |
- */ |
- List<Type2> get typeArguments; |
- /** |
* Return {@code true} if this type is a subtype of the given type. |
* <p> |
* A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i> is a subtype of the |
@@ -5555,6 +6508,7 @@ |
* @return {@code true} if this type is a subtype of the given type |
*/ |
bool isSubtypeOf(Type2 type); |
+ |
/** |
* Return the type resulting from substituting the given arguments for this type's parameters. |
* This is fully equivalent to {@code substitute(argumentTypes, getTypeArguments())}. |
@@ -5564,13 +6518,15 @@ |
FunctionType substitute4(List<Type2> argumentTypes); |
FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
} |
+ |
/** |
* The interface {@code InterfaceType} defines the behavior common to objects representing the type |
* introduced by either a class or an interface, or a reference to such a type. |
* @coverage dart.engine.type |
*/ |
-abstract class InterfaceType implements Type2 { |
+abstract class InterfaceType implements ParameterizedType { |
ClassElement get element; |
+ |
/** |
* 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. |
@@ -5578,6 +6534,7 @@ |
* @return the getter declared in this class with the given name |
*/ |
PropertyAccessorElement getGetter(String getterName); |
+ |
/** |
* Return an array containing all of the interfaces that are implemented by this interface. Note |
* that this is <b>not</b>, in general, equivalent to getting the interfaces from this type's |
@@ -5585,6 +6542,7 @@ |
* @return the interfaces that are implemented by this type |
*/ |
List<InterfaceType> get interfaces; |
+ |
/** |
* Return the least upper bound of this type and the given type, or {@code null} if there is no |
* least upper bound. |
@@ -5601,6 +6559,7 @@ |
* @return the least upper bound of this type and the given type |
*/ |
Type2 getLeastUpperBound(Type2 type); |
+ |
/** |
* 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. |
@@ -5608,6 +6567,7 @@ |
* @return the method declared in this class with the given name |
*/ |
MethodElement getMethod(String methodName); |
+ |
/** |
* 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. Note that this is <b>not</b>, in general, |
@@ -5616,6 +6576,7 @@ |
* @return the mixins that are applied to derive the superclass of this class |
*/ |
List<InterfaceType> get mixins; |
+ |
/** |
* 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. |
@@ -5623,6 +6584,7 @@ |
* @return the setter declared in this class with the given name |
*/ |
PropertyAccessorElement getSetter(String setterName); |
+ |
/** |
* Return the type representing the superclass of this type, or null if this type represents the |
* class 'Object'. Note that this is <b>not</b>, in general, equivalent to getting the superclass |
@@ -5631,16 +6593,8 @@ |
* @return the superclass of this type |
*/ |
InterfaceType get superclass; |
+ |
/** |
- * Return an array containing the actual types of the type arguments. If this type's element does |
- * not have type parameters, then the array should be empty (although it is possible for type |
- * arguments to be erroneously declared). If the element has type parameters and the actual type |
- * does not explicitly include argument values, then the type "dynamic" will be automatically |
- * provided. |
- * @return the actual types of the type arguments |
- */ |
- List<Type2> get typeArguments; |
- /** |
* Return {@code true} if this type is a direct supertype of the given type. The implicit |
* interface of class <i>I</i> is a direct supertype of the implicit interface of class <i>J</i> |
* iff: |
@@ -5655,6 +6609,7 @@ |
* @return {@code true} if this type is a direct supertype of the given type |
*/ |
bool isDirectSupertypeOf(InterfaceType type); |
+ |
/** |
* Return {@code true} if this type is more specific than the given type. An interface type |
* <i>T</i> is more specific than an interface type <i>S</i>, written <i>T « S</i>, if one |
@@ -5674,6 +6629,7 @@ |
* @return {@code true} if this type is more specific than the given type |
*/ |
bool isMoreSpecificThan(Type2 type); |
+ |
/** |
* Return {@code true} if this type is a subtype of the given type. An interface type <i>T</i> is |
* a subtype of an interface type <i>S</i>, written <i>T</i> <: <i>S</i>, iff |
@@ -5684,7 +6640,22 @@ |
* @return {@code true} if this type is a subtype of the given type |
*/ |
bool isSubtypeOf(Type2 type); |
+ |
/** |
+ * Return the element representing the constructor that results from looking up the given |
+ * constructor 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.11.1: <blockquote>If <i>e</i> is of the form <b>new</b> <i>T.id()</i> then let <i>q<i> be |
+ * the constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor <i>T<i>. Otherwise, if |
+ * <i>q</i> is not defined or not accessible, a NoSuchMethodException is thrown. </blockquote> |
+ * @param constructorName the name of the constructor being looked up |
+ * @param library the library with respect to which the lookup is being performed |
+ * @return the result of looking up the given constructor in this class with respect to the given |
+ * library |
+ */ |
+ ConstructorElement lookUpConstructor(String constructorName, LibraryElement library); |
+ |
+ /** |
* 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: |
@@ -5704,7 +6675,29 @@ |
* library |
*/ |
PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library); |
+ |
/** |
+ * Return the element representing the getter that results from looking up the given getter in the |
+ * superclass of 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 lookUpGetterInSuperclass(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: |
@@ -5723,7 +6716,28 @@ |
* library |
*/ |
MethodElement lookUpMethod(String methodName, LibraryElement library); |
+ |
/** |
+ * Return the element representing the method that results from looking up the given method in the |
+ * superclass of 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 lookUpMethodInSuperclass(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: |
@@ -5743,7 +6757,29 @@ |
* library |
*/ |
PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library); |
+ |
/** |
+ * Return the element representing the setter that results from looking up the given setter in the |
+ * superclass of 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 lookUpSetterInSuperclass(String setterName, LibraryElement library); |
+ |
+ /** |
* Return the type resulting from substituting the given arguments for this type's parameters. |
* This is fully equivalent to {@code substitute(argumentTypes, getTypeArguments())}. |
* @param argumentTypes the actual type arguments being substituted for the type parameters |
@@ -5752,19 +6788,53 @@ |
InterfaceType substitute5(List<Type2> argumentTypes); |
InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
} |
+ |
/** |
+ * The interface {@code ParameterizedType} defines the behavior common to objects representing the |
+ * type with type parameters, such as class and function type alias. |
+ * @coverage dart.engine.type |
+ */ |
+abstract class ParameterizedType implements Type2 { |
+ |
+ /** |
+ * Return an array containing the actual types of the type arguments. If this type's element does |
+ * not have type parameters, then the array should be empty (although it is possible for type |
+ * arguments to be erroneously declared). If the element has type parameters and the actual type |
+ * does not explicitly include argument values, then the type "dynamic" will be automatically |
+ * provided. |
+ * @return the actual types of the type arguments |
+ */ |
+ List<Type2> get typeArguments; |
+ |
+ /** |
+ * Return an array containing all of the type variables declared for this type. |
+ * @return the type variables declared for this type |
+ */ |
+ List<TypeVariableElement> get typeVariables; |
+} |
+ |
+/** |
* The interface {@code Type} defines the behavior of objects representing the declared type of |
* elements in the element model. |
* @coverage dart.engine.type |
*/ |
abstract class Type2 { |
+ |
/** |
+ * Return the name of this type as it should appear when presented to users in contexts such as |
+ * error messages. |
+ * @return the name of this type |
+ */ |
+ String get displayName; |
+ |
+ /** |
* Return the element representing the declaration of this type, or {@code null} if the type has |
* not, or cannot, be associated with an element. The former case will occur if the element model |
* is not yet complete; the latter case will occur if this object represents an undefined type. |
* @return the element representing the declaration of this type |
*/ |
Element get element; |
+ |
/** |
* Return the least upper bound of this type and the given type, or {@code null} if there is no |
* least upper bound. |
@@ -5772,12 +6842,14 @@ |
* @return the least upper bound of this type and the given type |
*/ |
Type2 getLeastUpperBound(Type2 type); |
+ |
/** |
* Return the name of this type, or {@code null} if the type does not have a name, such as when |
* the type represents the type of an unnamed function. |
* @return the name of this type |
*/ |
String get name; |
+ |
/** |
* Return {@code true} if this type is assignable to the given type. A type <i>T</i> may be |
* assigned to a type <i>S</i>, written <i>T</i> ⇔ <i>S</i>, iff either <i>T</i> <: <i>S</i> |
@@ -5786,6 +6858,7 @@ |
* @return {@code true} if this type is assignable to the given type |
*/ |
bool isAssignableTo(Type2 type); |
+ |
/** |
* Return {@code true} if this type represents the type 'Function' defined in the dart:core |
* library. |
@@ -5793,23 +6866,33 @@ |
* library |
*/ |
bool isDartCoreFunction(); |
+ |
/** |
* Return {@code true} if this type represents the type 'dynamic'. |
* @return {@code true} if this type represents the type 'dynamic' |
*/ |
bool isDynamic(); |
+ |
/** |
* Return {@code true} if this type is more specific than the given type. |
* @param type the type being compared with this type |
* @return {@code true} if this type is more specific than the given type |
*/ |
bool isMoreSpecificThan(Type2 type); |
+ |
/** |
+ * Return {@code true} if this type represents the type 'Object'. |
+ * @return {@code true} if this type represents the type 'Object' |
+ */ |
+ bool isObject(); |
+ |
+ /** |
* Return {@code true} if this type is a subtype of the given type. |
* @param type the type being compared with this type |
* @return {@code true} if this type is a subtype of the given type |
*/ |
bool isSubtypeOf(Type2 type); |
+ |
/** |
* Return {@code true} if this type is a supertype of the given type. A type <i>S</i> is a |
* supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subtype of <i>S</i>. |
@@ -5817,11 +6900,13 @@ |
* @return {@code true} if this type is a supertype of the given type |
*/ |
bool isSupertypeOf(Type2 type); |
+ |
/** |
* Return {@code true} if this type represents the type 'void'. |
* @return {@code true} if this type represents the type 'void' |
*/ |
bool isVoid(); |
+ |
/** |
* Return the type resulting from substituting the given arguments for the given parameters in |
* this type. The specification defines this operation in section 2: <blockquote> The notation |
@@ -5836,6 +6921,7 @@ |
*/ |
Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
} |
+ |
/** |
* The interface {@code TypeVariableType} defines the behavior of objects representing the type |
* introduced by a type variable. |
@@ -5844,6 +6930,7 @@ |
abstract class TypeVariableType implements Type2 { |
TypeVariableElement get element; |
} |
+ |
/** |
* The interface {@code VoidType} defines the behavior of the unique object representing the type{@code void}. |
* @coverage dart.engine.type |