| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.element; | 4 library engine.element; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
| 9 import 'utilities_collection.dart'; | 9 import 'utilities_collection.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 static ElementKind of(Element element) { | 706 static ElementKind of(Element element) { |
| 707 if (element == null) { | 707 if (element == null) { |
| 708 return ERROR; | 708 return ERROR; |
| 709 } | 709 } |
| 710 return element.kind; | 710 return element.kind; |
| 711 } | 711 } |
| 712 | 712 |
| 713 /** | 713 /** |
| 714 * The name displayed in the UI for this kind of element. | 714 * The name displayed in the UI for this kind of element. |
| 715 */ | 715 */ |
| 716 String displayName; | 716 final String displayName; |
| 717 | 717 |
| 718 /** | 718 /** |
| 719 * Initialize a newly created element kind to have the given display name. | 719 * Initialize a newly created element kind to have the given display name. |
| 720 * | 720 * |
| 721 * @param displayName the name displayed in the UI for this kind of element | 721 * @param displayName the name displayed in the UI for this kind of element |
| 722 */ | 722 */ |
| 723 ElementKind(String name, int ordinal, String displayName) : super(name, ordina
l) { | 723 ElementKind(String name, int ordinal, this.displayName) : super(name, ordinal)
; |
| 724 this.displayName = displayName; | |
| 725 } | |
| 726 } | 724 } |
| 727 | 725 |
| 728 /** | 726 /** |
| 729 * The interface `ElementLocation` defines the behavior of objects that represen
t the location | 727 * The interface `ElementLocation` defines the behavior of objects that represen
t the location |
| 730 * of an element within the element model. | 728 * of an element within the element model. |
| 731 * | 729 * |
| 732 * @coverage dart.engine.element | 730 * @coverage dart.engine.element |
| 733 */ | 731 */ |
| 734 abstract class ElementLocation { | 732 abstract class ElementLocation { |
| 735 /** | 733 /** |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an | 1917 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an |
| 1920 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved | 1918 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved |
| 1921 * using propagated type information, this class is a wrapper for a pair of | 1919 * using propagated type information, this class is a wrapper for a pair of |
| 1922 * [ExecutableElement]s, not just a single [ExecutableElement]. | 1920 * [ExecutableElement]s, not just a single [ExecutableElement]. |
| 1923 */ | 1921 */ |
| 1924 class AuxiliaryElements { | 1922 class AuxiliaryElements { |
| 1925 /** | 1923 /** |
| 1926 * The element based on propagated type information, or `null` if the AST stru
cture has not | 1924 * The element based on propagated type information, or `null` if the AST stru
cture has not |
| 1927 * been resolved or if this identifier could not be resolved. | 1925 * been resolved or if this identifier could not be resolved. |
| 1928 */ | 1926 */ |
| 1929 ExecutableElement propagatedElement; | 1927 final ExecutableElement propagatedElement; |
| 1930 | 1928 |
| 1931 /** | 1929 /** |
| 1932 * The element associated with this identifier based on static type informatio
n, or `null` | 1930 * The element associated with this identifier based on static type informatio
n, or `null` |
| 1933 * if the AST structure has not been resolved or if this identifier could not
be resolved. | 1931 * if the AST structure has not been resolved or if this identifier could not
be resolved. |
| 1934 */ | 1932 */ |
| 1935 ExecutableElement staticElement; | 1933 final ExecutableElement staticElement; |
| 1936 | 1934 |
| 1937 /** | 1935 /** |
| 1938 * Create the [AuxiliaryElements] with a static and propagated [ExecutableElem
ent]. | 1936 * Create the [AuxiliaryElements] with a static and propagated [ExecutableElem
ent]. |
| 1939 * | 1937 * |
| 1940 * @param staticElement the static element | 1938 * @param staticElement the static element |
| 1941 * @param propagatedElement the propagated element | 1939 * @param propagatedElement the propagated element |
| 1942 */ | 1940 */ |
| 1943 AuxiliaryElements(ExecutableElement staticElement, ExecutableElement propagate
dElement) { | 1941 AuxiliaryElements(this.staticElement, this.propagatedElement); |
| 1944 this.staticElement = staticElement; | |
| 1945 this.propagatedElement = propagatedElement; | |
| 1946 } | |
| 1947 } | 1942 } |
| 1948 | 1943 |
| 1949 /** | 1944 /** |
| 1950 * Instances of the class `ClassElementImpl` implement a `ClassElement`. | 1945 * Instances of the class `ClassElementImpl` implement a `ClassElement`. |
| 1951 * | 1946 * |
| 1952 * @coverage dart.engine.element | 1947 * @coverage dart.engine.element |
| 1953 */ | 1948 */ |
| 1954 class ClassElementImpl extends ElementImpl implements ClassElement { | 1949 class ClassElementImpl extends ElementImpl implements ClassElement { |
| 1955 /** | 1950 /** |
| 1956 * An array containing all of the accessors (getters and setters) contained in
this class. | 1951 * An array containing all of the accessors (getters and setters) contained in
this class. |
| 1957 */ | 1952 */ |
| 1958 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; | 1953 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; |
| 1959 | 1954 |
| 1960 /** | 1955 /** |
| 1961 * An array containing all of the constructors contained in this class. | 1956 * An array containing all of the constructors contained in this class. |
| 1962 */ | 1957 */ |
| 1963 List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; | 1958 List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; |
| 1964 | 1959 |
| 1965 /** | 1960 /** |
| 1966 * An array containing all of the fields contained in this class. | 1961 * An array containing all of the fields contained in this class. |
| 1967 */ | 1962 */ |
| 1968 List<FieldElement> _fields = FieldElementImpl.EMPTY_ARRAY; | 1963 List<FieldElement> _fields = FieldElementImpl.EMPTY_ARRAY; |
| 1969 | 1964 |
| 1970 /** | 1965 /** |
| 1971 * An array containing all of the mixins that are applied to the class being e
xtended in order to | 1966 * An array containing all of the mixins that are applied to the class being e
xtended in order to |
| 1972 * derive the superclass of this class. | 1967 * derive the superclass of this class. |
| 1973 */ | 1968 */ |
| 1974 List<InterfaceType> _mixins = InterfaceTypeImpl.EMPTY_ARRAY; | 1969 List<InterfaceType> mixins = InterfaceTypeImpl.EMPTY_ARRAY; |
| 1975 | 1970 |
| 1976 /** | 1971 /** |
| 1977 * An array containing all of the interfaces that are implemented by this clas
s. | 1972 * An array containing all of the interfaces that are implemented by this clas
s. |
| 1978 */ | 1973 */ |
| 1979 List<InterfaceType> _interfaces = InterfaceTypeImpl.EMPTY_ARRAY; | 1974 List<InterfaceType> interfaces = InterfaceTypeImpl.EMPTY_ARRAY; |
| 1980 | 1975 |
| 1981 /** | 1976 /** |
| 1982 * An array containing all of the methods contained in this class. | 1977 * An array containing all of the methods contained in this class. |
| 1983 */ | 1978 */ |
| 1984 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; | 1979 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; |
| 1985 | 1980 |
| 1986 /** | 1981 /** |
| 1987 * The superclass of the class, or `null` if the class does not have an explic
it superclass. | 1982 * The superclass of the class, or `null` if the class does not have an explic
it superclass. |
| 1988 */ | 1983 */ |
| 1989 InterfaceType _supertype; | 1984 InterfaceType supertype; |
| 1990 | 1985 |
| 1991 /** | 1986 /** |
| 1992 * The type defined by the class. | 1987 * The type defined by the class. |
| 1993 */ | 1988 */ |
| 1994 InterfaceType _type; | 1989 InterfaceType type; |
| 1995 | 1990 |
| 1996 /** | 1991 /** |
| 1997 * An array containing all of the type parameters defined for this class. | 1992 * An array containing all of the type parameters defined for this class. |
| 1998 */ | 1993 */ |
| 1999 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR
RAY; | 1994 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR
RAY; |
| 2000 | 1995 |
| 2001 /** | 1996 /** |
| 2002 * An empty array of type elements. | 1997 * An empty array of type elements. |
| 2003 */ | 1998 */ |
| 2004 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); | 1999 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 | 2066 |
| 2072 PropertyAccessorElement getGetter(String getterName) { | 2067 PropertyAccessorElement getGetter(String getterName) { |
| 2073 for (PropertyAccessorElement accessor in _accessors) { | 2068 for (PropertyAccessorElement accessor in _accessors) { |
| 2074 if (accessor.isGetter && accessor.name == getterName) { | 2069 if (accessor.isGetter && accessor.name == getterName) { |
| 2075 return accessor; | 2070 return accessor; |
| 2076 } | 2071 } |
| 2077 } | 2072 } |
| 2078 return null; | 2073 return null; |
| 2079 } | 2074 } |
| 2080 | 2075 |
| 2081 List<InterfaceType> get interfaces => _interfaces; | |
| 2082 | |
| 2083 ElementKind get kind => ElementKind.CLASS; | 2076 ElementKind get kind => ElementKind.CLASS; |
| 2084 | 2077 |
| 2085 MethodElement getMethod(String methodName) { | 2078 MethodElement getMethod(String methodName) { |
| 2086 for (MethodElement method in _methods) { | 2079 for (MethodElement method in _methods) { |
| 2087 if (method.name == methodName) { | 2080 if (method.name == methodName) { |
| 2088 return method; | 2081 return method; |
| 2089 } | 2082 } |
| 2090 } | 2083 } |
| 2091 return null; | 2084 return null; |
| 2092 } | 2085 } |
| 2093 | 2086 |
| 2094 List<MethodElement> get methods => _methods; | 2087 List<MethodElement> get methods => _methods; |
| 2095 | 2088 |
| 2096 List<InterfaceType> get mixins => _mixins; | |
| 2097 | |
| 2098 ConstructorElement getNamedConstructor(String name) { | 2089 ConstructorElement getNamedConstructor(String name) { |
| 2099 for (ConstructorElement element in constructors) { | 2090 for (ConstructorElement element in constructors) { |
| 2100 String elementName = element.name; | 2091 String elementName = element.name; |
| 2101 if (elementName != null && elementName == name) { | 2092 if (elementName != null && elementName == name) { |
| 2102 return element; | 2093 return element; |
| 2103 } | 2094 } |
| 2104 } | 2095 } |
| 2105 return null; | 2096 return null; |
| 2106 } | 2097 } |
| 2107 | 2098 |
| 2108 PropertyAccessorElement getSetter(String setterName) { | 2099 PropertyAccessorElement getSetter(String setterName) { |
| 2109 if (!setterName.endsWith("=")) { | 2100 if (!setterName.endsWith("=")) { |
| 2110 setterName += '='; | 2101 setterName += '='; |
| 2111 } | 2102 } |
| 2112 for (PropertyAccessorElement accessor in _accessors) { | 2103 for (PropertyAccessorElement accessor in _accessors) { |
| 2113 if (accessor.isSetter && accessor.name == setterName) { | 2104 if (accessor.isSetter && accessor.name == setterName) { |
| 2114 return accessor; | 2105 return accessor; |
| 2115 } | 2106 } |
| 2116 } | 2107 } |
| 2117 return null; | 2108 return null; |
| 2118 } | 2109 } |
| 2119 | 2110 |
| 2120 InterfaceType get supertype => _supertype; | |
| 2121 | |
| 2122 InterfaceType get type => _type; | |
| 2123 | |
| 2124 List<TypeParameterElement> get typeParameters => _typeParameters; | 2111 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 2125 | 2112 |
| 2126 ConstructorElement get unnamedConstructor { | 2113 ConstructorElement get unnamedConstructor { |
| 2127 for (ConstructorElement element in constructors) { | 2114 for (ConstructorElement element in constructors) { |
| 2128 String name = element.displayName; | 2115 String name = element.displayName; |
| 2129 if (name == null || name.isEmpty) { | 2116 if (name == null || name.isEmpty) { |
| 2130 return element; | 2117 return element; |
| 2131 } | 2118 } |
| 2132 } | 2119 } |
| 2133 return null; | 2120 return null; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2307 /** | 2294 /** |
| 2308 * Set whether this class references 'super' to the given value. | 2295 * Set whether this class references 'super' to the given value. |
| 2309 * | 2296 * |
| 2310 * @param isReferencedSuper `true` references 'super' | 2297 * @param isReferencedSuper `true` references 'super' |
| 2311 */ | 2298 */ |
| 2312 void set hasReferenceToSuper2(bool isReferencedSuper) { | 2299 void set hasReferenceToSuper2(bool isReferencedSuper) { |
| 2313 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); | 2300 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
| 2314 } | 2301 } |
| 2315 | 2302 |
| 2316 /** | 2303 /** |
| 2317 * Set the interfaces that are implemented by this class to the given types. | |
| 2318 * | |
| 2319 * @param the interfaces that are implemented by this class | |
| 2320 */ | |
| 2321 void set interfaces(List<InterfaceType> interfaces) { | |
| 2322 this._interfaces = interfaces; | |
| 2323 } | |
| 2324 | |
| 2325 /** | |
| 2326 * Set the methods contained in this class to the given methods. | 2304 * Set the methods contained in this class to the given methods. |
| 2327 * | 2305 * |
| 2328 * @param methods the methods contained in this class | 2306 * @param methods the methods contained in this class |
| 2329 */ | 2307 */ |
| 2330 void set methods(List<MethodElement> methods) { | 2308 void set methods(List<MethodElement> methods) { |
| 2331 for (MethodElement method in methods) { | 2309 for (MethodElement method in methods) { |
| 2332 (method as MethodElementImpl).enclosingElement = this; | 2310 (method as MethodElementImpl).enclosingElement = this; |
| 2333 } | 2311 } |
| 2334 this._methods = methods; | 2312 this._methods = methods; |
| 2335 } | 2313 } |
| 2336 | 2314 |
| 2337 /** | 2315 /** |
| 2338 * Set the mixins that are applied to the class being extended in order to der
ive the superclass | |
| 2339 * of this class to the given types. | |
| 2340 * | |
| 2341 * @param mixins the mixins that are applied to derive the superclass of this
class | |
| 2342 */ | |
| 2343 void set mixins(List<InterfaceType> mixins) { | |
| 2344 this._mixins = mixins; | |
| 2345 } | |
| 2346 | |
| 2347 /** | |
| 2348 * Set the superclass of the class to the given type. | |
| 2349 * | |
| 2350 * @param supertype the superclass of the class | |
| 2351 */ | |
| 2352 void set supertype(InterfaceType supertype) { | |
| 2353 this._supertype = supertype; | |
| 2354 } | |
| 2355 | |
| 2356 /** | |
| 2357 * Set the type defined by the class to the given type. | |
| 2358 * | |
| 2359 * @param type the type defined by the class | |
| 2360 */ | |
| 2361 void set type(InterfaceType type) { | |
| 2362 this._type = type; | |
| 2363 } | |
| 2364 | |
| 2365 /** | |
| 2366 * Set whether this class is defined by a typedef construct to correspond to t
he given value. | 2316 * Set whether this class is defined by a typedef construct to correspond to t
he given value. |
| 2367 * | 2317 * |
| 2368 * @param isTypedef `true` if the class is defined by a typedef construct | 2318 * @param isTypedef `true` if the class is defined by a typedef construct |
| 2369 */ | 2319 */ |
| 2370 void set typedef(bool isTypedef) { | 2320 void set typedef(bool isTypedef) { |
| 2371 setModifier(Modifier.TYPEDEF, isTypedef); | 2321 setModifier(Modifier.TYPEDEF, isTypedef); |
| 2372 } | 2322 } |
| 2373 | 2323 |
| 2374 /** | 2324 /** |
| 2375 * Set the type parameters defined for this class to the given type parameters
. | 2325 * Set the type parameters defined for this class to the given type parameters
. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; | 2425 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; |
| 2476 | 2426 |
| 2477 /** | 2427 /** |
| 2478 * An array containing all of the variables contained in this compilation unit
. | 2428 * An array containing all of the variables contained in this compilation unit
. |
| 2479 */ | 2429 */ |
| 2480 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A
RRAY; | 2430 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A
RRAY; |
| 2481 | 2431 |
| 2482 /** | 2432 /** |
| 2483 * The source that corresponds to this compilation unit. | 2433 * The source that corresponds to this compilation unit. |
| 2484 */ | 2434 */ |
| 2485 Source _source; | 2435 Source source; |
| 2486 | 2436 |
| 2487 /** | 2437 /** |
| 2488 * An array containing all of the function type aliases contained in this comp
ilation unit. | 2438 * An array containing all of the function type aliases contained in this comp
ilation unit. |
| 2489 */ | 2439 */ |
| 2490 List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMP
TY_ARRAY; | 2440 List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMP
TY_ARRAY; |
| 2491 | 2441 |
| 2492 /** | 2442 /** |
| 2493 * An array containing all of the types contained in this compilation unit. | 2443 * An array containing all of the types contained in this compilation unit. |
| 2494 */ | 2444 */ |
| 2495 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; | 2445 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; |
| 2496 | 2446 |
| 2497 /** | 2447 /** |
| 2498 * The URI that is specified by the "part" directive in the enclosing library,
or `null` if | 2448 * The URI that is specified by the "part" directive in the enclosing library,
or `null` if |
| 2499 * this is the defining compilation unit of a library. | 2449 * this is the defining compilation unit of a library. |
| 2500 */ | 2450 */ |
| 2501 String _uri; | 2451 String uri; |
| 2502 | 2452 |
| 2503 /** | 2453 /** |
| 2504 * Initialize a newly created compilation unit element to have the given name. | 2454 * Initialize a newly created compilation unit element to have the given name. |
| 2505 * | 2455 * |
| 2506 * @param name the name of this element | 2456 * @param name the name of this element |
| 2507 */ | 2457 */ |
| 2508 CompilationUnitElementImpl(String name) : super.con2(name, -1); | 2458 CompilationUnitElementImpl(String name) : super.con2(name, -1); |
| 2509 | 2459 |
| 2510 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); | 2460 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); |
| 2511 | 2461 |
| 2512 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _source == (object as CompilationUnitElementImpl).source; | 2462 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && source == (object as CompilationUnitElementImpl).source; |
| 2513 | 2463 |
| 2514 List<PropertyAccessorElement> get accessors => _accessors; | 2464 List<PropertyAccessorElement> get accessors => _accessors; |
| 2515 | 2465 |
| 2516 ElementImpl getChild(String identifier) { | 2466 ElementImpl getChild(String identifier) { |
| 2517 for (PropertyAccessorElement accessor in _accessors) { | 2467 for (PropertyAccessorElement accessor in _accessors) { |
| 2518 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { | 2468 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { |
| 2519 return accessor as PropertyAccessorElementImpl; | 2469 return accessor as PropertyAccessorElementImpl; |
| 2520 } | 2470 } |
| 2521 } | 2471 } |
| 2522 for (VariableElement variable in _variables) { | 2472 for (VariableElement variable in _variables) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2543 } | 2493 } |
| 2544 | 2494 |
| 2545 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; | 2495 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; |
| 2546 | 2496 |
| 2547 List<FunctionElement> get functions => _functions; | 2497 List<FunctionElement> get functions => _functions; |
| 2548 | 2498 |
| 2549 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; | 2499 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; |
| 2550 | 2500 |
| 2551 ElementKind get kind => ElementKind.COMPILATION_UNIT; | 2501 ElementKind get kind => ElementKind.COMPILATION_UNIT; |
| 2552 | 2502 |
| 2553 Source get source => _source; | |
| 2554 | |
| 2555 List<TopLevelVariableElement> get topLevelVariables => _variables; | 2503 List<TopLevelVariableElement> get topLevelVariables => _variables; |
| 2556 | 2504 |
| 2557 ClassElement getType(String className) { | 2505 ClassElement getType(String className) { |
| 2558 for (ClassElement type in _types) { | 2506 for (ClassElement type in _types) { |
| 2559 if (type.name == className) { | 2507 if (type.name == className) { |
| 2560 return type; | 2508 return type; |
| 2561 } | 2509 } |
| 2562 } | 2510 } |
| 2563 return null; | 2511 return null; |
| 2564 } | 2512 } |
| 2565 | 2513 |
| 2566 List<ClassElement> get types => _types; | 2514 List<ClassElement> get types => _types; |
| 2567 | 2515 |
| 2568 String get uri => _uri; | 2516 int get hashCode => source.hashCode; |
| 2569 | |
| 2570 int get hashCode => _source.hashCode; | |
| 2571 | 2517 |
| 2572 /** | 2518 /** |
| 2573 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the | 2519 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the |
| 2574 * given accessors. | 2520 * given accessors. |
| 2575 * | 2521 * |
| 2576 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit | 2522 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit |
| 2577 */ | 2523 */ |
| 2578 void set accessors(List<PropertyAccessorElement> accessors) { | 2524 void set accessors(List<PropertyAccessorElement> accessors) { |
| 2579 for (PropertyAccessorElement accessor in accessors) { | 2525 for (PropertyAccessorElement accessor in accessors) { |
| 2580 (accessor as PropertyAccessorElementImpl).enclosingElement = this; | 2526 (accessor as PropertyAccessorElementImpl).enclosingElement = this; |
| 2581 } | 2527 } |
| 2582 this._accessors = accessors; | 2528 this._accessors = accessors; |
| 2583 } | 2529 } |
| 2584 | 2530 |
| 2585 /** | 2531 /** |
| 2586 * Set the top-level functions contained in this compilation unit to the given
functions. | 2532 * Set the top-level functions contained in this compilation unit to the given
functions. |
| 2587 * | 2533 * |
| 2588 * @param functions the top-level functions contained in this compilation unit | 2534 * @param functions the top-level functions contained in this compilation unit |
| 2589 */ | 2535 */ |
| 2590 void set functions(List<FunctionElement> functions) { | 2536 void set functions(List<FunctionElement> functions) { |
| 2591 for (FunctionElement function in functions) { | 2537 for (FunctionElement function in functions) { |
| 2592 (function as FunctionElementImpl).enclosingElement = this; | 2538 (function as FunctionElementImpl).enclosingElement = this; |
| 2593 } | 2539 } |
| 2594 this._functions = functions; | 2540 this._functions = functions; |
| 2595 } | 2541 } |
| 2596 | 2542 |
| 2597 /** | 2543 /** |
| 2598 * Set the source that corresponds to this compilation unit to the given sourc
e. | |
| 2599 * | |
| 2600 * @param source the source that corresponds to this compilation unit | |
| 2601 */ | |
| 2602 void set source(Source source) { | |
| 2603 this._source = source; | |
| 2604 } | |
| 2605 | |
| 2606 /** | |
| 2607 * Set the top-level variables contained in this compilation unit to the given
variables. | 2544 * Set the top-level variables contained in this compilation unit to the given
variables. |
| 2608 * | 2545 * |
| 2609 * @param variables the top-level variables contained in this compilation unit | 2546 * @param variables the top-level variables contained in this compilation unit |
| 2610 */ | 2547 */ |
| 2611 void set topLevelVariables(List<TopLevelVariableElement> variables) { | 2548 void set topLevelVariables(List<TopLevelVariableElement> variables) { |
| 2612 for (TopLevelVariableElement field in variables) { | 2549 for (TopLevelVariableElement field in variables) { |
| 2613 (field as TopLevelVariableElementImpl).enclosingElement = this; | 2550 (field as TopLevelVariableElementImpl).enclosingElement = this; |
| 2614 } | 2551 } |
| 2615 this._variables = variables; | 2552 this._variables = variables; |
| 2616 } | 2553 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2632 * | 2569 * |
| 2633 * @param types types contained in this compilation unit | 2570 * @param types types contained in this compilation unit |
| 2634 */ | 2571 */ |
| 2635 void set types(List<ClassElement> types) { | 2572 void set types(List<ClassElement> types) { |
| 2636 for (ClassElement type in types) { | 2573 for (ClassElement type in types) { |
| 2637 (type as ClassElementImpl).enclosingElement = this; | 2574 (type as ClassElementImpl).enclosingElement = this; |
| 2638 } | 2575 } |
| 2639 this._types = types; | 2576 this._types = types; |
| 2640 } | 2577 } |
| 2641 | 2578 |
| 2642 /** | |
| 2643 * Set the URI that is specified by the "part" directive in the enclosing libr
ary. | |
| 2644 * | |
| 2645 * @param uri the URI that is specified by the "part" directive in the enclosi
ng library. | |
| 2646 */ | |
| 2647 void set uri(String uri) { | |
| 2648 this._uri = uri; | |
| 2649 } | |
| 2650 | |
| 2651 void visitChildren(ElementVisitor visitor) { | 2579 void visitChildren(ElementVisitor visitor) { |
| 2652 super.visitChildren(visitor); | 2580 super.visitChildren(visitor); |
| 2653 safelyVisitChildren(_accessors, visitor); | 2581 safelyVisitChildren(_accessors, visitor); |
| 2654 safelyVisitChildren(_functions, visitor); | 2582 safelyVisitChildren(_functions, visitor); |
| 2655 safelyVisitChildren(_typeAliases, visitor); | 2583 safelyVisitChildren(_typeAliases, visitor); |
| 2656 safelyVisitChildren(_types, visitor); | 2584 safelyVisitChildren(_types, visitor); |
| 2657 safelyVisitChildren(_variables, visitor); | 2585 safelyVisitChildren(_variables, visitor); |
| 2658 } | 2586 } |
| 2659 | 2587 |
| 2660 void appendTo(JavaStringBuilder builder) { | 2588 void appendTo(JavaStringBuilder builder) { |
| 2661 if (_source == null) { | 2589 if (source == null) { |
| 2662 builder.append("{compilation unit}"); | 2590 builder.append("{compilation unit}"); |
| 2663 } else { | 2591 } else { |
| 2664 builder.append(_source.fullName); | 2592 builder.append(source.fullName); |
| 2665 } | 2593 } |
| 2666 } | 2594 } |
| 2667 | 2595 |
| 2668 String get identifier => source.encoding; | 2596 String get identifier => source.encoding; |
| 2669 } | 2597 } |
| 2670 | 2598 |
| 2671 /** | 2599 /** |
| 2672 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for
a | 2600 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for
a |
| 2673 * 'const' field that has an initializer. | 2601 * 'const' field that has an initializer. |
| 2674 */ | 2602 */ |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2749 */ | 2677 */ |
| 2750 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
rElement { | 2678 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
rElement { |
| 2751 /** | 2679 /** |
| 2752 * An empty array of constructor elements. | 2680 * An empty array of constructor elements. |
| 2753 */ | 2681 */ |
| 2754 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); | 2682 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); |
| 2755 | 2683 |
| 2756 /** | 2684 /** |
| 2757 * The constructor to which this constructor is redirecting. | 2685 * The constructor to which this constructor is redirecting. |
| 2758 */ | 2686 */ |
| 2759 ConstructorElement _redirectedConstructor; | 2687 ConstructorElement redirectedConstructor; |
| 2760 | 2688 |
| 2761 /** | 2689 /** |
| 2762 * Initialize a newly created constructor element to have the given name. | 2690 * Initialize a newly created constructor element to have the given name. |
| 2763 * | 2691 * |
| 2764 * @param name the name of this element | 2692 * @param name the name of this element |
| 2765 */ | 2693 */ |
| 2766 ConstructorElementImpl(Identifier name) : super.con1(name); | 2694 ConstructorElementImpl(Identifier name) : super.con1(name); |
| 2767 | 2695 |
| 2768 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 2696 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 2769 | 2697 |
| 2770 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 2698 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| 2771 | 2699 |
| 2772 ElementKind get kind => ElementKind.CONSTRUCTOR; | 2700 ElementKind get kind => ElementKind.CONSTRUCTOR; |
| 2773 | 2701 |
| 2774 ConstructorElement get redirectedConstructor => _redirectedConstructor; | |
| 2775 | |
| 2776 bool get isConst => hasModifier(Modifier.CONST); | 2702 bool get isConst => hasModifier(Modifier.CONST); |
| 2777 | 2703 |
| 2778 bool get isDefaultConstructor { | 2704 bool get isDefaultConstructor { |
| 2779 String name = this.name; | 2705 String name = this.name; |
| 2780 if (name != null && name.length != 0) { | 2706 if (name != null && name.length != 0) { |
| 2781 return false; | 2707 return false; |
| 2782 } | 2708 } |
| 2783 for (ParameterElement parameter in parameters) { | 2709 for (ParameterElement parameter in parameters) { |
| 2784 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { | 2710 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { |
| 2785 return false; | 2711 return false; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2803 | 2729 |
| 2804 /** | 2730 /** |
| 2805 * Set whether this constructor represents a factory method to the given value
. | 2731 * Set whether this constructor represents a factory method to the given value
. |
| 2806 * | 2732 * |
| 2807 * @param isFactory `true` if this constructor represents a factory method | 2733 * @param isFactory `true` if this constructor represents a factory method |
| 2808 */ | 2734 */ |
| 2809 void set factory(bool isFactory) { | 2735 void set factory(bool isFactory) { |
| 2810 setModifier(Modifier.FACTORY, isFactory); | 2736 setModifier(Modifier.FACTORY, isFactory); |
| 2811 } | 2737 } |
| 2812 | 2738 |
| 2813 /** | |
| 2814 * Sets the constructor to which this constructor is redirecting. | |
| 2815 * | |
| 2816 * @param redirectedConstructor the constructor to which this constructor is r
edirecting | |
| 2817 */ | |
| 2818 void set redirectedConstructor(ConstructorElement redirectedConstructor) { | |
| 2819 this._redirectedConstructor = redirectedConstructor; | |
| 2820 } | |
| 2821 | |
| 2822 void appendTo(JavaStringBuilder builder) { | 2739 void appendTo(JavaStringBuilder builder) { |
| 2823 builder.append(enclosingElement.displayName); | 2740 builder.append(enclosingElement.displayName); |
| 2824 String name = displayName; | 2741 String name = displayName; |
| 2825 if (name != null && !name.isEmpty) { | 2742 if (name != null && !name.isEmpty) { |
| 2826 builder.append("."); | 2743 builder.append("."); |
| 2827 builder.append(name); | 2744 builder.append(name); |
| 2828 } | 2745 } |
| 2829 super.appendTo(builder); | 2746 super.appendTo(builder); |
| 2830 } | 2747 } |
| 2831 } | 2748 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2917 | 2834 |
| 2918 /** | 2835 /** |
| 2919 * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotatio
n]. | 2836 * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotatio
n]. |
| 2920 * | 2837 * |
| 2921 * @coverage dart.engine.element | 2838 * @coverage dart.engine.element |
| 2922 */ | 2839 */ |
| 2923 class ElementAnnotationImpl implements ElementAnnotation { | 2840 class ElementAnnotationImpl implements ElementAnnotation { |
| 2924 /** | 2841 /** |
| 2925 * The element representing the field, variable, or constructor being used as
an annotation. | 2842 * The element representing the field, variable, or constructor being used as
an annotation. |
| 2926 */ | 2843 */ |
| 2927 Element _element; | 2844 final Element element; |
| 2928 | 2845 |
| 2929 /** | 2846 /** |
| 2930 * An empty array of annotations. | 2847 * An empty array of annotations. |
| 2931 */ | 2848 */ |
| 2932 static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImp
l>(0); | 2849 static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImp
l>(0); |
| 2933 | 2850 |
| 2934 /** | 2851 /** |
| 2935 * The name of the class used to mark an element as being deprecated. | 2852 * The name of the class used to mark an element as being deprecated. |
| 2936 */ | 2853 */ |
| 2937 static String _DEPRECATED_CLASS_NAME = "Deprecated"; | 2854 static String _DEPRECATED_CLASS_NAME = "Deprecated"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2951 * The name of the top-level variable used to mark a class as implementing a p
roxy object. | 2868 * The name of the top-level variable used to mark a class as implementing a p
roxy object. |
| 2952 */ | 2869 */ |
| 2953 static String _PROXY_VARIABLE_NAME = "proxy"; | 2870 static String _PROXY_VARIABLE_NAME = "proxy"; |
| 2954 | 2871 |
| 2955 /** | 2872 /** |
| 2956 * Initialize a newly created annotation. | 2873 * Initialize a newly created annotation. |
| 2957 * | 2874 * |
| 2958 * @param element the element representing the field, variable, or constructor
being used as an | 2875 * @param element the element representing the field, variable, or constructor
being used as an |
| 2959 * annotation | 2876 * annotation |
| 2960 */ | 2877 */ |
| 2961 ElementAnnotationImpl(Element element) { | 2878 ElementAnnotationImpl(this.element); |
| 2962 this._element = element; | |
| 2963 } | |
| 2964 | |
| 2965 Element get element => _element; | |
| 2966 | 2879 |
| 2967 bool get isDeprecated { | 2880 bool get isDeprecated { |
| 2968 if (_element != null) { | 2881 if (element != null) { |
| 2969 LibraryElement library = _element.library; | 2882 LibraryElement library = element.library; |
| 2970 if (library != null && library.isDartCore) { | 2883 if (library != null && library.isDartCore) { |
| 2971 if (_element is ConstructorElement) { | 2884 if (element is ConstructorElement) { |
| 2972 ConstructorElement constructorElement = _element as ConstructorElement
; | 2885 ConstructorElement constructorElement = element as ConstructorElement; |
| 2973 if (constructorElement.enclosingElement.name == _DEPRECATED_CLASS_NAME
) { | 2886 if (constructorElement.enclosingElement.name == _DEPRECATED_CLASS_NAME
) { |
| 2974 return true; | 2887 return true; |
| 2975 } | 2888 } |
| 2976 } else if (_element is PropertyAccessorElement && _element.name == _DEPR
ECATED_VARIABLE_NAME) { | 2889 } else if (element is PropertyAccessorElement && element.name == _DEPREC
ATED_VARIABLE_NAME) { |
| 2977 return true; | 2890 return true; |
| 2978 } | 2891 } |
| 2979 } | 2892 } |
| 2980 } | 2893 } |
| 2981 return false; | 2894 return false; |
| 2982 } | 2895 } |
| 2983 | 2896 |
| 2984 bool get isOverride { | 2897 bool get isOverride { |
| 2985 if (_element != null) { | 2898 if (element != null) { |
| 2986 LibraryElement library = _element.library; | 2899 LibraryElement library = element.library; |
| 2987 if (library != null && library.isDartCore) { | 2900 if (library != null && library.isDartCore) { |
| 2988 if (_element is PropertyAccessorElement && _element.name == _OVERRIDE_VA
RIABLE_NAME) { | 2901 if (element is PropertyAccessorElement && element.name == _OVERRIDE_VARI
ABLE_NAME) { |
| 2989 return true; | 2902 return true; |
| 2990 } | 2903 } |
| 2991 } | 2904 } |
| 2992 } | 2905 } |
| 2993 return false; | 2906 return false; |
| 2994 } | 2907 } |
| 2995 | 2908 |
| 2996 bool get isProxy { | 2909 bool get isProxy { |
| 2997 if (_element != null) { | 2910 if (element != null) { |
| 2998 LibraryElement library = _element.library; | 2911 LibraryElement library = element.library; |
| 2999 if (library != null && library.isDartCore) { | 2912 if (library != null && library.isDartCore) { |
| 3000 if (_element is PropertyAccessorElement && _element.name == _PROXY_VARIA
BLE_NAME) { | 2913 if (element is PropertyAccessorElement && element.name == _PROXY_VARIABL
E_NAME) { |
| 3001 return true; | 2914 return true; |
| 3002 } | 2915 } |
| 3003 } | 2916 } |
| 3004 } | 2917 } |
| 3005 return false; | 2918 return false; |
| 3006 } | 2919 } |
| 3007 | 2920 |
| 3008 String toString() => "@${_element.toString()}"; | 2921 String toString() => "@${element.toString()}"; |
| 3009 } | 2922 } |
| 3010 | 2923 |
| 3011 /** | 2924 /** |
| 3012 * The abstract class `ElementImpl` implements the behavior common to objects th
at implement | 2925 * The abstract class `ElementImpl` implements the behavior common to objects th
at implement |
| 3013 * an [Element]. | 2926 * an [Element]. |
| 3014 * | 2927 * |
| 3015 * @coverage dart.engine.element | 2928 * @coverage dart.engine.element |
| 3016 */ | 2929 */ |
| 3017 abstract class ElementImpl implements Element { | 2930 abstract class ElementImpl implements Element { |
| 3018 /** | 2931 /** |
| 3019 * The enclosing element of this element, or `null` if this element is at the
root of the | 2932 * The enclosing element of this element, or `null` if this element is at the
root of the |
| 3020 * element structure. | 2933 * element structure. |
| 3021 */ | 2934 */ |
| 3022 ElementImpl _enclosingElement; | 2935 ElementImpl _enclosingElement; |
| 3023 | 2936 |
| 3024 /** | 2937 /** |
| 3025 * The name of this element. | 2938 * The name of this element. |
| 3026 */ | 2939 */ |
| 3027 String _name; | 2940 String _name; |
| 3028 | 2941 |
| 3029 /** | 2942 /** |
| 3030 * The offset of the name of this element in the file that contains the declar
ation of this | 2943 * The offset of the name of this element in the file that contains the declar
ation of this |
| 3031 * element. | 2944 * element. |
| 3032 */ | 2945 */ |
| 3033 int _nameOffset = 0; | 2946 int nameOffset = 0; |
| 3034 | 2947 |
| 3035 /** | 2948 /** |
| 3036 * A bit-encoded form of the modifiers associated with this element. | 2949 * A bit-encoded form of the modifiers associated with this element. |
| 3037 */ | 2950 */ |
| 3038 int _modifiers = 0; | 2951 int _modifiers = 0; |
| 3039 | 2952 |
| 3040 /** | 2953 /** |
| 3041 * An array containing all of the metadata associated with this element. | 2954 * An array containing all of the metadata associated with this element. |
| 3042 */ | 2955 */ |
| 3043 List<ElementAnnotation> _metadata = ElementAnnotationImpl.EMPTY_ARRAY; | 2956 List<ElementAnnotation> metadata = ElementAnnotationImpl.EMPTY_ARRAY; |
| 3044 | 2957 |
| 3045 /** | 2958 /** |
| 3046 * A cached copy of the calculated hashCode for this element. | 2959 * A cached copy of the calculated hashCode for this element. |
| 3047 */ | 2960 */ |
| 3048 int _cachedHashCode = 0; | 2961 int _cachedHashCode = 0; |
| 3049 | 2962 |
| 3050 /** | 2963 /** |
| 3051 * Initialize a newly created element to have the given name. | 2964 * Initialize a newly created element to have the given name. |
| 3052 * | 2965 * |
| 3053 * @param name the name of this element | 2966 * @param name the name of this element |
| 3054 */ | 2967 */ |
| 3055 ElementImpl.con1(Identifier name) : this.con2(name == null ? "" : name.name, n
ame == null ? -1 : name.offset); | 2968 ElementImpl.con1(Identifier name) : this.con2(name == null ? "" : name.name, n
ame == null ? -1 : name.offset); |
| 3056 | 2969 |
| 3057 /** | 2970 /** |
| 3058 * Initialize a newly created element to have the given name. | 2971 * Initialize a newly created element to have the given name. |
| 3059 * | 2972 * |
| 3060 * @param name the name of this element | 2973 * @param name the name of this element |
| 3061 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 2974 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 3062 * declaration of this element | 2975 * declaration of this element |
| 3063 */ | 2976 */ |
| 3064 ElementImpl.con2(String name, int nameOffset) { | 2977 ElementImpl.con2(String name, this.nameOffset) { |
| 3065 this._name = StringUtilities.intern(name); | 2978 this._name = StringUtilities.intern(name); |
| 3066 this._nameOffset = nameOffset; | |
| 3067 } | 2979 } |
| 3068 | 2980 |
| 3069 String computeDocumentationComment() { | 2981 String computeDocumentationComment() { |
| 3070 AnalysisContext context = this.context; | 2982 AnalysisContext context = this.context; |
| 3071 if (context == null) { | 2983 if (context == null) { |
| 3072 return null; | 2984 return null; |
| 3073 } | 2985 } |
| 3074 return context.computeDocumentationComment(this); | 2986 return context.computeDocumentationComment(this); |
| 3075 } | 2987 } |
| 3076 | 2988 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3109 } | 3021 } |
| 3110 | 3022 |
| 3111 String get displayName => _name; | 3023 String get displayName => _name; |
| 3112 | 3024 |
| 3113 Element get enclosingElement => _enclosingElement; | 3025 Element get enclosingElement => _enclosingElement; |
| 3114 | 3026 |
| 3115 LibraryElement get library => getAncestor(LibraryElement); | 3027 LibraryElement get library => getAncestor(LibraryElement); |
| 3116 | 3028 |
| 3117 ElementLocation get location => new ElementLocationImpl.con1(this); | 3029 ElementLocation get location => new ElementLocationImpl.con1(this); |
| 3118 | 3030 |
| 3119 List<ElementAnnotation> get metadata => _metadata; | |
| 3120 | |
| 3121 String get name => _name; | 3031 String get name => _name; |
| 3122 | 3032 |
| 3123 int get nameOffset => _nameOffset; | |
| 3124 | |
| 3125 Source get source { | 3033 Source get source { |
| 3126 if (_enclosingElement == null) { | 3034 if (_enclosingElement == null) { |
| 3127 return null; | 3035 return null; |
| 3128 } | 3036 } |
| 3129 return _enclosingElement.source; | 3037 return _enclosingElement.source; |
| 3130 } | 3038 } |
| 3131 | 3039 |
| 3132 int get hashCode { | 3040 int get hashCode { |
| 3133 if (_cachedHashCode == 0) { | 3041 if (_cachedHashCode == 0) { |
| 3134 _cachedHashCode = location.hashCode; | 3042 _cachedHashCode = location.hashCode; |
| 3135 } | 3043 } |
| 3136 return _cachedHashCode; | 3044 return _cachedHashCode; |
| 3137 } | 3045 } |
| 3138 | 3046 |
| 3139 bool isAccessibleIn(LibraryElement library) { | 3047 bool isAccessibleIn(LibraryElement library) { |
| 3140 if (Identifier.isPrivateName(_name)) { | 3048 if (Identifier.isPrivateName(_name)) { |
| 3141 return library == this.library; | 3049 return library == this.library; |
| 3142 } | 3050 } |
| 3143 return true; | 3051 return true; |
| 3144 } | 3052 } |
| 3145 | 3053 |
| 3146 bool get isDeprecated { | 3054 bool get isDeprecated { |
| 3147 for (ElementAnnotation annotation in _metadata) { | 3055 for (ElementAnnotation annotation in metadata) { |
| 3148 if (annotation.isDeprecated) { | 3056 if (annotation.isDeprecated) { |
| 3149 return true; | 3057 return true; |
| 3150 } | 3058 } |
| 3151 } | 3059 } |
| 3152 return false; | 3060 return false; |
| 3153 } | 3061 } |
| 3154 | 3062 |
| 3155 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); | 3063 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); |
| 3156 | 3064 |
| 3157 /** | 3065 /** |
| 3158 * Set the metadata associate with this element to the given array of annotati
ons. | |
| 3159 * | |
| 3160 * @param metadata the metadata to be associated with this element | |
| 3161 */ | |
| 3162 void set metadata(List<ElementAnnotation> metadata) { | |
| 3163 this._metadata = metadata; | |
| 3164 } | |
| 3165 | |
| 3166 /** | |
| 3167 * Set the offset of the name of this element in the file that contains the de
claration of this | |
| 3168 * element to the given value. This is normally done via the constructor, but
this method is | |
| 3169 * provided to support unnamed constructors. | |
| 3170 * | |
| 3171 * @param nameOffset the offset to the beginning of the name | |
| 3172 */ | |
| 3173 void set nameOffset(int nameOffset) { | |
| 3174 this._nameOffset = nameOffset; | |
| 3175 } | |
| 3176 | |
| 3177 /** | |
| 3178 * Set whether this element is synthetic to correspond to the given value. | 3066 * Set whether this element is synthetic to correspond to the given value. |
| 3179 * | 3067 * |
| 3180 * @param isSynthetic `true` if the element is synthetic | 3068 * @param isSynthetic `true` if the element is synthetic |
| 3181 */ | 3069 */ |
| 3182 void set synthetic(bool isSynthetic) { | 3070 void set synthetic(bool isSynthetic) { |
| 3183 setModifier(Modifier.SYNTHETIC, isSynthetic); | 3071 setModifier(Modifier.SYNTHETIC, isSynthetic); |
| 3184 } | 3072 } |
| 3185 | 3073 |
| 3186 String toString() { | 3074 String toString() { |
| 3187 JavaStringBuilder builder = new JavaStringBuilder(); | 3075 JavaStringBuilder builder = new JavaStringBuilder(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3272 | 3160 |
| 3273 /** | 3161 /** |
| 3274 * Instances of the class `ElementLocationImpl` implement an [ElementLocation]. | 3162 * Instances of the class `ElementLocationImpl` implement an [ElementLocation]. |
| 3275 * | 3163 * |
| 3276 * @coverage dart.engine.element | 3164 * @coverage dart.engine.element |
| 3277 */ | 3165 */ |
| 3278 class ElementLocationImpl implements ElementLocation { | 3166 class ElementLocationImpl implements ElementLocation { |
| 3279 /** | 3167 /** |
| 3280 * The path to the element whose location is represented by this object. | 3168 * The path to the element whose location is represented by this object. |
| 3281 */ | 3169 */ |
| 3282 List<String> components; | 3170 List<String> _components; |
| 3283 | 3171 |
| 3284 /** | 3172 /** |
| 3285 * The character used to separate components in the encoded form. | 3173 * The character used to separate components in the encoded form. |
| 3286 */ | 3174 */ |
| 3287 static int _SEPARATOR_CHAR = 0x3B; | 3175 static int _SEPARATOR_CHAR = 0x3B; |
| 3288 | 3176 |
| 3289 /** | 3177 /** |
| 3290 * Initialize a newly created location to represent the given element. | 3178 * Initialize a newly created location to represent the given element. |
| 3291 * | 3179 * |
| 3292 * @param element the element whose location is being represented | 3180 * @param element the element whose location is being represented |
| 3293 */ | 3181 */ |
| 3294 ElementLocationImpl.con1(Element element) { | 3182 ElementLocationImpl.con1(Element element) { |
| 3295 List<String> components = new List<String>(); | 3183 List<String> components = new List<String>(); |
| 3296 Element ancestor = element; | 3184 Element ancestor = element; |
| 3297 while (ancestor != null) { | 3185 while (ancestor != null) { |
| 3298 components.insert(0, (ancestor as ElementImpl).identifier); | 3186 components.insert(0, (ancestor as ElementImpl).identifier); |
| 3299 ancestor = ancestor.enclosingElement; | 3187 ancestor = ancestor.enclosingElement; |
| 3300 } | 3188 } |
| 3301 this.components = new List.from(components); | 3189 this._components = new List.from(components); |
| 3302 } | 3190 } |
| 3303 | 3191 |
| 3304 /** | 3192 /** |
| 3305 * Initialize a newly created location from the given encoded form. | 3193 * Initialize a newly created location from the given encoded form. |
| 3306 * | 3194 * |
| 3307 * @param encoding the encoded form of a location | 3195 * @param encoding the encoded form of a location |
| 3308 */ | 3196 */ |
| 3309 ElementLocationImpl.con2(String encoding) { | 3197 ElementLocationImpl.con2(String encoding) { |
| 3310 this.components = decode(encoding); | 3198 this._components = decode(encoding); |
| 3311 } | 3199 } |
| 3312 | 3200 |
| 3313 bool operator ==(Object object) { | 3201 bool operator ==(Object object) { |
| 3314 if (identical(this, object)) { | 3202 if (identical(this, object)) { |
| 3315 return true; | 3203 return true; |
| 3316 } | 3204 } |
| 3317 if (object is! ElementLocationImpl) { | 3205 if (object is! ElementLocationImpl) { |
| 3318 return false; | 3206 return false; |
| 3319 } | 3207 } |
| 3320 ElementLocationImpl location = object as ElementLocationImpl; | 3208 ElementLocationImpl location = object as ElementLocationImpl; |
| 3321 List<String> otherComponents = location.components; | 3209 List<String> otherComponents = location._components; |
| 3322 int length = components.length; | 3210 int length = _components.length; |
| 3323 if (otherComponents.length != length) { | 3211 if (otherComponents.length != length) { |
| 3324 return false; | 3212 return false; |
| 3325 } | 3213 } |
| 3326 for (int i = length - 1; i >= 2; i--) { | 3214 for (int i = length - 1; i >= 2; i--) { |
| 3327 if (components[i] != otherComponents[i]) { | 3215 if (_components[i] != otherComponents[i]) { |
| 3328 return false; | 3216 return false; |
| 3329 } | 3217 } |
| 3330 } | 3218 } |
| 3331 if (length > 1 && !equalSourceComponents(components[1], otherComponents[1]))
{ | 3219 if (length > 1 && !equalSourceComponents(_components[1], otherComponents[1])
) { |
| 3332 return false; | 3220 return false; |
| 3333 } | 3221 } |
| 3334 if (length > 0 && !equalSourceComponents(components[0], otherComponents[0]))
{ | 3222 if (length > 0 && !equalSourceComponents(_components[0], otherComponents[0])
) { |
| 3335 return false; | 3223 return false; |
| 3336 } | 3224 } |
| 3337 return true; | 3225 return true; |
| 3338 } | 3226 } |
| 3339 | 3227 |
| 3228 /** |
| 3229 * Return the path to the element whose location is represented by this object
. |
| 3230 * |
| 3231 * @return the path to the element whose location is represented by this objec
t |
| 3232 */ |
| 3233 List<String> get components => _components; |
| 3234 |
| 3340 String get encoding { | 3235 String get encoding { |
| 3341 JavaStringBuilder builder = new JavaStringBuilder(); | 3236 JavaStringBuilder builder = new JavaStringBuilder(); |
| 3342 int length = components.length; | 3237 int length = _components.length; |
| 3343 for (int i = 0; i < length; i++) { | 3238 for (int i = 0; i < length; i++) { |
| 3344 if (i > 0) { | 3239 if (i > 0) { |
| 3345 builder.appendChar(_SEPARATOR_CHAR); | 3240 builder.appendChar(_SEPARATOR_CHAR); |
| 3346 } | 3241 } |
| 3347 encode(builder, components[i]); | 3242 encode(builder, _components[i]); |
| 3348 } | 3243 } |
| 3349 return builder.toString(); | 3244 return builder.toString(); |
| 3350 } | 3245 } |
| 3351 | 3246 |
| 3352 int get hashCode { | 3247 int get hashCode { |
| 3353 int result = 1; | 3248 int result = 1; |
| 3354 for (int i = 0; i < components.length; i++) { | 3249 for (int i = 0; i < _components.length; i++) { |
| 3355 String component = components[i]; | 3250 String component = _components[i]; |
| 3356 int componentHash; | 3251 int componentHash; |
| 3357 if (i <= 1) { | 3252 if (i <= 1) { |
| 3358 componentHash = hashSourceComponent(component); | 3253 componentHash = hashSourceComponent(component); |
| 3359 } else { | 3254 } else { |
| 3360 componentHash = component.hashCode; | 3255 componentHash = component.hashCode; |
| 3361 } | 3256 } |
| 3362 result = 31 * result + componentHash; | 3257 result = 31 * result + componentHash; |
| 3363 } | 3258 } |
| 3364 return result; | 3259 return result; |
| 3365 } | 3260 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3517 List<LocalVariableElement> _localVariables = LocalVariableElementImpl.EMPTY_AR
RAY; | 3412 List<LocalVariableElement> _localVariables = LocalVariableElementImpl.EMPTY_AR
RAY; |
| 3518 | 3413 |
| 3519 /** | 3414 /** |
| 3520 * An array containing all of the parameters defined by this executable elemen
t. | 3415 * An array containing all of the parameters defined by this executable elemen
t. |
| 3521 */ | 3416 */ |
| 3522 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 3417 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 3523 | 3418 |
| 3524 /** | 3419 /** |
| 3525 * The return type defined by this executable element. | 3420 * The return type defined by this executable element. |
| 3526 */ | 3421 */ |
| 3527 Type2 _returnType; | 3422 Type2 returnType; |
| 3528 | 3423 |
| 3529 /** | 3424 /** |
| 3530 * The type of function defined by this executable element. | 3425 * The type of function defined by this executable element. |
| 3531 */ | 3426 */ |
| 3532 FunctionType _type; | 3427 FunctionType type; |
| 3533 | 3428 |
| 3534 /** | 3429 /** |
| 3535 * An empty array of executable elements. | 3430 * An empty array of executable elements. |
| 3536 */ | 3431 */ |
| 3537 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); | 3432 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); |
| 3538 | 3433 |
| 3539 /** | 3434 /** |
| 3540 * Initialize a newly created executable element to have the given name. | 3435 * Initialize a newly created executable element to have the given name. |
| 3541 * | 3436 * |
| 3542 * @param name the name of this element | 3437 * @param name the name of this element |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3577 } | 3472 } |
| 3578 | 3473 |
| 3579 List<FunctionElement> get functions => _functions; | 3474 List<FunctionElement> get functions => _functions; |
| 3580 | 3475 |
| 3581 List<LabelElement> get labels => _labels; | 3476 List<LabelElement> get labels => _labels; |
| 3582 | 3477 |
| 3583 List<LocalVariableElement> get localVariables => _localVariables; | 3478 List<LocalVariableElement> get localVariables => _localVariables; |
| 3584 | 3479 |
| 3585 List<ParameterElement> get parameters => _parameters; | 3480 List<ParameterElement> get parameters => _parameters; |
| 3586 | 3481 |
| 3587 Type2 get returnType => _returnType; | |
| 3588 | |
| 3589 FunctionType get type => _type; | |
| 3590 | |
| 3591 bool get isOperator => false; | 3482 bool get isOperator => false; |
| 3592 | 3483 |
| 3593 /** | 3484 /** |
| 3594 * Set the functions defined within this executable element to the given funct
ions. | 3485 * Set the functions defined within this executable element to the given funct
ions. |
| 3595 * | 3486 * |
| 3596 * @param functions the functions defined within this executable element | 3487 * @param functions the functions defined within this executable element |
| 3597 */ | 3488 */ |
| 3598 void set functions(List<FunctionElement> functions) { | 3489 void set functions(List<FunctionElement> functions) { |
| 3599 for (FunctionElement function in functions) { | 3490 for (FunctionElement function in functions) { |
| 3600 (function as FunctionElementImpl).enclosingElement = this; | 3491 (function as FunctionElementImpl).enclosingElement = this; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3631 * | 3522 * |
| 3632 * @param parameters the parameters defined by this executable element | 3523 * @param parameters the parameters defined by this executable element |
| 3633 */ | 3524 */ |
| 3634 void set parameters(List<ParameterElement> parameters) { | 3525 void set parameters(List<ParameterElement> parameters) { |
| 3635 for (ParameterElement parameter in parameters) { | 3526 for (ParameterElement parameter in parameters) { |
| 3636 (parameter as ParameterElementImpl).enclosingElement = this; | 3527 (parameter as ParameterElementImpl).enclosingElement = this; |
| 3637 } | 3528 } |
| 3638 this._parameters = parameters; | 3529 this._parameters = parameters; |
| 3639 } | 3530 } |
| 3640 | 3531 |
| 3641 /** | |
| 3642 * Set the return type defined by this executable element. | |
| 3643 * | |
| 3644 * @param returnType the return type defined by this executable element | |
| 3645 */ | |
| 3646 void set returnType(Type2 returnType) { | |
| 3647 this._returnType = returnType; | |
| 3648 } | |
| 3649 | |
| 3650 /** | |
| 3651 * Set the type of function defined by this executable element to the given ty
pe. | |
| 3652 * | |
| 3653 * @param type the type of function defined by this executable element | |
| 3654 */ | |
| 3655 void set type(FunctionType type) { | |
| 3656 this._type = type; | |
| 3657 } | |
| 3658 | |
| 3659 void visitChildren(ElementVisitor visitor) { | 3532 void visitChildren(ElementVisitor visitor) { |
| 3660 super.visitChildren(visitor); | 3533 super.visitChildren(visitor); |
| 3661 safelyVisitChildren(_functions, visitor); | 3534 safelyVisitChildren(_functions, visitor); |
| 3662 safelyVisitChildren(_labels, visitor); | 3535 safelyVisitChildren(_labels, visitor); |
| 3663 safelyVisitChildren(_localVariables, visitor); | 3536 safelyVisitChildren(_localVariables, visitor); |
| 3664 safelyVisitChildren(_parameters, visitor); | 3537 safelyVisitChildren(_parameters, visitor); |
| 3665 } | 3538 } |
| 3666 | 3539 |
| 3667 void appendTo(JavaStringBuilder builder) { | 3540 void appendTo(JavaStringBuilder builder) { |
| 3668 builder.append("("); | 3541 builder.append("("); |
| 3669 int parameterCount = _parameters.length; | 3542 int parameterCount = _parameters.length; |
| 3670 for (int i = 0; i < parameterCount; i++) { | 3543 for (int i = 0; i < parameterCount; i++) { |
| 3671 if (i > 0) { | 3544 if (i > 0) { |
| 3672 builder.append(", "); | 3545 builder.append(", "); |
| 3673 } | 3546 } |
| 3674 (_parameters[i] as ParameterElementImpl).appendTo(builder); | 3547 (_parameters[i] as ParameterElementImpl).appendTo(builder); |
| 3675 } | 3548 } |
| 3676 builder.append(")"); | 3549 builder.append(")"); |
| 3677 if (_type != null) { | 3550 if (type != null) { |
| 3678 builder.append(Element.RIGHT_ARROW); | 3551 builder.append(Element.RIGHT_ARROW); |
| 3679 builder.append(_type.returnType); | 3552 builder.append(type.returnType); |
| 3680 } | 3553 } |
| 3681 } | 3554 } |
| 3682 } | 3555 } |
| 3683 | 3556 |
| 3684 /** | 3557 /** |
| 3685 * Instances of the class `ExportElementImpl` implement an [ExportElement]. | 3558 * Instances of the class `ExportElementImpl` implement an [ExportElement]. |
| 3686 * | 3559 * |
| 3687 * @coverage dart.engine.element | 3560 * @coverage dart.engine.element |
| 3688 */ | 3561 */ |
| 3689 class ExportElementImpl extends ElementImpl implements ExportElement { | 3562 class ExportElementImpl extends ElementImpl implements ExportElement { |
| 3690 /** | 3563 /** |
| 3691 * The URI that is specified by this directive. | 3564 * The URI that is specified by this directive. |
| 3692 */ | 3565 */ |
| 3693 String _uri; | 3566 String uri; |
| 3694 | 3567 |
| 3695 /** | 3568 /** |
| 3696 * The library that is exported from this library by this export directive. | 3569 * The library that is exported from this library by this export directive. |
| 3697 */ | 3570 */ |
| 3698 LibraryElement _exportedLibrary; | 3571 LibraryElement exportedLibrary; |
| 3699 | 3572 |
| 3700 /** | 3573 /** |
| 3701 * The combinators that were specified as part of the export directive in the
order in which they | 3574 * The combinators that were specified as part of the export directive in the
order in which they |
| 3702 * were specified. | 3575 * were specified. |
| 3703 */ | 3576 */ |
| 3704 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; | 3577 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY; |
| 3705 | 3578 |
| 3706 /** | 3579 /** |
| 3707 * Initialize a newly created export element. | 3580 * Initialize a newly created export element. |
| 3708 */ | 3581 */ |
| 3709 ExportElementImpl() : super.con1(null); | 3582 ExportElementImpl() : super.con1(null); |
| 3710 | 3583 |
| 3711 accept(ElementVisitor visitor) => visitor.visitExportElement(this); | 3584 accept(ElementVisitor visitor) => visitor.visitExportElement(this); |
| 3712 | 3585 |
| 3713 List<NamespaceCombinator> get combinators => _combinators; | |
| 3714 | |
| 3715 LibraryElement get exportedLibrary => _exportedLibrary; | |
| 3716 | |
| 3717 ElementKind get kind => ElementKind.EXPORT; | 3586 ElementKind get kind => ElementKind.EXPORT; |
| 3718 | 3587 |
| 3719 String get uri => _uri; | |
| 3720 | |
| 3721 /** | |
| 3722 * Set the combinators that were specified as part of the export directive to
the given array of | |
| 3723 * combinators. | |
| 3724 * | |
| 3725 * @param combinators the combinators that were specified as part of the expor
t directive | |
| 3726 */ | |
| 3727 void set combinators(List<NamespaceCombinator> combinators) { | |
| 3728 this._combinators = combinators; | |
| 3729 } | |
| 3730 | |
| 3731 /** | |
| 3732 * Set the library that is exported from this library by this import directive
to the given | |
| 3733 * library. | |
| 3734 * | |
| 3735 * @param exportedLibrary the library that is exported from this library | |
| 3736 */ | |
| 3737 void set exportedLibrary(LibraryElement exportedLibrary) { | |
| 3738 this._exportedLibrary = exportedLibrary; | |
| 3739 } | |
| 3740 | |
| 3741 /** | |
| 3742 * Set the URI that is specified by this directive. | |
| 3743 * | |
| 3744 * @param uri the URI that is specified by this directive. | |
| 3745 */ | |
| 3746 void set uri(String uri) { | |
| 3747 this._uri = uri; | |
| 3748 } | |
| 3749 | |
| 3750 void appendTo(JavaStringBuilder builder) { | 3588 void appendTo(JavaStringBuilder builder) { |
| 3751 builder.append("export "); | 3589 builder.append("export "); |
| 3752 (_exportedLibrary as LibraryElementImpl).appendTo(builder); | 3590 (exportedLibrary as LibraryElementImpl).appendTo(builder); |
| 3753 } | 3591 } |
| 3754 | 3592 |
| 3755 String get identifier => _exportedLibrary.name; | 3593 String get identifier => exportedLibrary.name; |
| 3756 } | 3594 } |
| 3757 | 3595 |
| 3758 /** | 3596 /** |
| 3759 * Instances of the class `ExternalHtmlScriptElementImpl` implement an | 3597 * Instances of the class `ExternalHtmlScriptElementImpl` implement an |
| 3760 * [ExternalHtmlScriptElement]. | 3598 * [ExternalHtmlScriptElement]. |
| 3761 * | 3599 * |
| 3762 * @coverage dart.engine.element | 3600 * @coverage dart.engine.element |
| 3763 */ | 3601 */ |
| 3764 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext
ernalHtmlScriptElement { | 3602 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext
ernalHtmlScriptElement { |
| 3765 /** | 3603 /** |
| 3766 * The source specified in the `source` attribute or `null` if unspecified. | 3604 * The source specified in the `source` attribute or `null` if unspecified. |
| 3767 */ | 3605 */ |
| 3768 Source _scriptSource; | 3606 Source scriptSource; |
| 3769 | 3607 |
| 3770 /** | 3608 /** |
| 3771 * Initialize a newly created script element to have the specified tag name an
d offset. | 3609 * Initialize a newly created script element to have the specified tag name an
d offset. |
| 3772 * | 3610 * |
| 3773 * @param node the XML node from which this element is derived (not `null`) | 3611 * @param node the XML node from which this element is derived (not `null`) |
| 3774 */ | 3612 */ |
| 3775 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node); | 3613 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node); |
| 3776 | 3614 |
| 3777 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this)
; | 3615 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this)
; |
| 3778 | 3616 |
| 3779 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; | 3617 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; |
| 3780 | |
| 3781 Source get scriptSource => _scriptSource; | |
| 3782 | |
| 3783 /** | |
| 3784 * Set the source specified in the `source` attribute. | |
| 3785 * | |
| 3786 * @param scriptSource the script source or `null` if unspecified | |
| 3787 */ | |
| 3788 void set scriptSource(Source scriptSource) { | |
| 3789 this._scriptSource = scriptSource; | |
| 3790 } | |
| 3791 } | 3618 } |
| 3792 | 3619 |
| 3793 /** | 3620 /** |
| 3794 * Instances of the class `FieldElementImpl` implement a `FieldElement`. | 3621 * Instances of the class `FieldElementImpl` implement a `FieldElement`. |
| 3795 * | 3622 * |
| 3796 * @coverage dart.engine.element | 3623 * @coverage dart.engine.element |
| 3797 */ | 3624 */ |
| 3798 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme
nt { | 3625 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme
nt { |
| 3799 /** | 3626 /** |
| 3800 * An empty array of field elements. | 3627 * An empty array of field elements. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3837 * Instances of the class `FieldFormalParameterElementImpl` extend | 3664 * Instances of the class `FieldFormalParameterElementImpl` extend |
| 3838 * [ParameterElementImpl] to provide the additional information of the [FieldEle
ment] | 3665 * [ParameterElementImpl] to provide the additional information of the [FieldEle
ment] |
| 3839 * associated with the parameter. | 3666 * associated with the parameter. |
| 3840 * | 3667 * |
| 3841 * @coverage dart.engine.element | 3668 * @coverage dart.engine.element |
| 3842 */ | 3669 */ |
| 3843 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi
eldFormalParameterElement { | 3670 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi
eldFormalParameterElement { |
| 3844 /** | 3671 /** |
| 3845 * The field associated with this field formal parameter. | 3672 * The field associated with this field formal parameter. |
| 3846 */ | 3673 */ |
| 3847 FieldElement _field; | 3674 FieldElement field; |
| 3848 | 3675 |
| 3849 /** | 3676 /** |
| 3850 * Initialize a newly created parameter element to have the given name. | 3677 * Initialize a newly created parameter element to have the given name. |
| 3851 * | 3678 * |
| 3852 * @param name the name of this element | 3679 * @param name the name of this element |
| 3853 */ | 3680 */ |
| 3854 FieldFormalParameterElementImpl(Identifier name) : super.con1(name); | 3681 FieldFormalParameterElementImpl(Identifier name) : super.con1(name); |
| 3855 | 3682 |
| 3856 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi
s); | 3683 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi
s); |
| 3857 | 3684 |
| 3858 FieldElement get field => _field; | |
| 3859 | |
| 3860 bool get isInitializingFormal => true; | 3685 bool get isInitializingFormal => true; |
| 3861 | |
| 3862 /** | |
| 3863 * Set the field element associated with this field formal parameter to the gi
ven element. | |
| 3864 * | |
| 3865 * @param field the new field element | |
| 3866 */ | |
| 3867 void set field(FieldElement field) { | |
| 3868 this._field = field; | |
| 3869 } | |
| 3870 } | 3686 } |
| 3871 | 3687 |
| 3872 /** | 3688 /** |
| 3873 * Instances of the class `FunctionElementImpl` implement a `FunctionElement`. | 3689 * Instances of the class `FunctionElementImpl` implement a `FunctionElement`. |
| 3874 * | 3690 * |
| 3875 * @coverage dart.engine.element | 3691 * @coverage dart.engine.element |
| 3876 */ | 3692 */ |
| 3877 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
nt { | 3693 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
nt { |
| 3878 /** | 3694 /** |
| 3879 * The offset to the beginning of the visible range for this element. | 3695 * The offset to the beginning of the visible range for this element. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3952 */ | 3768 */ |
| 3953 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { | 3769 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { |
| 3954 /** | 3770 /** |
| 3955 * An array containing all of the parameters defined by this type alias. | 3771 * An array containing all of the parameters defined by this type alias. |
| 3956 */ | 3772 */ |
| 3957 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 3773 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 3958 | 3774 |
| 3959 /** | 3775 /** |
| 3960 * The return type defined by this type alias. | 3776 * The return type defined by this type alias. |
| 3961 */ | 3777 */ |
| 3962 Type2 _returnType; | 3778 Type2 returnType; |
| 3963 | 3779 |
| 3964 /** | 3780 /** |
| 3965 * The type of function defined by this type alias. | 3781 * The type of function defined by this type alias. |
| 3966 */ | 3782 */ |
| 3967 FunctionType _type; | 3783 FunctionType type; |
| 3968 | 3784 |
| 3969 /** | 3785 /** |
| 3970 * An array containing all of the type parameters defined for this type. | 3786 * An array containing all of the type parameters defined for this type. |
| 3971 */ | 3787 */ |
| 3972 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR
RAY; | 3788 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR
RAY; |
| 3973 | 3789 |
| 3974 /** | 3790 /** |
| 3975 * An empty array of type alias elements. | 3791 * An empty array of type alias elements. |
| 3976 */ | 3792 */ |
| 3977 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); | 3793 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3998 } | 3814 } |
| 3999 return null; | 3815 return null; |
| 4000 } | 3816 } |
| 4001 | 3817 |
| 4002 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; | 3818 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; |
| 4003 | 3819 |
| 4004 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; | 3820 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
| 4005 | 3821 |
| 4006 List<ParameterElement> get parameters => _parameters; | 3822 List<ParameterElement> get parameters => _parameters; |
| 4007 | 3823 |
| 4008 Type2 get returnType => _returnType; | |
| 4009 | |
| 4010 FunctionType get type => _type; | |
| 4011 | |
| 4012 List<TypeParameterElement> get typeParameters => _typeParameters; | 3824 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 4013 | 3825 |
| 4014 /** | 3826 /** |
| 4015 * Set the parameters defined by this type alias to the given parameters. | 3827 * Set the parameters defined by this type alias to the given parameters. |
| 4016 * | 3828 * |
| 4017 * @param parameters the parameters defined by this type alias | 3829 * @param parameters the parameters defined by this type alias |
| 4018 */ | 3830 */ |
| 4019 void set parameters(List<ParameterElement> parameters) { | 3831 void set parameters(List<ParameterElement> parameters) { |
| 4020 if (parameters != null) { | 3832 if (parameters != null) { |
| 4021 for (ParameterElement parameter in parameters) { | 3833 for (ParameterElement parameter in parameters) { |
| 4022 (parameter as ParameterElementImpl).enclosingElement = this; | 3834 (parameter as ParameterElementImpl).enclosingElement = this; |
| 4023 } | 3835 } |
| 4024 } | 3836 } |
| 4025 this._parameters = parameters; | 3837 this._parameters = parameters; |
| 4026 } | 3838 } |
| 4027 | 3839 |
| 4028 /** | 3840 /** |
| 4029 * Set the return type defined by this type alias. | |
| 4030 * | |
| 4031 * @param returnType the return type defined by this type alias | |
| 4032 */ | |
| 4033 void set returnType(Type2 returnType) { | |
| 4034 this._returnType = returnType; | |
| 4035 } | |
| 4036 | |
| 4037 /** | |
| 4038 * Set the type of function defined by this type alias to the given type. | |
| 4039 * | |
| 4040 * @param type the type of function defined by this type alias | |
| 4041 */ | |
| 4042 void set type(FunctionType type) { | |
| 4043 this._type = type; | |
| 4044 } | |
| 4045 | |
| 4046 /** | |
| 4047 * Set the type parameters defined for this type to the given parameters. | 3841 * Set the type parameters defined for this type to the given parameters. |
| 4048 * | 3842 * |
| 4049 * @param typeParameters the type parameters defined for this type | 3843 * @param typeParameters the type parameters defined for this type |
| 4050 */ | 3844 */ |
| 4051 void set typeParameters(List<TypeParameterElement> typeParameters) { | 3845 void set typeParameters(List<TypeParameterElement> typeParameters) { |
| 4052 for (TypeParameterElement typeParameter in typeParameters) { | 3846 for (TypeParameterElement typeParameter in typeParameters) { |
| 4053 (typeParameter as TypeParameterElementImpl).enclosingElement = this; | 3847 (typeParameter as TypeParameterElementImpl).enclosingElement = this; |
| 4054 } | 3848 } |
| 4055 this._typeParameters = typeParameters; | 3849 this._typeParameters = typeParameters; |
| 4056 } | 3850 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4099 } | 3893 } |
| 4100 builder.append("("); | 3894 builder.append("("); |
| 4101 int parameterCount = _parameters.length; | 3895 int parameterCount = _parameters.length; |
| 4102 for (int i = 0; i < parameterCount; i++) { | 3896 for (int i = 0; i < parameterCount; i++) { |
| 4103 if (i > 0) { | 3897 if (i > 0) { |
| 4104 builder.append(", "); | 3898 builder.append(", "); |
| 4105 } | 3899 } |
| 4106 (_parameters[i] as ParameterElementImpl).appendTo(builder); | 3900 (_parameters[i] as ParameterElementImpl).appendTo(builder); |
| 4107 } | 3901 } |
| 4108 builder.append(")"); | 3902 builder.append(")"); |
| 4109 if (_type != null) { | 3903 if (type != null) { |
| 4110 builder.append(Element.RIGHT_ARROW); | 3904 builder.append(Element.RIGHT_ARROW); |
| 4111 builder.append(_type.returnType); | 3905 builder.append(type.returnType); |
| 4112 } | 3906 } |
| 4113 } | 3907 } |
| 4114 } | 3908 } |
| 4115 | 3909 |
| 4116 /** | 3910 /** |
| 4117 * Instances of the class `HideElementCombinatorImpl` implement a | 3911 * Instances of the class `HideElementCombinatorImpl` implement a |
| 4118 * [HideElementCombinator]. | 3912 * [HideElementCombinator]. |
| 4119 * | 3913 * |
| 4120 * @coverage dart.engine.element | 3914 * @coverage dart.engine.element |
| 4121 */ | 3915 */ |
| 4122 class HideElementCombinatorImpl implements HideElementCombinator { | 3916 class HideElementCombinatorImpl implements HideElementCombinator { |
| 4123 /** | 3917 /** |
| 4124 * The names that are not to be made visible in the importing library even if
they are defined in | 3918 * The names that are not to be made visible in the importing library even if
they are defined in |
| 4125 * the imported library. | 3919 * the imported library. |
| 4126 */ | 3920 */ |
| 4127 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; | 3921 List<String> hiddenNames = StringUtilities.EMPTY_ARRAY; |
| 4128 | |
| 4129 List<String> get hiddenNames => _hiddenNames; | |
| 4130 | |
| 4131 /** | |
| 4132 * Set the names that are not to be made visible in the importing library even
if they are defined | |
| 4133 * in the imported library to the given names. | |
| 4134 * | |
| 4135 * @param hiddenNames the names that are not to be made visible in the importi
ng library | |
| 4136 */ | |
| 4137 void set hiddenNames(List<String> hiddenNames) { | |
| 4138 this._hiddenNames = hiddenNames; | |
| 4139 } | |
| 4140 | 3922 |
| 4141 String toString() { | 3923 String toString() { |
| 4142 JavaStringBuilder builder = new JavaStringBuilder(); | 3924 JavaStringBuilder builder = new JavaStringBuilder(); |
| 4143 builder.append("show "); | 3925 builder.append("show "); |
| 4144 int count = _hiddenNames.length; | 3926 int count = hiddenNames.length; |
| 4145 for (int i = 0; i < count; i++) { | 3927 for (int i = 0; i < count; i++) { |
| 4146 if (i > 0) { | 3928 if (i > 0) { |
| 4147 builder.append(", "); | 3929 builder.append(", "); |
| 4148 } | 3930 } |
| 4149 builder.append(_hiddenNames[i]); | 3931 builder.append(hiddenNames[i]); |
| 4150 } | 3932 } |
| 4151 return builder.toString(); | 3933 return builder.toString(); |
| 4152 } | 3934 } |
| 4153 } | 3935 } |
| 4154 | 3936 |
| 4155 /** | 3937 /** |
| 4156 * Instances of the class `HtmlElementImpl` implement an [HtmlElement]. | 3938 * Instances of the class `HtmlElementImpl` implement an [HtmlElement]. |
| 4157 * | 3939 * |
| 4158 * @coverage dart.engine.element | 3940 * @coverage dart.engine.element |
| 4159 */ | 3941 */ |
| 4160 class HtmlElementImpl extends ElementImpl implements HtmlElement { | 3942 class HtmlElementImpl extends ElementImpl implements HtmlElement { |
| 4161 /** | 3943 /** |
| 4162 * An empty array of HTML file elements. | 3944 * An empty array of HTML file elements. |
| 4163 */ | 3945 */ |
| 4164 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); | 3946 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); |
| 4165 | 3947 |
| 4166 /** | 3948 /** |
| 4167 * The analysis context in which this library is defined. | 3949 * The analysis context in which this library is defined. |
| 4168 */ | 3950 */ |
| 4169 AnalysisContext _context; | 3951 final AnalysisContext context; |
| 4170 | 3952 |
| 4171 /** | 3953 /** |
| 4172 * The scripts contained in or referenced from script tags in the HTML file. | 3954 * The scripts contained in or referenced from script tags in the HTML file. |
| 4173 */ | 3955 */ |
| 4174 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; | 3956 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; |
| 4175 | 3957 |
| 4176 /** | 3958 /** |
| 4177 * The source that corresponds to this HTML file. | 3959 * The source that corresponds to this HTML file. |
| 4178 */ | 3960 */ |
| 4179 Source _source; | 3961 Source source; |
| 4180 | 3962 |
| 4181 /** | 3963 /** |
| 4182 * Initialize a newly created HTML element to have the given name. | 3964 * Initialize a newly created HTML element to have the given name. |
| 4183 * | 3965 * |
| 4184 * @param context the analysis context in which the HTML file is defined | 3966 * @param context the analysis context in which the HTML file is defined |
| 4185 * @param name the name of this element | 3967 * @param name the name of this element |
| 4186 */ | 3968 */ |
| 4187 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { | 3969 HtmlElementImpl(this.context, String name) : super.con2(name, -1); |
| 4188 this._context = context; | |
| 4189 } | |
| 4190 | 3970 |
| 4191 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); | 3971 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); |
| 4192 | 3972 |
| 4193 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc
e == (object as CompilationUnitElementImpl).source; | 3973 bool operator ==(Object object) => runtimeType == object.runtimeType && source
== (object as CompilationUnitElementImpl).source; |
| 4194 | |
| 4195 AnalysisContext get context => _context; | |
| 4196 | 3974 |
| 4197 ElementKind get kind => ElementKind.HTML; | 3975 ElementKind get kind => ElementKind.HTML; |
| 4198 | 3976 |
| 4199 List<HtmlScriptElement> get scripts => _scripts; | 3977 List<HtmlScriptElement> get scripts => _scripts; |
| 4200 | 3978 |
| 4201 Source get source => _source; | 3979 int get hashCode => source.hashCode; |
| 4202 | |
| 4203 int get hashCode => _source.hashCode; | |
| 4204 | 3980 |
| 4205 /** | 3981 /** |
| 4206 * Set the scripts contained in the HTML file to the given scripts. | 3982 * Set the scripts contained in the HTML file to the given scripts. |
| 4207 * | 3983 * |
| 4208 * @param scripts the scripts | 3984 * @param scripts the scripts |
| 4209 */ | 3985 */ |
| 4210 void set scripts(List<HtmlScriptElement> scripts) { | 3986 void set scripts(List<HtmlScriptElement> scripts) { |
| 4211 if (scripts.length == 0) { | 3987 if (scripts.length == 0) { |
| 4212 scripts = HtmlScriptElementImpl.EMPTY_ARRAY; | 3988 scripts = HtmlScriptElementImpl.EMPTY_ARRAY; |
| 4213 } | 3989 } |
| 4214 for (HtmlScriptElement script in scripts) { | 3990 for (HtmlScriptElement script in scripts) { |
| 4215 (script as HtmlScriptElementImpl).enclosingElement = this; | 3991 (script as HtmlScriptElementImpl).enclosingElement = this; |
| 4216 } | 3992 } |
| 4217 this._scripts = scripts; | 3993 this._scripts = scripts; |
| 4218 } | 3994 } |
| 4219 | 3995 |
| 4220 /** | |
| 4221 * Set the source that corresponds to this HTML file to the given source. | |
| 4222 * | |
| 4223 * @param source the source that corresponds to this HTML file | |
| 4224 */ | |
| 4225 void set source(Source source) { | |
| 4226 this._source = source; | |
| 4227 } | |
| 4228 | |
| 4229 void visitChildren(ElementVisitor visitor) { | 3996 void visitChildren(ElementVisitor visitor) { |
| 4230 super.visitChildren(visitor); | 3997 super.visitChildren(visitor); |
| 4231 safelyVisitChildren(_scripts, visitor); | 3998 safelyVisitChildren(_scripts, visitor); |
| 4232 } | 3999 } |
| 4233 | 4000 |
| 4234 void appendTo(JavaStringBuilder builder) { | 4001 void appendTo(JavaStringBuilder builder) { |
| 4235 if (_source == null) { | 4002 if (source == null) { |
| 4236 builder.append("{HTML file}"); | 4003 builder.append("{HTML file}"); |
| 4237 } else { | 4004 } else { |
| 4238 builder.append(_source.fullName); | 4005 builder.append(source.fullName); |
| 4239 } | 4006 } |
| 4240 } | 4007 } |
| 4241 } | 4008 } |
| 4242 | 4009 |
| 4243 /** | 4010 /** |
| 4244 * Instances of the class `HtmlScriptElementImpl` implement an [HtmlScriptElemen
t]. | 4011 * Instances of the class `HtmlScriptElementImpl` implement an [HtmlScriptElemen
t]. |
| 4245 * | 4012 * |
| 4246 * @coverage dart.engine.element | 4013 * @coverage dart.engine.element |
| 4247 */ | 4014 */ |
| 4248 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl
ement { | 4015 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl
ement { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4267 class ImportElementImpl extends ElementImpl implements ImportElement { | 4034 class ImportElementImpl extends ElementImpl implements ImportElement { |
| 4268 /** | 4035 /** |
| 4269 * The offset of this directive, may be `-1` if synthetic. | 4036 * The offset of this directive, may be `-1` if synthetic. |
| 4270 */ | 4037 */ |
| 4271 int _offset = -1; | 4038 int _offset = -1; |
| 4272 | 4039 |
| 4273 /** | 4040 /** |
| 4274 * The offset of the character immediately following the last character of thi
s node's URI, may be | 4041 * The offset of the character immediately following the last character of thi
s node's URI, may be |
| 4275 * `-1` if synthetic. | 4042 * `-1` if synthetic. |
| 4276 */ | 4043 */ |
| 4277 int _uriEnd = -1; | 4044 int uriEnd = -1; |
| 4278 | 4045 |
| 4279 /** | 4046 /** |
| 4280 * The offset of the prefix of this import in the file that contains the this
import directive, or | 4047 * The offset of the prefix of this import in the file that contains the this
import directive, or |
| 4281 * `-1` if this import is synthetic. | 4048 * `-1` if this import is synthetic. |
| 4282 */ | 4049 */ |
| 4283 int _prefixOffset = 0; | 4050 int prefixOffset = 0; |
| 4284 | 4051 |
| 4285 /** | 4052 /** |
| 4286 * The URI that is specified by this directive. | 4053 * The URI that is specified by this directive. |
| 4287 */ | 4054 */ |
| 4288 String _uri; | 4055 String uri; |
| 4289 | 4056 |
| 4290 /** | 4057 /** |
| 4291 * The library that is imported into this library by this import directive. | 4058 * The library that is imported into this library by this import directive. |
| 4292 */ | 4059 */ |
| 4293 LibraryElement _importedLibrary; | 4060 LibraryElement importedLibrary; |
| 4294 | 4061 |
| 4295 /** | 4062 /** |
| 4296 * The combinators that were specified as part of the import directive in the
order in which they | 4063 * The combinators that were specified as part of the import directive in the
order in which they |
| 4297 * were specified. | 4064 * were specified. |
| 4298 */ | 4065 */ |
| 4299 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; | 4066 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY; |
| 4300 | 4067 |
| 4301 /** | 4068 /** |
| 4302 * The prefix that was specified as part of the import directive, or `null` if
there was no | 4069 * The prefix that was specified as part of the import directive, or `null` if
there was no |
| 4303 * prefix specified. | 4070 * prefix specified. |
| 4304 */ | 4071 */ |
| 4305 PrefixElement _prefix; | 4072 PrefixElement prefix; |
| 4306 | 4073 |
| 4307 /** | 4074 /** |
| 4308 * Initialize a newly created import element. | 4075 * Initialize a newly created import element. |
| 4309 */ | 4076 */ |
| 4310 ImportElementImpl() : super.con1(null); | 4077 ImportElementImpl() : super.con1(null); |
| 4311 | 4078 |
| 4312 accept(ElementVisitor visitor) => visitor.visitImportElement(this); | 4079 accept(ElementVisitor visitor) => visitor.visitImportElement(this); |
| 4313 | 4080 |
| 4314 List<NamespaceCombinator> get combinators => _combinators; | |
| 4315 | |
| 4316 LibraryElement get importedLibrary => _importedLibrary; | |
| 4317 | |
| 4318 ElementKind get kind => ElementKind.IMPORT; | 4081 ElementKind get kind => ElementKind.IMPORT; |
| 4319 | 4082 |
| 4320 PrefixElement get prefix => _prefix; | |
| 4321 | |
| 4322 int get prefixOffset => _prefixOffset; | |
| 4323 | |
| 4324 String get uri => _uri; | |
| 4325 | |
| 4326 int get uriEnd => _uriEnd; | |
| 4327 | |
| 4328 /** | |
| 4329 * Set the combinators that were specified as part of the import directive to
the given array of | |
| 4330 * combinators. | |
| 4331 * | |
| 4332 * @param combinators the combinators that were specified as part of the impor
t directive | |
| 4333 */ | |
| 4334 void set combinators(List<NamespaceCombinator> combinators) { | |
| 4335 this._combinators = combinators; | |
| 4336 } | |
| 4337 | |
| 4338 /** | |
| 4339 * Set the library that is imported into this library by this import directive
to the given | |
| 4340 * library. | |
| 4341 * | |
| 4342 * @param importedLibrary the library that is imported into this library | |
| 4343 */ | |
| 4344 void set importedLibrary(LibraryElement importedLibrary) { | |
| 4345 this._importedLibrary = importedLibrary; | |
| 4346 } | |
| 4347 | |
| 4348 /** | 4083 /** |
| 4349 * Set the offset of this directive. | 4084 * Set the offset of this directive. |
| 4350 */ | 4085 */ |
| 4351 void set offset(int offset) { | 4086 void set offset(int offset) { |
| 4352 this._offset = offset; | 4087 this._offset = offset; |
| 4353 } | 4088 } |
| 4354 | 4089 |
| 4355 /** | |
| 4356 * Set the prefix that was specified as part of the import directive to the gi
ven prefix. | |
| 4357 * | |
| 4358 * @param prefix the prefix that was specified as part of the import directive | |
| 4359 */ | |
| 4360 void set prefix(PrefixElement prefix) { | |
| 4361 this._prefix = prefix; | |
| 4362 } | |
| 4363 | |
| 4364 /** | |
| 4365 * Set the offset of the prefix of this import in the file that contains the t
his import | |
| 4366 * directive. | |
| 4367 */ | |
| 4368 void set prefixOffset(int prefixOffset) { | |
| 4369 this._prefixOffset = prefixOffset; | |
| 4370 } | |
| 4371 | |
| 4372 /** | |
| 4373 * Set the URI that is specified by this directive. | |
| 4374 * | |
| 4375 * @param uri the URI that is specified by this directive. | |
| 4376 */ | |
| 4377 void set uri(String uri) { | |
| 4378 this._uri = uri; | |
| 4379 } | |
| 4380 | |
| 4381 /** | |
| 4382 * Set the the offset of the character immediately following the last characte
r of this node's | |
| 4383 * URI. `-1` for synthetic import. | |
| 4384 */ | |
| 4385 void set uriEnd(int uriEnd) { | |
| 4386 this._uriEnd = uriEnd; | |
| 4387 } | |
| 4388 | |
| 4389 void visitChildren(ElementVisitor visitor) { | 4090 void visitChildren(ElementVisitor visitor) { |
| 4390 super.visitChildren(visitor); | 4091 super.visitChildren(visitor); |
| 4391 safelyVisitChild(_prefix, visitor); | 4092 safelyVisitChild(prefix, visitor); |
| 4392 } | 4093 } |
| 4393 | 4094 |
| 4394 void appendTo(JavaStringBuilder builder) { | 4095 void appendTo(JavaStringBuilder builder) { |
| 4395 builder.append("import "); | 4096 builder.append("import "); |
| 4396 (_importedLibrary as LibraryElementImpl).appendTo(builder); | 4097 (importedLibrary as LibraryElementImpl).appendTo(builder); |
| 4397 } | 4098 } |
| 4398 | 4099 |
| 4399 String get identifier => "${(_importedLibrary as LibraryElementImpl).identifie
r}@${_offset}"; | 4100 String get identifier => "${(importedLibrary as LibraryElementImpl).identifier
}@${_offset}"; |
| 4400 } | 4101 } |
| 4401 | 4102 |
| 4402 /** | 4103 /** |
| 4403 * Instances of the class `LabelElementImpl` implement a `LabelElement`. | 4104 * Instances of the class `LabelElementImpl` implement a `LabelElement`. |
| 4404 * | 4105 * |
| 4405 * @coverage dart.engine.element | 4106 * @coverage dart.engine.element |
| 4406 */ | 4107 */ |
| 4407 class LabelElementImpl extends ElementImpl implements LabelElement { | 4108 class LabelElementImpl extends ElementImpl implements LabelElement { |
| 4408 /** | 4109 /** |
| 4409 * A flag indicating whether this label is associated with a `switch` statemen
t. | 4110 * A flag indicating whether this label is associated with a `switch` statemen
t. |
| 4410 */ | 4111 */ |
| 4411 bool isOnSwitchStatement = false; | 4112 bool _onSwitchStatement = false; |
| 4412 | 4113 |
| 4413 /** | 4114 /** |
| 4414 * A flag indicating whether this label is associated with a `switch` member (
`case` | 4115 * A flag indicating whether this label is associated with a `switch` member (
`case` |
| 4415 * or `default`). | 4116 * or `default`). |
| 4416 */ | 4117 */ |
| 4417 bool isOnSwitchMember = false; | 4118 bool _onSwitchMember = false; |
| 4418 | 4119 |
| 4419 /** | 4120 /** |
| 4420 * An empty array of label elements. | 4121 * An empty array of label elements. |
| 4421 */ | 4122 */ |
| 4422 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); | 4123 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); |
| 4423 | 4124 |
| 4424 /** | 4125 /** |
| 4425 * Initialize a newly created label element to have the given name. | 4126 * Initialize a newly created label element to have the given name. |
| 4426 * | 4127 * |
| 4427 * @param name the name of this element | 4128 * @param name the name of this element |
| 4428 * @param onSwitchStatement `true` if this label is associated with a `switch` | 4129 * @param onSwitchStatement `true` if this label is associated with a `switch` |
| 4429 * statement | 4130 * statement |
| 4430 * @param onSwitchMember `true` if this label is associated with a `switch` me
mber | 4131 * @param onSwitchMember `true` if this label is associated with a `switch` me
mber |
| 4431 */ | 4132 */ |
| 4432 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember)
: super.con1(name) { | 4133 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember)
: super.con1(name) { |
| 4433 this.isOnSwitchStatement = onSwitchStatement; | 4134 this._onSwitchStatement = onSwitchStatement; |
| 4434 this.isOnSwitchMember = onSwitchMember; | 4135 this._onSwitchMember = onSwitchMember; |
| 4435 } | 4136 } |
| 4436 | 4137 |
| 4437 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); | 4138 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); |
| 4438 | 4139 |
| 4439 ExecutableElement get enclosingElement => super.enclosingElement as Executable
Element; | 4140 ExecutableElement get enclosingElement => super.enclosingElement as Executable
Element; |
| 4440 | 4141 |
| 4441 ElementKind get kind => ElementKind.LABEL; | 4142 ElementKind get kind => ElementKind.LABEL; |
| 4143 |
| 4144 /** |
| 4145 * Return `true` if this label is associated with a `switch` member (`case` or |
| 4146 * `default`). |
| 4147 * |
| 4148 * @return `true` if this label is associated with a `switch` member |
| 4149 */ |
| 4150 bool get isOnSwitchMember => _onSwitchMember; |
| 4151 |
| 4152 /** |
| 4153 * Return `true` if this label is associated with a `switch` statement. |
| 4154 * |
| 4155 * @return `true` if this label is associated with a `switch` statement |
| 4156 */ |
| 4157 bool get isOnSwitchStatement => _onSwitchStatement; |
| 4442 } | 4158 } |
| 4443 | 4159 |
| 4444 /** | 4160 /** |
| 4445 * Instances of the class `LibraryElementImpl` implement a `LibraryElement`. | 4161 * Instances of the class `LibraryElementImpl` implement a `LibraryElement`. |
| 4446 * | 4162 * |
| 4447 * @coverage dart.engine.element | 4163 * @coverage dart.engine.element |
| 4448 */ | 4164 */ |
| 4449 class LibraryElementImpl extends ElementImpl implements LibraryElement { | 4165 class LibraryElementImpl extends ElementImpl implements LibraryElement { |
| 4450 /** | 4166 /** |
| 4451 * An empty array of library elements. | 4167 * An empty array of library elements. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4480 return false; | 4196 return false; |
| 4481 } | 4197 } |
| 4482 } | 4198 } |
| 4483 } | 4199 } |
| 4484 return true; | 4200 return true; |
| 4485 } | 4201 } |
| 4486 | 4202 |
| 4487 /** | 4203 /** |
| 4488 * The analysis context in which this library is defined. | 4204 * The analysis context in which this library is defined. |
| 4489 */ | 4205 */ |
| 4490 AnalysisContext _context; | 4206 final AnalysisContext context; |
| 4491 | 4207 |
| 4492 /** | 4208 /** |
| 4493 * The compilation unit that defines this library. | 4209 * The compilation unit that defines this library. |
| 4494 */ | 4210 */ |
| 4495 CompilationUnitElement _definingCompilationUnit; | 4211 CompilationUnitElement _definingCompilationUnit; |
| 4496 | 4212 |
| 4497 /** | 4213 /** |
| 4498 * The entry point for this library, or `null` if this library does not have a
n entry point. | 4214 * The entry point for this library, or `null` if this library does not have a
n entry point. |
| 4499 */ | 4215 */ |
| 4500 FunctionElement _entryPoint; | 4216 FunctionElement entryPoint; |
| 4501 | 4217 |
| 4502 /** | 4218 /** |
| 4503 * An array containing specifications of all of the imports defined in this li
brary. | 4219 * An array containing specifications of all of the imports defined in this li
brary. |
| 4504 */ | 4220 */ |
| 4505 List<ImportElement> _imports = ImportElement.EMPTY_ARRAY; | 4221 List<ImportElement> _imports = ImportElement.EMPTY_ARRAY; |
| 4506 | 4222 |
| 4507 /** | 4223 /** |
| 4508 * An array containing specifications of all of the exports defined in this li
brary. | 4224 * An array containing specifications of all of the exports defined in this li
brary. |
| 4509 */ | 4225 */ |
| 4510 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; | 4226 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; |
| 4511 | 4227 |
| 4512 /** | 4228 /** |
| 4513 * An array containing all of the compilation units that are included in this
library using a | 4229 * An array containing all of the compilation units that are included in this
library using a |
| 4514 * `part` directive. | 4230 * `part` directive. |
| 4515 */ | 4231 */ |
| 4516 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; | 4232 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; |
| 4517 | 4233 |
| 4518 /** | 4234 /** |
| 4519 * Initialize a newly created library element to have the given name. | 4235 * Initialize a newly created library element to have the given name. |
| 4520 * | 4236 * |
| 4521 * @param context the analysis context in which the library is defined | 4237 * @param context the analysis context in which the library is defined |
| 4522 * @param name the name of this element | 4238 * @param name the name of this element |
| 4523 */ | 4239 */ |
| 4524 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co
n1(name) { | 4240 LibraryElementImpl(this.context, LibraryIdentifier name) : super.con1(name); |
| 4525 this._context = context; | |
| 4526 } | |
| 4527 | 4241 |
| 4528 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); | 4242 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); |
| 4529 | 4243 |
| 4530 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _definingCompilationUnit == (object as LibraryElementImpl).definingC
ompilationUnit; | 4244 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _definingCompilationUnit == (object as LibraryElementImpl).definingC
ompilationUnit; |
| 4531 | 4245 |
| 4532 ElementImpl getChild(String identifier) { | 4246 ElementImpl getChild(String identifier) { |
| 4533 if ((_definingCompilationUnit as CompilationUnitElementImpl).identifier == i
dentifier) { | 4247 if ((_definingCompilationUnit as CompilationUnitElementImpl).identifier == i
dentifier) { |
| 4534 return _definingCompilationUnit as CompilationUnitElementImpl; | 4248 return _definingCompilationUnit as CompilationUnitElementImpl; |
| 4535 } | 4249 } |
| 4536 for (CompilationUnitElement part in _parts) { | 4250 for (CompilationUnitElement part in _parts) { |
| 4537 if ((part as CompilationUnitElementImpl).identifier == identifier) { | 4251 if ((part as CompilationUnitElementImpl).identifier == identifier) { |
| 4538 return part as CompilationUnitElementImpl; | 4252 return part as CompilationUnitElementImpl; |
| 4539 } | 4253 } |
| 4540 } | 4254 } |
| 4541 for (ImportElement importElement in _imports) { | 4255 for (ImportElement importElement in _imports) { |
| 4542 if ((importElement as ImportElementImpl).identifier == identifier) { | 4256 if ((importElement as ImportElementImpl).identifier == identifier) { |
| 4543 return importElement as ImportElementImpl; | 4257 return importElement as ImportElementImpl; |
| 4544 } | 4258 } |
| 4545 } | 4259 } |
| 4546 for (ExportElement exportElement in _exports) { | 4260 for (ExportElement exportElement in _exports) { |
| 4547 if ((exportElement as ExportElementImpl).identifier == identifier) { | 4261 if ((exportElement as ExportElementImpl).identifier == identifier) { |
| 4548 return exportElement as ExportElementImpl; | 4262 return exportElement as ExportElementImpl; |
| 4549 } | 4263 } |
| 4550 } | 4264 } |
| 4551 return null; | 4265 return null; |
| 4552 } | 4266 } |
| 4553 | 4267 |
| 4554 AnalysisContext get context => _context; | |
| 4555 | |
| 4556 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit
; | 4268 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit
; |
| 4557 | 4269 |
| 4558 FunctionElement get entryPoint => _entryPoint; | |
| 4559 | |
| 4560 List<LibraryElement> get exportedLibraries { | 4270 List<LibraryElement> get exportedLibraries { |
| 4561 Set<LibraryElement> libraries = new Set<LibraryElement>(); | 4271 Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| 4562 for (ExportElement element in _exports) { | 4272 for (ExportElement element in _exports) { |
| 4563 LibraryElement library = element.exportedLibrary; | 4273 LibraryElement library = element.exportedLibrary; |
| 4564 if (library != null) { | 4274 if (library != null) { |
| 4565 libraries.add(library); | 4275 libraries.add(library); |
| 4566 } | 4276 } |
| 4567 } | 4277 } |
| 4568 return new List.from(libraries); | 4278 return new List.from(libraries); |
| 4569 } | 4279 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4616 type = part.getType(className); | 4326 type = part.getType(className); |
| 4617 if (type != null) { | 4327 if (type != null) { |
| 4618 return type; | 4328 return type; |
| 4619 } | 4329 } |
| 4620 } | 4330 } |
| 4621 return null; | 4331 return null; |
| 4622 } | 4332 } |
| 4623 | 4333 |
| 4624 int get hashCode => _definingCompilationUnit.hashCode; | 4334 int get hashCode => _definingCompilationUnit.hashCode; |
| 4625 | 4335 |
| 4626 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr
ary; | 4336 bool get isBrowserApplication => entryPoint != null && isOrImportsBrowserLibra
ry; |
| 4627 | 4337 |
| 4628 bool get isDartCore => name == "dart.core"; | 4338 bool get isDartCore => name == "dart.core"; |
| 4629 | 4339 |
| 4630 bool get isInSdk => name.startsWith("dart."); | 4340 bool get isInSdk => name.startsWith("dart."); |
| 4631 | 4341 |
| 4632 bool isUpToDate2(int timeStamp) { | 4342 bool isUpToDate2(int timeStamp) { |
| 4633 Set<LibraryElement> visitedLibraries = new Set(); | 4343 Set<LibraryElement> visitedLibraries = new Set(); |
| 4634 return isUpToDate(this, timeStamp, visitedLibraries); | 4344 return isUpToDate(this, timeStamp, visitedLibraries); |
| 4635 } | 4345 } |
| 4636 | 4346 |
| 4637 /** | 4347 /** |
| 4638 * Set the compilation unit that defines this library to the given compilation
unit. | 4348 * Set the compilation unit that defines this library to the given compilation
unit. |
| 4639 * | 4349 * |
| 4640 * @param definingCompilationUnit the compilation unit that defines this libra
ry | 4350 * @param definingCompilationUnit the compilation unit that defines this libra
ry |
| 4641 */ | 4351 */ |
| 4642 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni
t) { | 4352 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni
t) { |
| 4643 (definingCompilationUnit as CompilationUnitElementImpl).enclosingElement = t
his; | 4353 (definingCompilationUnit as CompilationUnitElementImpl).enclosingElement = t
his; |
| 4644 this._definingCompilationUnit = definingCompilationUnit; | 4354 this._definingCompilationUnit = definingCompilationUnit; |
| 4645 } | 4355 } |
| 4646 | 4356 |
| 4647 /** | 4357 /** |
| 4648 * Set the entry point for this library to the given function. | |
| 4649 * | |
| 4650 * @param entryPoint the entry point for this library | |
| 4651 */ | |
| 4652 void set entryPoint(FunctionElement entryPoint) { | |
| 4653 this._entryPoint = entryPoint; | |
| 4654 } | |
| 4655 | |
| 4656 /** | |
| 4657 * Set the specifications of all of the exports defined in this library to the
given array. | 4358 * Set the specifications of all of the exports defined in this library to the
given array. |
| 4658 * | 4359 * |
| 4659 * @param exports the specifications of all of the exports defined in this lib
rary | 4360 * @param exports the specifications of all of the exports defined in this lib
rary |
| 4660 */ | 4361 */ |
| 4661 void set exports(List<ExportElement> exports) { | 4362 void set exports(List<ExportElement> exports) { |
| 4662 for (ExportElement exportElement in exports) { | 4363 for (ExportElement exportElement in exports) { |
| 4663 (exportElement as ExportElementImpl).enclosingElement = this; | 4364 (exportElement as ExportElementImpl).enclosingElement = this; |
| 4664 } | 4365 } |
| 4665 this._exports = exports; | 4366 this._exports = exports; |
| 4666 } | 4367 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4704 | 4405 |
| 4705 String get identifier => _definingCompilationUnit.source.encoding; | 4406 String get identifier => _definingCompilationUnit.source.encoding; |
| 4706 | 4407 |
| 4707 /** | 4408 /** |
| 4708 * Answer `true` if the receiver directly or indirectly imports the dart:html
libraries. | 4409 * Answer `true` if the receiver directly or indirectly imports the dart:html
libraries. |
| 4709 * | 4410 * |
| 4710 * @return `true` if the receiver directly or indirectly imports the dart:html
libraries | 4411 * @return `true` if the receiver directly or indirectly imports the dart:html
libraries |
| 4711 */ | 4412 */ |
| 4712 bool get isOrImportsBrowserLibrary { | 4413 bool get isOrImportsBrowserLibrary { |
| 4713 List<LibraryElement> visited = new List<LibraryElement>(); | 4414 List<LibraryElement> visited = new List<LibraryElement>(); |
| 4714 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); | 4415 Source htmlLibSource = context.sourceFactory.forUri(DartSdk.DART_HTML); |
| 4715 visited.add(this); | 4416 visited.add(this); |
| 4716 for (int index = 0; index < visited.length; index++) { | 4417 for (int index = 0; index < visited.length; index++) { |
| 4717 LibraryElement library = visited[index]; | 4418 LibraryElement library = visited[index]; |
| 4718 Source source = library.definingCompilationUnit.source; | 4419 Source source = library.definingCompilationUnit.source; |
| 4719 if (source == htmlLibSource) { | 4420 if (source == htmlLibSource) { |
| 4720 return true; | 4421 return true; |
| 4721 } | 4422 } |
| 4722 for (LibraryElement importedLibrary in library.importedLibraries) { | 4423 for (LibraryElement importedLibrary in library.importedLibraries) { |
| 4723 if (!visited.contains(importedLibrary)) { | 4424 if (!visited.contains(importedLibrary)) { |
| 4724 visited.add(importedLibrary); | 4425 visited.add(importedLibrary); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4978 | 4679 |
| 4979 /** | 4680 /** |
| 4980 * Add the given element to the list of elements. If the element is a multiply
-defined element, | 4681 * Add the given element to the list of elements. If the element is a multiply
-defined element, |
| 4981 * add all of the conflicting elements that it represents. | 4682 * add all of the conflicting elements that it represents. |
| 4982 * | 4683 * |
| 4983 * @param elements the list to which the element(s) are to be added | 4684 * @param elements the list to which the element(s) are to be added |
| 4984 * @param element the element(s) to be added | 4685 * @param element the element(s) to be added |
| 4985 */ | 4686 */ |
| 4986 static void add(Set<Element> elements, Element element) { | 4687 static void add(Set<Element> elements, Element element) { |
| 4987 if (element is MultiplyDefinedElementImpl) { | 4688 if (element is MultiplyDefinedElementImpl) { |
| 4988 for (Element conflictingElement in (element as MultiplyDefinedElementImpl)
._conflictingElements) { | 4689 for (Element conflictingElement in (element as MultiplyDefinedElementImpl)
.conflictingElements) { |
| 4989 elements.add(conflictingElement); | 4690 elements.add(conflictingElement); |
| 4990 } | 4691 } |
| 4991 } else { | 4692 } else { |
| 4992 elements.add(element); | 4693 elements.add(element); |
| 4993 } | 4694 } |
| 4994 } | 4695 } |
| 4995 | 4696 |
| 4996 /** | 4697 /** |
| 4997 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given | 4698 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given |
| 4998 * elements are multiply-defined elements then the conflicting elements they r
epresent will be | 4699 * elements are multiply-defined elements then the conflicting elements they r
epresent will be |
| 4999 * included in the array. Otherwise, the element itself will be included. | 4700 * included in the array. Otherwise, the element itself will be included. |
| 5000 * | 4701 * |
| 5001 * @param firstElement the first element to be included | 4702 * @param firstElement the first element to be included |
| 5002 * @param secondElement the second element to be included | 4703 * @param secondElement the second element to be included |
| 5003 * @return an array containing all of the conflicting elements | 4704 * @return an array containing all of the conflicting elements |
| 5004 */ | 4705 */ |
| 5005 static List<Element> computeConflictingElements(Element firstElement, Element
secondElement) { | 4706 static List<Element> computeConflictingElements(Element firstElement, Element
secondElement) { |
| 5006 Set<Element> elements = new Set<Element>(); | 4707 Set<Element> elements = new Set<Element>(); |
| 5007 add(elements, firstElement); | 4708 add(elements, firstElement); |
| 5008 add(elements, secondElement); | 4709 add(elements, secondElement); |
| 5009 return new List.from(elements); | 4710 return new List.from(elements); |
| 5010 } | 4711 } |
| 5011 | 4712 |
| 5012 /** | 4713 /** |
| 5013 * The analysis context in which the multiply defined elements are defined. | 4714 * The analysis context in which the multiply defined elements are defined. |
| 5014 */ | 4715 */ |
| 5015 AnalysisContext _context; | 4716 final AnalysisContext context; |
| 5016 | 4717 |
| 5017 /** | 4718 /** |
| 5018 * The name of the conflicting elements. | 4719 * The name of the conflicting elements. |
| 5019 */ | 4720 */ |
| 5020 String _name; | 4721 String _name; |
| 5021 | 4722 |
| 5022 /** | 4723 /** |
| 5023 * A list containing all of the elements that conflict. | 4724 * A list containing all of the elements that conflict. |
| 5024 */ | 4725 */ |
| 5025 List<Element> _conflictingElements; | 4726 final List<Element> conflictingElements; |
| 5026 | 4727 |
| 5027 /** | 4728 /** |
| 5028 * Initialize a newly created element to represent a list of conflicting eleme
nts. | 4729 * Initialize a newly created element to represent a list of conflicting eleme
nts. |
| 5029 * | 4730 * |
| 5030 * @param context the analysis context in which the multiply defined elements
are defined | 4731 * @param context the analysis context in which the multiply defined elements
are defined |
| 5031 * @param conflictingElements the elements that conflict | 4732 * @param conflictingElements the elements that conflict |
| 5032 */ | 4733 */ |
| 5033 MultiplyDefinedElementImpl(AnalysisContext context, List<Element> conflictingE
lements) { | 4734 MultiplyDefinedElementImpl(this.context, this.conflictingElements) { |
| 5034 this._context = context; | |
| 5035 _name = conflictingElements[0].name; | 4735 _name = conflictingElements[0].name; |
| 5036 this._conflictingElements = conflictingElements; | |
| 5037 } | 4736 } |
| 5038 | 4737 |
| 5039 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 4738 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
| 5040 | 4739 |
| 5041 String computeDocumentationComment() => null; | 4740 String computeDocumentationComment() => null; |
| 5042 | 4741 |
| 5043 Element getAncestor(Type elementClass) => null; | 4742 Element getAncestor(Type elementClass) => null; |
| 5044 | 4743 |
| 5045 List<Element> get conflictingElements => _conflictingElements; | |
| 5046 | |
| 5047 AnalysisContext get context => _context; | |
| 5048 | |
| 5049 String get displayName => _name; | 4744 String get displayName => _name; |
| 5050 | 4745 |
| 5051 Element get enclosingElement => null; | 4746 Element get enclosingElement => null; |
| 5052 | 4747 |
| 5053 ElementKind get kind => ElementKind.ERROR; | 4748 ElementKind get kind => ElementKind.ERROR; |
| 5054 | 4749 |
| 5055 LibraryElement get library => null; | 4750 LibraryElement get library => null; |
| 5056 | 4751 |
| 5057 ElementLocation get location => null; | 4752 ElementLocation get location => null; |
| 5058 | 4753 |
| 5059 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY; | 4754 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY; |
| 5060 | 4755 |
| 5061 String get name => _name; | 4756 String get name => _name; |
| 5062 | 4757 |
| 5063 int get nameOffset => -1; | 4758 int get nameOffset => -1; |
| 5064 | 4759 |
| 5065 Source get source => null; | 4760 Source get source => null; |
| 5066 | 4761 |
| 5067 Type2 get type => DynamicTypeImpl.instance; | 4762 Type2 get type => DynamicTypeImpl.instance; |
| 5068 | 4763 |
| 5069 bool isAccessibleIn(LibraryElement library) { | 4764 bool isAccessibleIn(LibraryElement library) { |
| 5070 for (Element element in _conflictingElements) { | 4765 for (Element element in conflictingElements) { |
| 5071 if (element.isAccessibleIn(library)) { | 4766 if (element.isAccessibleIn(library)) { |
| 5072 return true; | 4767 return true; |
| 5073 } | 4768 } |
| 5074 } | 4769 } |
| 5075 return false; | 4770 return false; |
| 5076 } | 4771 } |
| 5077 | 4772 |
| 5078 bool get isDeprecated => false; | 4773 bool get isDeprecated => false; |
| 5079 | 4774 |
| 5080 bool get isSynthetic => true; | 4775 bool get isSynthetic => true; |
| 5081 | 4776 |
| 5082 String toString() { | 4777 String toString() { |
| 5083 JavaStringBuilder builder = new JavaStringBuilder(); | 4778 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5084 builder.append("["); | 4779 builder.append("["); |
| 5085 int count = _conflictingElements.length; | 4780 int count = conflictingElements.length; |
| 5086 for (int i = 0; i < count; i++) { | 4781 for (int i = 0; i < count; i++) { |
| 5087 if (i > 0) { | 4782 if (i > 0) { |
| 5088 builder.append(", "); | 4783 builder.append(", "); |
| 5089 } | 4784 } |
| 5090 (_conflictingElements[i] as ElementImpl).appendTo(builder); | 4785 (conflictingElements[i] as ElementImpl).appendTo(builder); |
| 5091 } | 4786 } |
| 5092 builder.append("]"); | 4787 builder.append("]"); |
| 5093 return builder.toString(); | 4788 return builder.toString(); |
| 5094 } | 4789 } |
| 5095 | 4790 |
| 5096 void visitChildren(ElementVisitor visitor) { | 4791 void visitChildren(ElementVisitor visitor) { |
| 5097 } | 4792 } |
| 5098 } | 4793 } |
| 5099 | 4794 |
| 5100 /** | 4795 /** |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5115 | 4810 |
| 5116 /** | 4811 /** |
| 5117 * An array containing all of the parameters defined by this parameter element
. There will only be | 4812 * An array containing all of the parameters defined by this parameter element
. There will only be |
| 5118 * parameters if this parameter is a function typed parameter. | 4813 * parameters if this parameter is a function typed parameter. |
| 5119 */ | 4814 */ |
| 5120 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 4815 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 5121 | 4816 |
| 5122 /** | 4817 /** |
| 5123 * The kind of this parameter. | 4818 * The kind of this parameter. |
| 5124 */ | 4819 */ |
| 5125 ParameterKind _parameterKind; | 4820 ParameterKind parameterKind; |
| 5126 | 4821 |
| 5127 /** | 4822 /** |
| 5128 * The offset to the beginning of the default value range for this element. | 4823 * The offset to the beginning of the default value range for this element. |
| 5129 */ | 4824 */ |
| 5130 int _defaultValueRangeOffset = 0; | 4825 int _defaultValueRangeOffset = 0; |
| 5131 | 4826 |
| 5132 /** | 4827 /** |
| 5133 * The length of the default value range for this element, or `-1` if this ele
ment does not | 4828 * The length of the default value range for this element, or `-1` if this ele
ment does not |
| 5134 * have a default value. | 4829 * have a default value. |
| 5135 */ | 4830 */ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5171 | 4866 |
| 5172 SourceRange get defaultValueRange { | 4867 SourceRange get defaultValueRange { |
| 5173 if (_defaultValueRangeLength < 0) { | 4868 if (_defaultValueRangeLength < 0) { |
| 5174 return null; | 4869 return null; |
| 5175 } | 4870 } |
| 5176 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength); | 4871 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength); |
| 5177 } | 4872 } |
| 5178 | 4873 |
| 5179 ElementKind get kind => ElementKind.PARAMETER; | 4874 ElementKind get kind => ElementKind.PARAMETER; |
| 5180 | 4875 |
| 5181 ParameterKind get parameterKind => _parameterKind; | |
| 5182 | |
| 5183 List<ParameterElement> get parameters => _parameters; | 4876 List<ParameterElement> get parameters => _parameters; |
| 5184 | 4877 |
| 5185 SourceRange get visibleRange { | 4878 SourceRange get visibleRange { |
| 5186 if (_visibleRangeLength < 0) { | 4879 if (_visibleRangeLength < 0) { |
| 5187 return null; | 4880 return null; |
| 5188 } | 4881 } |
| 5189 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4882 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 5190 } | 4883 } |
| 5191 | 4884 |
| 5192 bool get isInitializingFormal => false; | 4885 bool get isInitializingFormal => false; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5216 * @param offset the offset to the beginning of the default value range for th
is element | 4909 * @param offset the offset to the beginning of the default value range for th
is element |
| 5217 * @param length the length of the default value range for this element, or `-
1` if this | 4910 * @param length the length of the default value range for this element, or `-
1` if this |
| 5218 * element does not have a default value | 4911 * element does not have a default value |
| 5219 */ | 4912 */ |
| 5220 void setDefaultValueRange(int offset, int length) { | 4913 void setDefaultValueRange(int offset, int length) { |
| 5221 _defaultValueRangeOffset = offset; | 4914 _defaultValueRangeOffset = offset; |
| 5222 _defaultValueRangeLength = length; | 4915 _defaultValueRangeLength = length; |
| 5223 } | 4916 } |
| 5224 | 4917 |
| 5225 /** | 4918 /** |
| 5226 * Set the kind of this parameter to the given kind. | |
| 5227 * | |
| 5228 * @param parameterKind the new kind of this parameter | |
| 5229 */ | |
| 5230 void set parameterKind(ParameterKind parameterKind) { | |
| 5231 this._parameterKind = parameterKind; | |
| 5232 } | |
| 5233 | |
| 5234 /** | |
| 5235 * Set the parameters defined by this executable element to the given paramete
rs. | 4919 * Set the parameters defined by this executable element to the given paramete
rs. |
| 5236 * | 4920 * |
| 5237 * @param parameters the parameters defined by this executable element | 4921 * @param parameters the parameters defined by this executable element |
| 5238 */ | 4922 */ |
| 5239 void set parameters(List<ParameterElement> parameters) { | 4923 void set parameters(List<ParameterElement> parameters) { |
| 5240 for (ParameterElement parameter in parameters) { | 4924 for (ParameterElement parameter in parameters) { |
| 5241 (parameter as ParameterElementImpl).enclosingElement = this; | 4925 (parameter as ParameterElementImpl).enclosingElement = this; |
| 5242 } | 4926 } |
| 5243 this._parameters = parameters; | 4927 this._parameters = parameters; |
| 5244 } | 4928 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5336 /** | 5020 /** |
| 5337 * Instances of the class `PropertyAccessorElementImpl` implement a | 5021 * Instances of the class `PropertyAccessorElementImpl` implement a |
| 5338 * `PropertyAccessorElement`. | 5022 * `PropertyAccessorElement`. |
| 5339 * | 5023 * |
| 5340 * @coverage dart.engine.element | 5024 * @coverage dart.engine.element |
| 5341 */ | 5025 */ |
| 5342 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
rtyAccessorElement { | 5026 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
rtyAccessorElement { |
| 5343 /** | 5027 /** |
| 5344 * The variable associated with this accessor. | 5028 * The variable associated with this accessor. |
| 5345 */ | 5029 */ |
| 5346 PropertyInducingElement _variable; | 5030 PropertyInducingElement variable; |
| 5347 | 5031 |
| 5348 /** | 5032 /** |
| 5349 * An empty array of property accessor elements. | 5033 * An empty array of property accessor elements. |
| 5350 */ | 5034 */ |
| 5351 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl
ement>(0); | 5035 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl
ement>(0); |
| 5352 | 5036 |
| 5353 /** | 5037 /** |
| 5354 * Initialize a newly created property accessor element to have the given name
. | 5038 * Initialize a newly created property accessor element to have the given name
. |
| 5355 * | 5039 * |
| 5356 * @param name the name of this element | 5040 * @param name the name of this element |
| 5357 */ | 5041 */ |
| 5358 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name); | 5042 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name); |
| 5359 | 5043 |
| 5360 /** | 5044 /** |
| 5361 * Initialize a newly created synthetic property accessor element to be associ
ated with the given | 5045 * Initialize a newly created synthetic property accessor element to be associ
ated with the given |
| 5362 * variable. | 5046 * variable. |
| 5363 * | 5047 * |
| 5364 * @param variable the variable with which this access is associated | 5048 * @param variable the variable with which this access is associated |
| 5365 */ | 5049 */ |
| 5366 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable) : super
.con2(variable.name, variable.nameOffset) { | 5050 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable) : super
.con2(variable.name, variable.nameOffset) { |
| 5367 this._variable = variable; | 5051 this.variable = variable; |
| 5368 synthetic = true; | 5052 synthetic = true; |
| 5369 } | 5053 } |
| 5370 | 5054 |
| 5371 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 5055 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
| 5372 | 5056 |
| 5373 bool operator ==(Object object) => super == object && identical(isGetter, (obj
ect as PropertyAccessorElement).isGetter); | 5057 bool operator ==(Object object) => super == object && identical(isGetter, (obj
ect as PropertyAccessorElement).isGetter); |
| 5374 | 5058 |
| 5375 PropertyAccessorElement get correspondingGetter { | 5059 PropertyAccessorElement get correspondingGetter { |
| 5376 if (isGetter || _variable == null) { | 5060 if (isGetter || variable == null) { |
| 5377 return null; | 5061 return null; |
| 5378 } | 5062 } |
| 5379 return _variable.getter; | 5063 return variable.getter; |
| 5380 } | 5064 } |
| 5381 | 5065 |
| 5382 PropertyAccessorElement get correspondingSetter { | 5066 PropertyAccessorElement get correspondingSetter { |
| 5383 if (isSetter || _variable == null) { | 5067 if (isSetter || variable == null) { |
| 5384 return null; | 5068 return null; |
| 5385 } | 5069 } |
| 5386 return _variable.setter; | 5070 return variable.setter; |
| 5387 } | 5071 } |
| 5388 | 5072 |
| 5389 ElementKind get kind { | 5073 ElementKind get kind { |
| 5390 if (isGetter) { | 5074 if (isGetter) { |
| 5391 return ElementKind.GETTER; | 5075 return ElementKind.GETTER; |
| 5392 } | 5076 } |
| 5393 return ElementKind.SETTER; | 5077 return ElementKind.SETTER; |
| 5394 } | 5078 } |
| 5395 | 5079 |
| 5396 String get name { | 5080 String get name { |
| 5397 if (isSetter) { | 5081 if (isSetter) { |
| 5398 return "${super.name}="; | 5082 return "${super.name}="; |
| 5399 } | 5083 } |
| 5400 return super.name; | 5084 return super.name; |
| 5401 } | 5085 } |
| 5402 | 5086 |
| 5403 PropertyInducingElement get variable => _variable; | |
| 5404 | |
| 5405 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 5087 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 5406 | 5088 |
| 5407 bool get isGetter => hasModifier(Modifier.GETTER); | 5089 bool get isGetter => hasModifier(Modifier.GETTER); |
| 5408 | 5090 |
| 5409 bool get isSetter => hasModifier(Modifier.SETTER); | 5091 bool get isSetter => hasModifier(Modifier.SETTER); |
| 5410 | 5092 |
| 5411 bool get isStatic => hasModifier(Modifier.STATIC); | 5093 bool get isStatic => hasModifier(Modifier.STATIC); |
| 5412 | 5094 |
| 5413 /** | 5095 /** |
| 5414 * Set whether this accessor is abstract to correspond to the given value. | 5096 * Set whether this accessor is abstract to correspond to the given value. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5439 | 5121 |
| 5440 /** | 5122 /** |
| 5441 * Set whether this accessor is static to correspond to the given value. | 5123 * Set whether this accessor is static to correspond to the given value. |
| 5442 * | 5124 * |
| 5443 * @param isStatic `true` if the accessor is static | 5125 * @param isStatic `true` if the accessor is static |
| 5444 */ | 5126 */ |
| 5445 void set static(bool isStatic) { | 5127 void set static(bool isStatic) { |
| 5446 setModifier(Modifier.STATIC, isStatic); | 5128 setModifier(Modifier.STATIC, isStatic); |
| 5447 } | 5129 } |
| 5448 | 5130 |
| 5449 /** | |
| 5450 * Set the variable associated with this accessor to the given variable. | |
| 5451 * | |
| 5452 * @param variable the variable associated with this accessor | |
| 5453 */ | |
| 5454 void set variable(PropertyInducingElement variable) { | |
| 5455 this._variable = variable; | |
| 5456 } | |
| 5457 | |
| 5458 void appendTo(JavaStringBuilder builder) { | 5131 void appendTo(JavaStringBuilder builder) { |
| 5459 builder.append(isGetter ? "get " : "set "); | 5132 builder.append(isGetter ? "get " : "set "); |
| 5460 builder.append(variable.displayName); | 5133 builder.append(variable.displayName); |
| 5461 super.appendTo(builder); | 5134 super.appendTo(builder); |
| 5462 } | 5135 } |
| 5463 } | 5136 } |
| 5464 | 5137 |
| 5465 /** | 5138 /** |
| 5466 * Instances of the class `PropertyInducingElementImpl` implement a | 5139 * Instances of the class `PropertyInducingElementImpl` implement a |
| 5467 * `PropertyInducingElement`. | 5140 * `PropertyInducingElement`. |
| 5468 * | 5141 * |
| 5469 * @coverage dart.engine.element | 5142 * @coverage dart.engine.element |
| 5470 */ | 5143 */ |
| 5471 abstract class PropertyInducingElementImpl extends VariableElementImpl implement
s PropertyInducingElement { | 5144 abstract class PropertyInducingElementImpl extends VariableElementImpl implement
s PropertyInducingElement { |
| 5472 /** | 5145 /** |
| 5473 * The getter associated with this element. | 5146 * The getter associated with this element. |
| 5474 */ | 5147 */ |
| 5475 PropertyAccessorElement _getter; | 5148 PropertyAccessorElement getter; |
| 5476 | 5149 |
| 5477 /** | 5150 /** |
| 5478 * The setter associated with this element, or `null` if the element is effect
ively | 5151 * The setter associated with this element, or `null` if the element is effect
ively |
| 5479 * `final` and therefore does not have a setter associated with it. | 5152 * `final` and therefore does not have a setter associated with it. |
| 5480 */ | 5153 */ |
| 5481 PropertyAccessorElement _setter; | 5154 PropertyAccessorElement setter; |
| 5482 | 5155 |
| 5483 /** | 5156 /** |
| 5484 * An empty array of elements. | 5157 * An empty array of elements. |
| 5485 */ | 5158 */ |
| 5486 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl
ement>(0); | 5159 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl
ement>(0); |
| 5487 | 5160 |
| 5488 /** | 5161 /** |
| 5489 * Initialize a newly created element to have the given name. | 5162 * Initialize a newly created element to have the given name. |
| 5490 * | 5163 * |
| 5491 * @param name the name of this element | 5164 * @param name the name of this element |
| 5492 */ | 5165 */ |
| 5493 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name); | 5166 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name); |
| 5494 | 5167 |
| 5495 /** | 5168 /** |
| 5496 * Initialize a newly created synthetic element to have the given name. | 5169 * Initialize a newly created synthetic element to have the given name. |
| 5497 * | 5170 * |
| 5498 * @param name the name of this element | 5171 * @param name the name of this element |
| 5499 */ | 5172 */ |
| 5500 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { | 5173 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { |
| 5501 synthetic = true; | 5174 synthetic = true; |
| 5502 } | 5175 } |
| 5503 | |
| 5504 PropertyAccessorElement get getter => _getter; | |
| 5505 | |
| 5506 PropertyAccessorElement get setter => _setter; | |
| 5507 | |
| 5508 /** | |
| 5509 * Set the getter associated with this element to the given accessor. | |
| 5510 * | |
| 5511 * @param getter the getter associated with this element | |
| 5512 */ | |
| 5513 void set getter(PropertyAccessorElement getter) { | |
| 5514 this._getter = getter; | |
| 5515 } | |
| 5516 | |
| 5517 /** | |
| 5518 * Set the setter associated with this element to the given accessor. | |
| 5519 * | |
| 5520 * @param setter the setter associated with this element | |
| 5521 */ | |
| 5522 void set setter(PropertyAccessorElement setter) { | |
| 5523 this._setter = setter; | |
| 5524 } | |
| 5525 } | 5176 } |
| 5526 | 5177 |
| 5527 /** | 5178 /** |
| 5528 * Instances of the class `ShowElementCombinatorImpl` implement a | 5179 * Instances of the class `ShowElementCombinatorImpl` implement a |
| 5529 * [ShowElementCombinator]. | 5180 * [ShowElementCombinator]. |
| 5530 * | 5181 * |
| 5531 * @coverage dart.engine.element | 5182 * @coverage dart.engine.element |
| 5532 */ | 5183 */ |
| 5533 class ShowElementCombinatorImpl implements ShowElementCombinator { | 5184 class ShowElementCombinatorImpl implements ShowElementCombinator { |
| 5534 /** | 5185 /** |
| 5535 * The names that are to be made visible in the importing library if they are
defined in the | 5186 * The names that are to be made visible in the importing library if they are
defined in the |
| 5536 * imported library. | 5187 * imported library. |
| 5537 */ | 5188 */ |
| 5538 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; | 5189 List<String> shownNames = StringUtilities.EMPTY_ARRAY; |
| 5539 | 5190 |
| 5540 /** | 5191 /** |
| 5541 * The offset of the character immediately following the last character of thi
s node. | 5192 * The offset of the character immediately following the last character of thi
s node. |
| 5542 */ | 5193 */ |
| 5543 int _end = -1; | 5194 int end = -1; |
| 5544 | 5195 |
| 5545 /** | 5196 /** |
| 5546 * The offset of the 'show' keyword of this element. | 5197 * The offset of the 'show' keyword of this element. |
| 5547 */ | 5198 */ |
| 5548 int _offset = 0; | 5199 int offset = 0; |
| 5549 | |
| 5550 int get end => _end; | |
| 5551 | |
| 5552 int get offset => _offset; | |
| 5553 | |
| 5554 List<String> get shownNames => _shownNames; | |
| 5555 | |
| 5556 /** | |
| 5557 * Set the the offset of the character immediately following the last characte
r of this node. | |
| 5558 */ | |
| 5559 void set end(int endOffset) { | |
| 5560 this._end = endOffset; | |
| 5561 } | |
| 5562 | |
| 5563 /** | |
| 5564 * Sets the offset of the 'show' keyword of this directive. | |
| 5565 */ | |
| 5566 void set offset(int offset) { | |
| 5567 this._offset = offset; | |
| 5568 } | |
| 5569 | |
| 5570 /** | |
| 5571 * Set the names that are to be made visible in the importing library if they
are defined in the | |
| 5572 * imported library to the given names. | |
| 5573 * | |
| 5574 * @param shownNames the names that are to be made visible in the importing li
brary | |
| 5575 */ | |
| 5576 void set shownNames(List<String> shownNames) { | |
| 5577 this._shownNames = shownNames; | |
| 5578 } | |
| 5579 | 5200 |
| 5580 String toString() { | 5201 String toString() { |
| 5581 JavaStringBuilder builder = new JavaStringBuilder(); | 5202 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5582 builder.append("show "); | 5203 builder.append("show "); |
| 5583 int count = _shownNames.length; | 5204 int count = shownNames.length; |
| 5584 for (int i = 0; i < count; i++) { | 5205 for (int i = 0; i < count; i++) { |
| 5585 if (i > 0) { | 5206 if (i > 0) { |
| 5586 builder.append(", "); | 5207 builder.append(", "); |
| 5587 } | 5208 } |
| 5588 builder.append(_shownNames[i]); | 5209 builder.append(shownNames[i]); |
| 5589 } | 5210 } |
| 5590 return builder.toString(); | 5211 return builder.toString(); |
| 5591 } | 5212 } |
| 5592 } | 5213 } |
| 5593 | 5214 |
| 5594 /** | 5215 /** |
| 5595 * Instances of the class `TopLevelVariableElementImpl` implement a | 5216 * Instances of the class `TopLevelVariableElementImpl` implement a |
| 5596 * `TopLevelVariableElement`. | 5217 * `TopLevelVariableElement`. |
| 5597 * | 5218 * |
| 5598 * @coverage dart.engine.element | 5219 * @coverage dart.engine.element |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5626 | 5247 |
| 5627 /** | 5248 /** |
| 5628 * Instances of the class `TypeParameterElementImpl` implement a [TypeParameterE
lement]. | 5249 * Instances of the class `TypeParameterElementImpl` implement a [TypeParameterE
lement]. |
| 5629 * | 5250 * |
| 5630 * @coverage dart.engine.element | 5251 * @coverage dart.engine.element |
| 5631 */ | 5252 */ |
| 5632 class TypeParameterElementImpl extends ElementImpl implements TypeParameterEleme
nt { | 5253 class TypeParameterElementImpl extends ElementImpl implements TypeParameterEleme
nt { |
| 5633 /** | 5254 /** |
| 5634 * The type defined by this type parameter. | 5255 * The type defined by this type parameter. |
| 5635 */ | 5256 */ |
| 5636 TypeParameterType _type; | 5257 TypeParameterType type; |
| 5637 | 5258 |
| 5638 /** | 5259 /** |
| 5639 * The type representing the bound associated with this parameter, or `null` i
f this | 5260 * The type representing the bound associated with this parameter, or `null` i
f this |
| 5640 * parameter does not have an explicit bound. | 5261 * parameter does not have an explicit bound. |
| 5641 */ | 5262 */ |
| 5642 Type2 _bound; | 5263 Type2 bound; |
| 5643 | 5264 |
| 5644 /** | 5265 /** |
| 5645 * An empty array of type parameter elements. | 5266 * An empty array of type parameter elements. |
| 5646 */ | 5267 */ |
| 5647 static List<TypeParameterElement> EMPTY_ARRAY = new List<TypeParameterElement>
(0); | 5268 static List<TypeParameterElement> EMPTY_ARRAY = new List<TypeParameterElement>
(0); |
| 5648 | 5269 |
| 5649 /** | 5270 /** |
| 5650 * Initialize a newly created type parameter element to have the given name. | 5271 * Initialize a newly created type parameter element to have the given name. |
| 5651 * | 5272 * |
| 5652 * @param name the name of this element | 5273 * @param name the name of this element |
| 5653 */ | 5274 */ |
| 5654 TypeParameterElementImpl(Identifier name) : super.con1(name); | 5275 TypeParameterElementImpl(Identifier name) : super.con1(name); |
| 5655 | 5276 |
| 5656 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); | 5277 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); |
| 5657 | 5278 |
| 5658 Type2 get bound => _bound; | |
| 5659 | |
| 5660 ElementKind get kind => ElementKind.TYPE_PARAMETER; | 5279 ElementKind get kind => ElementKind.TYPE_PARAMETER; |
| 5661 | 5280 |
| 5662 TypeParameterType get type => _type; | |
| 5663 | |
| 5664 /** | |
| 5665 * Set the type representing the bound associated with this parameter to the g
iven type. | |
| 5666 * | |
| 5667 * @param bound the type representing the bound associated with this parameter | |
| 5668 */ | |
| 5669 void set bound(Type2 bound) { | |
| 5670 this._bound = bound; | |
| 5671 } | |
| 5672 | |
| 5673 /** | |
| 5674 * Set the type defined by this type parameter to the given type | |
| 5675 * | |
| 5676 * @param type the type defined by this type parameter | |
| 5677 */ | |
| 5678 void set type(TypeParameterType type) { | |
| 5679 this._type = type; | |
| 5680 } | |
| 5681 | |
| 5682 void appendTo(JavaStringBuilder builder) { | 5281 void appendTo(JavaStringBuilder builder) { |
| 5683 builder.append(displayName); | 5282 builder.append(displayName); |
| 5684 if (_bound != null) { | 5283 if (bound != null) { |
| 5685 builder.append(" extends "); | 5284 builder.append(" extends "); |
| 5686 builder.append(_bound); | 5285 builder.append(bound); |
| 5687 } | 5286 } |
| 5688 } | 5287 } |
| 5689 } | 5288 } |
| 5690 | 5289 |
| 5691 /** | 5290 /** |
| 5692 * Instances of the class `VariableElementImpl` implement a `VariableElement`. | 5291 * Instances of the class `VariableElementImpl` implement a `VariableElement`. |
| 5693 * | 5292 * |
| 5694 * @coverage dart.engine.element | 5293 * @coverage dart.engine.element |
| 5695 */ | 5294 */ |
| 5696 abstract class VariableElementImpl extends ElementImpl implements VariableElemen
t { | 5295 abstract class VariableElementImpl extends ElementImpl implements VariableElemen
t { |
| 5697 /** | 5296 /** |
| 5698 * The declared type of this variable. | 5297 * The declared type of this variable. |
| 5699 */ | 5298 */ |
| 5700 Type2 _type; | 5299 Type2 type; |
| 5701 | 5300 |
| 5702 /** | 5301 /** |
| 5703 * A synthetic function representing this variable's initializer, or `null` if
this variable | 5302 * A synthetic function representing this variable's initializer, or `null` if
this variable |
| 5704 * does not have an initializer. | 5303 * does not have an initializer. |
| 5705 */ | 5304 */ |
| 5706 FunctionElement _initializer; | 5305 FunctionElement _initializer; |
| 5707 | 5306 |
| 5708 /** | 5307 /** |
| 5709 * An empty array of variable elements. | 5308 * An empty array of variable elements. |
| 5710 */ | 5309 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 5730 * Return the result of evaluating this variable's initializer as a compile-ti
me constant | 5329 * Return the result of evaluating this variable's initializer as a compile-ti
me constant |
| 5731 * expression, or `null` if this variable is not a 'const' variable or does no
t have an | 5330 * expression, or `null` if this variable is not a 'const' variable or does no
t have an |
| 5732 * initializer. | 5331 * initializer. |
| 5733 * | 5332 * |
| 5734 * @return the result of evaluating this variable's initializer | 5333 * @return the result of evaluating this variable's initializer |
| 5735 */ | 5334 */ |
| 5736 EvaluationResultImpl get evaluationResult => null; | 5335 EvaluationResultImpl get evaluationResult => null; |
| 5737 | 5336 |
| 5738 FunctionElement get initializer => _initializer; | 5337 FunctionElement get initializer => _initializer; |
| 5739 | 5338 |
| 5740 Type2 get type => _type; | |
| 5741 | |
| 5742 bool get isConst => hasModifier(Modifier.CONST); | 5339 bool get isConst => hasModifier(Modifier.CONST); |
| 5743 | 5340 |
| 5744 bool get isFinal => hasModifier(Modifier.FINAL); | 5341 bool get isFinal => hasModifier(Modifier.FINAL); |
| 5745 | 5342 |
| 5746 /** | 5343 /** |
| 5747 * Return `true` if this variable is potentially mutated somewhere in closure.
This | 5344 * Return `true` if this variable is potentially mutated somewhere in closure.
This |
| 5748 * information is only available for local variables (including parameters). | 5345 * information is only available for local variables (including parameters). |
| 5749 * | 5346 * |
| 5750 * @return `true` if this variable is potentially mutated somewhere in closure | 5347 * @return `true` if this variable is potentially mutated somewhere in closure |
| 5751 */ | 5348 */ |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5792 * | 5389 * |
| 5793 * @param initializer the function representing this variable's initializer | 5390 * @param initializer the function representing this variable's initializer |
| 5794 */ | 5391 */ |
| 5795 void set initializer(FunctionElement initializer) { | 5392 void set initializer(FunctionElement initializer) { |
| 5796 if (initializer != null) { | 5393 if (initializer != null) { |
| 5797 (initializer as FunctionElementImpl).enclosingElement = this; | 5394 (initializer as FunctionElementImpl).enclosingElement = this; |
| 5798 } | 5395 } |
| 5799 this._initializer = initializer; | 5396 this._initializer = initializer; |
| 5800 } | 5397 } |
| 5801 | 5398 |
| 5802 /** | |
| 5803 * Set the declared type of this variable to the given type. | |
| 5804 * | |
| 5805 * @param type the declared type of this variable | |
| 5806 */ | |
| 5807 void set type(Type2 type) { | |
| 5808 this._type = type; | |
| 5809 } | |
| 5810 | |
| 5811 void visitChildren(ElementVisitor visitor) { | 5399 void visitChildren(ElementVisitor visitor) { |
| 5812 super.visitChildren(visitor); | 5400 super.visitChildren(visitor); |
| 5813 safelyVisitChild(_initializer, visitor); | 5401 safelyVisitChild(_initializer, visitor); |
| 5814 } | 5402 } |
| 5815 | 5403 |
| 5816 void appendTo(JavaStringBuilder builder) { | 5404 void appendTo(JavaStringBuilder builder) { |
| 5817 builder.append(type); | 5405 builder.append(type); |
| 5818 builder.append(" "); | 5406 builder.append(" "); |
| 5819 builder.append(displayName); | 5407 builder.append(displayName); |
| 5820 } | 5408 } |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6480 | 6068 |
| 6481 /** | 6069 /** |
| 6482 * The unique instance of the class `BottomTypeImpl` implements the type `bottom
`. | 6070 * The unique instance of the class `BottomTypeImpl` implements the type `bottom
`. |
| 6483 * | 6071 * |
| 6484 * @coverage dart.engine.type | 6072 * @coverage dart.engine.type |
| 6485 */ | 6073 */ |
| 6486 class BottomTypeImpl extends TypeImpl { | 6074 class BottomTypeImpl extends TypeImpl { |
| 6487 /** | 6075 /** |
| 6488 * The unique instance of this class. | 6076 * The unique instance of this class. |
| 6489 */ | 6077 */ |
| 6490 static final BottomTypeImpl instance = new BottomTypeImpl(); | 6078 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); |
| 6079 |
| 6080 /** |
| 6081 * Return the unique instance of this class. |
| 6082 * |
| 6083 * @return the unique instance of this class |
| 6084 */ |
| 6085 static BottomTypeImpl get instance => _INSTANCE; |
| 6491 | 6086 |
| 6492 /** | 6087 /** |
| 6493 * Prevent the creation of instances of this class. | 6088 * Prevent the creation of instances of this class. |
| 6494 */ | 6089 */ |
| 6495 BottomTypeImpl() : super(null, "<bottom>"); | 6090 BottomTypeImpl() : super(null, "<bottom>"); |
| 6496 | 6091 |
| 6497 bool operator ==(Object object) => identical(object, this); | 6092 bool operator ==(Object object) => identical(object, this); |
| 6498 | 6093 |
| 6499 bool get isBottom => true; | 6094 bool get isBottom => true; |
| 6500 | 6095 |
| 6501 bool isSupertypeOf(Type2 type) => false; | 6096 bool isSupertypeOf(Type2 type) => false; |
| 6502 | 6097 |
| 6503 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp
es) => this; | 6098 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp
es) => this; |
| 6504 | 6099 |
| 6505 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs) => true; | 6100 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs) => true; |
| 6506 | 6101 |
| 6507 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs)
=> true; | 6102 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs)
=> true; |
| 6508 } | 6103 } |
| 6509 | 6104 |
| 6510 /** | 6105 /** |
| 6511 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam
ic`. | 6106 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam
ic`. |
| 6512 * | 6107 * |
| 6513 * @coverage dart.engine.type | 6108 * @coverage dart.engine.type |
| 6514 */ | 6109 */ |
| 6515 class DynamicTypeImpl extends TypeImpl { | 6110 class DynamicTypeImpl extends TypeImpl { |
| 6516 /** | 6111 /** |
| 6517 * The unique instance of this class. | 6112 * The unique instance of this class. |
| 6518 */ | 6113 */ |
| 6519 static final DynamicTypeImpl instance = new DynamicTypeImpl(); | 6114 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); |
| 6115 |
| 6116 /** |
| 6117 * Return the unique instance of this class. |
| 6118 * |
| 6119 * @return the unique instance of this class |
| 6120 */ |
| 6121 static DynamicTypeImpl get instance => _INSTANCE; |
| 6520 | 6122 |
| 6521 /** | 6123 /** |
| 6522 * Prevent the creation of instances of this class. | 6124 * Prevent the creation of instances of this class. |
| 6523 */ | 6125 */ |
| 6524 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { | 6126 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { |
| 6525 (element as DynamicElementImpl).type = this; | 6127 (element as DynamicElementImpl).type = this; |
| 6526 } | 6128 } |
| 6527 | 6129 |
| 6528 bool operator ==(Object object) => object is DynamicTypeImpl; | 6130 bool operator ==(Object object) => object is DynamicTypeImpl; |
| 6529 | 6131 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6580 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() !
= secondEntry.getValue()) { | 6182 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() !
= secondEntry.getValue()) { |
| 6581 return false; | 6183 return false; |
| 6582 } | 6184 } |
| 6583 } | 6185 } |
| 6584 return true; | 6186 return true; |
| 6585 } | 6187 } |
| 6586 | 6188 |
| 6587 /** | 6189 /** |
| 6588 * An array containing the actual types of the type arguments. | 6190 * An array containing the actual types of the type arguments. |
| 6589 */ | 6191 */ |
| 6590 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; | 6192 List<Type2> typeArguments = TypeImpl.EMPTY_ARRAY; |
| 6591 | 6193 |
| 6592 /** | 6194 /** |
| 6593 * Initialize a newly created function type to be declared by the given elemen
t and to have the | 6195 * Initialize a newly created function type to be declared by the given elemen
t and to have the |
| 6594 * given name. | 6196 * given name. |
| 6595 * | 6197 * |
| 6596 * @param element the element representing the declaration of the function typ
e | 6198 * @param element the element representing the declaration of the function typ
e |
| 6597 */ | 6199 */ |
| 6598 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n
ull ? null : element.name); | 6200 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n
ull ? null : element.name); |
| 6599 | 6201 |
| 6600 /** | 6202 /** |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6683 | 6285 |
| 6684 Map<String, Type2> get namedParameterTypes { | 6286 Map<String, Type2> get namedParameterTypes { |
| 6685 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 6287 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 6686 List<ParameterElement> parameters = baseParameters; | 6288 List<ParameterElement> parameters = baseParameters; |
| 6687 if (parameters.length == 0) { | 6289 if (parameters.length == 0) { |
| 6688 return namedParameterTypes; | 6290 return namedParameterTypes; |
| 6689 } | 6291 } |
| 6690 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); | 6292 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 6691 for (ParameterElement parameter in parameters) { | 6293 for (ParameterElement parameter in parameters) { |
| 6692 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { | 6294 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { |
| 6693 namedParameterTypes[parameter.name] = parameter.type.substitute2(_typeAr
guments, typeParameters); | 6295 namedParameterTypes[parameter.name] = parameter.type.substitute2(typeArg
uments, typeParameters); |
| 6694 } | 6296 } |
| 6695 } | 6297 } |
| 6696 return namedParameterTypes; | 6298 return namedParameterTypes; |
| 6697 } | 6299 } |
| 6698 | 6300 |
| 6699 List<Type2> get normalParameterTypes { | 6301 List<Type2> get normalParameterTypes { |
| 6700 List<ParameterElement> parameters = baseParameters; | 6302 List<ParameterElement> parameters = baseParameters; |
| 6701 if (parameters.length == 0) { | 6303 if (parameters.length == 0) { |
| 6702 return TypeImpl.EMPTY_ARRAY; | 6304 return TypeImpl.EMPTY_ARRAY; |
| 6703 } | 6305 } |
| 6704 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); | 6306 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 6705 List<Type2> types = new List<Type2>(); | 6307 List<Type2> types = new List<Type2>(); |
| 6706 for (ParameterElement parameter in parameters) { | 6308 for (ParameterElement parameter in parameters) { |
| 6707 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { | 6309 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { |
| 6708 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); | 6310 types.add(parameter.type.substitute2(typeArguments, typeParameters)); |
| 6709 } | 6311 } |
| 6710 } | 6312 } |
| 6711 return new List.from(types); | 6313 return new List.from(types); |
| 6712 } | 6314 } |
| 6713 | 6315 |
| 6714 List<Type2> get optionalParameterTypes { | 6316 List<Type2> get optionalParameterTypes { |
| 6715 List<ParameterElement> parameters = baseParameters; | 6317 List<ParameterElement> parameters = baseParameters; |
| 6716 if (parameters.length == 0) { | 6318 if (parameters.length == 0) { |
| 6717 return TypeImpl.EMPTY_ARRAY; | 6319 return TypeImpl.EMPTY_ARRAY; |
| 6718 } | 6320 } |
| 6719 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); | 6321 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 6720 List<Type2> types = new List<Type2>(); | 6322 List<Type2> types = new List<Type2>(); |
| 6721 for (ParameterElement parameter in parameters) { | 6323 for (ParameterElement parameter in parameters) { |
| 6722 if (identical(parameter.parameterKind, ParameterKind.POSITIONAL)) { | 6324 if (identical(parameter.parameterKind, ParameterKind.POSITIONAL)) { |
| 6723 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); | 6325 types.add(parameter.type.substitute2(typeArguments, typeParameters)); |
| 6724 } | 6326 } |
| 6725 } | 6327 } |
| 6726 return new List.from(types); | 6328 return new List.from(types); |
| 6727 } | 6329 } |
| 6728 | 6330 |
| 6729 List<ParameterElement> get parameters { | 6331 List<ParameterElement> get parameters { |
| 6730 List<ParameterElement> baseParameters = this.baseParameters; | 6332 List<ParameterElement> baseParameters = this.baseParameters; |
| 6731 int parameterCount = baseParameters.length; | 6333 int parameterCount = baseParameters.length; |
| 6732 if (parameterCount == 0) { | 6334 if (parameterCount == 0) { |
| 6733 return baseParameters; | 6335 return baseParameters; |
| 6734 } | 6336 } |
| 6735 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); | 6337 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); |
| 6736 for (int i = 0; i < parameterCount; i++) { | 6338 for (int i = 0; i < parameterCount; i++) { |
| 6737 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); | 6339 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); |
| 6738 } | 6340 } |
| 6739 return specializedParameters; | 6341 return specializedParameters; |
| 6740 } | 6342 } |
| 6741 | 6343 |
| 6742 Type2 get returnType { | 6344 Type2 get returnType { |
| 6743 Type2 baseReturnType = this.baseReturnType; | 6345 Type2 baseReturnType = this.baseReturnType; |
| 6744 if (baseReturnType == null) { | 6346 if (baseReturnType == null) { |
| 6745 return DynamicTypeImpl.instance; | 6347 return DynamicTypeImpl.instance; |
| 6746 } | 6348 } |
| 6747 return baseReturnType.substitute2(_typeArguments, TypeParameterTypeImpl.getT
ypes(typeParameters)); | 6349 return baseReturnType.substitute2(typeArguments, TypeParameterTypeImpl.getTy
pes(typeParameters)); |
| 6748 } | 6350 } |
| 6749 | 6351 |
| 6750 List<Type2> get typeArguments => _typeArguments; | |
| 6751 | |
| 6752 List<TypeParameterElement> get typeParameters { | 6352 List<TypeParameterElement> get typeParameters { |
| 6753 Element element = this.element; | 6353 Element element = this.element; |
| 6754 if (element is FunctionTypeAliasElement) { | 6354 if (element is FunctionTypeAliasElement) { |
| 6755 return (element as FunctionTypeAliasElement).typeParameters; | 6355 return (element as FunctionTypeAliasElement).typeParameters; |
| 6756 } | 6356 } |
| 6757 ClassElement definingClass = element.getAncestor(ClassElement); | 6357 ClassElement definingClass = element.getAncestor(ClassElement); |
| 6758 if (definingClass != null) { | 6358 if (definingClass != null) { |
| 6759 return definingClass.typeParameters; | 6359 return definingClass.typeParameters; |
| 6760 } | 6360 } |
| 6761 return TypeParameterElementImpl.EMPTY_ARRAY; | 6361 return TypeParameterElementImpl.EMPTY_ARRAY; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6850 } | 6450 } |
| 6851 } | 6451 } |
| 6852 } | 6452 } |
| 6853 Type2 tRetType = t.returnType; | 6453 Type2 tRetType = t.returnType; |
| 6854 Type2 sRetType = s.returnType; | 6454 Type2 sRetType = s.returnType; |
| 6855 return sRetType.isVoid || (tRetType as TypeImpl).isMoreSpecificThan3(sRetTyp
e, withDynamic, visitedTypePairs); | 6455 return sRetType.isVoid || (tRetType as TypeImpl).isMoreSpecificThan3(sRetTyp
e, withDynamic, visitedTypePairs); |
| 6856 } | 6456 } |
| 6857 | 6457 |
| 6858 bool isAssignableTo(Type2 type) => isSubtypeOf3(type, new Set<TypeImpl_TypePai
r>()); | 6458 bool isAssignableTo(Type2 type) => isSubtypeOf3(type, new Set<TypeImpl_TypePai
r>()); |
| 6859 | 6459 |
| 6860 /** | |
| 6861 * Set the actual types of the type arguments to the given types. | |
| 6862 * | |
| 6863 * @param typeArguments the actual types of the type arguments | |
| 6864 */ | |
| 6865 void set typeArguments(List<Type2> typeArguments) { | |
| 6866 this._typeArguments = typeArguments; | |
| 6867 } | |
| 6868 | |
| 6869 FunctionTypeImpl substitute3(List<Type2> argumentTypes) => substitute2(argumen
tTypes, typeArguments); | 6460 FunctionTypeImpl substitute3(List<Type2> argumentTypes) => substitute2(argumen
tTypes, typeArguments); |
| 6870 | 6461 |
| 6871 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT
ypes) { | 6462 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT
ypes) { |
| 6872 if (argumentTypes.length != parameterTypes.length) { | 6463 if (argumentTypes.length != parameterTypes.length) { |
| 6873 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); | 6464 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); |
| 6874 } | 6465 } |
| 6875 if (argumentTypes.length == 0) { | 6466 if (argumentTypes.length == 0) { |
| 6876 return this; | 6467 return this; |
| 6877 } | 6468 } |
| 6878 Element element = this.element; | 6469 Element element = this.element; |
| 6879 FunctionTypeImpl newType = (element is ExecutableElement) ? new FunctionType
Impl.con1(element as ExecutableElement) : new FunctionTypeImpl.con2(element as F
unctionTypeAliasElement); | 6470 FunctionTypeImpl newType = (element is ExecutableElement) ? new FunctionType
Impl.con1(element as ExecutableElement) : new FunctionTypeImpl.con2(element as F
unctionTypeAliasElement); |
| 6880 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p
arameterTypes); | 6471 newType.typeArguments = TypeImpl.substitute(typeArguments, argumentTypes, pa
rameterTypes); |
| 6881 return newType; | 6472 return newType; |
| 6882 } | 6473 } |
| 6883 | 6474 |
| 6884 void appendTo(JavaStringBuilder builder) { | 6475 void appendTo(JavaStringBuilder builder) { |
| 6885 List<Type2> normalParameterTypes = this.normalParameterTypes; | 6476 List<Type2> normalParameterTypes = this.normalParameterTypes; |
| 6886 List<Type2> optionalParameterTypes = this.optionalParameterTypes; | 6477 List<Type2> optionalParameterTypes = this.optionalParameterTypes; |
| 6887 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; | 6478 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; |
| 6888 Type2 returnType = this.returnType; | 6479 Type2 returnType = this.returnType; |
| 6889 builder.append("("); | 6480 builder.append("("); |
| 6890 bool needsComma = false; | 6481 bool needsComma = false; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7216 } | 6807 } |
| 7217 } | 6808 } |
| 7218 InterfaceTypeImpl lub = new InterfaceTypeImpl.con1(firstType.element); | 6809 InterfaceTypeImpl lub = new InterfaceTypeImpl.con1(firstType.element); |
| 7219 lub.typeArguments = lubArguments; | 6810 lub.typeArguments = lubArguments; |
| 7220 return lub; | 6811 return lub; |
| 7221 } | 6812 } |
| 7222 | 6813 |
| 7223 /** | 6814 /** |
| 7224 * An array containing the actual types of the type arguments. | 6815 * An array containing the actual types of the type arguments. |
| 7225 */ | 6816 */ |
| 7226 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; | 6817 List<Type2> typeArguments = TypeImpl.EMPTY_ARRAY; |
| 7227 | 6818 |
| 7228 /** | 6819 /** |
| 7229 * Initialize a newly created type to be declared by the given element. | 6820 * Initialize a newly created type to be declared by the given element. |
| 7230 * | 6821 * |
| 7231 * @param element the element representing the declaration of the type | 6822 * @param element the element representing the declaration of the type |
| 7232 */ | 6823 */ |
| 7233 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame); | 6824 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame); |
| 7234 | 6825 |
| 7235 /** | 6826 /** |
| 7236 * Initialize a newly created type to have the given name. This constructor sh
ould only be used in | 6827 * Initialize a newly created type to have the given name. This constructor sh
ould only be used in |
| 7237 * cases where there is no declaration of the type. | 6828 * cases where there is no declaration of the type. |
| 7238 * | 6829 * |
| 7239 * @param name the name of the type | 6830 * @param name the name of the type |
| 7240 */ | 6831 */ |
| 7241 InterfaceTypeImpl.con2(String name) : super(null, name); | 6832 InterfaceTypeImpl.con2(String name) : super(null, name); |
| 7242 | 6833 |
| 7243 bool operator ==(Object object) { | 6834 bool operator ==(Object object) { |
| 7244 if (object is! InterfaceTypeImpl) { | 6835 if (object is! InterfaceTypeImpl) { |
| 7245 return false; | 6836 return false; |
| 7246 } | 6837 } |
| 7247 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; | 6838 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; |
| 7248 return (element == otherType.element) && JavaArrays.equals(_typeArguments, o
therType._typeArguments); | 6839 return (element == otherType.element) && JavaArrays.equals(typeArguments, ot
herType.typeArguments); |
| 7249 } | 6840 } |
| 7250 | 6841 |
| 7251 List<PropertyAccessorElement> get accessors { | 6842 List<PropertyAccessorElement> get accessors { |
| 7252 List<PropertyAccessorElement> accessors = element.accessors; | 6843 List<PropertyAccessorElement> accessors = element.accessors; |
| 7253 List<PropertyAccessorElement> members = new List<PropertyAccessorElement>(ac
cessors.length); | 6844 List<PropertyAccessorElement> members = new List<PropertyAccessorElement>(ac
cessors.length); |
| 7254 for (int i = 0; i < accessors.length; i++) { | 6845 for (int i = 0; i < accessors.length; i++) { |
| 7255 members[i] = PropertyAccessorMember.from(accessors[i], this); | 6846 members[i] = PropertyAccessorMember.from(accessors[i], this); |
| 7256 } | 6847 } |
| 7257 return members; | 6848 return members; |
| 7258 } | 6849 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7292 ClassElement classElement = element; | 6883 ClassElement classElement = element; |
| 7293 List<InterfaceType> interfaces = classElement.interfaces; | 6884 List<InterfaceType> interfaces = classElement.interfaces; |
| 7294 List<TypeParameterElement> typeParameters = classElement.typeParameters; | 6885 List<TypeParameterElement> typeParameters = classElement.typeParameters; |
| 7295 List<Type2> parameterTypes = classElement.type.typeArguments; | 6886 List<Type2> parameterTypes = classElement.type.typeArguments; |
| 7296 if (typeParameters.length == 0) { | 6887 if (typeParameters.length == 0) { |
| 7297 return interfaces; | 6888 return interfaces; |
| 7298 } | 6889 } |
| 7299 int count = interfaces.length; | 6890 int count = interfaces.length; |
| 7300 List<InterfaceType> typedInterfaces = new List<InterfaceType>(count); | 6891 List<InterfaceType> typedInterfaces = new List<InterfaceType>(count); |
| 7301 for (int i = 0; i < count; i++) { | 6892 for (int i = 0; i < count; i++) { |
| 7302 typedInterfaces[i] = interfaces[i].substitute2(_typeArguments, parameterTy
pes); | 6893 typedInterfaces[i] = interfaces[i].substitute2(typeArguments, parameterTyp
es); |
| 7303 } | 6894 } |
| 7304 return typedInterfaces; | 6895 return typedInterfaces; |
| 7305 } | 6896 } |
| 7306 | 6897 |
| 7307 Type2 getLeastUpperBound(Type2 type) { | 6898 Type2 getLeastUpperBound(Type2 type) { |
| 7308 if (identical(type, this)) { | 6899 if (identical(type, this)) { |
| 7309 return this; | 6900 return this; |
| 7310 } | 6901 } |
| 7311 Type2 dynamicType = DynamicTypeImpl.instance; | 6902 Type2 dynamicType = DynamicTypeImpl.instance; |
| 7312 if (identical(this, dynamicType) || identical(type, dynamicType)) { | 6903 if (identical(this, dynamicType) || identical(type, dynamicType)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7361 ClassElement classElement = element; | 6952 ClassElement classElement = element; |
| 7362 List<InterfaceType> mixins = classElement.mixins; | 6953 List<InterfaceType> mixins = classElement.mixins; |
| 7363 List<TypeParameterElement> typeParameters = classElement.typeParameters; | 6954 List<TypeParameterElement> typeParameters = classElement.typeParameters; |
| 7364 List<Type2> parameterTypes = classElement.type.typeArguments; | 6955 List<Type2> parameterTypes = classElement.type.typeArguments; |
| 7365 if (typeParameters.length == 0) { | 6956 if (typeParameters.length == 0) { |
| 7366 return mixins; | 6957 return mixins; |
| 7367 } | 6958 } |
| 7368 int count = mixins.length; | 6959 int count = mixins.length; |
| 7369 List<InterfaceType> typedMixins = new List<InterfaceType>(count); | 6960 List<InterfaceType> typedMixins = new List<InterfaceType>(count); |
| 7370 for (int i = 0; i < count; i++) { | 6961 for (int i = 0; i < count; i++) { |
| 7371 typedMixins[i] = mixins[i].substitute2(_typeArguments, parameterTypes); | 6962 typedMixins[i] = mixins[i].substitute2(typeArguments, parameterTypes); |
| 7372 } | 6963 } |
| 7373 return typedMixins; | 6964 return typedMixins; |
| 7374 } | 6965 } |
| 7375 | 6966 |
| 7376 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember
.from((element as ClassElementImpl).getSetter(setterName), this); | 6967 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember
.from((element as ClassElementImpl).getSetter(setterName), this); |
| 7377 | 6968 |
| 7378 InterfaceType get superclass { | 6969 InterfaceType get superclass { |
| 7379 ClassElement classElement = element; | 6970 ClassElement classElement = element; |
| 7380 InterfaceType supertype = classElement.supertype; | 6971 InterfaceType supertype = classElement.supertype; |
| 7381 if (supertype == null) { | 6972 if (supertype == null) { |
| 7382 return null; | 6973 return null; |
| 7383 } | 6974 } |
| 7384 return supertype.substitute2(_typeArguments, classElement.type.typeArguments
); | 6975 return supertype.substitute2(typeArguments, classElement.type.typeArguments)
; |
| 7385 } | 6976 } |
| 7386 | 6977 |
| 7387 List<Type2> get typeArguments => _typeArguments; | |
| 7388 | |
| 7389 List<TypeParameterElement> get typeParameters => element.typeParameters; | 6978 List<TypeParameterElement> get typeParameters => element.typeParameters; |
| 7390 | 6979 |
| 7391 int get hashCode { | 6980 int get hashCode { |
| 7392 ClassElement element = this.element; | 6981 ClassElement element = this.element; |
| 7393 if (element == null) { | 6982 if (element == null) { |
| 7394 return 0; | 6983 return 0; |
| 7395 } | 6984 } |
| 7396 return element.hashCode; | 6985 return element.hashCode; |
| 7397 } | 6986 } |
| 7398 | 6987 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7549 if (element != null && element.isAccessibleIn(library)) { | 7138 if (element != null && element.isAccessibleIn(library)) { |
| 7550 return element; | 7139 return element; |
| 7551 } | 7140 } |
| 7552 } | 7141 } |
| 7553 supertype = supertype.superclass; | 7142 supertype = supertype.superclass; |
| 7554 supertypeElement = supertype == null ? null : supertype.element; | 7143 supertypeElement = supertype == null ? null : supertype.element; |
| 7555 } | 7144 } |
| 7556 return null; | 7145 return null; |
| 7557 } | 7146 } |
| 7558 | 7147 |
| 7559 /** | |
| 7560 * Set the actual types of the type arguments to those in the given array. | |
| 7561 * | |
| 7562 * @param typeArguments the actual types of the type arguments | |
| 7563 */ | |
| 7564 void set typeArguments(List<Type2> typeArguments) { | |
| 7565 this._typeArguments = typeArguments; | |
| 7566 } | |
| 7567 | |
| 7568 InterfaceTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argume
ntTypes, typeArguments); | 7148 InterfaceTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argume
ntTypes, typeArguments); |
| 7569 | 7149 |
| 7570 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter
Types) { | 7150 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter
Types) { |
| 7571 if (argumentTypes.length != parameterTypes.length) { | 7151 if (argumentTypes.length != parameterTypes.length) { |
| 7572 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); | 7152 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); |
| 7573 } | 7153 } |
| 7574 if (argumentTypes.length == 0 || _typeArguments.length == 0) { | 7154 if (argumentTypes.length == 0 || typeArguments.length == 0) { |
| 7575 return this; | 7155 return this; |
| 7576 } | 7156 } |
| 7577 List<Type2> newTypeArguments = TypeImpl.substitute(_typeArguments, argumentT
ypes, parameterTypes); | 7157 List<Type2> newTypeArguments = TypeImpl.substitute(typeArguments, argumentTy
pes, parameterTypes); |
| 7578 if (JavaArrays.equals(newTypeArguments, _typeArguments)) { | 7158 if (JavaArrays.equals(newTypeArguments, typeArguments)) { |
| 7579 return this; | 7159 return this; |
| 7580 } | 7160 } |
| 7581 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); | 7161 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); |
| 7582 newType.typeArguments = newTypeArguments; | 7162 newType.typeArguments = newTypeArguments; |
| 7583 return newType; | 7163 return newType; |
| 7584 } | 7164 } |
| 7585 | 7165 |
| 7586 void appendTo(JavaStringBuilder builder) { | 7166 void appendTo(JavaStringBuilder builder) { |
| 7587 builder.append(name); | 7167 builder.append(name); |
| 7588 int argumentCount = _typeArguments.length; | 7168 int argumentCount = typeArguments.length; |
| 7589 if (argumentCount > 0) { | 7169 if (argumentCount > 0) { |
| 7590 builder.append("<"); | 7170 builder.append("<"); |
| 7591 for (int i = 0; i < argumentCount; i++) { | 7171 for (int i = 0; i < argumentCount; i++) { |
| 7592 if (i > 0) { | 7172 if (i > 0) { |
| 7593 builder.append(", "); | 7173 builder.append(", "); |
| 7594 } | 7174 } |
| 7595 (_typeArguments[i] as TypeImpl).appendTo(builder); | 7175 (typeArguments[i] as TypeImpl).appendTo(builder); |
| 7596 } | 7176 } |
| 7597 builder.append(">"); | 7177 builder.append(">"); |
| 7598 } | 7178 } |
| 7599 } | 7179 } |
| 7600 | 7180 |
| 7601 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs) { | 7181 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs) { |
| 7602 if (identical(type, DynamicTypeImpl.instance)) { | 7182 if (identical(type, DynamicTypeImpl.instance)) { |
| 7603 return true; | 7183 return true; |
| 7604 } else if (type is! InterfaceType) { | 7184 } else if (type is! InterfaceType) { |
| 7605 return false; | 7185 return false; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7746 | 7326 |
| 7747 /** | 7327 /** |
| 7748 * The element representing the declaration of this type, or `null` if the typ
e has not, or | 7328 * The element representing the declaration of this type, or `null` if the typ
e has not, or |
| 7749 * cannot, be associated with an element. | 7329 * cannot, be associated with an element. |
| 7750 */ | 7330 */ |
| 7751 Element _element; | 7331 Element _element; |
| 7752 | 7332 |
| 7753 /** | 7333 /** |
| 7754 * The name of this type, or `null` if the type does not have a name. | 7334 * The name of this type, or `null` if the type does not have a name. |
| 7755 */ | 7335 */ |
| 7756 String _name; | 7336 final String name; |
| 7757 | 7337 |
| 7758 /** | 7338 /** |
| 7759 * An empty array of types. | 7339 * An empty array of types. |
| 7760 */ | 7340 */ |
| 7761 static List<Type2> EMPTY_ARRAY = new List<Type2>(0); | 7341 static List<Type2> EMPTY_ARRAY = new List<Type2>(0); |
| 7762 | 7342 |
| 7763 /** | 7343 /** |
| 7764 * Initialize a newly created type to be declared by the given element and to
have the given name. | 7344 * Initialize a newly created type to be declared by the given element and to
have the given name. |
| 7765 * | 7345 * |
| 7766 * @param element the element representing the declaration of the type | 7346 * @param element the element representing the declaration of the type |
| 7767 * @param name the name of the type | 7347 * @param name the name of the type |
| 7768 */ | 7348 */ |
| 7769 TypeImpl(Element element, String name) { | 7349 TypeImpl(Element element, this.name) { |
| 7770 this._element = element; | 7350 this._element = element; |
| 7771 this._name = name; | |
| 7772 } | 7351 } |
| 7773 | 7352 |
| 7774 String get displayName => name; | 7353 String get displayName => name; |
| 7775 | 7354 |
| 7776 Element get element => _element; | 7355 Element get element => _element; |
| 7777 | 7356 |
| 7778 Type2 getLeastUpperBound(Type2 type) => null; | 7357 Type2 getLeastUpperBound(Type2 type) => null; |
| 7779 | 7358 |
| 7780 String get name => _name; | |
| 7781 | |
| 7782 bool isAssignableTo(Type2 type) => isAssignableTo2(type, new Set<TypeImpl_Type
Pair>()); | 7359 bool isAssignableTo(Type2 type) => isAssignableTo2(type, new Set<TypeImpl_Type
Pair>()); |
| 7783 | 7360 |
| 7784 /** | 7361 /** |
| 7785 * Return `true` if this type is assignable to the given type. A type <i>T</i>
may be | 7362 * Return `true` if this type is assignable to the given type. A type <i>T</i>
may be |
| 7786 * assigned to a type <i>S</i>, written <i>T</i> ⇔ <i>S</i>, iff either <
i>T</i> <: <i>S</i> | 7363 * assigned to a type <i>S</i>, written <i>T</i> ⇔ <i>S</i>, iff either <
i>T</i> <: <i>S</i> |
| 7787 * or <i>S</i> <: <i>T</i>. | 7364 * or <i>S</i> <: <i>T</i>. |
| 7788 * | 7365 * |
| 7789 * The given set of pairs of types (T1, T2), where each pair indicates that we
invoked this method | 7366 * The given set of pairs of types (T1, T2), where each pair indicates that we
invoked this method |
| 7790 * because we are in the process of answering the question of whether T1 is a
subtype of T2, is | 7367 * because we are in the process of answering the question of whether T1 is a
subtype of T2, is |
| 7791 * used to prevent infinite loops. | 7368 * used to prevent infinite loops. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7860 appendTo(builder); | 7437 appendTo(builder); |
| 7861 return builder.toString(); | 7438 return builder.toString(); |
| 7862 } | 7439 } |
| 7863 | 7440 |
| 7864 /** | 7441 /** |
| 7865 * Append a textual representation of this type to the given builder. | 7442 * Append a textual representation of this type to the given builder. |
| 7866 * | 7443 * |
| 7867 * @param builder the builder to which the text is to be appended | 7444 * @param builder the builder to which the text is to be appended |
| 7868 */ | 7445 */ |
| 7869 void appendTo(JavaStringBuilder builder) { | 7446 void appendTo(JavaStringBuilder builder) { |
| 7870 if (_name == null) { | 7447 if (name == null) { |
| 7871 builder.append("<unnamed type>"); | 7448 builder.append("<unnamed type>"); |
| 7872 } else { | 7449 } else { |
| 7873 builder.append(_name); | 7450 builder.append(name); |
| 7874 } | 7451 } |
| 7875 } | 7452 } |
| 7876 | 7453 |
| 7877 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs); | 7454 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ
ePair> visitedTypePairs); |
| 7878 | 7455 |
| 7879 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs); | 7456 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs); |
| 7880 } | 7457 } |
| 7881 | 7458 |
| 7882 class TypeImpl_TypePair { | 7459 class TypeImpl_TypePair { |
| 7883 Type2 _firstType; | 7460 Type2 _firstType; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8009 | 7586 |
| 8010 /** | 7587 /** |
| 8011 * The unique instance of the class `VoidTypeImpl` implements the type `void`. | 7588 * The unique instance of the class `VoidTypeImpl` implements the type `void`. |
| 8012 * | 7589 * |
| 8013 * @coverage dart.engine.type | 7590 * @coverage dart.engine.type |
| 8014 */ | 7591 */ |
| 8015 class VoidTypeImpl extends TypeImpl implements VoidType { | 7592 class VoidTypeImpl extends TypeImpl implements VoidType { |
| 8016 /** | 7593 /** |
| 8017 * The unique instance of this class. | 7594 * The unique instance of this class. |
| 8018 */ | 7595 */ |
| 8019 static final VoidTypeImpl instance = new VoidTypeImpl(); | 7596 static VoidTypeImpl _INSTANCE = new VoidTypeImpl(); |
| 7597 |
| 7598 /** |
| 7599 * Return the unique instance of this class. |
| 7600 * |
| 7601 * @return the unique instance of this class |
| 7602 */ |
| 7603 static VoidTypeImpl get instance => _INSTANCE; |
| 8020 | 7604 |
| 8021 /** | 7605 /** |
| 8022 * Prevent the creation of instances of this class. | 7606 * Prevent the creation of instances of this class. |
| 8023 */ | 7607 */ |
| 8024 VoidTypeImpl() : super(null, Keyword.VOID.syntax); | 7608 VoidTypeImpl() : super(null, Keyword.VOID.syntax); |
| 8025 | 7609 |
| 8026 bool operator ==(Object object) => identical(object, this); | 7610 bool operator ==(Object object) => identical(object, this); |
| 8027 | 7611 |
| 8028 bool get isVoid => true; | 7612 bool get isVoid => true; |
| 8029 | 7613 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8643 | 8227 |
| 8644 /** | 8228 /** |
| 8645 * The interface `VoidType` defines the behavior of the unique object representi
ng the type | 8229 * The interface `VoidType` defines the behavior of the unique object representi
ng the type |
| 8646 * `void`. | 8230 * `void`. |
| 8647 * | 8231 * |
| 8648 * @coverage dart.engine.type | 8232 * @coverage dart.engine.type |
| 8649 */ | 8233 */ |
| 8650 abstract class VoidType implements Type2 { | 8234 abstract class VoidType implements Type2 { |
| 8651 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 8235 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 8652 } | 8236 } |
| OLD | NEW |