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 'source.dart'; | 9 import 'source.dart'; |
10 import 'scanner.dart' show Keyword; | 10 import 'scanner.dart' show Keyword; |
11 import 'ast.dart' show Identifier, LibraryIdentifier; | 11 import 'ast.dart' show Identifier, LibraryIdentifier; |
12 import 'sdk.dart' show DartSdk; | 12 import 'sdk.dart' show DartSdk; |
13 import 'html.dart' show XmlTagNode; | 13 import 'html.dart' show XmlTagNode; |
14 import 'engine.dart' show AnalysisContext; | 14 import 'engine.dart' show AnalysisContext; |
15 import 'constant.dart' show EvaluationResultImpl; | 15 import 'constant.dart' show EvaluationResultImpl; |
16 import 'utilities_dart.dart'; | 16 import 'utilities_dart.dart'; |
17 | 17 |
| 18 |
18 /** | 19 /** |
19 * The interface {@code Annotation} defines the behavior of objects representing
a single annotation | 20 * The interface {@code Annotation} defines the behavior of objects representing
a single annotation |
20 * associated with an element. | 21 * associated with an element. |
21 * @coverage dart.engine.element | 22 * @coverage dart.engine.element |
22 */ | 23 */ |
23 abstract class Annotation { | 24 abstract class Annotation { |
| 25 |
24 /** | 26 /** |
25 * Return the element representing the field, variable, or const constructor b
eing used as an | 27 * Return the element representing the field, variable, or const constructor b
eing used as an |
26 * annotation. | 28 * annotation. |
27 * @return the field, variable, or constructor being used as an annotation | 29 * @return the field, variable, or constructor being used as an annotation |
28 */ | 30 */ |
29 Element get element; | 31 Element get element; |
30 } | 32 } |
| 33 |
31 /** | 34 /** |
32 * The interface {@code ClassElement} defines the behavior of elements that repr
esent a class. | 35 * The interface {@code ClassElement} defines the behavior of elements that repr
esent a class. |
33 * @coverage dart.engine.element | 36 * @coverage dart.engine.element |
34 */ | 37 */ |
35 abstract class ClassElement implements Element { | 38 abstract class ClassElement implements Element { |
| 39 |
36 /** | 40 /** |
37 * Return an array containing all of the accessors (getters and setters) decla
red in this class. | 41 * Return an array containing all of the accessors (getters and setters) decla
red in this class. |
38 * @return the accessors declared in this class | 42 * @return the accessors declared in this class |
39 */ | 43 */ |
40 List<PropertyAccessorElement> get accessors; | 44 List<PropertyAccessorElement> get accessors; |
| 45 |
41 /** | 46 /** |
42 * Return an array containing all the supertypes defined for this class and it
s supertypes. | 47 * Return an array containing all the supertypes defined for this class and it
s supertypes. This |
| 48 * includes superclasses, mixins and interfaces. |
43 * @return all the supertypes of this class, including mixins | 49 * @return all the supertypes of this class, including mixins |
44 */ | 50 */ |
45 List<InterfaceType> get allSupertypes; | 51 List<InterfaceType> get allSupertypes; |
| 52 |
46 /** | 53 /** |
47 * Return an array containing all of the constructors declared in this class. | 54 * Return an array containing all of the constructors declared in this class. |
48 * @return the constructors declared in this class | 55 * @return the constructors declared in this class |
49 */ | 56 */ |
50 List<ConstructorElement> get constructors; | 57 List<ConstructorElement> get constructors; |
| 58 |
51 /** | 59 /** |
52 * Return an array containing all of the fields declared in this class. | 60 * Return an array containing all of the fields declared in this class. |
53 * @return the fields declared in this class | 61 * @return the fields declared in this class |
54 */ | 62 */ |
55 List<FieldElement> get fields; | 63 List<FieldElement> get fields; |
| 64 |
| 65 /** |
| 66 * Return the element representing the getter with the given name that is decl
ared in this class, |
| 67 * or {@code null} if this class does not declare a getter with the given name
. |
| 68 * @param getterName the name of the getter to be returned |
| 69 * @return the getter declared in this class with the given name |
| 70 */ |
| 71 PropertyAccessorElement getGetter(String getterName); |
| 72 |
56 /** | 73 /** |
57 * Return an array containing all of the interfaces that are implemented by th
is class. | 74 * Return an array containing all of the interfaces that are implemented by th
is class. |
| 75 * <p> |
| 76 * <b>Note:</b> Because the element model represents the state of the code, it
is possible for it |
| 77 * to be semantically invalid. In particular, it is not safe to assume that th
e inheritance |
| 78 * structure of a class does not contain a cycle. Clients that traverse the in
heritance structure |
| 79 * must explicitly guard against infinite loops. |
58 * @return the interfaces that are implemented by this class | 80 * @return the interfaces that are implemented by this class |
59 */ | 81 */ |
60 List<InterfaceType> get interfaces; | 82 List<InterfaceType> get interfaces; |
| 83 |
| 84 /** |
| 85 * Return the element representing the method with the given name that is decl
ared in this class, |
| 86 * or {@code null} if this class does not declare a method with the given name
. |
| 87 * @param methodName the name of the method to be returned |
| 88 * @return the method declared in this class with the given name |
| 89 */ |
| 90 MethodElement getMethod(String methodName); |
| 91 |
61 /** | 92 /** |
62 * Return an array containing all of the methods declared in this class. | 93 * Return an array containing all of the methods declared in this class. |
63 * @return the methods declared in this class | 94 * @return the methods declared in this class |
64 */ | 95 */ |
65 List<MethodElement> get methods; | 96 List<MethodElement> get methods; |
| 97 |
66 /** | 98 /** |
67 * Return an array containing all of the mixins that are applied to the class
being extended in | 99 * Return an array containing all of the mixins that are applied to the class
being extended in |
68 * order to derive the superclass of this class. | 100 * order to derive the superclass of this class. |
| 101 * <p> |
| 102 * <b>Note:</b> Because the element model represents the state of the code, it
is possible for it |
| 103 * to be semantically invalid. In particular, it is not safe to assume that th
e inheritance |
| 104 * structure of a class does not contain a cycle. Clients that traverse the in
heritance structure |
| 105 * must explicitly guard against infinite loops. |
69 * @return the mixins that are applied to derive the superclass of this class | 106 * @return the mixins that are applied to derive the superclass of this class |
70 */ | 107 */ |
71 List<InterfaceType> get mixins; | 108 List<InterfaceType> get mixins; |
| 109 |
72 /** | 110 /** |
73 * Return the named constructor declared in this class with the given name, or
{@code null} if | 111 * Return the named constructor declared in this class with the given name, or
{@code null} if |
74 * this class does not declare a named constructor with the given name. | 112 * this class does not declare a named constructor with the given name. |
75 * @param name the name of the constructor to be returned | 113 * @param name the name of the constructor to be returned |
76 * @return the element representing the specified constructor | 114 * @return the element representing the specified constructor |
77 */ | 115 */ |
78 ConstructorElement getNamedConstructor(String name); | 116 ConstructorElement getNamedConstructor(String name); |
| 117 |
| 118 /** |
| 119 * Return the element representing the setter with the given name that is decl
ared in this class, |
| 120 * or {@code null} if this class does not declare a setter with the given name
. |
| 121 * @param setterName the name of the getter to be returned |
| 122 * @return the setter declared in this class with the given name |
| 123 */ |
| 124 PropertyAccessorElement getSetter(String setterName); |
| 125 |
79 /** | 126 /** |
80 * Return the superclass of this class, or {@code null} if the class represent
s the class | 127 * Return the superclass of this class, or {@code null} if the class represent
s the class |
81 * 'Object'. All other classes will have a non-{@code null} superclass. If the
superclass was not | 128 * 'Object'. All other classes will have a non-{@code null} superclass. If the
superclass was not |
82 * explicitly declared then the implicit superclass 'Object' will be returned. | 129 * explicitly declared then the implicit superclass 'Object' will be returned. |
| 130 * <p> |
| 131 * <b>Note:</b> Because the element model represents the state of the code, it
is possible for it |
| 132 * to be semantically invalid. In particular, it is not safe to assume that th
e inheritance |
| 133 * structure of a class does not contain a cycle. Clients that traverse the in
heritance structure |
| 134 * must explicitly guard against infinite loops. |
83 * @return the superclass of this class | 135 * @return the superclass of this class |
84 */ | 136 */ |
85 InterfaceType get supertype; | 137 InterfaceType get supertype; |
| 138 |
86 /** | 139 /** |
87 * Return the type defined by the class. | 140 * Return the type defined by the class. |
88 * @return the type defined by the class | 141 * @return the type defined by the class |
89 */ | 142 */ |
90 InterfaceType get type; | 143 InterfaceType get type; |
| 144 |
91 /** | 145 /** |
92 * Return an array containing all of the type variables declared for this clas
s. | 146 * Return an array containing all of the type variables declared for this clas
s. |
93 * @return the type variables declared for this class | 147 * @return the type variables declared for this class |
94 */ | 148 */ |
95 List<TypeVariableElement> get typeVariables; | 149 List<TypeVariableElement> get typeVariables; |
| 150 |
96 /** | 151 /** |
97 * Return the unnamed constructor declared in this class, or {@code null} if t
his class does not | 152 * Return the unnamed constructor declared in this class, or {@code null} if t
his class does not |
98 * declare an unnamed constructor but does declare named constructors. The ret
urned constructor | 153 * declare an unnamed constructor but does declare named constructors. The ret
urned constructor |
99 * will be synthetic if this class does not declare any constructors, in which
case it will | 154 * will be synthetic if this class does not declare any constructors, in which
case it will |
100 * represent the default constructor for the class. | 155 * represent the default constructor for the class. |
101 * @return the unnamed constructor defined in this class | 156 * @return the unnamed constructor defined in this class |
102 */ | 157 */ |
103 ConstructorElement get unnamedConstructor; | 158 ConstructorElement get unnamedConstructor; |
| 159 |
| 160 /** |
| 161 * Return {@code true} if this class or its superclass declares a non-final in
stance field. |
| 162 * @return {@code true} if this class or its superclass declares a non-final i
nstance field |
| 163 */ |
| 164 bool hasNonFinalField(); |
| 165 |
| 166 /** |
| 167 * Return {@code true} if this class has reference to super (so, for example,
cannot be used as a |
| 168 * mixin). |
| 169 * @return {@code true} if this class has reference to super |
| 170 */ |
| 171 bool hasReferenceToSuper(); |
| 172 |
104 /** | 173 /** |
105 * Return {@code true} if this class is abstract. A class is abstract if it ha
s an explicit{@code abstract} modifier. Note, that this definition of <i>abstrac
t</i> is different from | 174 * Return {@code true} if this class is abstract. A class is abstract if it ha
s an explicit{@code abstract} modifier. Note, that this definition of <i>abstrac
t</i> is different from |
106 * <i>has unimplemented members</i>. | 175 * <i>has unimplemented members</i>. |
107 * @return {@code true} if this class is abstract | 176 * @return {@code true} if this class is abstract |
108 */ | 177 */ |
109 bool isAbstract(); | 178 bool isAbstract(); |
| 179 |
110 /** | 180 /** |
111 * Return {@code true} if this class is defined by a typedef construct. | 181 * Return {@code true} if this class is defined by a typedef construct. |
112 * @return {@code true} if this class is defined by a typedef construct | 182 * @return {@code true} if this class is defined by a typedef construct |
113 */ | 183 */ |
114 bool isTypedef(); | 184 bool isTypedef(); |
| 185 |
115 /** | 186 /** |
116 * Return {@code true} if this class can validly be used as a mixin when defin
ing another class. | 187 * Return {@code true} if this class can validly be used as a mixin when defin
ing another class. |
117 * The behavior of this method is defined by the Dart Language Specification i
n section 9: | 188 * The behavior of this method is defined by the Dart Language Specification i
n section 9: |
118 * <blockquote>It is a compile-time error if a declared or derived mixin refer
s to super. It is a | 189 * <blockquote>It is a compile-time error if a declared or derived mixin refer
s to super. It is a |
119 * compile-time error if a declared or derived mixin explicitly declares a con
structor. It is a | 190 * compile-time error if a declared or derived mixin explicitly declares a con
structor. It is a |
120 * compile-time error if a mixin is derived from a class whose superclass is n
ot | 191 * compile-time error if a mixin is derived from a class whose superclass is n
ot |
121 * Object.</blockquote> | 192 * Object.</blockquote> |
122 * @return {@code true} if this class can validly be used as a mixin | 193 * @return {@code true} if this class can validly be used as a mixin |
123 */ | 194 */ |
124 bool isValidMixin(); | 195 bool isValidMixin(); |
125 /** | 196 |
126 * Return the executable element representing the method, getter or setter tha
t results from | |
127 * looking up the given member in this class with respect to the given library
, or {@code null} if | |
128 * the look up fails. This method is used to determine what member the passed
name is inherited | |
129 * from. The behavior of this method is defined by the Dart Language Specifica
tion in section | |
130 * 8.1.1: Let <i>C</i> be a class declared in library <i>L</i> with superclass
<i>S</i> and let | |
131 * <i>C</i> declare an instance member <i>m</i>, and assume <i>S</i> declares
an instance member | |
132 * </i>m'</i> with the same name as m. Then <i>m</i> overrides m'</i> iff <i>m
'</i> is accessible | |
133 * to <i>L</i>, <i>m</i> has the same name as <i>m'</i> and neither <i>m</i> n
or <i>m'</i> are | |
134 * fields. | |
135 * @param memberName the name of the member being looked up | |
136 * @param library the library with respect to which the lookup is being perfor
med | |
137 * @return the result of looking up the given member in this class with respec
t to the given | |
138 * library | |
139 */ | |
140 ExecutableElement lookUpExecutable(String memberName, LibraryElement library); | |
141 /** | 197 /** |
142 * Return the element representing the getter that results from looking up the
given getter in | 198 * Return the element representing the getter that results from looking up the
given getter in |
143 * this class with respect to the given library, or {@code null} if the look u
p fails. The | 199 * this class with respect to the given library, or {@code null} if the look u
p fails. The |
144 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: | 200 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: |
145 * <blockquote>The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> | 201 * <blockquote>The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> |
146 * with respect to library <i>L</i> is: | 202 * with respect to library <i>L</i> is: |
147 * <ul> | 203 * <ul> |
148 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is | 204 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is |
149 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. | 205 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. |
150 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result | 206 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result |
151 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. | 207 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. |
152 * Otherwise, we say that the lookup has failed.</li> | 208 * Otherwise, we say that the lookup has failed.</li> |
153 * </ul> | 209 * </ul> |
154 * </blockquote> | 210 * </blockquote> |
155 * @param getterName the name of the getter being looked up | 211 * @param getterName the name of the getter being looked up |
156 * @param library the library with respect to which the lookup is being perfor
med | 212 * @param library the library with respect to which the lookup is being perfor
med |
157 * @return the result of looking up the given getter in this class with respec
t to the given | 213 * @return the result of looking up the given getter in this class with respec
t to the given |
158 * library | 214 * library |
159 */ | 215 */ |
160 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
); | 216 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
); |
| 217 |
161 /** | 218 /** |
162 * Return the element representing the method that results from looking up the
given method in | 219 * Return the element representing the method that results from looking up the
given method in |
163 * this class with respect to the given library, or {@code null} if the look u
p fails. The | 220 * this class with respect to the given library, or {@code null} if the look u
p fails. The |
164 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: | 221 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: |
165 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit
h respect to library | 222 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit
h respect to library |
166 * <i>L</i> is: | 223 * <i>L</i> is: |
167 * <ul> | 224 * <ul> |
168 * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessib
le to <i>L</i>, then | 225 * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessib
le to <i>L</i>, then |
169 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super
class <i>S</i>, then | 226 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super
class <i>S</i>, then |
170 * the result of the lookup is the result of looking up method <i>m</i> in <i>
S</i> with respect | 227 * the result of the lookup is the result of looking up method <i>m</i> in <i>
S</i> with respect |
171 * to <i>L</i>. Otherwise, we say that the lookup has failed.</li> | 228 * to <i>L</i>. Otherwise, we say that the lookup has failed.</li> |
172 * </ul> | 229 * </ul> |
173 * </blockquote> | 230 * </blockquote> |
174 * @param methodName the name of the method being looked up | 231 * @param methodName the name of the method being looked up |
175 * @param library the library with respect to which the lookup is being perfor
med | 232 * @param library the library with respect to which the lookup is being perfor
med |
176 * @return the result of looking up the given method in this class with respec
t to the given | 233 * @return the result of looking up the given method in this class with respec
t to the given |
177 * library | 234 * library |
178 */ | 235 */ |
179 MethodElement lookUpMethod(String methodName, LibraryElement library); | 236 MethodElement lookUpMethod(String methodName, LibraryElement library); |
| 237 |
180 /** | 238 /** |
181 * Return the element representing the setter that results from looking up the
given setter in | 239 * Return the element representing the setter that results from looking up the
given setter in |
182 * this class with respect to the given library, or {@code null} if the look u
p fails. The | 240 * this class with respect to the given library, or {@code null} if the look u
p fails. The |
183 * behavior of this method is defined by the Dart Language Specification in se
ction 12.16: | 241 * behavior of this method is defined by the Dart Language Specification in se
ction 12.16: |
184 * <blockquote> The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> | 242 * <blockquote> The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> |
185 * with respect to library <i>L</i> is: | 243 * with respect to library <i>L</i> is: |
186 * <ul> | 244 * <ul> |
187 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is | 245 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is |
188 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. | 246 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. |
189 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result | 247 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result |
190 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. | 248 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. |
191 * Otherwise, we say that the lookup has failed.</li> | 249 * Otherwise, we say that the lookup has failed.</li> |
192 * </ul> | 250 * </ul> |
193 * </blockquote> | 251 * </blockquote> |
194 * @param setterName the name of the setter being looked up | 252 * @param setterName the name of the setter being looked up |
195 * @param library the library with respect to which the lookup is being perfor
med | 253 * @param library the library with respect to which the lookup is being perfor
med |
196 * @return the result of looking up the given setter in this class with respec
t to the given | 254 * @return the result of looking up the given setter in this class with respec
t to the given |
197 * library | 255 * library |
198 */ | 256 */ |
199 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
); | 257 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
); |
200 } | 258 } |
| 259 |
201 /** | 260 /** |
202 * The interface {@code CompilationUnitElement} defines the behavior of elements
representing a | 261 * The interface {@code CompilationUnitElement} defines the behavior of elements
representing a |
203 * compilation unit. | 262 * compilation unit. |
204 * @coverage dart.engine.element | 263 * @coverage dart.engine.element |
205 */ | 264 */ |
206 abstract class CompilationUnitElement implements Element { | 265 abstract class CompilationUnitElement implements Element, UriReferencedElement { |
| 266 |
207 /** | 267 /** |
208 * Return an array containing all of the top-level accessors (getters and sett
ers) contained in | 268 * Return an array containing all of the top-level accessors (getters and sett
ers) contained in |
209 * this compilation unit. | 269 * this compilation unit. |
210 * @return the top-level accessors contained in this compilation unit | 270 * @return the top-level accessors contained in this compilation unit |
211 */ | 271 */ |
212 List<PropertyAccessorElement> get accessors; | 272 List<PropertyAccessorElement> get accessors; |
| 273 |
213 /** | 274 /** |
214 * Return the library in which this compilation unit is defined. | 275 * Return the library in which this compilation unit is defined. |
215 * @return the library in which this compilation unit is defined | 276 * @return the library in which this compilation unit is defined |
216 */ | 277 */ |
217 LibraryElement get enclosingElement; | 278 LibraryElement get enclosingElement; |
| 279 |
218 /** | 280 /** |
219 * Return an array containing all of the top-level functions contained in this
compilation unit. | 281 * Return an array containing all of the top-level functions contained in this
compilation unit. |
220 * @return the top-level functions contained in this compilation unit | 282 * @return the top-level functions contained in this compilation unit |
221 */ | 283 */ |
222 List<FunctionElement> get functions; | 284 List<FunctionElement> get functions; |
| 285 |
223 /** | 286 /** |
224 * Return an array containing all of the function type aliases contained in th
is compilation unit. | 287 * Return an array containing all of the function type aliases contained in th
is compilation unit. |
225 * @return the function type aliases contained in this compilation unit | 288 * @return the function type aliases contained in this compilation unit |
226 */ | 289 */ |
227 List<FunctionTypeAliasElement> get functionTypeAliases; | 290 List<FunctionTypeAliasElement> get functionTypeAliases; |
| 291 |
228 /** | 292 /** |
229 * Return an array containing all of the top-level variables contained in this
compilation unit. | 293 * Return an array containing all of the top-level variables contained in this
compilation unit. |
230 * @return the top-level variables contained in this compilation unit | 294 * @return the top-level variables contained in this compilation unit |
231 */ | 295 */ |
232 List<TopLevelVariableElement> get topLevelVariables; | 296 List<TopLevelVariableElement> get topLevelVariables; |
| 297 |
233 /** | 298 /** |
234 * Return the class defined in this compilation unit that has the given name,
or {@code null} if | 299 * Return the class defined in this compilation unit that has the given name,
or {@code null} if |
235 * this compilation unit does not define a class with the given name. | 300 * this compilation unit does not define a class with the given name. |
236 * @param className the name of the class to be returned | 301 * @param className the name of the class to be returned |
237 * @return the class with the given name that is defined in this compilation u
nit | 302 * @return the class with the given name that is defined in this compilation u
nit |
238 */ | 303 */ |
239 ClassElement getType(String className); | 304 ClassElement getType(String className); |
| 305 |
240 /** | 306 /** |
241 * Return an array containing all of the classes contained in this compilation
unit. | 307 * Return an array containing all of the classes contained in this compilation
unit. |
242 * @return the classes contained in this compilation unit | 308 * @return the classes contained in this compilation unit |
243 */ | 309 */ |
244 List<ClassElement> get types; | 310 List<ClassElement> get types; |
245 } | 311 } |
| 312 |
246 /** | 313 /** |
247 * The interface {@code ConstructorElement} defines the behavior of elements rep
resenting a | 314 * The interface {@code ConstructorElement} defines the behavior of elements rep
resenting a |
248 * constructor or a factory method defined within a type. | 315 * constructor or a factory method defined within a type. |
249 * @coverage dart.engine.element | 316 * @coverage dart.engine.element |
250 */ | 317 */ |
251 abstract class ConstructorElement implements ExecutableElement { | 318 abstract class ConstructorElement implements ExecutableElement { |
| 319 |
252 /** | 320 /** |
253 * Return the type in which this constructor is defined. | 321 * Return the type in which this constructor is defined. |
254 * @return the type in which this constructor is defined | 322 * @return the type in which this constructor is defined |
255 */ | 323 */ |
256 ClassElement get enclosingElement; | 324 ClassElement get enclosingElement; |
| 325 |
| 326 /** |
| 327 * Return the constructor to which this constructor is redirecting. |
| 328 * @return the constructor to which this constructor is redirecting |
| 329 */ |
| 330 ConstructorElement get redirectedConstructor; |
| 331 |
257 /** | 332 /** |
258 * Return {@code true} if this constructor is a const constructor. | 333 * Return {@code true} if this constructor is a const constructor. |
259 * @return {@code true} if this constructor is a const constructor | 334 * @return {@code true} if this constructor is a const constructor |
260 */ | 335 */ |
261 bool isConst(); | 336 bool isConst(); |
| 337 |
262 /** | 338 /** |
263 * Return {@code true} if this constructor represents a factory constructor. | 339 * Return {@code true} if this constructor represents a factory constructor. |
264 * @return {@code true} if this constructor represents a factory constructor | 340 * @return {@code true} if this constructor represents a factory constructor |
265 */ | 341 */ |
266 bool isFactory(); | 342 bool isFactory(); |
267 } | 343 } |
| 344 |
268 /** | 345 /** |
269 * The interface {@code Element} defines the behavior common to all of the eleme
nts in the element | 346 * The interface {@code Element} defines the behavior common to all of the eleme
nts in the element |
270 * model. Generally speaking, the element model is a semantic model of the progr
am that represents | 347 * model. Generally speaking, the element model is a semantic model of the progr
am that represents |
271 * things that are declared with a name and hence can be referenced elsewhere in
the code. | 348 * things that are declared with a name and hence can be referenced elsewhere in
the code. |
272 * <p> | 349 * <p> |
273 * There are two exceptions to the general case. First, there are elements in th
e element model that | 350 * There are two exceptions to the general case. First, there are elements in th
e element model that |
274 * are created for the convenience of various kinds of analysis but that do not
have any | 351 * are created for the convenience of various kinds of analysis but that do not
have any |
275 * corresponding declaration within the source code. Such elements are marked as
being | 352 * corresponding declaration within the source code. Such elements are marked as
being |
276 * <i>synthetic</i>. Examples of synthetic elements include | 353 * <i>synthetic</i>. Examples of synthetic elements include |
277 * <ul> | 354 * <ul> |
278 * <li>default constructors in classes that do not define any explicit construct
ors, | 355 * <li>default constructors in classes that do not define any explicit construct
ors, |
279 * <li>getters and setters that are induced by explicit field declarations, | 356 * <li>getters and setters that are induced by explicit field declarations, |
280 * <li>fields that are induced by explicit declarations of getters and setters,
and | 357 * <li>fields that are induced by explicit declarations of getters and setters,
and |
281 * <li>functions representing the initialization expression for a variable. | 358 * <li>functions representing the initialization expression for a variable. |
282 * </ul> | 359 * </ul> |
283 * <p> | 360 * <p> |
284 * Second, there are elements in the element model that do not have a name. Thes
e correspond to | 361 * Second, there are elements in the element model that do not have a name. Thes
e correspond to |
285 * unnamed functions and exist in order to more accurately represent the semanti
c structure of the | 362 * unnamed functions and exist in order to more accurately represent the semanti
c structure of the |
286 * program. | 363 * program. |
287 * @coverage dart.engine.element | 364 * @coverage dart.engine.element |
288 */ | 365 */ |
289 abstract class Element { | 366 abstract class Element { |
| 367 |
290 /** | 368 /** |
291 * A comparator that can be used to sort elements by their name offset. Elemen
ts with a smaller | 369 * A comparator that can be used to sort elements by their name offset. Elemen
ts with a smaller |
292 * offset will be sorted to be before elements with a larger name offset. | 370 * offset will be sorted to be before elements with a larger name offset. |
293 */ | 371 */ |
294 static Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Element sec
ondElement) => firstElement.nameOffset - secondElement.nameOffset; | 372 static Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Element sec
ondElement) => firstElement.nameOffset - secondElement.nameOffset; |
| 373 |
295 /** | 374 /** |
296 * Use the given visitor to visit this element. | 375 * Use the given visitor to visit this element. |
297 * @param visitor the visitor that will visit this element | 376 * @param visitor the visitor that will visit this element |
298 * @return the value returned by the visitor as a result of visiting this elem
ent | 377 * @return the value returned by the visitor as a result of visiting this elem
ent |
299 */ | 378 */ |
300 accept(ElementVisitor visitor); | 379 accept(ElementVisitor visitor); |
| 380 |
301 /** | 381 /** |
302 * Return the documentation comment for this element as it appears in the orig
inal source | 382 * Return the documentation comment for this element as it appears in the orig
inal source |
303 * (complete with the beginning and ending delimiters), or {@code null} if thi
s element does not | 383 * (complete with the beginning and ending delimiters), or {@code null} if thi
s element does not |
304 * have a documentation comment associated with it. This can be a long-running
operation if the | 384 * have a documentation comment associated with it. This can be a long-running
operation if the |
305 * information needed to access the comment is not cached. | 385 * information needed to access the comment is not cached. |
306 * @return this element's documentation comment | 386 * @return this element's documentation comment |
307 * @throws AnalysisException if the documentation comment could not be determi
ned because the | 387 * @throws AnalysisException if the documentation comment could not be determi
ned because the |
308 * analysis could not be performed | 388 * analysis could not be performed |
309 */ | 389 */ |
310 String computeDocumentationComment(); | 390 String computeDocumentationComment(); |
| 391 |
311 /** | 392 /** |
312 * Return the element of the given class that most immediately encloses this e
lement, or{@code null} if there is no enclosing element of the given class. | 393 * Return the element of the given class that most immediately encloses this e
lement, or{@code null} if there is no enclosing element of the given class. |
313 * @param elementClass the class of the element to be returned | 394 * @param elementClass the class of the element to be returned |
314 * @return the element that encloses this element | 395 * @return the element that encloses this element |
315 */ | 396 */ |
316 Element getAncestor(Type elementClass); | 397 Element getAncestor(Type elementClass); |
| 398 |
317 /** | 399 /** |
318 * Return the analysis context in which this element is defined. | 400 * Return the analysis context in which this element is defined. |
319 * @return the analysis context in which this element is defined | 401 * @return the analysis context in which this element is defined |
320 */ | 402 */ |
321 AnalysisContext get context; | 403 AnalysisContext get context; |
| 404 |
| 405 /** |
| 406 * Return the display name of this element, or {@code null} if this element do
es not have a name. |
| 407 * <p> |
| 408 * In most cases the name and the display name are the same. Differences thoug
h are cases such as |
| 409 * setters where the name of some setter {@code set f(x)} is {@code f=}, inste
ad of {@code f}. |
| 410 * @return the display name of this element |
| 411 */ |
| 412 String get displayName; |
| 413 |
322 /** | 414 /** |
323 * Return the element that either physically or logically encloses this elemen
t. This will be{@code null} if this element is a library because libraries are t
he top-level elements in the | 415 * Return the element that either physically or logically encloses this elemen
t. This will be{@code null} if this element is a library because libraries are t
he top-level elements in the |
324 * model. | 416 * model. |
325 * @return the element that encloses this element | 417 * @return the element that encloses this element |
326 */ | 418 */ |
327 Element get enclosingElement; | 419 Element get enclosingElement; |
| 420 |
328 /** | 421 /** |
329 * Return the kind of element that this is. | 422 * Return the kind of element that this is. |
330 * @return the kind of this element | 423 * @return the kind of this element |
331 */ | 424 */ |
332 ElementKind get kind; | 425 ElementKind get kind; |
| 426 |
333 /** | 427 /** |
334 * Return the library that contains this element. This will be the element its
elf if it is a | 428 * Return the library that contains this element. This will be the element its
elf if it is a |
335 * library element. This will be {@code null} if this element is an HTML file
because HTML files | 429 * library element. This will be {@code null} if this element is an HTML file
because HTML files |
336 * are not contained in libraries. | 430 * are not contained in libraries. |
337 * @return the library that contains this element | 431 * @return the library that contains this element |
338 */ | 432 */ |
339 LibraryElement get library; | 433 LibraryElement get library; |
| 434 |
340 /** | 435 /** |
341 * Return an object representing the location of this element in the element m
odel. The object can | 436 * Return an object representing the location of this element in the element m
odel. The object can |
342 * be used to locate this element at a later time. | 437 * be used to locate this element at a later time. |
343 * @return the location of this element in the element model | 438 * @return the location of this element in the element model |
344 */ | 439 */ |
345 ElementLocation get location; | 440 ElementLocation get location; |
| 441 |
346 /** | 442 /** |
347 * Return an array containing all of the metadata associated with this element
. | 443 * Return an array containing all of the metadata associated with this element
. |
348 * @return the metadata associated with this element | 444 * @return the metadata associated with this element |
349 */ | 445 */ |
350 List<Annotation> get metadata; | 446 List<Annotation> get metadata; |
| 447 |
351 /** | 448 /** |
352 * Return the name of this element, or {@code null} if this element does not h
ave a name. | 449 * Return the name of this element, or {@code null} if this element does not h
ave a name. |
353 * @return the name of this element | 450 * @return the name of this element |
354 */ | 451 */ |
355 String get name; | 452 String get name; |
| 453 |
356 /** | 454 /** |
357 * Return the offset of the name of this element in the file that contains the
declaration of this | 455 * Return the offset of the name of this element in the file that contains the
declaration of this |
358 * element, or {@code -1} if this element is synthetic, does not have a name,
or otherwise does | 456 * element, or {@code -1} if this element is synthetic, does not have a name,
or otherwise does |
359 * not have an offset. | 457 * not have an offset. |
360 * @return the offset of the name of this element | 458 * @return the offset of the name of this element |
361 */ | 459 */ |
362 int get nameOffset; | 460 int get nameOffset; |
| 461 |
363 /** | 462 /** |
364 * Return the source that contains this element, or {@code null} if this eleme
nt is not contained | 463 * Return the source that contains this element, or {@code null} if this eleme
nt is not contained |
365 * in a source. | 464 * in a source. |
366 * @return the source that contains this element | 465 * @return the source that contains this element |
367 */ | 466 */ |
368 Source get source; | 467 Source get source; |
| 468 |
369 /** | 469 /** |
370 * Return {@code true} if this element, assuming that it is within scope, is a
ccessible to code in | 470 * Return {@code true} if this element, assuming that it is within scope, is a
ccessible to code in |
371 * the given library. This is defined by the Dart Language Specification in se
ction 3.2: | 471 * the given library. This is defined by the Dart Language Specification in se
ction 3.2: |
372 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i
>m</i> is declared | 472 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i
>m</i> is declared |
373 * in <i>L</i> or if <i>m</i> is public. </blockquote> | 473 * in <i>L</i> or if <i>m</i> is public. </blockquote> |
374 * @param library the library in which a possible reference to this element wo
uld occur | 474 * @param library the library in which a possible reference to this element wo
uld occur |
375 * @return {@code true} if this element is accessible to code in the given lib
rary | 475 * @return {@code true} if this element is accessible to code in the given lib
rary |
376 */ | 476 */ |
377 bool isAccessibleIn(LibraryElement library); | 477 bool isAccessibleIn(LibraryElement library); |
| 478 |
378 /** | 479 /** |
379 * Return {@code true} if this element is synthetic. A synthetic element is an
element that is not | 480 * Return {@code true} if this element is synthetic. A synthetic element is an
element that is not |
380 * represented in the source code explicitly, but is implied by the source cod
e, such as the | 481 * represented in the source code explicitly, but is implied by the source cod
e, such as the |
381 * default constructor for a class that does not explicitly define any constru
ctors. | 482 * default constructor for a class that does not explicitly define any constru
ctors. |
382 * @return {@code true} if this element is synthetic | 483 * @return {@code true} if this element is synthetic |
383 */ | 484 */ |
384 bool isSynthetic(); | 485 bool isSynthetic(); |
| 486 |
385 /** | 487 /** |
386 * Use the given visitor to visit all of the children of this element. There i
s no guarantee of | 488 * Use the given visitor to visit all of the children of this element. There i
s no guarantee of |
387 * the order in which the children will be visited. | 489 * the order in which the children will be visited. |
388 * @param visitor the visitor that will be used to visit the children of this
element | 490 * @param visitor the visitor that will be used to visit the children of this
element |
389 */ | 491 */ |
390 void visitChildren(ElementVisitor<Object> visitor); | 492 void visitChildren(ElementVisitor<Object> visitor); |
391 } | 493 } |
| 494 |
392 /** | 495 /** |
393 * The enumeration {@code ElementKind} defines the various kinds of elements in
the element model. | 496 * The enumeration {@code ElementKind} defines the various kinds of elements in
the element model. |
394 * @coverage dart.engine.element | 497 * @coverage dart.engine.element |
395 */ | 498 */ |
396 class ElementKind implements Comparable<ElementKind> { | 499 class ElementKind implements Comparable<ElementKind> { |
397 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class"); | 500 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class"); |
398 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT'
, 1, "compilation unit"); | 501 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT'
, 1, "compilation unit"); |
399 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons
tructor"); | 502 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons
tructor"); |
400 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>"); | 503 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>"); |
401 static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML
_SCRIPT', 4, "embedded html script"); | 504 static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML
_SCRIPT', 4, "embedded html script"); |
(...skipping 11 matching lines...) Expand all Loading... |
413 static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); | 516 static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); |
414 static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); | 517 static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); |
415 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "paramet
er"); | 518 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "paramet
er"); |
416 static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix
"); | 519 static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix
"); |
417 static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); | 520 static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); |
418 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA
BLE', 21, "top level variable"); | 521 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA
BLE', 21, "top level variable"); |
419 static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_
ALIAS', 22, "function type alias"); | 522 static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_
ALIAS', 22, "function type alias"); |
420 static final ElementKind TYPE_VARIABLE = new ElementKind('TYPE_VARIABLE', 23,
"type variable"); | 523 static final ElementKind TYPE_VARIABLE = new ElementKind('TYPE_VARIABLE', 23,
"type variable"); |
421 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe
>"); | 524 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe
>"); |
422 static final List<ElementKind> values = [CLASS, COMPILATION_UNIT, CONSTRUCTOR,
DYNAMIC, EMBEDDED_HTML_SCRIPT, ERROR, EXPORT, EXTERNAL_HTML_SCRIPT, FIELD, FUNC
TION, GETTER, HTML, IMPORT, LABEL, LIBRARY, LOCAL_VARIABLE, METHOD, NAME, PARAME
TER, PREFIX, SETTER, TOP_LEVEL_VARIABLE, FUNCTION_TYPE_ALIAS, TYPE_VARIABLE, UNI
VERSE]; | 525 static final List<ElementKind> values = [CLASS, COMPILATION_UNIT, CONSTRUCTOR,
DYNAMIC, EMBEDDED_HTML_SCRIPT, ERROR, EXPORT, EXTERNAL_HTML_SCRIPT, FIELD, FUNC
TION, GETTER, HTML, IMPORT, LABEL, LIBRARY, LOCAL_VARIABLE, METHOD, NAME, PARAME
TER, PREFIX, SETTER, TOP_LEVEL_VARIABLE, FUNCTION_TYPE_ALIAS, TYPE_VARIABLE, UNI
VERSE]; |
423 final String __name; | 526 |
424 final int __ordinal; | 527 /// The name of this enum constant, as declared in the enum declaration. |
425 int get ordinal => __ordinal; | 528 final String name; |
| 529 |
| 530 /// The position in the enum declaration. |
| 531 final int ordinal; |
| 532 |
426 /** | 533 /** |
427 * Return the kind of the given element, or {@link #ERROR} if the element is {
@code null}. This is | 534 * Return the kind of the given element, or {@link #ERROR} if the element is {
@code null}. This is |
428 * a utility method that can reduce the need for null checks in other places. | 535 * a utility method that can reduce the need for null checks in other places. |
429 * @param element the element whose kind is to be returned | 536 * @param element the element whose kind is to be returned |
430 * @return the kind of the given element | 537 * @return the kind of the given element |
431 */ | 538 */ |
432 static ElementKind of(Element element) { | 539 static ElementKind of(Element element) { |
433 if (element == null) { | 540 if (element == null) { |
434 return ERROR; | 541 return ERROR; |
435 } | 542 } |
436 return element.kind; | 543 return element.kind; |
437 } | 544 } |
| 545 |
438 /** | 546 /** |
439 * The name displayed in the UI for this kind of element. | 547 * The name displayed in the UI for this kind of element. |
440 */ | 548 */ |
441 String _displayName; | 549 String _displayName; |
| 550 |
442 /** | 551 /** |
443 * Initialize a newly created element kind to have the given display name. | 552 * Initialize a newly created element kind to have the given display name. |
444 * @param displayName the name displayed in the UI for this kind of element | 553 * @param displayName the name displayed in the UI for this kind of element |
445 */ | 554 */ |
446 ElementKind(this.__name, this.__ordinal, String displayName) { | 555 ElementKind(this.name, this.ordinal, String displayName) { |
447 this._displayName = displayName; | 556 this._displayName = displayName; |
448 } | 557 } |
| 558 |
449 /** | 559 /** |
450 * Return the name displayed in the UI for this kind of element. | 560 * Return the name displayed in the UI for this kind of element. |
451 * @return the name of this {@link ElementKind} to display in UI. | 561 * @return the name of this {@link ElementKind} to display in UI. |
452 */ | 562 */ |
453 String get displayName => _displayName; | 563 String get displayName => _displayName; |
454 int compareTo(ElementKind other) => __ordinal - other.__ordinal; | 564 int compareTo(ElementKind other) => ordinal - other.ordinal; |
455 String toString() => __name; | 565 String toString() => name; |
456 } | 566 } |
| 567 |
457 /** | 568 /** |
458 * The interface {@code ElementLocation} defines the behavior of objects that re
present the location | 569 * The interface {@code ElementLocation} defines the behavior of objects that re
present the location |
459 * of an element within the element model. | 570 * of an element within the element model. |
460 * @coverage dart.engine.element | 571 * @coverage dart.engine.element |
461 */ | 572 */ |
462 abstract class ElementLocation { | 573 abstract class ElementLocation { |
| 574 |
463 /** | 575 /** |
464 * Return an encoded representation of this location that can be used to creat
e a location that is | 576 * Return an encoded representation of this location that can be used to creat
e a location that is |
465 * equal to this location. | 577 * equal to this location. |
466 * @return an encoded representation of this location | 578 * @return an encoded representation of this location |
467 */ | 579 */ |
468 String get encoding; | 580 String get encoding; |
469 } | 581 } |
| 582 |
470 /** | 583 /** |
471 * The interface {@code ElementVisitor} defines the behavior of objects that can
be used to visit an | 584 * The interface {@code ElementVisitor} defines the behavior of objects that can
be used to visit an |
472 * element structure. | 585 * element structure. |
473 * @coverage dart.engine.element | 586 * @coverage dart.engine.element |
474 */ | 587 */ |
475 abstract class ElementVisitor<R> { | 588 abstract class ElementVisitor<R> { |
476 R visitClassElement(ClassElement element); | 589 R visitClassElement(ClassElement element); |
477 R visitCompilationUnitElement(CompilationUnitElement element); | 590 R visitCompilationUnitElement(CompilationUnitElement element); |
478 R visitConstructorElement(ConstructorElement element); | 591 R visitConstructorElement(ConstructorElement element); |
479 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); | 592 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); |
480 R visitExportElement(ExportElement element); | 593 R visitExportElement(ExportElement element); |
481 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element); | 594 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element); |
482 R visitFieldElement(FieldElement element); | 595 R visitFieldElement(FieldElement element); |
483 R visitFieldFormalParameterElement(FieldFormalParameterElement element); | 596 R visitFieldFormalParameterElement(FieldFormalParameterElement element); |
484 R visitFunctionElement(FunctionElement element); | 597 R visitFunctionElement(FunctionElement element); |
485 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element); | 598 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element); |
486 R visitHtmlElement(HtmlElement element); | 599 R visitHtmlElement(HtmlElement element); |
487 R visitImportElement(ImportElement element); | 600 R visitImportElement(ImportElement element); |
488 R visitLabelElement(LabelElement element); | 601 R visitLabelElement(LabelElement element); |
489 R visitLibraryElement(LibraryElement element); | 602 R visitLibraryElement(LibraryElement element); |
490 R visitLocalVariableElement(LocalVariableElement element); | 603 R visitLocalVariableElement(LocalVariableElement element); |
491 R visitMethodElement(MethodElement element); | 604 R visitMethodElement(MethodElement element); |
492 R visitMultiplyDefinedElement(MultiplyDefinedElement element); | 605 R visitMultiplyDefinedElement(MultiplyDefinedElement element); |
493 R visitParameterElement(ParameterElement element); | 606 R visitParameterElement(ParameterElement element); |
494 R visitPrefixElement(PrefixElement element); | 607 R visitPrefixElement(PrefixElement element); |
495 R visitPropertyAccessorElement(PropertyAccessorElement element); | 608 R visitPropertyAccessorElement(PropertyAccessorElement element); |
496 R visitTopLevelVariableElement(TopLevelVariableElement element); | 609 R visitTopLevelVariableElement(TopLevelVariableElement element); |
497 R visitTypeVariableElement(TypeVariableElement element); | 610 R visitTypeVariableElement(TypeVariableElement element); |
498 } | 611 } |
| 612 |
499 /** | 613 /** |
500 * The interface {@code EmbeddedHtmlScriptElement} defines the behavior of eleme
nts representing a | 614 * The interface {@code EmbeddedHtmlScriptElement} defines the behavior of eleme
nts representing a |
501 * script tag in an HTML file having content that defines a Dart library. | 615 * script tag in an HTML file having content that defines a Dart library. |
502 * @coverage dart.engine.element | 616 * @coverage dart.engine.element |
503 */ | 617 */ |
504 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { | 618 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { |
| 619 |
505 /** | 620 /** |
506 * Return the library element defined by the content of the script tag. | 621 * Return the library element defined by the content of the script tag. |
507 * @return the library element (not {@code null}) | 622 * @return the library element (not {@code null}) |
508 */ | 623 */ |
509 LibraryElement get scriptLibrary; | 624 LibraryElement get scriptLibrary; |
510 } | 625 } |
| 626 |
511 /** | 627 /** |
512 * The interface {@code ExecutableElement} defines the behavior of elements repr
esenting an | 628 * The interface {@code ExecutableElement} defines the behavior of elements repr
esenting an |
513 * executable object, including functions, methods, constructors, getters, and s
etters. | 629 * executable object, including functions, methods, constructors, getters, and s
etters. |
514 * @coverage dart.engine.element | 630 * @coverage dart.engine.element |
515 */ | 631 */ |
516 abstract class ExecutableElement implements Element { | 632 abstract class ExecutableElement implements Element { |
| 633 |
517 /** | 634 /** |
518 * Return an array containing all of the functions defined within this executa
ble element. | 635 * Return an array containing all of the functions defined within this executa
ble element. |
519 * @return the functions defined within this executable element | 636 * @return the functions defined within this executable element |
520 */ | 637 */ |
521 List<FunctionElement> get functions; | 638 List<FunctionElement> get functions; |
| 639 |
522 /** | 640 /** |
523 * Return an array containing all of the labels defined within this executable
element. | 641 * Return an array containing all of the labels defined within this executable
element. |
524 * @return the labels defined within this executable element | 642 * @return the labels defined within this executable element |
525 */ | 643 */ |
526 List<LabelElement> get labels; | 644 List<LabelElement> get labels; |
| 645 |
527 /** | 646 /** |
528 * Return an array containing all of the local variables defined within this e
xecutable element. | 647 * Return an array containing all of the local variables defined within this e
xecutable element. |
529 * @return the local variables defined within this executable element | 648 * @return the local variables defined within this executable element |
530 */ | 649 */ |
531 List<LocalVariableElement> get localVariables; | 650 List<LocalVariableElement> get localVariables; |
| 651 |
532 /** | 652 /** |
533 * Return an array containing all of the parameters defined by this executable
element. | 653 * Return an array containing all of the parameters defined by this executable
element. |
534 * @return the parameters defined by this executable element | 654 * @return the parameters defined by this executable element |
535 */ | 655 */ |
536 List<ParameterElement> get parameters; | 656 List<ParameterElement> get parameters; |
| 657 |
537 /** | 658 /** |
538 * Return the type of function defined by this executable element. | 659 * Return the type of function defined by this executable element. |
539 * @return the type of function defined by this executable element | 660 * @return the type of function defined by this executable element |
540 */ | 661 */ |
541 FunctionType get type; | 662 FunctionType get type; |
| 663 |
542 /** | 664 /** |
543 * Return {@code true} if this executable element is an operator. The test may
be based on the | 665 * Return {@code true} if this executable element is an operator. The test may
be based on the |
544 * name of the executable element, in which case the result will be correct wh
en the name is | 666 * name of the executable element, in which case the result will be correct wh
en the name is |
545 * legal. | 667 * legal. |
546 * @return {@code true} if this executable element is an operator | 668 * @return {@code true} if this executable element is an operator |
547 */ | 669 */ |
548 bool isOperator(); | 670 bool isOperator(); |
| 671 |
549 /** | 672 /** |
550 * Return {@code true} if this element is a static element. A static element i
s an element that is | 673 * Return {@code true} if this element is a static element. A static element i
s an element that is |
551 * not associated with a particular instance, but rather with an entire librar
y or class. | 674 * not associated with a particular instance, but rather with an entire librar
y or class. |
552 * @return {@code true} if this executable element is a static element | 675 * @return {@code true} if this executable element is a static element |
553 */ | 676 */ |
554 bool isStatic(); | 677 bool isStatic(); |
555 } | 678 } |
| 679 |
556 /** | 680 /** |
557 * The interface {@code ExportElement} defines the behavior of objects represent
ing information | 681 * The interface {@code ExportElement} defines the behavior of objects represent
ing information |
558 * about a single export directive within a library. | 682 * about a single export directive within a library. |
559 * @coverage dart.engine.element | 683 * @coverage dart.engine.element |
560 */ | 684 */ |
561 abstract class ExportElement implements Element { | 685 abstract class ExportElement implements Element, UriReferencedElement { |
| 686 |
562 /** | 687 /** |
563 * An empty array of export elements. | 688 * An empty array of export elements. |
564 */ | 689 */ |
565 static List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); | 690 static List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); |
| 691 |
566 /** | 692 /** |
567 * Return an array containing the combinators that were specified as part of t
he export directive | 693 * Return an array containing the combinators that were specified as part of t
he export directive |
568 * in the order in which they were specified. | 694 * in the order in which they were specified. |
569 * @return the combinators specified in the export directive | 695 * @return the combinators specified in the export directive |
570 */ | 696 */ |
571 List<NamespaceCombinator> get combinators; | 697 List<NamespaceCombinator> get combinators; |
| 698 |
572 /** | 699 /** |
573 * Return the library that is exported from this library by this export direct
ive. | 700 * Return the library that is exported from this library by this export direct
ive. |
574 * @return the library that is exported from this library | 701 * @return the library that is exported from this library |
575 */ | 702 */ |
576 LibraryElement get exportedLibrary; | 703 LibraryElement get exportedLibrary; |
577 } | 704 } |
| 705 |
578 /** | 706 /** |
579 * The interface {@code ExternalHtmlScriptElement} defines the behavior of eleme
nts representing a | 707 * The interface {@code ExternalHtmlScriptElement} defines the behavior of eleme
nts representing a |
580 * script tag in an HTML file having a {@code source} attribute that references
a Dart library | 708 * script tag in an HTML file having a {@code source} attribute that references
a Dart library |
581 * source file. | 709 * source file. |
582 * @coverage dart.engine.element | 710 * @coverage dart.engine.element |
583 */ | 711 */ |
584 abstract class ExternalHtmlScriptElement implements HtmlScriptElement { | 712 abstract class ExternalHtmlScriptElement implements HtmlScriptElement { |
| 713 |
585 /** | 714 /** |
586 * Return the source referenced by this element, or {@code null} if this eleme
nt does not | 715 * Return the source referenced by this element, or {@code null} if this eleme
nt does not |
587 * reference a Dart library source file. | 716 * reference a Dart library source file. |
588 * @return the source for the external Dart library | 717 * @return the source for the external Dart library |
589 */ | 718 */ |
590 Source get scriptSource; | 719 Source get scriptSource; |
591 } | 720 } |
| 721 |
592 /** | 722 /** |
593 * The interface {@code FieldElement} defines the behavior of elements represent
ing a field defined | 723 * The interface {@code FieldElement} defines the behavior of elements represent
ing a field defined |
594 * within a type. | 724 * within a type. |
595 * @coverage dart.engine.element | 725 * @coverage dart.engine.element |
596 */ | 726 */ |
597 abstract class FieldElement implements PropertyInducingElement { | 727 abstract class FieldElement implements PropertyInducingElement { |
| 728 |
598 /** | 729 /** |
599 * Return the type in which this field is defined. | 730 * Return the type in which this field is defined. |
600 * @return the type in which this field is defined | 731 * @return the type in which this field is defined |
601 */ | 732 */ |
602 ClassElement get enclosingElement; | 733 ClassElement get enclosingElement; |
603 } | 734 } |
| 735 |
604 /** | 736 /** |
605 * The interface {@code FieldFormalParameterElement} defines the behavior of ele
ments representing a | 737 * The interface {@code FieldFormalParameterElement} defines the behavior of ele
ments representing a |
606 * field formal parameter defined within a constructor element. | 738 * field formal parameter defined within a constructor element. |
607 */ | 739 */ |
608 abstract class FieldFormalParameterElement implements ParameterElement { | 740 abstract class FieldFormalParameterElement implements ParameterElement { |
| 741 |
609 /** | 742 /** |
610 * Return the field element associated with this field formal parameter, or {@
code null} if the | 743 * Return the field element associated with this field formal parameter, or {@
code null} if the |
611 * parameter references a field that doesn't exist. | 744 * parameter references a field that doesn't exist. |
612 * @return the field element associated with this field formal parameter | 745 * @return the field element associated with this field formal parameter |
613 */ | 746 */ |
614 FieldElement get field; | 747 FieldElement get field; |
615 } | 748 } |
| 749 |
616 /** | 750 /** |
617 * The interface {@code FunctionElement} defines the behavior of elements repres
enting a function. | 751 * The interface {@code FunctionElement} defines the behavior of elements repres
enting a function. |
618 * @coverage dart.engine.element | 752 * @coverage dart.engine.element |
619 */ | 753 */ |
620 abstract class FunctionElement implements ExecutableElement, LocalElement { | 754 abstract class FunctionElement implements ExecutableElement, LocalElement { |
621 } | 755 } |
| 756 |
622 /** | 757 /** |
623 * The interface {@code FunctionTypeAliasElement} defines the behavior of elemen
ts representing a | 758 * The interface {@code FunctionTypeAliasElement} defines the behavior of elemen
ts representing a |
624 * function type alias ({@code typedef}). | 759 * function type alias ({@code typedef}). |
625 * @coverage dart.engine.element | 760 * @coverage dart.engine.element |
626 */ | 761 */ |
627 abstract class FunctionTypeAliasElement implements Element { | 762 abstract class FunctionTypeAliasElement implements Element { |
| 763 |
628 /** | 764 /** |
629 * Return the compilation unit in which this type alias is defined. | 765 * Return the compilation unit in which this type alias is defined. |
630 * @return the compilation unit in which this type alias is defined | 766 * @return the compilation unit in which this type alias is defined |
631 */ | 767 */ |
632 CompilationUnitElement get enclosingElement; | 768 CompilationUnitElement get enclosingElement; |
| 769 |
633 /** | 770 /** |
634 * Return an array containing all of the parameters defined by this type alias
. | 771 * Return an array containing all of the parameters defined by this type alias
. |
635 * @return the parameters defined by this type alias | 772 * @return the parameters defined by this type alias |
636 */ | 773 */ |
637 List<ParameterElement> get parameters; | 774 List<ParameterElement> get parameters; |
| 775 |
638 /** | 776 /** |
639 * Return the type of function defined by this type alias. | 777 * Return the type of function defined by this type alias. |
640 * @return the type of function defined by this type alias | 778 * @return the type of function defined by this type alias |
641 */ | 779 */ |
642 FunctionType get type; | 780 FunctionType get type; |
| 781 |
643 /** | 782 /** |
644 * Return an array containing all of the type variables defined for this type. | 783 * Return an array containing all of the type variables defined for this type. |
645 * @return the type variables defined for this type | 784 * @return the type variables defined for this type |
646 */ | 785 */ |
647 List<TypeVariableElement> get typeVariables; | 786 List<TypeVariableElement> get typeVariables; |
648 } | 787 } |
| 788 |
649 /** | 789 /** |
650 * The interface {@code HideCombinator} defines the behavior of combinators that
cause some of the | 790 * The interface {@code HideCombinator} defines the behavior of combinators that
cause some of the |
651 * names in a namespace to be hidden when being imported. | 791 * names in a namespace to be hidden when being imported. |
652 * @coverage dart.engine.element | 792 * @coverage dart.engine.element |
653 */ | 793 */ |
654 abstract class HideCombinator implements NamespaceCombinator { | 794 abstract class HideCombinator implements NamespaceCombinator { |
| 795 |
655 /** | 796 /** |
656 * Return an array containing the names that are not to be made visible in the
importing library | 797 * Return an array containing the names that are not to be made visible in the
importing library |
657 * even if they are defined in the imported library. | 798 * even if they are defined in the imported library. |
658 * @return the names from the imported library that are hidden from the import
ing library | 799 * @return the names from the imported library that are hidden from the import
ing library |
659 */ | 800 */ |
660 List<String> get hiddenNames; | 801 List<String> get hiddenNames; |
661 } | 802 } |
| 803 |
662 /** | 804 /** |
663 * The interface {@code HtmlElement} defines the behavior of elements representi
ng an HTML file. | 805 * The interface {@code HtmlElement} defines the behavior of elements representi
ng an HTML file. |
664 * @coverage dart.engine.element | 806 * @coverage dart.engine.element |
665 */ | 807 */ |
666 abstract class HtmlElement implements Element { | 808 abstract class HtmlElement implements Element { |
| 809 |
667 /** | 810 /** |
668 * Return an array containing all of the script elements contained in the HTML
file. This includes | 811 * Return an array containing all of the script elements contained in the HTML
file. This includes |
669 * scripts with libraries that are defined by the content of a script tag as w
ell as libraries | 812 * scripts with libraries that are defined by the content of a script tag as w
ell as libraries |
670 * that are referenced in the {@core source} attribute of a script tag. | 813 * that are referenced in the {@core source} attribute of a script tag. |
671 * @return the script elements in the HTML file (not {@code null}, contains no
{@code null}s) | 814 * @return the script elements in the HTML file (not {@code null}, contains no
{@code null}s) |
672 */ | 815 */ |
673 List<HtmlScriptElement> get scripts; | 816 List<HtmlScriptElement> get scripts; |
674 } | 817 } |
| 818 |
675 /** | 819 /** |
676 * The interface {@code HtmlScriptElement} defines the behavior of elements repr
esenting a script | 820 * The interface {@code HtmlScriptElement} defines the behavior of elements repr
esenting a script |
677 * tag in an HTML file. | 821 * tag in an HTML file. |
678 * @see EmbeddedHtmlScriptElement | 822 * @see EmbeddedHtmlScriptElement |
679 * @see ExternalHtmlScriptElement | 823 * @see ExternalHtmlScriptElement |
680 * @coverage dart.engine.element | 824 * @coverage dart.engine.element |
681 */ | 825 */ |
682 abstract class HtmlScriptElement implements Element { | 826 abstract class HtmlScriptElement implements Element { |
683 } | 827 } |
| 828 |
684 /** | 829 /** |
685 * The interface {@code ImportElement} defines the behavior of objects represent
ing information | 830 * The interface {@code ImportElement} defines the behavior of objects represent
ing information |
686 * about a single import directive within a library. | 831 * about a single import directive within a library. |
687 * @coverage dart.engine.element | 832 * @coverage dart.engine.element |
688 */ | 833 */ |
689 abstract class ImportElement implements Element { | 834 abstract class ImportElement implements Element, UriReferencedElement { |
| 835 |
690 /** | 836 /** |
691 * An empty array of import elements. | 837 * An empty array of import elements. |
692 */ | 838 */ |
693 static List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0); | 839 static List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0); |
| 840 |
694 /** | 841 /** |
695 * Return an array containing the combinators that were specified as part of t
he import directive | 842 * Return an array containing the combinators that were specified as part of t
he import directive |
696 * in the order in which they were specified. | 843 * in the order in which they were specified. |
697 * @return the combinators specified in the import directive | 844 * @return the combinators specified in the import directive |
698 */ | 845 */ |
699 List<NamespaceCombinator> get combinators; | 846 List<NamespaceCombinator> get combinators; |
| 847 |
700 /** | 848 /** |
701 * Return the library that is imported into this library by this import direct
ive. | 849 * Return the library that is imported into this library by this import direct
ive. |
702 * @return the library that is imported into this library | 850 * @return the library that is imported into this library |
703 */ | 851 */ |
704 LibraryElement get importedLibrary; | 852 LibraryElement get importedLibrary; |
| 853 |
705 /** | 854 /** |
706 * Return the prefix that was specified as part of the import directive, or {@
code null} if there | 855 * Return the prefix that was specified as part of the import directive, or {@
code null} if there |
707 * was no prefix specified. | 856 * was no prefix specified. |
708 * @return the prefix that was specified as part of the import directive | 857 * @return the prefix that was specified as part of the import directive |
709 */ | 858 */ |
710 PrefixElement get prefix; | 859 PrefixElement get prefix; |
711 } | 860 } |
| 861 |
712 /** | 862 /** |
713 * The interface {@code LabelElement} defines the behavior of elements represent
ing a label | 863 * The interface {@code LabelElement} defines the behavior of elements represent
ing a label |
714 * associated with a statement. | 864 * associated with a statement. |
715 * @coverage dart.engine.element | 865 * @coverage dart.engine.element |
716 */ | 866 */ |
717 abstract class LabelElement implements Element { | 867 abstract class LabelElement implements Element { |
| 868 |
718 /** | 869 /** |
719 * Return the executable element in which this label is defined. | 870 * Return the executable element in which this label is defined. |
720 * @return the executable element in which this label is defined | 871 * @return the executable element in which this label is defined |
721 */ | 872 */ |
722 ExecutableElement get enclosingElement; | 873 ExecutableElement get enclosingElement; |
723 } | 874 } |
| 875 |
724 /** | 876 /** |
725 * The interface {@code LibraryElement} defines the behavior of elements represe
nting a library. | 877 * The interface {@code LibraryElement} defines the behavior of elements represe
nting a library. |
726 * @coverage dart.engine.element | 878 * @coverage dart.engine.element |
727 */ | 879 */ |
728 abstract class LibraryElement implements Element { | 880 abstract class LibraryElement implements Element { |
| 881 |
729 /** | 882 /** |
730 * Return the compilation unit that defines this library. | 883 * Return the compilation unit that defines this library. |
731 * @return the compilation unit that defines this library | 884 * @return the compilation unit that defines this library |
732 */ | 885 */ |
733 CompilationUnitElement get definingCompilationUnit; | 886 CompilationUnitElement get definingCompilationUnit; |
| 887 |
734 /** | 888 /** |
735 * Return the entry point for this library, or {@code null} if this library do
es not have an entry | 889 * Return the entry point for this library, or {@code null} if this library do
es not have an entry |
736 * point. The entry point is defined to be a zero argument top-level function
whose name is{@code main}. | 890 * point. The entry point is defined to be a zero argument top-level function
whose name is{@code main}. |
737 * @return the entry point for this library | 891 * @return the entry point for this library |
738 */ | 892 */ |
739 FunctionElement get entryPoint; | 893 FunctionElement get entryPoint; |
| 894 |
740 /** | 895 /** |
741 * Return an array containing all of the libraries that are exported from this
library. | 896 * Return an array containing all of the libraries that are exported from this
library. |
742 * @return an array containing all of the libraries that are exported from thi
s library | 897 * @return an array containing all of the libraries that are exported from thi
s library |
743 */ | 898 */ |
744 List<LibraryElement> get exportedLibraries; | 899 List<LibraryElement> get exportedLibraries; |
| 900 |
745 /** | 901 /** |
746 * Return an array containing all of the exports defined in this library. | 902 * Return an array containing all of the exports defined in this library. |
747 * @return the exports defined in this library | 903 * @return the exports defined in this library |
748 */ | 904 */ |
749 List<ExportElement> get exports; | 905 List<ExportElement> get exports; |
| 906 |
750 /** | 907 /** |
751 * Return an array containing all of the libraries that are imported into this
library. This | 908 * Return an array containing all of the libraries that are imported into this
library. This |
752 * includes all of the libraries that are imported using a prefix (also availa
ble through the | 909 * includes all of the libraries that are imported using a prefix (also availa
ble through the |
753 * prefixes returned by {@link #getPrefixes()}) and those that are imported wi
thout a prefix. | 910 * prefixes returned by {@link #getPrefixes()}) and those that are imported wi
thout a prefix. |
754 * @return an array containing all of the libraries that are imported into thi
s library | 911 * @return an array containing all of the libraries that are imported into thi
s library |
755 */ | 912 */ |
756 List<LibraryElement> get importedLibraries; | 913 List<LibraryElement> get importedLibraries; |
| 914 |
757 /** | 915 /** |
758 * Return an array containing all of the imports defined in this library. | 916 * Return an array containing all of the imports defined in this library. |
759 * @return the imports defined in this library | 917 * @return the imports defined in this library |
760 */ | 918 */ |
761 List<ImportElement> get imports; | 919 List<ImportElement> get imports; |
| 920 |
762 /** | 921 /** |
763 * Return an array containing all of the compilation units that are included i
n this library using | 922 * Return an array containing all of the compilation units that are included i
n this library using |
764 * a {@code part} directive. This does not include the defining compilation un
it that contains the{@code part} directives. | 923 * a {@code part} directive. This does not include the defining compilation un
it that contains the{@code part} directives. |
765 * @return the compilation units that are included in this library | 924 * @return the compilation units that are included in this library |
766 */ | 925 */ |
767 List<CompilationUnitElement> get parts; | 926 List<CompilationUnitElement> get parts; |
| 927 |
768 /** | 928 /** |
769 * Return an array containing elements for each of the prefixes used to {@code
import} libraries | 929 * Return an array containing elements for each of the prefixes used to {@code
import} libraries |
770 * into this library. Each prefix can be used in more than one {@code import}
directive. | 930 * into this library. Each prefix can be used in more than one {@code import}
directive. |
771 * @return the prefixes used to {@code import} libraries into this library | 931 * @return the prefixes used to {@code import} libraries into this library |
772 */ | 932 */ |
773 List<PrefixElement> get prefixes; | 933 List<PrefixElement> get prefixes; |
| 934 |
774 /** | 935 /** |
775 * Return the class defined in this library that has the given name, or {@code
null} if this | 936 * Return the class defined in this library that has the given name, or {@code
null} if this |
776 * library does not define a class with the given name. | 937 * library does not define a class with the given name. |
777 * @param className the name of the class to be returned | 938 * @param className the name of the class to be returned |
778 * @return the class with the given name that is defined in this library | 939 * @return the class with the given name that is defined in this library |
779 */ | 940 */ |
780 ClassElement getType(String className); | 941 ClassElement getType(String className); |
| 942 |
781 /** | 943 /** |
782 * Answer {@code true} if this library is an application that can be run in th
e browser. | 944 * Answer {@code true} if this library is an application that can be run in th
e browser. |
783 * @return {@code true} if this library is an application that can be run in t
he browser | 945 * @return {@code true} if this library is an application that can be run in t
he browser |
784 */ | 946 */ |
785 bool isBrowserApplication(); | 947 bool isBrowserApplication(); |
| 948 |
786 /** | 949 /** |
787 * Return {@code true} if this library is the dart:core library. | 950 * Return {@code true} if this library is the dart:core library. |
788 * @return {@code true} if this library is the dart:core library | 951 * @return {@code true} if this library is the dart:core library |
789 */ | 952 */ |
790 bool isDartCore(); | 953 bool isDartCore(); |
| 954 |
791 /** | 955 /** |
792 * Return {@code true} if this library is up to date with respect to the given
time stamp. If any | 956 * Return {@code true} if this library is up to date with respect to the given
time stamp. If any |
793 * transitively referenced Source is newer than the time stamp, this method re
turns false. | 957 * transitively referenced Source is newer than the time stamp, this method re
turns false. |
794 * @param timeStamp the time stamp to compare against | 958 * @param timeStamp the time stamp to compare against |
795 * @return {@code true} if this library is up to date with respect to the give
n time stamp | 959 * @return {@code true} if this library is up to date with respect to the give
n time stamp |
796 */ | 960 */ |
797 bool isUpToDate2(int timeStamp); | 961 bool isUpToDate2(int timeStamp); |
798 } | 962 } |
| 963 |
799 /** | 964 /** |
800 * The interface {@code LocalElement} defines the behavior of elements that can
be (but are not | 965 * The interface {@code LocalElement} defines the behavior of elements that can
be (but are not |
801 * required to be) defined within a method or function (an {@link ExecutableElem
ent}). | 966 * required to be) defined within a method or function (an {@link ExecutableElem
ent}). |
802 * @coverage dart.engine.element | 967 * @coverage dart.engine.element |
803 */ | 968 */ |
804 abstract class LocalElement implements Element { | 969 abstract class LocalElement implements Element { |
| 970 |
805 /** | 971 /** |
806 * Return a source range that covers the approximate portion of the source in
which the name of | 972 * Return a source range that covers the approximate portion of the source in
which the name of |
807 * this element is visible, or {@code null} if there is no single range of cha
racters within which | 973 * this element is visible, or {@code null} if there is no single range of cha
racters within which |
808 * the element name is visible. | 974 * the element name is visible. |
809 * <ul> | 975 * <ul> |
810 * <li>For a local variable, this includes everything from the end of the vari
able's initializer | 976 * <li>For a local variable, this includes everything from the end of the vari
able's initializer |
811 * to the end of the block that encloses the variable declaration.</li> | 977 * to the end of the block that encloses the variable declaration.</li> |
812 * <li>For a parameter, this includes the body of the method or function that
declares the | 978 * <li>For a parameter, this includes the body of the method or function that
declares the |
813 * parameter.</li> | 979 * parameter.</li> |
814 * <li>For a local function, this includes everything from the beginning of th
e function's body to | 980 * <li>For a local function, this includes everything from the beginning of th
e function's body to |
815 * the end of the block that encloses the function declaration.</li> | 981 * the end of the block that encloses the function declaration.</li> |
816 * <li>For top-level functions, {@code null} will be returned because they are
potentially visible | 982 * <li>For top-level functions, {@code null} will be returned because they are
potentially visible |
817 * in multiple sources.</li> | 983 * in multiple sources.</li> |
818 * </ul> | 984 * </ul> |
819 * @return the range of characters in which the name of this element is visibl
e | 985 * @return the range of characters in which the name of this element is visibl
e |
820 */ | 986 */ |
821 SourceRange get visibleRange; | 987 SourceRange get visibleRange; |
822 } | 988 } |
| 989 |
823 /** | 990 /** |
824 * The interface {@code LocalVariableElement} defines the behavior common to ele
ments that represent | 991 * The interface {@code LocalVariableElement} defines the behavior common to ele
ments that represent |
825 * a local variable. | 992 * a local variable. |
826 * @coverage dart.engine.element | 993 * @coverage dart.engine.element |
827 */ | 994 */ |
828 abstract class LocalVariableElement implements LocalElement, VariableElement { | 995 abstract class LocalVariableElement implements LocalElement, VariableElement { |
829 } | 996 } |
| 997 |
830 /** | 998 /** |
831 * The interface {@code MethodElement} defines the behavior of elements that rep
resent a method | 999 * The interface {@code MethodElement} defines the behavior of elements that rep
resent a method |
832 * defined within a type. | 1000 * defined within a type. |
833 * @coverage dart.engine.element | 1001 * @coverage dart.engine.element |
834 */ | 1002 */ |
835 abstract class MethodElement implements ExecutableElement { | 1003 abstract class MethodElement implements ExecutableElement { |
| 1004 |
836 /** | 1005 /** |
837 * Return the type in which this method is defined. | 1006 * Return the type in which this method is defined. |
838 * @return the type in which this method is defined | 1007 * @return the type in which this method is defined |
839 */ | 1008 */ |
840 ClassElement get enclosingElement; | 1009 ClassElement get enclosingElement; |
| 1010 |
841 /** | 1011 /** |
842 * Return {@code true} if this method is abstract. Methods are abstract if the
y are not external | 1012 * Return {@code true} if this method is abstract. Methods are abstract if the
y are not external |
843 * and have no body. | 1013 * and have no body. |
844 * @return {@code true} if this method is abstract | 1014 * @return {@code true} if this method is abstract |
845 */ | 1015 */ |
846 bool isAbstract(); | 1016 bool isAbstract(); |
847 } | 1017 } |
| 1018 |
848 /** | 1019 /** |
849 * The interface {@code MultiplyDefinedElement} defines the behavior of pseudo-e
lements that | 1020 * The interface {@code MultiplyDefinedElement} defines the behavior of pseudo-e
lements that |
850 * represent multiple elements defined within a single scope that have the same
name. This situation | 1021 * represent multiple elements defined within a single scope that have the same
name. This situation |
851 * is not allowed by the language, so objects implementing this interface always
represent an error. | 1022 * is not allowed by the language, so objects implementing this interface always
represent an error. |
852 * As a result, most of the normal operations on elements do not make sense and
will return useless | 1023 * As a result, most of the normal operations on elements do not make sense and
will return useless |
853 * results. | 1024 * results. |
854 * @coverage dart.engine.element | 1025 * @coverage dart.engine.element |
855 */ | 1026 */ |
856 abstract class MultiplyDefinedElement implements Element { | 1027 abstract class MultiplyDefinedElement implements Element { |
| 1028 |
857 /** | 1029 /** |
858 * Return an array containing all of the elements that were defined within the
scope to have the | 1030 * Return an array containing all of the elements that were defined within the
scope to have the |
859 * same name. | 1031 * same name. |
860 * @return the elements that were defined with the same name | 1032 * @return the elements that were defined with the same name |
861 */ | 1033 */ |
862 List<Element> get conflictingElements; | 1034 List<Element> get conflictingElements; |
863 } | 1035 } |
| 1036 |
864 /** | 1037 /** |
865 * The interface {@code NamespaceCombinator} defines the behavior common to obje
cts that control how | 1038 * The interface {@code NamespaceCombinator} defines the behavior common to obje
cts that control how |
866 * namespaces are combined. | 1039 * namespaces are combined. |
867 * @coverage dart.engine.element | 1040 * @coverage dart.engine.element |
868 */ | 1041 */ |
869 abstract class NamespaceCombinator { | 1042 abstract class NamespaceCombinator { |
| 1043 |
870 /** | 1044 /** |
871 * An empty array of namespace combinators. | 1045 * An empty array of namespace combinators. |
872 */ | 1046 */ |
873 static List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombinator>(0
); | 1047 static List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombinator>(0
); |
874 } | 1048 } |
| 1049 |
875 /** | 1050 /** |
876 * The interface {@code ParameterElement} defines the behavior of elements repre
senting a parameter | 1051 * The interface {@code ParameterElement} defines the behavior of elements repre
senting a parameter |
877 * defined within an executable element. | 1052 * defined within an executable element. |
878 * @coverage dart.engine.element | 1053 * @coverage dart.engine.element |
879 */ | 1054 */ |
880 abstract class ParameterElement implements LocalElement, VariableElement { | 1055 abstract class ParameterElement implements LocalElement, VariableElement { |
| 1056 |
881 /** | 1057 /** |
882 * Return the kind of this parameter. | 1058 * Return the kind of this parameter. |
883 * @return the kind of this parameter | 1059 * @return the kind of this parameter |
884 */ | 1060 */ |
885 ParameterKind get parameterKind; | 1061 ParameterKind get parameterKind; |
| 1062 |
886 /** | 1063 /** |
887 * Return an array containing all of the parameters defined by this parameter.
A parameter will | 1064 * Return an array containing all of the parameters defined by this parameter.
A parameter will |
888 * only define other parameters if it is a function typed parameter. | 1065 * only define other parameters if it is a function typed parameter. |
889 * @return the parameters defined by this parameter element | 1066 * @return the parameters defined by this parameter element |
890 */ | 1067 */ |
891 List<ParameterElement> get parameters; | 1068 List<ParameterElement> get parameters; |
| 1069 |
892 /** | 1070 /** |
893 * Return {@code true} if this parameter is an initializing formal parameter. | 1071 * Return {@code true} if this parameter is an initializing formal parameter. |
894 * @return {@code true} if this parameter is an initializing formal parameter | 1072 * @return {@code true} if this parameter is an initializing formal parameter |
895 */ | 1073 */ |
896 bool isInitializingFormal(); | 1074 bool isInitializingFormal(); |
897 } | 1075 } |
| 1076 |
898 /** | 1077 /** |
899 * The interface {@code PrefixElement} defines the behavior common to elements t
hat represent a | 1078 * The interface {@code PrefixElement} defines the behavior common to elements t
hat represent a |
900 * prefix used to import one or more libraries into another library. | 1079 * prefix used to import one or more libraries into another library. |
901 * @coverage dart.engine.element | 1080 * @coverage dart.engine.element |
902 */ | 1081 */ |
903 abstract class PrefixElement implements Element { | 1082 abstract class PrefixElement implements Element { |
| 1083 |
904 /** | 1084 /** |
905 * Return the library into which other libraries are imported using this prefi
x. | 1085 * Return the library into which other libraries are imported using this prefi
x. |
906 * @return the library into which other libraries are imported using this pref
ix | 1086 * @return the library into which other libraries are imported using this pref
ix |
907 */ | 1087 */ |
908 LibraryElement get enclosingElement; | 1088 LibraryElement get enclosingElement; |
| 1089 |
909 /** | 1090 /** |
910 * Return an array containing all of the libraries that are imported using thi
s prefix. | 1091 * Return an array containing all of the libraries that are imported using thi
s prefix. |
911 * @return the libraries that are imported using this prefix | 1092 * @return the libraries that are imported using this prefix |
912 */ | 1093 */ |
913 List<LibraryElement> get importedLibraries; | 1094 List<LibraryElement> get importedLibraries; |
914 } | 1095 } |
| 1096 |
915 /** | 1097 /** |
916 * The interface {@code PropertyAccessorElement} defines the behavior of element
s representing a | 1098 * The interface {@code PropertyAccessorElement} defines the behavior of element
s representing a |
917 * getter or a setter. Note that explicitly defined property accessors implicitl
y define a synthetic | 1099 * getter or a setter. Note that explicitly defined property accessors implicitl
y define a synthetic |
918 * field. Symmetrically, synthetic accessors are implicitly created for explicit
ly defined fields. | 1100 * field. Symmetrically, synthetic accessors are implicitly created for explicit
ly defined fields. |
919 * The following rules apply: | 1101 * The following rules apply: |
920 * <ul> | 1102 * <ul> |
921 * <li>Every explicit field is represented by a non-synthetic {@link FieldElemen
t}. | 1103 * <li>Every explicit field is represented by a non-synthetic {@link FieldElemen
t}. |
922 * <li>Every explicit field induces a getter and possibly a setter, both of whic
h are represented by | 1104 * <li>Every explicit field induces a getter and possibly a setter, both of whic
h are represented by |
923 * synthetic {@link PropertyAccessorElement}s. | 1105 * synthetic {@link PropertyAccessorElement}s. |
924 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P
ropertyAccessorElement}. | 1106 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P
ropertyAccessorElement}. |
925 * <li>Every explicit getter or setter (or pair thereof if they have the same na
me) induces a field | 1107 * <li>Every explicit getter or setter (or pair thereof if they have the same na
me) induces a field |
926 * that is represented by a synthetic {@link FieldElement}. | 1108 * that is represented by a synthetic {@link FieldElement}. |
927 * </ul> | 1109 * </ul> |
928 * @coverage dart.engine.element | 1110 * @coverage dart.engine.element |
929 */ | 1111 */ |
930 abstract class PropertyAccessorElement implements ExecutableElement { | 1112 abstract class PropertyAccessorElement implements ExecutableElement { |
| 1113 |
| 1114 /** |
| 1115 * Return the accessor representing the getter that corresponds to (has the sa
me name as) this |
| 1116 * setter, or {@code null} if this accessor is not a setter or if there is no
corresponding |
| 1117 * getter. |
| 1118 * @return the getter that corresponds to this setter |
| 1119 */ |
| 1120 PropertyAccessorElement get correspondingGetter; |
| 1121 |
| 1122 /** |
| 1123 * Return the accessor representing the setter that corresponds to (has the sa
me name as) this |
| 1124 * getter, or {@code null} if this accessor is not a getter or if there is no
corresponding |
| 1125 * setter. |
| 1126 * @return the setter that corresponds to this getter |
| 1127 */ |
| 1128 PropertyAccessorElement get correspondingSetter; |
| 1129 |
931 /** | 1130 /** |
932 * Return the field or top-level variable associated with this accessor. If th
is accessor was | 1131 * Return the field or top-level variable associated with this accessor. If th
is accessor was |
933 * explicitly defined (is not synthetic) then the variable associated with it
will be synthetic. | 1132 * explicitly defined (is not synthetic) then the variable associated with it
will be synthetic. |
934 * @return the variable associated with this accessor | 1133 * @return the variable associated with this accessor |
935 */ | 1134 */ |
936 PropertyInducingElement get variable; | 1135 PropertyInducingElement get variable; |
| 1136 |
| 1137 /** |
| 1138 * Return {@code true} if this accessor is abstract. Accessors are abstract if
they are not |
| 1139 * external and have no body. |
| 1140 * @return {@code true} if this accessor is abstract |
| 1141 */ |
| 1142 bool isAbstract(); |
| 1143 |
937 /** | 1144 /** |
938 * Return {@code true} if this accessor represents a getter. | 1145 * Return {@code true} if this accessor represents a getter. |
939 * @return {@code true} if this accessor represents a getter | 1146 * @return {@code true} if this accessor represents a getter |
940 */ | 1147 */ |
941 bool isGetter(); | 1148 bool isGetter(); |
| 1149 |
942 /** | 1150 /** |
943 * Return {@code true} if this accessor represents a setter. | 1151 * Return {@code true} if this accessor represents a setter. |
944 * @return {@code true} if this accessor represents a setter | 1152 * @return {@code true} if this accessor represents a setter |
945 */ | 1153 */ |
946 bool isSetter(); | 1154 bool isSetter(); |
947 } | 1155 } |
| 1156 |
948 /** | 1157 /** |
949 * The interface {@code PropertyInducingElement} defines the behavior of element
s representing a | 1158 * The interface {@code PropertyInducingElement} defines the behavior of element
s representing a |
950 * variable that has an associated getter and possibly a setter. Note that expli
citly defined | 1159 * variable that has an associated getter and possibly a setter. Note that expli
citly defined |
951 * variables implicitly define a synthetic getter and that non-{@code final} exp
licitly defined | 1160 * variables implicitly define a synthetic getter and that non-{@code final} exp
licitly defined |
952 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel
ds are implicitly | 1161 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel
ds are implicitly |
953 * created for explicitly defined getters and setters. The following rules apply
: | 1162 * created for explicitly defined getters and setters. The following rules apply
: |
954 * <ul> | 1163 * <ul> |
955 * <li>Every explicit variable is represented by a non-synthetic {@link Property
InducingElement}. | 1164 * <li>Every explicit variable is represented by a non-synthetic {@link Property
InducingElement}. |
956 * <li>Every explicit variable induces a getter and possibly a setter, both of w
hich are represented | 1165 * <li>Every explicit variable induces a getter and possibly a setter, both of w
hich are represented |
957 * by synthetic {@link PropertyAccessorElement}s. | 1166 * by synthetic {@link PropertyAccessorElement}s. |
958 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P
ropertyAccessorElement}. | 1167 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P
ropertyAccessorElement}. |
959 * <li>Every explicit getter or setter (or pair thereof if they have the same na
me) induces a | 1168 * <li>Every explicit getter or setter (or pair thereof if they have the same na
me) induces a |
960 * variable that is represented by a synthetic {@link PropertyInducingElement}. | 1169 * variable that is represented by a synthetic {@link PropertyInducingElement}. |
961 * </ul> | 1170 * </ul> |
962 * @coverage dart.engine.element | 1171 * @coverage dart.engine.element |
963 */ | 1172 */ |
964 abstract class PropertyInducingElement implements VariableElement { | 1173 abstract class PropertyInducingElement implements VariableElement { |
| 1174 |
965 /** | 1175 /** |
966 * Return the getter associated with this variable. If this variable was expli
citly defined (is | 1176 * Return the getter associated with this variable. If this variable was expli
citly defined (is |
967 * not synthetic) then the getter associated with it will be synthetic. | 1177 * not synthetic) then the getter associated with it will be synthetic. |
968 * @return the getter associated with this variable | 1178 * @return the getter associated with this variable |
969 */ | 1179 */ |
970 PropertyAccessorElement get getter; | 1180 PropertyAccessorElement get getter; |
| 1181 |
971 /** | 1182 /** |
972 * Return the setter associated with this variable, or {@code null} if the var
iable is effectively{@code final} and therefore does not have a setter associate
d with it. (This can happen either | 1183 * Return the setter associated with this variable, or {@code null} if the var
iable is effectively{@code final} and therefore does not have a setter associate
d with it. (This can happen either |
973 * because the variable is explicitly defined as being {@code final} or becaus
e the variable is | 1184 * because the variable is explicitly defined as being {@code final} or becaus
e the variable is |
974 * induced by an explicit getter that does not have a corresponding setter.) I
f this variable was | 1185 * induced by an explicit getter that does not have a corresponding setter.) I
f this variable was |
975 * explicitly defined (is not synthetic) then the setter associated with it wi
ll be synthetic. | 1186 * explicitly defined (is not synthetic) then the setter associated with it wi
ll be synthetic. |
976 * @return the setter associated with this variable | 1187 * @return the setter associated with this variable |
977 */ | 1188 */ |
978 PropertyAccessorElement get setter; | 1189 PropertyAccessorElement get setter; |
| 1190 |
979 /** | 1191 /** |
980 * Return {@code true} if this element is a static element. A static element i
s an element that is | 1192 * Return {@code true} if this element is a static element. A static element i
s an element that is |
981 * not associated with a particular instance, but rather with an entire librar
y or class. | 1193 * not associated with a particular instance, but rather with an entire librar
y or class. |
982 * @return {@code true} if this executable element is a static element | 1194 * @return {@code true} if this executable element is a static element |
983 */ | 1195 */ |
984 bool isStatic(); | 1196 bool isStatic(); |
985 } | 1197 } |
| 1198 |
986 /** | 1199 /** |
987 * The interface {@code ShowCombinator} defines the behavior of combinators that
cause some of the | 1200 * The interface {@code ShowCombinator} defines the behavior of combinators that
cause some of the |
988 * names in a namespace to be visible (and the rest hidden) when being imported. | 1201 * names in a namespace to be visible (and the rest hidden) when being imported. |
989 * @coverage dart.engine.element | 1202 * @coverage dart.engine.element |
990 */ | 1203 */ |
991 abstract class ShowCombinator implements NamespaceCombinator { | 1204 abstract class ShowCombinator implements NamespaceCombinator { |
| 1205 |
992 /** | 1206 /** |
993 * Return an array containing the names that are to be made visible in the imp
orting library if | 1207 * Return an array containing the names that are to be made visible in the imp
orting library if |
994 * they are defined in the imported library. | 1208 * they are defined in the imported library. |
995 * @return the names from the imported library that are visible in the importi
ng library | 1209 * @return the names from the imported library that are visible in the importi
ng library |
996 */ | 1210 */ |
997 List<String> get shownNames; | 1211 List<String> get shownNames; |
998 } | 1212 } |
| 1213 |
999 /** | 1214 /** |
1000 * The interface {@code TopLevelVariableElement} defines the behavior of element
s representing a | 1215 * The interface {@code TopLevelVariableElement} defines the behavior of element
s representing a |
1001 * top-level variable. | 1216 * top-level variable. |
1002 * @coverage dart.engine.element | 1217 * @coverage dart.engine.element |
1003 */ | 1218 */ |
1004 abstract class TopLevelVariableElement implements PropertyInducingElement { | 1219 abstract class TopLevelVariableElement implements PropertyInducingElement { |
1005 } | 1220 } |
| 1221 |
1006 /** | 1222 /** |
1007 * The interface {@code TypeVariableElement} defines the behavior of elements re
presenting a type | 1223 * The interface {@code TypeVariableElement} defines the behavior of elements re
presenting a type |
1008 * variable. | 1224 * variable. |
1009 * @coverage dart.engine.element | 1225 * @coverage dart.engine.element |
1010 */ | 1226 */ |
1011 abstract class TypeVariableElement implements Element { | 1227 abstract class TypeVariableElement implements Element { |
| 1228 |
1012 /** | 1229 /** |
1013 * Return the type representing the bound associated with this variable, or {@
code null} if this | 1230 * Return the type representing the bound associated with this variable, or {@
code null} if this |
1014 * variable does not have an explicit bound. | 1231 * variable does not have an explicit bound. |
1015 * @return the type representing the bound associated with this variable | 1232 * @return the type representing the bound associated with this variable |
1016 */ | 1233 */ |
1017 Type2 get bound; | 1234 Type2 get bound; |
| 1235 |
1018 /** | 1236 /** |
1019 * Return the type defined by this type variable. | 1237 * Return the type defined by this type variable. |
1020 * @return the type defined by this type variable | 1238 * @return the type defined by this type variable |
1021 */ | 1239 */ |
1022 TypeVariableType get type; | 1240 TypeVariableType get type; |
1023 } | 1241 } |
| 1242 |
1024 /** | 1243 /** |
1025 * The interface {@code UndefinedElement} defines the behavior of pseudo-element
s that represent | 1244 * The interface {@code UndefinedElement} defines the behavior of pseudo-element
s that represent |
1026 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing | 1245 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing |
1027 * this interface always represent an error. As a result, most of the normal ope
rations on elements | 1246 * this interface always represent an error. As a result, most of the normal ope
rations on elements |
1028 * do not make sense and will return useless results. | 1247 * do not make sense and will return useless results. |
1029 * @coverage dart.engine.element | 1248 * @coverage dart.engine.element |
1030 */ | 1249 */ |
1031 abstract class UndefinedElement implements Element { | 1250 abstract class UndefinedElement implements Element { |
1032 } | 1251 } |
| 1252 |
| 1253 /** |
| 1254 * The interface {@code UriReferencedElement} defines the behavior of objects in
cluded into a |
| 1255 * library using some URI. |
| 1256 * @coverage dart.engine.element |
| 1257 */ |
| 1258 abstract class UriReferencedElement implements Element { |
| 1259 |
| 1260 /** |
| 1261 * Return the URI that is used to include this element into the enclosing libr
ary, or {@code null}if this is the defining compilation unit of a library. |
| 1262 * @return the URI that is used to include this element into the enclosing lib
rary |
| 1263 */ |
| 1264 String get uri; |
| 1265 } |
| 1266 |
1033 /** | 1267 /** |
1034 * The interface {@code VariableElement} defines the behavior common to elements
that represent a | 1268 * The interface {@code VariableElement} defines the behavior common to elements
that represent a |
1035 * variable. | 1269 * variable. |
1036 * @coverage dart.engine.element | 1270 * @coverage dart.engine.element |
1037 */ | 1271 */ |
1038 abstract class VariableElement implements Element { | 1272 abstract class VariableElement implements Element { |
| 1273 |
1039 /** | 1274 /** |
1040 * Return a synthetic function representing this variable's initializer, or {@
code null} if this | 1275 * Return a synthetic function representing this variable's initializer, or {@
code null} if this |
1041 * variable does not have an initializer. The function will have no parameters
. The return type of | 1276 * variable does not have an initializer. The function will have no parameters
. The return type of |
1042 * the function will be the compile-time type of the initialization expression
. | 1277 * the function will be the compile-time type of the initialization expression
. |
1043 * @return a synthetic function representing this variable's initializer | 1278 * @return a synthetic function representing this variable's initializer |
1044 */ | 1279 */ |
1045 FunctionElement get initializer; | 1280 FunctionElement get initializer; |
| 1281 |
1046 /** | 1282 /** |
1047 * Return the declared type of this variable, or {@code null} if the variable
did not have a | 1283 * Return the declared type of this variable, or {@code null} if the variable
did not have a |
1048 * declared type (such as if it was declared using the keyword 'var'). | 1284 * declared type (such as if it was declared using the keyword 'var'). |
1049 * @return the declared type of this variable | 1285 * @return the declared type of this variable |
1050 */ | 1286 */ |
1051 Type2 get type; | 1287 Type2 get type; |
| 1288 |
1052 /** | 1289 /** |
1053 * Return {@code true} if this variable was declared with the 'const' modifier
. | 1290 * Return {@code true} if this variable was declared with the 'const' modifier
. |
1054 * @return {@code true} if this variable was declared with the 'const' modifie
r | 1291 * @return {@code true} if this variable was declared with the 'const' modifie
r |
1055 */ | 1292 */ |
1056 bool isConst(); | 1293 bool isConst(); |
| 1294 |
1057 /** | 1295 /** |
1058 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are | 1296 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are |
1059 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly | 1297 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly |
1060 * final. | 1298 * final. |
1061 * @return {@code true} if this variable was declared with the 'final' modifie
r | 1299 * @return {@code true} if this variable was declared with the 'final' modifie
r |
1062 */ | 1300 */ |
1063 bool isFinal(); | 1301 bool isFinal(); |
1064 } | 1302 } |
| 1303 |
1065 /** | 1304 /** |
1066 * Instances of the class {@code GeneralizingElementVisitor} implement an elemen
t visitor that will | 1305 * Instances of the class {@code GeneralizingElementVisitor} implement an elemen
t visitor that will |
1067 * recursively visit all of the elements in an element model (like instances of
the class{@link RecursiveElementVisitor}). In addition, when an element of a spe
cific type is visited not | 1306 * recursively visit all of the elements in an element model (like instances of
the class{@link RecursiveElementVisitor}). In addition, when an element of a spe
cific type is visited not |
1068 * only will the visit method for that specific type of element be invoked, but
additional methods | 1307 * only will the visit method for that specific type of element be invoked, but
additional methods |
1069 * for the supertypes of that element will also be invoked. For example, using a
n instance of this | 1308 * for the supertypes of that element will also be invoked. For example, using a
n instance of this |
1070 * class to visit a {@link MethodElement} will cause the method{@link #visitMeth
odElement(MethodElement)} to be invoked but will also cause the methods{@link #v
isitExecutableElement(ExecutableElement)} and {@link #visitElement(Element)} to
be | 1309 * class to visit a {@link MethodElement} will cause the method{@link #visitMeth
odElement(MethodElement)} to be invoked but will also cause the methods{@link #v
isitExecutableElement(ExecutableElement)} and {@link #visitElement(Element)} to
be |
1071 * subsequently invoked. This allows visitors to be written that visit all execu
table elements | 1310 * subsequently invoked. This allows visitors to be written that visit all execu
table elements |
1072 * without needing to override the visit method for each of the specific subclas
ses of{@link ExecutableElement}. | 1311 * without needing to override the visit method for each of the specific subclas
ses of{@link ExecutableElement}. |
1073 * <p> | 1312 * <p> |
1074 * Note, however, that unlike many visitors, element visitors visit objects base
d on the interfaces | 1313 * Note, however, that unlike many visitors, element visitors visit objects base
d on the interfaces |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 R visitMethodElement(MethodElement element) => visitExecutableElement(element)
; | 1387 R visitMethodElement(MethodElement element) => visitExecutableElement(element)
; |
1149 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(
element); | 1388 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(
element); |
1150 R visitParameterElement(ParameterElement element) => visitLocalElement(element
); | 1389 R visitParameterElement(ParameterElement element) => visitLocalElement(element
); |
1151 R visitPrefixElement(PrefixElement element) => visitElement(element); | 1390 R visitPrefixElement(PrefixElement element) => visitElement(element); |
1152 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut
ableElement(element); | 1391 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut
ableElement(element); |
1153 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab
leElement(element); | 1392 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab
leElement(element); |
1154 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper
tyInducingElement(element); | 1393 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper
tyInducingElement(element); |
1155 R visitTypeVariableElement(TypeVariableElement element) => visitElement(elemen
t); | 1394 R visitTypeVariableElement(TypeVariableElement element) => visitElement(elemen
t); |
1156 R visitVariableElement(VariableElement element) => visitElement(element); | 1395 R visitVariableElement(VariableElement element) => visitElement(element); |
1157 } | 1396 } |
| 1397 |
1158 /** | 1398 /** |
1159 * Instances of the class {@code RecursiveElementVisitor} implement an element v
isitor that will | 1399 * Instances of the class {@code RecursiveElementVisitor} implement an element v
isitor that will |
1160 * recursively visit all of the element in an element model. For example, using
an instance of this | 1400 * recursively visit all of the element in an element model. For example, using
an instance of this |
1161 * class to visit a {@link CompilationUnitElement} will also cause all of the ty
pes in the | 1401 * class to visit a {@link CompilationUnitElement} will also cause all of the ty
pes in the |
1162 * compilation unit to be visited. | 1402 * compilation unit to be visited. |
1163 * <p> | 1403 * <p> |
1164 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 1404 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
1165 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the | 1405 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the |
1166 * children of the visited element to not be visited. | 1406 * children of the visited element to not be visited. |
1167 * @coverage dart.engine.element | 1407 * @coverage dart.engine.element |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 } | 1489 } |
1250 R visitTopLevelVariableElement(TopLevelVariableElement element) { | 1490 R visitTopLevelVariableElement(TopLevelVariableElement element) { |
1251 element.visitChildren(this); | 1491 element.visitChildren(this); |
1252 return null; | 1492 return null; |
1253 } | 1493 } |
1254 R visitTypeVariableElement(TypeVariableElement element) { | 1494 R visitTypeVariableElement(TypeVariableElement element) { |
1255 element.visitChildren(this); | 1495 element.visitChildren(this); |
1256 return null; | 1496 return null; |
1257 } | 1497 } |
1258 } | 1498 } |
| 1499 |
1259 /** | 1500 /** |
1260 * Instances of the class {@code SimpleElementVisitor} implement an element visi
tor that will do | 1501 * Instances of the class {@code SimpleElementVisitor} implement an element visi
tor that will do |
1261 * nothing when visiting an element. It is intended to be a superclass for class
es that use the | 1502 * nothing when visiting an element. It is intended to be a superclass for class
es that use the |
1262 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a | 1503 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a |
1263 * whole structure) and that only need to visit a small number of element types. | 1504 * whole structure) and that only need to visit a small number of element types. |
1264 * @coverage dart.engine.element | 1505 * @coverage dart.engine.element |
1265 */ | 1506 */ |
1266 class SimpleElementVisitor<R> implements ElementVisitor<R> { | 1507 class SimpleElementVisitor<R> implements ElementVisitor<R> { |
1267 R visitClassElement(ClassElement element) => null; | 1508 R visitClassElement(ClassElement element) => null; |
1268 R visitCompilationUnitElement(CompilationUnitElement element) => null; | 1509 R visitCompilationUnitElement(CompilationUnitElement element) => null; |
(...skipping 11 matching lines...) Expand all Loading... |
1280 R visitLibraryElement(LibraryElement element) => null; | 1521 R visitLibraryElement(LibraryElement element) => null; |
1281 R visitLocalVariableElement(LocalVariableElement element) => null; | 1522 R visitLocalVariableElement(LocalVariableElement element) => null; |
1282 R visitMethodElement(MethodElement element) => null; | 1523 R visitMethodElement(MethodElement element) => null; |
1283 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; | 1524 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; |
1284 R visitParameterElement(ParameterElement element) => null; | 1525 R visitParameterElement(ParameterElement element) => null; |
1285 R visitPrefixElement(PrefixElement element) => null; | 1526 R visitPrefixElement(PrefixElement element) => null; |
1286 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; | 1527 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; |
1287 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; | 1528 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; |
1288 R visitTypeVariableElement(TypeVariableElement element) => null; | 1529 R visitTypeVariableElement(TypeVariableElement element) => null; |
1289 } | 1530 } |
| 1531 |
1290 /** | 1532 /** |
1291 * Instances of the class {@code AnnotationImpl} implement an {@link Annotation}
. | 1533 * Instances of the class {@code AnnotationImpl} implement an {@link Annotation}
. |
1292 * @coverage dart.engine.element | 1534 * @coverage dart.engine.element |
1293 */ | 1535 */ |
1294 class AnnotationImpl implements Annotation { | 1536 class AnnotationImpl implements Annotation { |
| 1537 |
1295 /** | 1538 /** |
1296 * The element representing the field, variable, or constructor being used as
an annotation. | 1539 * The element representing the field, variable, or constructor being used as
an annotation. |
1297 */ | 1540 */ |
1298 Element _element; | 1541 Element _element; |
| 1542 |
1299 /** | 1543 /** |
1300 * An empty array of annotations. | 1544 * An empty array of annotations. |
1301 */ | 1545 */ |
1302 static List<AnnotationImpl> EMPTY_ARRAY = new List<AnnotationImpl>(0); | 1546 static List<AnnotationImpl> EMPTY_ARRAY = new List<AnnotationImpl>(0); |
| 1547 |
1303 /** | 1548 /** |
1304 * Initialize a newly created annotation. | 1549 * Initialize a newly created annotation. |
1305 * @param element the element representing the field, variable, or constructor
being used as an | 1550 * @param element the element representing the field, variable, or constructor
being used as an |
1306 * annotation | 1551 * annotation |
1307 */ | 1552 */ |
1308 AnnotationImpl(Element element) { | 1553 AnnotationImpl(Element element) { |
1309 this._element = element; | 1554 this._element = element; |
1310 } | 1555 } |
1311 Element get element => _element; | 1556 Element get element => _element; |
1312 String toString() => "@${_element.toString()}"; | 1557 String toString() => "@${_element.toString()}"; |
1313 } | 1558 } |
| 1559 |
1314 /** | 1560 /** |
1315 * Instances of the class {@code ClassElementImpl} implement a {@code ClassEleme
nt}. | 1561 * Instances of the class {@code ClassElementImpl} implement a {@code ClassEleme
nt}. |
1316 * @coverage dart.engine.element | 1562 * @coverage dart.engine.element |
1317 */ | 1563 */ |
1318 class ClassElementImpl extends ElementImpl implements ClassElement { | 1564 class ClassElementImpl extends ElementImpl implements ClassElement { |
| 1565 |
1319 /** | 1566 /** |
1320 * An array containing all of the accessors (getters and setters) contained in
this class. | 1567 * An array containing all of the accessors (getters and setters) contained in
this class. |
1321 */ | 1568 */ |
1322 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; | 1569 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; |
| 1570 |
1323 /** | 1571 /** |
1324 * An array containing all of the constructors contained in this class. | 1572 * An array containing all of the constructors contained in this class. |
1325 */ | 1573 */ |
1326 List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; | 1574 List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; |
| 1575 |
1327 /** | 1576 /** |
1328 * An array containing all of the fields contained in this class. | 1577 * An array containing all of the fields contained in this class. |
1329 */ | 1578 */ |
1330 List<FieldElement> _fields = FieldElementImpl.EMPTY_ARRAY; | 1579 List<FieldElement> _fields = FieldElementImpl.EMPTY_ARRAY; |
| 1580 |
1331 /** | 1581 /** |
1332 * An array containing all of the mixins that are applied to the class being e
xtended in order to | 1582 * An array containing all of the mixins that are applied to the class being e
xtended in order to |
1333 * derive the superclass of this class. | 1583 * derive the superclass of this class. |
1334 */ | 1584 */ |
1335 List<InterfaceType> _mixins = InterfaceTypeImpl.EMPTY_ARRAY; | 1585 List<InterfaceType> _mixins = InterfaceTypeImpl.EMPTY_ARRAY; |
| 1586 |
1336 /** | 1587 /** |
1337 * An array containing all of the interfaces that are implemented by this clas
s. | 1588 * An array containing all of the interfaces that are implemented by this clas
s. |
1338 */ | 1589 */ |
1339 List<InterfaceType> _interfaces = InterfaceTypeImpl.EMPTY_ARRAY; | 1590 List<InterfaceType> _interfaces = InterfaceTypeImpl.EMPTY_ARRAY; |
| 1591 |
1340 /** | 1592 /** |
1341 * An array containing all of the methods contained in this class. | 1593 * An array containing all of the methods contained in this class. |
1342 */ | 1594 */ |
1343 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; | 1595 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; |
| 1596 |
1344 /** | 1597 /** |
1345 * The superclass of the class, or {@code null} if the class does not have an
explicit superclass. | 1598 * The superclass of the class, or {@code null} if the class does not have an
explicit superclass. |
1346 */ | 1599 */ |
1347 InterfaceType _supertype; | 1600 InterfaceType _supertype; |
| 1601 |
1348 /** | 1602 /** |
1349 * The type defined by the class. | 1603 * The type defined by the class. |
1350 */ | 1604 */ |
1351 InterfaceType _type; | 1605 InterfaceType _type; |
| 1606 |
1352 /** | 1607 /** |
1353 * An array containing all of the type variables defined for this class. | 1608 * An array containing all of the type variables defined for this class. |
1354 */ | 1609 */ |
1355 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY
; | 1610 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY
; |
| 1611 |
1356 /** | 1612 /** |
1357 * An empty array of type elements. | 1613 * An empty array of type elements. |
1358 */ | 1614 */ |
1359 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); | 1615 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); |
| 1616 |
1360 /** | 1617 /** |
1361 * Initialize a newly created class element to have the given name. | 1618 * Initialize a newly created class element to have the given name. |
1362 * @param name the name of this element | 1619 * @param name the name of this element |
1363 */ | 1620 */ |
1364 ClassElementImpl(Identifier name) : super.con1(name) { | 1621 ClassElementImpl(Identifier name) : super.con1(name) { |
1365 } | 1622 } |
1366 accept(ElementVisitor visitor) => visitor.visitClassElement(this); | 1623 accept(ElementVisitor visitor) => visitor.visitClassElement(this); |
1367 List<PropertyAccessorElement> get accessors => _accessors; | 1624 List<PropertyAccessorElement> get accessors => _accessors; |
1368 List<InterfaceType> get allSupertypes { | 1625 List<InterfaceType> get allSupertypes { |
1369 Set<InterfaceType> list = new Set<InterfaceType>(); | 1626 List<InterfaceType> list = new List<InterfaceType>(); |
1370 collectAllSupertypes(list); | 1627 collectAllSupertypes(list); |
1371 return new List.from(list); | 1628 return new List.from(list); |
1372 } | 1629 } |
1373 ElementImpl getChild(String identifier2) { | 1630 ElementImpl getChild(String identifier2) { |
1374 for (PropertyAccessorElement accessor in _accessors) { | 1631 for (PropertyAccessorElement accessor in _accessors) { |
1375 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2)
{ | 1632 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2)
{ |
1376 return accessor as PropertyAccessorElementImpl; | 1633 return accessor as PropertyAccessorElementImpl; |
1377 } | 1634 } |
1378 } | 1635 } |
1379 for (ConstructorElement constructor in _constructors) { | 1636 for (ConstructorElement constructor in _constructors) { |
(...skipping 12 matching lines...) Expand all Loading... |
1392 } | 1649 } |
1393 } | 1650 } |
1394 for (TypeVariableElement typeVariable in _typeVariables) { | 1651 for (TypeVariableElement typeVariable in _typeVariables) { |
1395 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2)
{ | 1652 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2)
{ |
1396 return typeVariable as TypeVariableElementImpl; | 1653 return typeVariable as TypeVariableElementImpl; |
1397 } | 1654 } |
1398 } | 1655 } |
1399 return null; | 1656 return null; |
1400 } | 1657 } |
1401 List<ConstructorElement> get constructors => _constructors; | 1658 List<ConstructorElement> get constructors => _constructors; |
1402 /** | 1659 |
1403 * Return the executable elemement representing the getter, setter or method w
ith the given name | |
1404 * that is declared in this class, or {@code null} if this class does not decl
are a member with | |
1405 * the given name. | |
1406 * @param memberName the name of the getter to be returned | |
1407 * @return the member declared in this class with the given name | |
1408 */ | |
1409 ExecutableElement getExecutable(String memberName) { | |
1410 for (PropertyAccessorElement accessor in _accessors) { | |
1411 if (accessor.name == memberName) { | |
1412 return accessor; | |
1413 } | |
1414 } | |
1415 return getMethod(memberName); | |
1416 } | |
1417 /** | 1660 /** |
1418 * Given some name, this returns the {@link FieldElement} with the matching na
me, if there is no | 1661 * Given some name, this returns the {@link FieldElement} with the matching na
me, if there is no |
1419 * such field, then {@code null} is returned. | 1662 * such field, then {@code null} is returned. |
1420 * @param name some name to lookup a field element with | 1663 * @param name some name to lookup a field element with |
1421 * @return the matching field element, or {@code null} if no such element was
found | 1664 * @return the matching field element, or {@code null} if no such element was
found |
1422 */ | 1665 */ |
1423 FieldElement getField(String name2) { | 1666 FieldElement getField(String name2) { |
1424 for (FieldElement fieldElement in _fields) { | 1667 for (FieldElement fieldElement in _fields) { |
1425 if (name2 == fieldElement.name) { | 1668 if (name2 == fieldElement.name) { |
1426 return fieldElement; | 1669 return fieldElement; |
1427 } | 1670 } |
1428 } | 1671 } |
1429 return null; | 1672 return null; |
1430 } | 1673 } |
1431 List<FieldElement> get fields => _fields; | 1674 List<FieldElement> get fields => _fields; |
1432 /** | |
1433 * Return the element representing the getter with the given name that is decl
ared in this class, | |
1434 * or {@code null} if this class does not declare a getter with the given name
. | |
1435 * @param getterName the name of the getter to be returned | |
1436 * @return the getter declared in this class with the given name | |
1437 */ | |
1438 PropertyAccessorElement getGetter(String getterName) { | 1675 PropertyAccessorElement getGetter(String getterName) { |
1439 for (PropertyAccessorElement accessor in _accessors) { | 1676 for (PropertyAccessorElement accessor in _accessors) { |
1440 if (accessor.isGetter() && accessor.name == getterName) { | 1677 if (accessor.isGetter() && accessor.name == getterName) { |
1441 return accessor; | 1678 return accessor; |
1442 } | 1679 } |
1443 } | 1680 } |
1444 return null; | 1681 return null; |
1445 } | 1682 } |
1446 List<InterfaceType> get interfaces => _interfaces; | 1683 List<InterfaceType> get interfaces => _interfaces; |
1447 ElementKind get kind => ElementKind.CLASS; | 1684 ElementKind get kind => ElementKind.CLASS; |
1448 /** | |
1449 * Return the element representing the method with the given name that is decl
ared in this class, | |
1450 * or {@code null} if this class does not declare a method with the given name
. | |
1451 * @param methodName the name of the method to be returned | |
1452 * @return the method declared in this class with the given name | |
1453 */ | |
1454 MethodElement getMethod(String methodName) { | 1685 MethodElement getMethod(String methodName) { |
1455 for (MethodElement method in _methods) { | 1686 for (MethodElement method in _methods) { |
1456 if (method.name == methodName) { | 1687 if (method.name == methodName) { |
1457 return method; | 1688 return method; |
1458 } | 1689 } |
1459 } | 1690 } |
1460 return null; | 1691 return null; |
1461 } | 1692 } |
1462 List<MethodElement> get methods => _methods; | 1693 List<MethodElement> get methods => _methods; |
1463 List<InterfaceType> get mixins => _mixins; | 1694 List<InterfaceType> get mixins => _mixins; |
1464 ConstructorElement getNamedConstructor(String name2) { | 1695 ConstructorElement getNamedConstructor(String name2) { |
1465 for (ConstructorElement element in constructors) { | 1696 for (ConstructorElement element in constructors) { |
1466 String elementName = element.name; | 1697 String elementName = element.name; |
1467 if (elementName != null && elementName == name2) { | 1698 if (elementName != null && elementName == name2) { |
1468 return element; | 1699 return element; |
1469 } | 1700 } |
1470 } | 1701 } |
1471 return null; | 1702 return null; |
1472 } | 1703 } |
1473 /** | |
1474 * Return the element representing the setter with the given name that is decl
ared in this class, | |
1475 * or {@code null} if this class does not declare a setter with the given name
. | |
1476 * @param setterName the name of the getter to be returned | |
1477 * @return the setter declared in this class with the given name | |
1478 */ | |
1479 PropertyAccessorElement getSetter(String setterName) { | 1704 PropertyAccessorElement getSetter(String setterName) { |
| 1705 if (!setterName.endsWith("=")) { |
| 1706 setterName += '='; |
| 1707 } |
1480 for (PropertyAccessorElement accessor in _accessors) { | 1708 for (PropertyAccessorElement accessor in _accessors) { |
1481 if (accessor.isSetter() && accessor.name == setterName) { | 1709 if (accessor.isSetter() && accessor.name == setterName) { |
1482 return accessor; | 1710 return accessor; |
1483 } | 1711 } |
1484 } | 1712 } |
1485 return null; | 1713 return null; |
1486 } | 1714 } |
1487 InterfaceType get supertype => _supertype; | 1715 InterfaceType get supertype => _supertype; |
1488 InterfaceType get type => _type; | 1716 InterfaceType get type => _type; |
1489 List<TypeVariableElement> get typeVariables => _typeVariables; | 1717 List<TypeVariableElement> get typeVariables => _typeVariables; |
1490 ConstructorElement get unnamedConstructor { | 1718 ConstructorElement get unnamedConstructor { |
1491 for (ConstructorElement element in constructors) { | 1719 for (ConstructorElement element in constructors) { |
1492 String name2 = element.name; | 1720 String name = element.displayName; |
1493 if (name2 == null || name2.isEmpty) { | 1721 if (name == null || name.isEmpty) { |
1494 return element; | 1722 return element; |
1495 } | 1723 } |
1496 } | 1724 } |
1497 return null; | 1725 return null; |
1498 } | 1726 } |
| 1727 bool hasNonFinalField() { |
| 1728 List<ClassElement> classesToVisit = new List<ClassElement>(); |
| 1729 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 1730 classesToVisit.add(this); |
| 1731 while (!classesToVisit.isEmpty) { |
| 1732 ClassElement currentElement = classesToVisit.removeAt(0); |
| 1733 if (javaSetAdd(visitedClasses, currentElement)) { |
| 1734 for (FieldElement field in currentElement.fields) { |
| 1735 if (!field.isFinal() && !field.isConst() && !field.isStatic() && !fiel
d.isSynthetic()) { |
| 1736 return true; |
| 1737 } |
| 1738 } |
| 1739 for (InterfaceType mixinType in currentElement.mixins) { |
| 1740 ClassElement mixinElement = mixinType.element; |
| 1741 classesToVisit.add(mixinElement); |
| 1742 } |
| 1743 InterfaceType supertype2 = currentElement.supertype; |
| 1744 if (supertype2 != null) { |
| 1745 ClassElement superElement = supertype2.element; |
| 1746 if (superElement != null) { |
| 1747 classesToVisit.add(superElement); |
| 1748 } |
| 1749 } |
| 1750 } |
| 1751 } |
| 1752 return false; |
| 1753 } |
| 1754 bool hasReferenceToSuper() => hasModifier(Modifier.REFERENCES_SUPER); |
1499 bool isAbstract() => hasModifier(Modifier.ABSTRACT); | 1755 bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
1500 bool isTypedef() => hasModifier(Modifier.TYPEDEF); | 1756 bool isTypedef() => hasModifier(Modifier.TYPEDEF); |
1501 bool isValidMixin() => hasModifier(Modifier.MIXIN); | 1757 bool isValidMixin() => hasModifier(Modifier.MIXIN); |
1502 ExecutableElement lookUpExecutable(String memberName, LibraryElement library)
{ | 1758 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { |
1503 ExecutableElement element = getExecutable(memberName); | 1759 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
1504 if (element != null && element.isAccessibleIn(library)) { | 1760 ClassElement currentElement = this; |
1505 return element; | 1761 while (currentElement != null && !visitedClasses.contains(currentElement)) { |
1506 } | 1762 javaSetAdd(visitedClasses, currentElement); |
1507 for (InterfaceType mixin in _mixins) { | 1763 PropertyAccessorElement element = currentElement.getGetter(getterName); |
1508 ClassElement mixinElement = mixin.element; | 1764 if (element != null && element.isAccessibleIn(library)) { |
1509 if (mixinElement != null) { | 1765 return element; |
1510 ClassElementImpl mixinElementImpl = mixinElement as ClassElementImpl; | 1766 } |
1511 element = mixinElementImpl.getExecutable(memberName); | 1767 for (InterfaceType mixin in currentElement.mixins) { |
1512 if (element != null && element.isAccessibleIn(library)) { | 1768 ClassElement mixinElement = mixin.element; |
1513 return element; | 1769 if (mixinElement != null) { |
| 1770 element = mixinElement.getGetter(getterName); |
| 1771 if (element != null && element.isAccessibleIn(library)) { |
| 1772 return element; |
| 1773 } |
1514 } | 1774 } |
1515 } | 1775 } |
1516 } | 1776 InterfaceType supertype2 = currentElement.supertype; |
1517 if (_supertype != null) { | 1777 if (supertype2 == null) { |
1518 ClassElement supertypeElement = _supertype.element; | 1778 return null; |
1519 if (supertypeElement != null) { | |
1520 return supertypeElement.lookUpExecutable(memberName, library); | |
1521 } | 1779 } |
1522 } | 1780 currentElement = supertype2.element; |
1523 return null; | |
1524 } | |
1525 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { | |
1526 PropertyAccessorElement element = getGetter(getterName); | |
1527 if (element != null && element.isAccessibleIn(library)) { | |
1528 return element; | |
1529 } | |
1530 for (InterfaceType mixin in _mixins) { | |
1531 ClassElement mixinElement = mixin.element; | |
1532 if (mixinElement != null) { | |
1533 element = ((mixinElement as ClassElementImpl)).getGetter(getterName); | |
1534 if (element != null && element.isAccessibleIn(library)) { | |
1535 return element; | |
1536 } | |
1537 } | |
1538 } | |
1539 if (_supertype != null) { | |
1540 ClassElement supertypeElement = _supertype.element; | |
1541 if (supertypeElement != null) { | |
1542 return supertypeElement.lookUpGetter(getterName, library); | |
1543 } | |
1544 } | 1781 } |
1545 return null; | 1782 return null; |
1546 } | 1783 } |
1547 MethodElement lookUpMethod(String methodName, LibraryElement library) { | 1784 MethodElement lookUpMethod(String methodName, LibraryElement library) { |
1548 MethodElement element = getMethod(methodName); | 1785 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
1549 if (element != null && element.isAccessibleIn(library)) { | 1786 ClassElement currentElement = this; |
1550 return element; | 1787 while (currentElement != null && !visitedClasses.contains(currentElement)) { |
1551 } | 1788 javaSetAdd(visitedClasses, currentElement); |
1552 for (InterfaceType mixin in _mixins) { | 1789 MethodElement element = currentElement.getMethod(methodName); |
1553 ClassElement mixinElement = mixin.element; | 1790 if (element != null && element.isAccessibleIn(library)) { |
1554 if (mixinElement != null) { | 1791 return element; |
1555 element = ((mixinElement as ClassElementImpl)).getMethod(methodName); | 1792 } |
1556 if (element != null && element.isAccessibleIn(library)) { | 1793 for (InterfaceType mixin in currentElement.mixins) { |
1557 return element; | 1794 ClassElement mixinElement = mixin.element; |
| 1795 if (mixinElement != null) { |
| 1796 element = mixinElement.getMethod(methodName); |
| 1797 if (element != null && element.isAccessibleIn(library)) { |
| 1798 return element; |
| 1799 } |
1558 } | 1800 } |
1559 } | 1801 } |
1560 } | 1802 InterfaceType supertype2 = currentElement.supertype; |
1561 if (_supertype != null) { | 1803 if (supertype2 == null) { |
1562 ClassElement supertypeElement = _supertype.element; | 1804 return null; |
1563 if (supertypeElement != null) { | |
1564 return supertypeElement.lookUpMethod(methodName, library); | |
1565 } | 1805 } |
| 1806 currentElement = supertype2.element; |
1566 } | 1807 } |
1567 return null; | 1808 return null; |
1568 } | 1809 } |
1569 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { | 1810 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { |
1570 PropertyAccessorElement element = getSetter(setterName); | 1811 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
1571 if (element != null && element.isAccessibleIn(library)) { | 1812 ClassElement currentElement = this; |
1572 return element; | 1813 while (currentElement != null && !visitedClasses.contains(currentElement)) { |
1573 } | 1814 javaSetAdd(visitedClasses, currentElement); |
1574 for (InterfaceType mixin in _mixins) { | 1815 PropertyAccessorElement element = currentElement.getSetter(setterName); |
1575 ClassElement mixinElement = mixin.element; | 1816 if (element != null && element.isAccessibleIn(library)) { |
1576 if (mixinElement != null) { | 1817 return element; |
1577 element = ((mixinElement as ClassElementImpl)).getSetter(setterName); | 1818 } |
1578 if (element != null && element.isAccessibleIn(library)) { | 1819 for (InterfaceType mixin in currentElement.mixins) { |
1579 return element; | 1820 ClassElement mixinElement = mixin.element; |
| 1821 if (mixinElement != null) { |
| 1822 element = mixinElement.getSetter(setterName); |
| 1823 if (element != null && element.isAccessibleIn(library)) { |
| 1824 return element; |
| 1825 } |
1580 } | 1826 } |
1581 } | 1827 } |
1582 } | 1828 InterfaceType supertype2 = currentElement.supertype; |
1583 if (_supertype != null) { | 1829 if (supertype2 == null) { |
1584 ClassElement supertypeElement = _supertype.element; | 1830 return null; |
1585 if (supertypeElement != null) { | |
1586 return supertypeElement.lookUpSetter(setterName, library); | |
1587 } | 1831 } |
| 1832 currentElement = supertype2.element; |
1588 } | 1833 } |
1589 return null; | 1834 return null; |
1590 } | 1835 } |
| 1836 |
1591 /** | 1837 /** |
1592 * Set whether this class is abstract to correspond to the given value. | 1838 * Set whether this class is abstract to correspond to the given value. |
1593 * @param isAbstract {@code true} if the class is abstract | 1839 * @param isAbstract {@code true} if the class is abstract |
1594 */ | 1840 */ |
1595 void set abstract(bool isAbstract) { | 1841 void set abstract(bool isAbstract) { |
1596 setModifier(Modifier.ABSTRACT, isAbstract); | 1842 setModifier(Modifier.ABSTRACT, isAbstract); |
1597 } | 1843 } |
| 1844 |
1598 /** | 1845 /** |
1599 * Set the accessors contained in this class to the given accessors. | 1846 * Set the accessors contained in this class to the given accessors. |
1600 * @param accessors the accessors contained in this class | 1847 * @param accessors the accessors contained in this class |
1601 */ | 1848 */ |
1602 void set accessors(List<PropertyAccessorElement> accessors2) { | 1849 void set accessors(List<PropertyAccessorElement> accessors2) { |
1603 for (PropertyAccessorElement accessor in accessors2) { | 1850 for (PropertyAccessorElement accessor in accessors2) { |
1604 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; | 1851 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; |
1605 } | 1852 } |
1606 this._accessors = accessors2; | 1853 this._accessors = accessors2; |
1607 } | 1854 } |
| 1855 |
1608 /** | 1856 /** |
1609 * Set the constructors contained in this class to the given constructors. | 1857 * Set the constructors contained in this class to the given constructors. |
1610 * @param constructors the constructors contained in this class | 1858 * @param constructors the constructors contained in this class |
1611 */ | 1859 */ |
1612 void set constructors(List<ConstructorElement> constructors2) { | 1860 void set constructors(List<ConstructorElement> constructors2) { |
1613 for (ConstructorElement constructor in constructors2) { | 1861 for (ConstructorElement constructor in constructors2) { |
1614 ((constructor as ConstructorElementImpl)).enclosingElement = this; | 1862 ((constructor as ConstructorElementImpl)).enclosingElement = this; |
1615 } | 1863 } |
1616 this._constructors = constructors2; | 1864 this._constructors = constructors2; |
1617 } | 1865 } |
| 1866 |
1618 /** | 1867 /** |
1619 * Set the fields contained in this class to the given fields. | 1868 * Set the fields contained in this class to the given fields. |
1620 * @param fields the fields contained in this class | 1869 * @param fields the fields contained in this class |
1621 */ | 1870 */ |
1622 void set fields(List<FieldElement> fields2) { | 1871 void set fields(List<FieldElement> fields2) { |
1623 for (FieldElement field in fields2) { | 1872 for (FieldElement field in fields2) { |
1624 ((field as FieldElementImpl)).enclosingElement = this; | 1873 ((field as FieldElementImpl)).enclosingElement = this; |
1625 } | 1874 } |
1626 this._fields = fields2; | 1875 this._fields = fields2; |
1627 } | 1876 } |
| 1877 |
| 1878 /** |
| 1879 * Set whether this class references 'super' to the given value. |
| 1880 * @param isReferencedSuper {@code true} references 'super' |
| 1881 */ |
| 1882 void set hasReferenceToSuper2(bool isReferencedSuper) { |
| 1883 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
| 1884 } |
| 1885 |
1628 /** | 1886 /** |
1629 * Set the interfaces that are implemented by this class to the given types. | 1887 * Set the interfaces that are implemented by this class to the given types. |
1630 * @param the interfaces that are implemented by this class | 1888 * @param the interfaces that are implemented by this class |
1631 */ | 1889 */ |
1632 void set interfaces(List<InterfaceType> interfaces2) { | 1890 void set interfaces(List<InterfaceType> interfaces2) { |
1633 this._interfaces = interfaces2; | 1891 this._interfaces = interfaces2; |
1634 } | 1892 } |
| 1893 |
1635 /** | 1894 /** |
1636 * Set the methods contained in this class to the given methods. | 1895 * Set the methods contained in this class to the given methods. |
1637 * @param methods the methods contained in this class | 1896 * @param methods the methods contained in this class |
1638 */ | 1897 */ |
1639 void set methods(List<MethodElement> methods2) { | 1898 void set methods(List<MethodElement> methods2) { |
1640 for (MethodElement method in methods2) { | 1899 for (MethodElement method in methods2) { |
1641 ((method as MethodElementImpl)).enclosingElement = this; | 1900 ((method as MethodElementImpl)).enclosingElement = this; |
1642 } | 1901 } |
1643 this._methods = methods2; | 1902 this._methods = methods2; |
1644 } | 1903 } |
| 1904 |
1645 /** | 1905 /** |
1646 * Set the mixins that are applied to the class being extended in order to der
ive the superclass | 1906 * Set the mixins that are applied to the class being extended in order to der
ive the superclass |
1647 * of this class to the given types. | 1907 * of this class to the given types. |
1648 * @param mixins the mixins that are applied to derive the superclass of this
class | 1908 * @param mixins the mixins that are applied to derive the superclass of this
class |
1649 */ | 1909 */ |
1650 void set mixins(List<InterfaceType> mixins2) { | 1910 void set mixins(List<InterfaceType> mixins2) { |
1651 this._mixins = mixins2; | 1911 this._mixins = mixins2; |
1652 } | 1912 } |
| 1913 |
1653 /** | 1914 /** |
1654 * Set the superclass of the class to the given type. | 1915 * Set the superclass of the class to the given type. |
1655 * @param supertype the superclass of the class | 1916 * @param supertype the superclass of the class |
1656 */ | 1917 */ |
1657 void set supertype(InterfaceType supertype2) { | 1918 void set supertype(InterfaceType supertype2) { |
1658 this._supertype = supertype2; | 1919 this._supertype = supertype2; |
1659 } | 1920 } |
| 1921 |
1660 /** | 1922 /** |
1661 * Set the type defined by the class to the given type. | 1923 * Set the type defined by the class to the given type. |
1662 * @param type the type defined by the class | 1924 * @param type the type defined by the class |
1663 */ | 1925 */ |
1664 void set type(InterfaceType type2) { | 1926 void set type(InterfaceType type2) { |
1665 this._type = type2; | 1927 this._type = type2; |
1666 } | 1928 } |
| 1929 |
1667 /** | 1930 /** |
1668 * Set whether this class is defined by a typedef construct to correspond to t
he given value. | 1931 * Set whether this class is defined by a typedef construct to correspond to t
he given value. |
1669 * @param isTypedef {@code true} if the class is defined by a typedef construc
t | 1932 * @param isTypedef {@code true} if the class is defined by a typedef construc
t |
1670 */ | 1933 */ |
1671 void set typedef(bool isTypedef) { | 1934 void set typedef(bool isTypedef) { |
1672 setModifier(Modifier.TYPEDEF, isTypedef); | 1935 setModifier(Modifier.TYPEDEF, isTypedef); |
1673 } | 1936 } |
| 1937 |
1674 /** | 1938 /** |
1675 * Set the type variables defined for this class to the given type variables. | 1939 * Set the type variables defined for this class to the given type variables. |
1676 * @param typeVariables the type variables defined for this class | 1940 * @param typeVariables the type variables defined for this class |
1677 */ | 1941 */ |
1678 void set typeVariables(List<TypeVariableElement> typeVariables2) { | 1942 void set typeVariables(List<TypeVariableElement> typeVariables2) { |
1679 for (TypeVariableElement typeVariable in typeVariables2) { | 1943 for (TypeVariableElement typeVariable in typeVariables2) { |
1680 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this; | 1944 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this; |
1681 } | 1945 } |
1682 this._typeVariables = typeVariables2; | 1946 this._typeVariables = typeVariables2; |
1683 } | 1947 } |
| 1948 |
1684 /** | 1949 /** |
1685 * Set whether this class is a valid mixin to correspond to the given value. | 1950 * Set whether this class is a valid mixin to correspond to the given value. |
1686 * @param isValidMixin {@code true} if this class can be used as a mixin | 1951 * @param isValidMixin {@code true} if this class can be used as a mixin |
1687 */ | 1952 */ |
1688 void set validMixin(bool isValidMixin) { | 1953 void set validMixin(bool isValidMixin) { |
1689 setModifier(Modifier.MIXIN, isValidMixin); | 1954 setModifier(Modifier.MIXIN, isValidMixin); |
1690 } | 1955 } |
1691 void visitChildren(ElementVisitor<Object> visitor) { | 1956 void visitChildren(ElementVisitor<Object> visitor) { |
1692 super.visitChildren(visitor); | 1957 super.visitChildren(visitor); |
1693 safelyVisitChildren(_accessors, visitor); | 1958 safelyVisitChildren(_accessors, visitor); |
1694 safelyVisitChildren(_constructors, visitor); | 1959 safelyVisitChildren(_constructors, visitor); |
1695 safelyVisitChildren(_fields, visitor); | 1960 safelyVisitChildren(_fields, visitor); |
1696 safelyVisitChildren(_methods, visitor); | 1961 safelyVisitChildren(_methods, visitor); |
1697 safelyVisitChildren(_typeVariables, visitor); | 1962 safelyVisitChildren(_typeVariables, visitor); |
1698 } | 1963 } |
1699 void appendTo(JavaStringBuilder builder) { | 1964 void appendTo(JavaStringBuilder builder) { |
1700 String name2 = name; | 1965 String name = displayName; |
1701 if (name2 == null) { | 1966 if (name == null) { |
1702 builder.append("{unnamed class}"); | 1967 builder.append("{unnamed class}"); |
1703 } else { | 1968 } else { |
1704 builder.append(name2); | 1969 builder.append(name); |
1705 } | 1970 } |
1706 int variableCount = _typeVariables.length; | 1971 int variableCount = _typeVariables.length; |
1707 if (variableCount > 0) { | 1972 if (variableCount > 0) { |
1708 builder.append("<"); | 1973 builder.append("<"); |
1709 for (int i = 0; i < variableCount; i++) { | 1974 for (int i = 0; i < variableCount; i++) { |
1710 if (i > 0) { | 1975 if (i > 0) { |
1711 builder.append(", "); | 1976 builder.append(", "); |
1712 } | 1977 } |
1713 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); | 1978 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); |
1714 } | 1979 } |
1715 builder.append(">"); | 1980 builder.append(">"); |
1716 } | 1981 } |
1717 } | 1982 } |
1718 void collectAllSupertypes(Set<InterfaceType> list) { | 1983 void collectAllSupertypes(List<InterfaceType> supertypes) { |
1719 if (_supertype == null || list.contains(_supertype)) { | 1984 List<InterfaceType> typesToVisit = new List<InterfaceType>(); |
1720 return; | 1985 List<ClassElement> visitedClasses = new List<ClassElement>(); |
1721 } | 1986 typesToVisit.add(this.type); |
1722 javaSetAdd(list, _supertype); | 1987 while (!typesToVisit.isEmpty) { |
1723 ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list); | 1988 InterfaceType currentType = typesToVisit.removeAt(0); |
1724 for (InterfaceType type in interfaces) { | 1989 ClassElement currentElement = currentType.element; |
1725 if (!list.contains(type)) { | 1990 if (!visitedClasses.contains(currentElement)) { |
1726 javaSetAdd(list, type); | 1991 visitedClasses.add(currentElement); |
1727 ((type.element as ClassElementImpl)).collectAllSupertypes(list); | 1992 if (currentType != this.type) { |
1728 } | 1993 supertypes.add(currentType); |
1729 } | 1994 } |
1730 for (InterfaceType type in mixins) { | 1995 InterfaceType supertype = currentType.superclass; |
1731 if (!list.contains(type)) { | 1996 if (supertype != null) { |
1732 javaSetAdd(list, type); | 1997 typesToVisit.add(supertype); |
| 1998 } |
| 1999 for (InterfaceType type in currentElement.interfaces) { |
| 2000 typesToVisit.add(type); |
| 2001 } |
| 2002 for (InterfaceType type in currentElement.mixins) { |
| 2003 ClassElement element2 = type.element; |
| 2004 if (!visitedClasses.contains(element2)) { |
| 2005 supertypes.add(type); |
| 2006 } |
| 2007 } |
1733 } | 2008 } |
1734 } | 2009 } |
1735 } | 2010 } |
1736 } | 2011 } |
| 2012 |
1737 /** | 2013 /** |
1738 * Instances of the class {@code CompilationUnitElementImpl} implement a{@link C
ompilationUnitElement}. | 2014 * Instances of the class {@code CompilationUnitElementImpl} implement a{@link C
ompilationUnitElement}. |
1739 * @coverage dart.engine.element | 2015 * @coverage dart.engine.element |
1740 */ | 2016 */ |
1741 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
lement { | 2017 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
lement { |
| 2018 |
| 2019 /** |
| 2020 * An empty array of compilation unit elements. |
| 2021 */ |
| 2022 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem
ent>(0); |
| 2023 |
1742 /** | 2024 /** |
1743 * An array containing all of the top-level accessors (getters and setters) co
ntained in this | 2025 * An array containing all of the top-level accessors (getters and setters) co
ntained in this |
1744 * compilation unit. | 2026 * compilation unit. |
1745 */ | 2027 */ |
1746 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; | 2028 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; |
| 2029 |
1747 /** | 2030 /** |
1748 * An array containing all of the top-level functions contained in this compil
ation unit. | 2031 * An array containing all of the top-level functions contained in this compil
ation unit. |
1749 */ | 2032 */ |
1750 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; | 2033 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; |
| 2034 |
1751 /** | 2035 /** |
1752 * An array containing all of the variables contained in this compilation unit
. | 2036 * An array containing all of the variables contained in this compilation unit
. |
1753 */ | 2037 */ |
1754 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A
RRAY; | 2038 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A
RRAY; |
| 2039 |
1755 /** | 2040 /** |
1756 * The source that corresponds to this compilation unit. | 2041 * The source that corresponds to this compilation unit. |
1757 */ | 2042 */ |
1758 Source _source; | 2043 Source _source; |
| 2044 |
1759 /** | 2045 /** |
1760 * An array containing all of the function type aliases contained in this comp
ilation unit. | 2046 * An array containing all of the function type aliases contained in this comp
ilation unit. |
1761 */ | 2047 */ |
1762 List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMP
TY_ARRAY; | 2048 List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMP
TY_ARRAY; |
| 2049 |
1763 /** | 2050 /** |
1764 * An array containing all of the types contained in this compilation unit. | 2051 * An array containing all of the types contained in this compilation unit. |
1765 */ | 2052 */ |
1766 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; | 2053 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; |
| 2054 |
1767 /** | 2055 /** |
1768 * An empty array of compilation unit elements. | 2056 * The URI that is specified by the "part" directive in the enclosing library,
or {@code null} if |
| 2057 * this is the defining compilation unit of a library. |
1769 */ | 2058 */ |
1770 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem
ent>(0); | 2059 String _uri; |
| 2060 |
1771 /** | 2061 /** |
1772 * Initialize a newly created compilation unit element to have the given name. | 2062 * Initialize a newly created compilation unit element to have the given name. |
1773 * @param name the name of this element | 2063 * @param name the name of this element |
1774 */ | 2064 */ |
1775 CompilationUnitElementImpl(String name) : super.con2(name, -1) { | 2065 CompilationUnitElementImpl(String name) : super.con2(name, -1) { |
1776 } | 2066 } |
1777 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); | 2067 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); |
1778 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _source == ((object as CompilationUnitElementImpl)).source; | 2068 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _source == ((object as CompilationUnitElementImpl)).source; |
1779 List<PropertyAccessorElement> get accessors => _accessors; | 2069 List<PropertyAccessorElement> get accessors => _accessors; |
1780 ElementImpl getChild(String identifier2) { | 2070 ElementImpl getChild(String identifier2) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 List<TopLevelVariableElement> get topLevelVariables => _variables; | 2104 List<TopLevelVariableElement> get topLevelVariables => _variables; |
1815 ClassElement getType(String className) { | 2105 ClassElement getType(String className) { |
1816 for (ClassElement type in _types) { | 2106 for (ClassElement type in _types) { |
1817 if (type.name == className) { | 2107 if (type.name == className) { |
1818 return type; | 2108 return type; |
1819 } | 2109 } |
1820 } | 2110 } |
1821 return null; | 2111 return null; |
1822 } | 2112 } |
1823 List<ClassElement> get types => _types; | 2113 List<ClassElement> get types => _types; |
| 2114 String get uri => _uri; |
1824 int get hashCode => _source.hashCode; | 2115 int get hashCode => _source.hashCode; |
| 2116 |
1825 /** | 2117 /** |
1826 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the | 2118 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the |
1827 * given accessors. | 2119 * given accessors. |
1828 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit | 2120 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit |
1829 */ | 2121 */ |
1830 void set accessors(List<PropertyAccessorElement> accessors2) { | 2122 void set accessors(List<PropertyAccessorElement> accessors2) { |
1831 for (PropertyAccessorElement accessor in accessors2) { | 2123 for (PropertyAccessorElement accessor in accessors2) { |
1832 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; | 2124 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; |
1833 } | 2125 } |
1834 this._accessors = accessors2; | 2126 this._accessors = accessors2; |
1835 } | 2127 } |
| 2128 |
1836 /** | 2129 /** |
1837 * Set the top-level functions contained in this compilation unit to the given
functions. | 2130 * Set the top-level functions contained in this compilation unit to the given
functions. |
1838 * @param functions the top-level functions contained in this compilation unit | 2131 * @param functions the top-level functions contained in this compilation unit |
1839 */ | 2132 */ |
1840 void set functions(List<FunctionElement> functions2) { | 2133 void set functions(List<FunctionElement> functions2) { |
1841 for (FunctionElement function in functions2) { | 2134 for (FunctionElement function in functions2) { |
1842 ((function as FunctionElementImpl)).enclosingElement = this; | 2135 ((function as FunctionElementImpl)).enclosingElement = this; |
1843 } | 2136 } |
1844 this._functions = functions2; | 2137 this._functions = functions2; |
1845 } | 2138 } |
| 2139 |
1846 /** | 2140 /** |
1847 * Set the source that corresponds to this compilation unit to the given sourc
e. | 2141 * Set the source that corresponds to this compilation unit to the given sourc
e. |
1848 * @param source the source that corresponds to this compilation unit | 2142 * @param source the source that corresponds to this compilation unit |
1849 */ | 2143 */ |
1850 void set source(Source source2) { | 2144 void set source(Source source2) { |
1851 this._source = source2; | 2145 this._source = source2; |
1852 } | 2146 } |
| 2147 |
1853 /** | 2148 /** |
1854 * Set the top-level variables contained in this compilation unit to the given
variables. | 2149 * Set the top-level variables contained in this compilation unit to the given
variables. |
1855 * @param variables the top-level variables contained in this compilation unit | 2150 * @param variables the top-level variables contained in this compilation unit |
1856 */ | 2151 */ |
1857 void set topLevelVariables(List<TopLevelVariableElement> variables2) { | 2152 void set topLevelVariables(List<TopLevelVariableElement> variables2) { |
1858 for (TopLevelVariableElement field in variables2) { | 2153 for (TopLevelVariableElement field in variables2) { |
1859 ((field as TopLevelVariableElementImpl)).enclosingElement = this; | 2154 ((field as TopLevelVariableElementImpl)).enclosingElement = this; |
1860 } | 2155 } |
1861 this._variables = variables2; | 2156 this._variables = variables2; |
1862 } | 2157 } |
| 2158 |
1863 /** | 2159 /** |
1864 * Set the function type aliases contained in this compilation unit to the giv
en type aliases. | 2160 * Set the function type aliases contained in this compilation unit to the giv
en type aliases. |
1865 * @param typeAliases the function type aliases contained in this compilation
unit | 2161 * @param typeAliases the function type aliases contained in this compilation
unit |
1866 */ | 2162 */ |
1867 void set typeAliases(List<FunctionTypeAliasElement> typeAliases2) { | 2163 void set typeAliases(List<FunctionTypeAliasElement> typeAliases2) { |
1868 for (FunctionTypeAliasElement typeAlias in typeAliases2) { | 2164 for (FunctionTypeAliasElement typeAlias in typeAliases2) { |
1869 ((typeAlias as FunctionTypeAliasElementImpl)).enclosingElement = this; | 2165 ((typeAlias as FunctionTypeAliasElementImpl)).enclosingElement = this; |
1870 } | 2166 } |
1871 this._typeAliases = typeAliases2; | 2167 this._typeAliases = typeAliases2; |
1872 } | 2168 } |
| 2169 |
1873 /** | 2170 /** |
1874 * Set the types contained in this compilation unit to the given types. | 2171 * Set the types contained in this compilation unit to the given types. |
1875 * @param types types contained in this compilation unit | 2172 * @param types types contained in this compilation unit |
1876 */ | 2173 */ |
1877 void set types(List<ClassElement> types2) { | 2174 void set types(List<ClassElement> types2) { |
1878 for (ClassElement type in types2) { | 2175 for (ClassElement type in types2) { |
1879 ((type as ClassElementImpl)).enclosingElement = this; | 2176 ((type as ClassElementImpl)).enclosingElement = this; |
1880 } | 2177 } |
1881 this._types = types2; | 2178 this._types = types2; |
1882 } | 2179 } |
| 2180 |
| 2181 /** |
| 2182 * Set the URI that is specified by the "part" directive in the enclosing libr
ary. |
| 2183 * @param uri the URI that is specified by the "part" directive in the enclosi
ng library. |
| 2184 */ |
| 2185 void set uri(String uri2) { |
| 2186 this._uri = uri2; |
| 2187 } |
1883 void visitChildren(ElementVisitor<Object> visitor) { | 2188 void visitChildren(ElementVisitor<Object> visitor) { |
1884 super.visitChildren(visitor); | 2189 super.visitChildren(visitor); |
1885 safelyVisitChildren(_accessors, visitor); | 2190 safelyVisitChildren(_accessors, visitor); |
1886 safelyVisitChildren(_functions, visitor); | 2191 safelyVisitChildren(_functions, visitor); |
1887 safelyVisitChildren(_typeAliases, visitor); | 2192 safelyVisitChildren(_typeAliases, visitor); |
1888 safelyVisitChildren(_types, visitor); | 2193 safelyVisitChildren(_types, visitor); |
1889 safelyVisitChildren(_variables, visitor); | 2194 safelyVisitChildren(_variables, visitor); |
1890 } | 2195 } |
1891 void appendTo(JavaStringBuilder builder) { | 2196 void appendTo(JavaStringBuilder builder) { |
1892 if (_source == null) { | 2197 if (_source == null) { |
1893 builder.append("{compilation unit}"); | 2198 builder.append("{compilation unit}"); |
1894 } else { | 2199 } else { |
1895 builder.append(_source.fullName); | 2200 builder.append(_source.fullName); |
1896 } | 2201 } |
1897 } | 2202 } |
1898 } | 2203 } |
| 2204 |
1899 /** | 2205 /** |
1900 * Instances of the class {@code ConstFieldElementImpl} implement a {@code Field
Element} for a | 2206 * Instances of the class {@code ConstFieldElementImpl} implement a {@code Field
Element} for a |
1901 * 'const' field that has an initializer. | 2207 * 'const' field that has an initializer. |
1902 */ | 2208 */ |
1903 class ConstFieldElementImpl extends FieldElementImpl { | 2209 class ConstFieldElementImpl extends FieldElementImpl { |
| 2210 |
1904 /** | 2211 /** |
1905 * The result of evaluating this variable's initializer. | 2212 * The result of evaluating this variable's initializer. |
1906 */ | 2213 */ |
1907 EvaluationResultImpl _result; | 2214 EvaluationResultImpl _result; |
| 2215 |
1908 /** | 2216 /** |
1909 * Initialize a newly created field element to have the given name. | 2217 * Initialize a newly created field element to have the given name. |
1910 * @param name the name of this element | 2218 * @param name the name of this element |
1911 */ | 2219 */ |
1912 ConstFieldElementImpl(Identifier name) : super.con1(name) { | 2220 ConstFieldElementImpl(Identifier name) : super.con1(name) { |
1913 } | 2221 } |
1914 EvaluationResultImpl get evaluationResult => _result; | 2222 EvaluationResultImpl get evaluationResult => _result; |
1915 void set evaluationResult(EvaluationResultImpl result2) { | 2223 void set evaluationResult(EvaluationResultImpl result2) { |
1916 this._result = result2; | 2224 this._result = result2; |
1917 } | 2225 } |
1918 } | 2226 } |
| 2227 |
1919 /** | 2228 /** |
1920 * Instances of the class {@code ConstLocalVariableElementImpl} implement a{@cod
e LocalVariableElement} for a local 'const' variable that has an initializer. | 2229 * Instances of the class {@code ConstLocalVariableElementImpl} implement a{@cod
e LocalVariableElement} for a local 'const' variable that has an initializer. |
1921 * @coverage dart.engine.element | 2230 * @coverage dart.engine.element |
1922 */ | 2231 */ |
1923 class ConstLocalVariableElementImpl extends LocalVariableElementImpl { | 2232 class ConstLocalVariableElementImpl extends LocalVariableElementImpl { |
| 2233 |
1924 /** | 2234 /** |
1925 * The result of evaluating this variable's initializer. | 2235 * The result of evaluating this variable's initializer. |
1926 */ | 2236 */ |
1927 EvaluationResultImpl _result; | 2237 EvaluationResultImpl _result; |
| 2238 |
1928 /** | 2239 /** |
1929 * Initialize a newly created local variable element to have the given name. | 2240 * Initialize a newly created local variable element to have the given name. |
1930 * @param name the name of this element | 2241 * @param name the name of this element |
1931 */ | 2242 */ |
1932 ConstLocalVariableElementImpl(Identifier name) : super(name) { | 2243 ConstLocalVariableElementImpl(Identifier name) : super(name) { |
1933 } | 2244 } |
1934 EvaluationResultImpl get evaluationResult => _result; | 2245 EvaluationResultImpl get evaluationResult => _result; |
1935 void set evaluationResult(EvaluationResultImpl result2) { | 2246 void set evaluationResult(EvaluationResultImpl result2) { |
1936 this._result = result2; | 2247 this._result = result2; |
1937 } | 2248 } |
1938 } | 2249 } |
| 2250 |
1939 /** | 2251 /** |
1940 * Instances of the class {@code ConstParameterElementImpl} implement a {@code P
arameterElement} for | 2252 * Instances of the class {@code ConstParameterElementImpl} implement a {@code P
arameterElement} for |
1941 * a 'const' parameter that has an initializer. | 2253 * a 'const' parameter that has an initializer. |
1942 * @coverage dart.engine.element | 2254 * @coverage dart.engine.element |
1943 */ | 2255 */ |
1944 class ConstParameterElementImpl extends ParameterElementImpl { | 2256 class ConstParameterElementImpl extends ParameterElementImpl { |
| 2257 |
1945 /** | 2258 /** |
1946 * The result of evaluating this variable's initializer. | 2259 * The result of evaluating this variable's initializer. |
1947 */ | 2260 */ |
1948 EvaluationResultImpl _result; | 2261 EvaluationResultImpl _result; |
| 2262 |
1949 /** | 2263 /** |
1950 * Initialize a newly created parameter element to have the given name. | 2264 * Initialize a newly created parameter element to have the given name. |
1951 * @param name the name of this element | 2265 * @param name the name of this element |
1952 */ | 2266 */ |
1953 ConstParameterElementImpl(Identifier name) : super(name) { | 2267 ConstParameterElementImpl(Identifier name) : super(name) { |
1954 } | 2268 } |
1955 EvaluationResultImpl get evaluationResult => _result; | 2269 EvaluationResultImpl get evaluationResult => _result; |
1956 void set evaluationResult(EvaluationResultImpl result2) { | 2270 void set evaluationResult(EvaluationResultImpl result2) { |
1957 this._result = result2; | 2271 this._result = result2; |
1958 } | 2272 } |
1959 } | 2273 } |
| 2274 |
1960 /** | 2275 /** |
1961 * Instances of the class {@code ConstTopLevelVariableElementImpl} implement a{@
code TopLevelVariableElement} for a top-level 'const' variable that has an initi
alizer. | 2276 * Instances of the class {@code ConstTopLevelVariableElementImpl} implement a{@
code TopLevelVariableElement} for a top-level 'const' variable that has an initi
alizer. |
1962 */ | 2277 */ |
1963 class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl { | 2278 class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl { |
| 2279 |
1964 /** | 2280 /** |
1965 * The result of evaluating this variable's initializer. | 2281 * The result of evaluating this variable's initializer. |
1966 */ | 2282 */ |
1967 EvaluationResultImpl _result; | 2283 EvaluationResultImpl _result; |
| 2284 |
1968 /** | 2285 /** |
1969 * Initialize a newly created top-level variable element to have the given nam
e. | 2286 * Initialize a newly created top-level variable element to have the given nam
e. |
1970 * @param name the name of this element | 2287 * @param name the name of this element |
1971 */ | 2288 */ |
1972 ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name) { | 2289 ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name) { |
1973 } | 2290 } |
1974 EvaluationResultImpl get evaluationResult => _result; | 2291 EvaluationResultImpl get evaluationResult => _result; |
1975 void set evaluationResult(EvaluationResultImpl result2) { | 2292 void set evaluationResult(EvaluationResultImpl result2) { |
1976 this._result = result2; | 2293 this._result = result2; |
1977 } | 2294 } |
1978 } | 2295 } |
| 2296 |
1979 /** | 2297 /** |
1980 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons
tructorElement}. | 2298 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons
tructorElement}. |
1981 * @coverage dart.engine.element | 2299 * @coverage dart.engine.element |
1982 */ | 2300 */ |
1983 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
rElement { | 2301 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
rElement { |
| 2302 |
1984 /** | 2303 /** |
1985 * An empty array of constructor elements. | 2304 * An empty array of constructor elements. |
1986 */ | 2305 */ |
1987 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); | 2306 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); |
| 2307 |
| 2308 /** |
| 2309 * The constructor to which this constructor is redirecting. |
| 2310 */ |
| 2311 ConstructorElement _redirectedConstructor; |
| 2312 |
1988 /** | 2313 /** |
1989 * Initialize a newly created constructor element to have the given name. | 2314 * Initialize a newly created constructor element to have the given name. |
1990 * @param name the name of this element | 2315 * @param name the name of this element |
1991 */ | 2316 */ |
1992 ConstructorElementImpl(Identifier name) : super.con1(name) { | 2317 ConstructorElementImpl(Identifier name) : super.con1(name) { |
1993 } | 2318 } |
1994 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 2319 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
1995 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 2320 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
1996 ElementKind get kind => ElementKind.CONSTRUCTOR; | 2321 ElementKind get kind => ElementKind.CONSTRUCTOR; |
| 2322 ConstructorElement get redirectedConstructor => _redirectedConstructor; |
1997 bool isConst() => hasModifier(Modifier.CONST); | 2323 bool isConst() => hasModifier(Modifier.CONST); |
1998 bool isFactory() => hasModifier(Modifier.FACTORY); | 2324 bool isFactory() => hasModifier(Modifier.FACTORY); |
1999 bool isStatic() => false; | 2325 bool isStatic() => false; |
| 2326 |
2000 /** | 2327 /** |
2001 * Set whether this constructor represents a 'const' constructor to the given
value. | 2328 * Set whether this constructor represents a 'const' constructor to the given
value. |
2002 * @param isConst {@code true} if this constructor represents a 'const' constr
uctor | 2329 * @param isConst {@code true} if this constructor represents a 'const' constr
uctor |
2003 */ | 2330 */ |
2004 void set const2(bool isConst) { | 2331 void set const2(bool isConst) { |
2005 setModifier(Modifier.CONST, isConst); | 2332 setModifier(Modifier.CONST, isConst); |
2006 } | 2333 } |
| 2334 |
2007 /** | 2335 /** |
2008 * Set whether this constructor represents a factory method to the given value
. | 2336 * Set whether this constructor represents a factory method to the given value
. |
2009 * @param isFactory {@code true} if this constructor represents a factory meth
od | 2337 * @param isFactory {@code true} if this constructor represents a factory meth
od |
2010 */ | 2338 */ |
2011 void set factory(bool isFactory) { | 2339 void set factory(bool isFactory) { |
2012 setModifier(Modifier.FACTORY, isFactory); | 2340 setModifier(Modifier.FACTORY, isFactory); |
2013 } | 2341 } |
| 2342 |
| 2343 /** |
| 2344 * Sets the constructor to which this constructor is redirecting. |
| 2345 * @param redirectedConstructor the constructor to which this constructor is r
edirecting |
| 2346 */ |
| 2347 void set redirectedConstructor(ConstructorElement redirectedConstructor2) { |
| 2348 this._redirectedConstructor = redirectedConstructor2; |
| 2349 } |
2014 void appendTo(JavaStringBuilder builder) { | 2350 void appendTo(JavaStringBuilder builder) { |
2015 builder.append(enclosingElement.name); | 2351 builder.append(enclosingElement.displayName); |
2016 String name2 = name; | 2352 String name = displayName; |
2017 if (name2 != null && !name2.isEmpty) { | 2353 if (name != null && !name.isEmpty) { |
2018 builder.append("."); | 2354 builder.append("."); |
2019 builder.append(name2); | 2355 builder.append(name); |
2020 } | 2356 } |
2021 super.appendTo(builder); | 2357 super.appendTo(builder); |
2022 } | 2358 } |
2023 } | 2359 } |
| 2360 |
2024 /** | 2361 /** |
2025 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele
ment representing | 2362 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele
ment representing |
2026 * the declaration of the type {@code dynamic}. | 2363 * the declaration of the type {@code dynamic}. |
2027 * @coverage dart.engine.element | 2364 * @coverage dart.engine.element |
2028 */ | 2365 */ |
2029 class DynamicElementImpl extends ElementImpl { | 2366 class DynamicElementImpl extends ElementImpl { |
| 2367 |
2030 /** | 2368 /** |
2031 * Return the unique instance of this class. | 2369 * Return the unique instance of this class. |
2032 * @return the unique instance of this class | 2370 * @return the unique instance of this class |
2033 */ | 2371 */ |
2034 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as
DynamicElementImpl; | 2372 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as
DynamicElementImpl; |
| 2373 |
2035 /** | 2374 /** |
2036 * The type defined by this element. | 2375 * The type defined by this element. |
2037 */ | 2376 */ |
2038 DynamicTypeImpl _type; | 2377 DynamicTypeImpl _type; |
| 2378 |
2039 /** | 2379 /** |
2040 * Initialize a newly created instance of this class. Instances of this class
should <b>not</b> be | 2380 * Initialize a newly created instance of this class. Instances of this class
should <b>not</b> be |
2041 * created except as part of creating the type associated with this element. T
he single instance | 2381 * created except as part of creating the type associated with this element. T
he single instance |
2042 * of this class should be accessed through the method {@link #getInstance()}. | 2382 * of this class should be accessed through the method {@link #getInstance()}. |
2043 */ | 2383 */ |
2044 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { | 2384 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { |
2045 setModifier(Modifier.SYNTHETIC, true); | 2385 setModifier(Modifier.SYNTHETIC, true); |
2046 } | 2386 } |
2047 accept(ElementVisitor visitor) => null; | 2387 accept(ElementVisitor visitor) => null; |
2048 ElementKind get kind => ElementKind.DYNAMIC; | 2388 ElementKind get kind => ElementKind.DYNAMIC; |
| 2389 |
2049 /** | 2390 /** |
2050 * Return the type defined by this element. | 2391 * Return the type defined by this element. |
2051 * @return the type defined by this element | 2392 * @return the type defined by this element |
2052 */ | 2393 */ |
2053 DynamicTypeImpl get type => _type; | 2394 DynamicTypeImpl get type => _type; |
| 2395 |
2054 /** | 2396 /** |
2055 * Set the type defined by this element to the given type. | 2397 * Set the type defined by this element to the given type. |
2056 * @param type the type defined by this element | 2398 * @param type the type defined by this element |
2057 */ | 2399 */ |
2058 void set type(DynamicTypeImpl type2) { | 2400 void set type(DynamicTypeImpl type2) { |
2059 this._type = type2; | 2401 this._type = type2; |
2060 } | 2402 } |
2061 } | 2403 } |
| 2404 |
2062 /** | 2405 /** |
2063 * The abstract class {@code ElementImpl} implements the behavior common to obje
cts that implement | 2406 * The abstract class {@code ElementImpl} implements the behavior common to obje
cts that implement |
2064 * an {@link Element}. | 2407 * an {@link Element}. |
2065 * @coverage dart.engine.element | 2408 * @coverage dart.engine.element |
2066 */ | 2409 */ |
2067 abstract class ElementImpl implements Element { | 2410 abstract class ElementImpl implements Element { |
| 2411 |
2068 /** | 2412 /** |
2069 * The enclosing element of this element, or {@code null} if this element is a
t the root of the | 2413 * The enclosing element of this element, or {@code null} if this element is a
t the root of the |
2070 * element structure. | 2414 * element structure. |
2071 */ | 2415 */ |
2072 ElementImpl _enclosingElement; | 2416 ElementImpl _enclosingElement; |
| 2417 |
2073 /** | 2418 /** |
2074 * The name of this element. | 2419 * The name of this element. |
2075 */ | 2420 */ |
2076 String _name; | 2421 String _name; |
| 2422 |
2077 /** | 2423 /** |
2078 * The offset of the name of this element in the file that contains the declar
ation of this | 2424 * The offset of the name of this element in the file that contains the declar
ation of this |
2079 * element. | 2425 * element. |
2080 */ | 2426 */ |
2081 int _nameOffset = 0; | 2427 int _nameOffset = 0; |
| 2428 |
2082 /** | 2429 /** |
2083 * A bit-encoded form of the modifiers associated with this element. | 2430 * A bit-encoded form of the modifiers associated with this element. |
2084 */ | 2431 */ |
2085 Set<Modifier> _modifiers; | 2432 Set<Modifier> _modifiers; |
| 2433 |
2086 /** | 2434 /** |
2087 * An array containing all of the metadata associated with this element. | 2435 * An array containing all of the metadata associated with this element. |
2088 */ | 2436 */ |
2089 List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY; | 2437 List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY; |
| 2438 |
2090 /** | 2439 /** |
2091 * A cached copy of the calculated hashCode for this element. | 2440 * A cached copy of the calculated hashCode for this element. |
2092 */ | 2441 */ |
2093 int _cachedHashCode = 0; | 2442 int _cachedHashCode = 0; |
| 2443 |
2094 /** | 2444 /** |
2095 * Initialize a newly created element to have the given name. | 2445 * Initialize a newly created element to have the given name. |
2096 * @param name the name of this element | 2446 * @param name the name of this element |
2097 */ | 2447 */ |
2098 ElementImpl.con1(Identifier name2) { | 2448 ElementImpl.con1(Identifier name2) { |
2099 _jtd_constructor_189_impl(name2); | 2449 _jtd_constructor_193_impl(name2); |
2100 } | 2450 } |
2101 _jtd_constructor_189_impl(Identifier name2) { | 2451 _jtd_constructor_193_impl(Identifier name2) { |
2102 _jtd_constructor_190_impl(name2 == null ? "" : name2.name, name2 == null ? -
1 : name2.offset); | 2452 _jtd_constructor_194_impl(name2 == null ? "" : name2.name, name2 == null ? -
1 : name2.offset); |
2103 } | 2453 } |
| 2454 |
2104 /** | 2455 /** |
2105 * Initialize a newly created element to have the given name. | 2456 * Initialize a newly created element to have the given name. |
2106 * @param name the name of this element | 2457 * @param name the name of this element |
2107 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 2458 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
2108 * declaration of this element | 2459 * declaration of this element |
2109 */ | 2460 */ |
2110 ElementImpl.con2(String name2, int nameOffset2) { | 2461 ElementImpl.con2(String name2, int nameOffset2) { |
2111 _jtd_constructor_190_impl(name2, nameOffset2); | 2462 _jtd_constructor_194_impl(name2, nameOffset2); |
2112 } | 2463 } |
2113 _jtd_constructor_190_impl(String name2, int nameOffset2) { | 2464 _jtd_constructor_194_impl(String name2, int nameOffset2) { |
2114 this._name = StringUtilities.intern(name2); | 2465 this._name = StringUtilities.intern(name2); |
2115 this._nameOffset = nameOffset2; | 2466 this._nameOffset = nameOffset2; |
2116 } | 2467 } |
2117 String computeDocumentationComment() { | 2468 String computeDocumentationComment() { |
2118 AnalysisContext context2 = context; | 2469 AnalysisContext context2 = context; |
2119 if (context2 == null) { | 2470 if (context2 == null) { |
2120 return null; | 2471 return null; |
2121 } | 2472 } |
2122 return context2.computeDocumentationComment(this); | 2473 return context2.computeDocumentationComment(this); |
2123 } | 2474 } |
2124 bool operator ==(Object object) => object != null && object.runtimeType == run
timeType && ((object as Element)).location == location; | 2475 bool operator ==(Object object) => object != null && object.runtimeType == run
timeType && ((object as Element)).location == location; |
2125 Element getAncestor(Type elementClass) { | 2476 Element getAncestor(Type elementClass) { |
2126 Element ancestor = _enclosingElement; | 2477 Element ancestor = _enclosingElement; |
2127 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { | 2478 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { |
2128 ancestor = ancestor.enclosingElement; | 2479 ancestor = ancestor.enclosingElement; |
2129 } | 2480 } |
2130 return ancestor as Element; | 2481 return ancestor as Element; |
2131 } | 2482 } |
| 2483 |
2132 /** | 2484 /** |
2133 * Return the child of this element that is uniquely identified by the given i
dentifier, or{@code null} if there is no such child. | 2485 * Return the child of this element that is uniquely identified by the given i
dentifier, or{@code null} if there is no such child. |
2134 * @param identifier the identifier used to select a child | 2486 * @param identifier the identifier used to select a child |
2135 * @return the child of this element with the given identifier | 2487 * @return the child of this element with the given identifier |
2136 */ | 2488 */ |
2137 ElementImpl getChild(String identifier) => null; | 2489 ElementImpl getChild(String identifier) => null; |
2138 AnalysisContext get context { | 2490 AnalysisContext get context { |
2139 if (_enclosingElement == null) { | 2491 if (_enclosingElement == null) { |
2140 return null; | 2492 return null; |
2141 } | 2493 } |
2142 return _enclosingElement.context; | 2494 return _enclosingElement.context; |
2143 } | 2495 } |
| 2496 String get displayName => _name; |
2144 Element get enclosingElement => _enclosingElement; | 2497 Element get enclosingElement => _enclosingElement; |
2145 LibraryElement get library => getAncestor(LibraryElement); | 2498 LibraryElement get library => getAncestor(LibraryElement); |
2146 ElementLocation get location => new ElementLocationImpl.con1(this); | 2499 ElementLocation get location => new ElementLocationImpl.con1(this); |
2147 List<Annotation> get metadata => _metadata; | 2500 List<Annotation> get metadata => _metadata; |
2148 String get name => _name; | 2501 String get name => _name; |
2149 int get nameOffset => _nameOffset; | 2502 int get nameOffset => _nameOffset; |
2150 Source get source { | 2503 Source get source { |
2151 if (_enclosingElement == null) { | 2504 if (_enclosingElement == null) { |
2152 return null; | 2505 return null; |
2153 } | 2506 } |
2154 return _enclosingElement.source; | 2507 return _enclosingElement.source; |
2155 } | 2508 } |
2156 int get hashCode { | 2509 int get hashCode { |
2157 if (_cachedHashCode == 0) { | 2510 if (_cachedHashCode == 0) { |
2158 _cachedHashCode = location.hashCode; | 2511 _cachedHashCode = location.hashCode; |
2159 } | 2512 } |
2160 return _cachedHashCode; | 2513 return _cachedHashCode; |
2161 } | 2514 } |
2162 bool isAccessibleIn(LibraryElement library2) { | 2515 bool isAccessibleIn(LibraryElement library2) { |
2163 if (Identifier.isPrivateName(_name)) { | 2516 if (Identifier.isPrivateName(_name)) { |
2164 return library2 == library; | 2517 return library2 == library; |
2165 } | 2518 } |
2166 return true; | 2519 return true; |
2167 } | 2520 } |
2168 bool isSynthetic() => hasModifier(Modifier.SYNTHETIC); | 2521 bool isSynthetic() => hasModifier(Modifier.SYNTHETIC); |
| 2522 |
2169 /** | 2523 /** |
2170 * Set the metadata associate with this element to the given array of annotati
ons. | 2524 * Set the metadata associate with this element to the given array of annotati
ons. |
2171 * @param metadata the metadata to be associated with this element | 2525 * @param metadata the metadata to be associated with this element |
2172 */ | 2526 */ |
2173 void set metadata(List<Annotation> metadata2) { | 2527 void set metadata(List<Annotation> metadata2) { |
2174 this._metadata = metadata2; | 2528 this._metadata = metadata2; |
2175 } | 2529 } |
| 2530 |
2176 /** | 2531 /** |
2177 * Set the offset of the name of this element in the file that contains the de
claration of this | 2532 * Set the offset of the name of this element in the file that contains the de
claration of this |
2178 * element to the given value. This is normally done via the constructor, but
this method is | 2533 * element to the given value. This is normally done via the constructor, but
this method is |
2179 * provided to support unnamed constructors. | 2534 * provided to support unnamed constructors. |
2180 * @param nameOffset the offset to the beginning of the name | 2535 * @param nameOffset the offset to the beginning of the name |
2181 */ | 2536 */ |
2182 void set nameOffset(int nameOffset2) { | 2537 void set nameOffset(int nameOffset2) { |
2183 this._nameOffset = nameOffset2; | 2538 this._nameOffset = nameOffset2; |
2184 } | 2539 } |
| 2540 |
2185 /** | 2541 /** |
2186 * Set whether this element is synthetic to correspond to the given value. | 2542 * Set whether this element is synthetic to correspond to the given value. |
2187 * @param isSynthetic {@code true} if the element is synthetic | 2543 * @param isSynthetic {@code true} if the element is synthetic |
2188 */ | 2544 */ |
2189 void set synthetic(bool isSynthetic) { | 2545 void set synthetic(bool isSynthetic) { |
2190 setModifier(Modifier.SYNTHETIC, isSynthetic); | 2546 setModifier(Modifier.SYNTHETIC, isSynthetic); |
2191 } | 2547 } |
2192 String toString() { | 2548 String toString() { |
2193 JavaStringBuilder builder = new JavaStringBuilder(); | 2549 JavaStringBuilder builder = new JavaStringBuilder(); |
2194 appendTo(builder); | 2550 appendTo(builder); |
2195 return builder.toString(); | 2551 return builder.toString(); |
2196 } | 2552 } |
2197 void visitChildren(ElementVisitor<Object> visitor) { | 2553 void visitChildren(ElementVisitor<Object> visitor) { |
2198 } | 2554 } |
| 2555 |
2199 /** | 2556 /** |
2200 * Append a textual representation of this type to the given builder. | 2557 * Append a textual representation of this type to the given builder. |
2201 * @param builder the builder to which the text is to be appended | 2558 * @param builder the builder to which the text is to be appended |
2202 */ | 2559 */ |
2203 void appendTo(JavaStringBuilder builder) { | 2560 void appendTo(JavaStringBuilder builder) { |
2204 if (_name == null) { | 2561 if (_name == null) { |
2205 builder.append("<unnamed "); | 2562 builder.append("<unnamed "); |
2206 builder.append(runtimeType.toString()); | 2563 builder.append(runtimeType.toString()); |
2207 builder.append(">"); | 2564 builder.append(">"); |
2208 } else { | 2565 } else { |
2209 builder.append(_name); | 2566 builder.append(_name); |
2210 } | 2567 } |
2211 } | 2568 } |
| 2569 |
2212 /** | 2570 /** |
2213 * Return an identifier that uniquely identifies this element among the childr
en of this element's | 2571 * Return an identifier that uniquely identifies this element among the childr
en of this element's |
2214 * parent. | 2572 * parent. |
2215 * @return an identifier that uniquely identifies this element relative to its
parent | 2573 * @return an identifier that uniquely identifies this element relative to its
parent |
2216 */ | 2574 */ |
2217 String get identifier => name; | 2575 String get identifier => name; |
| 2576 |
2218 /** | 2577 /** |
2219 * Return {@code true} if this element has the given modifier associated with
it. | 2578 * Return {@code true} if this element has the given modifier associated with
it. |
2220 * @param modifier the modifier being tested for | 2579 * @param modifier the modifier being tested for |
2221 * @return {@code true} if this element has the given modifier associated with
it | 2580 * @return {@code true} if this element has the given modifier associated with
it |
2222 */ | 2581 */ |
2223 bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contai
ns(modifier); | 2582 bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contai
ns(modifier); |
| 2583 |
2224 /** | 2584 /** |
2225 * If the given child is not {@code null}, use the given visitor to visit it. | 2585 * If the given child is not {@code null}, use the given visitor to visit it. |
2226 * @param child the child to be visited | 2586 * @param child the child to be visited |
2227 * @param visitor the visitor to be used to visit the child | 2587 * @param visitor the visitor to be used to visit the child |
2228 */ | 2588 */ |
2229 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { | 2589 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { |
2230 if (child != null) { | 2590 if (child != null) { |
2231 child.accept(visitor); | 2591 child.accept(visitor); |
2232 } | 2592 } |
2233 } | 2593 } |
| 2594 |
2234 /** | 2595 /** |
2235 * Use the given visitor to visit all of the children in the given array. | 2596 * Use the given visitor to visit all of the children in the given array. |
2236 * @param children the children to be visited | 2597 * @param children the children to be visited |
2237 * @param visitor the visitor being used to visit the children | 2598 * @param visitor the visitor being used to visit the children |
2238 */ | 2599 */ |
2239 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito
r) { | 2600 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito
r) { |
2240 if (children != null) { | 2601 if (children != null) { |
2241 for (Element child in children) { | 2602 for (Element child in children) { |
2242 child.accept(visitor); | 2603 child.accept(visitor); |
2243 } | 2604 } |
2244 } | 2605 } |
2245 } | 2606 } |
| 2607 |
2246 /** | 2608 /** |
2247 * Set the enclosing element of this element to the given element. | 2609 * Set the enclosing element of this element to the given element. |
2248 * @param element the enclosing element of this element | 2610 * @param element the enclosing element of this element |
2249 */ | 2611 */ |
2250 void set enclosingElement(ElementImpl element) { | 2612 void set enclosingElement(ElementImpl element) { |
2251 _enclosingElement = element; | 2613 _enclosingElement = element; |
2252 } | 2614 } |
| 2615 |
2253 /** | 2616 /** |
2254 * Set whether the given modifier is associated with this element to correspon
d to the given | 2617 * Set whether the given modifier is associated with this element to correspon
d to the given |
2255 * value. | 2618 * value. |
2256 * @param modifier the modifier to be set | 2619 * @param modifier the modifier to be set |
2257 * @param value {@code true} if the modifier is to be associated with this ele
ment | 2620 * @param value {@code true} if the modifier is to be associated with this ele
ment |
2258 */ | 2621 */ |
2259 void setModifier(Modifier modifier, bool value) { | 2622 void setModifier(Modifier modifier, bool value) { |
2260 if (value) { | 2623 if (value) { |
2261 if (_modifiers == null) { | 2624 if (_modifiers == null) { |
2262 _modifiers = new Set(); | 2625 _modifiers = new Set(); |
2263 } | 2626 } |
2264 _modifiers.add(modifier); | 2627 _modifiers.add(modifier); |
2265 } else { | 2628 } else { |
2266 if (_modifiers != null) { | 2629 if (_modifiers != null) { |
2267 _modifiers.remove(modifier); | 2630 _modifiers.remove(modifier); |
2268 if (_modifiers.isEmpty) { | 2631 if (_modifiers.isEmpty) { |
2269 _modifiers = null; | 2632 _modifiers = null; |
2270 } | 2633 } |
2271 } | 2634 } |
2272 } | 2635 } |
2273 } | 2636 } |
2274 } | 2637 } |
| 2638 |
2275 /** | 2639 /** |
2276 * Instances of the class {@code ElementLocationImpl} implement an {@link Elemen
tLocation}. | 2640 * Instances of the class {@code ElementLocationImpl} implement an {@link Elemen
tLocation}. |
2277 * @coverage dart.engine.element | 2641 * @coverage dart.engine.element |
2278 */ | 2642 */ |
2279 class ElementLocationImpl implements ElementLocation { | 2643 class ElementLocationImpl implements ElementLocation { |
| 2644 |
2280 /** | 2645 /** |
2281 * The path to the element whose location is represented by this object. | 2646 * The path to the element whose location is represented by this object. |
2282 */ | 2647 */ |
2283 List<String> _components; | 2648 List<String> _components; |
| 2649 |
2284 /** | 2650 /** |
2285 * The character used to separate components in the encoded form. | 2651 * The character used to separate components in the encoded form. |
2286 */ | 2652 */ |
2287 static int _SEPARATOR_CHAR = 0x3B; | 2653 static int _SEPARATOR_CHAR = 0x3B; |
| 2654 |
2288 /** | 2655 /** |
2289 * Initialize a newly created location to represent the given element. | 2656 * Initialize a newly created location to represent the given element. |
2290 * @param element the element whose location is being represented | 2657 * @param element the element whose location is being represented |
2291 */ | 2658 */ |
2292 ElementLocationImpl.con1(Element element) { | 2659 ElementLocationImpl.con1(Element element) { |
2293 _jtd_constructor_191_impl(element); | 2660 _jtd_constructor_195_impl(element); |
2294 } | 2661 } |
2295 _jtd_constructor_191_impl(Element element) { | 2662 _jtd_constructor_195_impl(Element element) { |
2296 List<String> components = new List<String>(); | 2663 List<String> components = new List<String>(); |
2297 Element ancestor = element; | 2664 Element ancestor = element; |
2298 while (ancestor != null) { | 2665 while (ancestor != null) { |
2299 components.insert(0, ((ancestor as ElementImpl)).identifier); | 2666 components.insert(0, ((ancestor as ElementImpl)).identifier); |
2300 ancestor = ancestor.enclosingElement; | 2667 ancestor = ancestor.enclosingElement; |
2301 } | 2668 } |
2302 this._components = new List.from(components); | 2669 this._components = new List.from(components); |
2303 } | 2670 } |
| 2671 |
2304 /** | 2672 /** |
2305 * Initialize a newly created location from the given encoded form. | 2673 * Initialize a newly created location from the given encoded form. |
2306 * @param encoding the encoded form of a location | 2674 * @param encoding the encoded form of a location |
2307 */ | 2675 */ |
2308 ElementLocationImpl.con2(String encoding) { | 2676 ElementLocationImpl.con2(String encoding) { |
2309 _jtd_constructor_192_impl(encoding); | 2677 _jtd_constructor_196_impl(encoding); |
2310 } | 2678 } |
2311 _jtd_constructor_192_impl(String encoding) { | 2679 _jtd_constructor_196_impl(String encoding) { |
2312 this._components = decode(encoding); | 2680 this._components = decode(encoding); |
2313 } | 2681 } |
2314 bool operator ==(Object object) { | 2682 bool operator ==(Object object) { |
2315 if (object is! ElementLocationImpl) { | 2683 if (object is! ElementLocationImpl) { |
2316 return false; | 2684 return false; |
2317 } | 2685 } |
2318 ElementLocationImpl location = object as ElementLocationImpl; | 2686 ElementLocationImpl location = object as ElementLocationImpl; |
2319 return JavaArrays.equals(_components, location._components); | 2687 return JavaArrays.equals(_components, location._components); |
2320 } | 2688 } |
| 2689 |
2321 /** | 2690 /** |
2322 * Return the path to the element whose location is represented by this object
. | 2691 * Return the path to the element whose location is represented by this object
. |
2323 * @return the path to the element whose location is represented by this objec
t | 2692 * @return the path to the element whose location is represented by this objec
t |
2324 */ | 2693 */ |
2325 List<String> get components => _components; | 2694 List<String> get components => _components; |
2326 String get encoding { | 2695 String get encoding { |
2327 JavaStringBuilder builder = new JavaStringBuilder(); | 2696 JavaStringBuilder builder = new JavaStringBuilder(); |
2328 int length2 = _components.length; | 2697 int length2 = _components.length; |
2329 for (int i = 0; i < length2; i++) { | 2698 for (int i = 0; i < length2; i++) { |
2330 if (i > 0) { | 2699 if (i > 0) { |
2331 builder.appendChar(_SEPARATOR_CHAR); | 2700 builder.appendChar(_SEPARATOR_CHAR); |
2332 } | 2701 } |
2333 encode(builder, _components[i]); | 2702 encode(builder, _components[i]); |
2334 } | 2703 } |
2335 return builder.toString(); | 2704 return builder.toString(); |
2336 } | 2705 } |
2337 int get hashCode => JavaArrays.makeHashCode(_components); | 2706 int get hashCode => JavaArrays.makeHashCode(_components); |
2338 String toString() => encoding; | 2707 String toString() => encoding; |
| 2708 |
2339 /** | 2709 /** |
2340 * Decode the encoded form of a location into an array of components. | 2710 * Decode the encoded form of a location into an array of components. |
2341 * @param encoding the encoded form of a location | 2711 * @param encoding the encoded form of a location |
2342 * @return the components that were encoded | 2712 * @return the components that were encoded |
2343 */ | 2713 */ |
2344 List<String> decode(String encoding) { | 2714 List<String> decode(String encoding) { |
2345 List<String> components = new List<String>(); | 2715 List<String> components = new List<String>(); |
2346 JavaStringBuilder builder = new JavaStringBuilder(); | 2716 JavaStringBuilder builder = new JavaStringBuilder(); |
2347 int index = 0; | 2717 int index = 0; |
2348 int length2 = encoding.length; | 2718 int length2 = encoding.length; |
(...skipping 11 matching lines...) Expand all Loading... |
2360 } else { | 2730 } else { |
2361 builder.appendChar(currentChar); | 2731 builder.appendChar(currentChar); |
2362 index++; | 2732 index++; |
2363 } | 2733 } |
2364 } | 2734 } |
2365 if (builder.length > 0) { | 2735 if (builder.length > 0) { |
2366 components.add(builder.toString()); | 2736 components.add(builder.toString()); |
2367 } | 2737 } |
2368 return new List.from(components); | 2738 return new List.from(components); |
2369 } | 2739 } |
| 2740 |
2370 /** | 2741 /** |
2371 * Append an encoded form of the given component to the given builder. | 2742 * Append an encoded form of the given component to the given builder. |
2372 * @param builder the builder to which the encoded component is to be appended | 2743 * @param builder the builder to which the encoded component is to be appended |
2373 * @param component the component to be appended to the builder | 2744 * @param component the component to be appended to the builder |
2374 */ | 2745 */ |
2375 void encode(JavaStringBuilder builder, String component) { | 2746 void encode(JavaStringBuilder builder, String component) { |
2376 int length2 = component.length; | 2747 int length2 = component.length; |
2377 for (int i = 0; i < length2; i++) { | 2748 for (int i = 0; i < length2; i++) { |
2378 int currentChar = component.codeUnitAt(i); | 2749 int currentChar = component.codeUnitAt(i); |
2379 if (currentChar == _SEPARATOR_CHAR) { | 2750 if (currentChar == _SEPARATOR_CHAR) { |
2380 builder.appendChar(_SEPARATOR_CHAR); | 2751 builder.appendChar(_SEPARATOR_CHAR); |
2381 } | 2752 } |
2382 builder.appendChar(currentChar); | 2753 builder.appendChar(currentChar); |
2383 } | 2754 } |
2384 } | 2755 } |
2385 } | 2756 } |
| 2757 |
2386 /** | 2758 /** |
2387 * Instances of the class {@code EmbeddedHtmlScriptElementImpl} implement an{@li
nk EmbeddedHtmlScriptElement}. | 2759 * Instances of the class {@code EmbeddedHtmlScriptElementImpl} implement an{@li
nk EmbeddedHtmlScriptElement}. |
2388 * @coverage dart.engine.element | 2760 * @coverage dart.engine.element |
2389 */ | 2761 */ |
2390 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb
eddedHtmlScriptElement { | 2762 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb
eddedHtmlScriptElement { |
| 2763 |
2391 /** | 2764 /** |
2392 * The library defined by the script tag's content. | 2765 * The library defined by the script tag's content. |
2393 */ | 2766 */ |
2394 LibraryElement _scriptLibrary; | 2767 LibraryElement _scriptLibrary; |
| 2768 |
2395 /** | 2769 /** |
2396 * Initialize a newly created script element to have the specified tag name an
d offset. | 2770 * Initialize a newly created script element to have the specified tag name an
d offset. |
2397 * @param node the XML node from which this element is derived (not {@code nul
l}) | 2771 * @param node the XML node from which this element is derived (not {@code nul
l}) |
2398 */ | 2772 */ |
2399 EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node) { | 2773 EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node) { |
2400 } | 2774 } |
2401 accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this)
; | 2775 accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this)
; |
2402 ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT; | 2776 ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT; |
2403 LibraryElement get scriptLibrary => _scriptLibrary; | 2777 LibraryElement get scriptLibrary => _scriptLibrary; |
| 2778 |
2404 /** | 2779 /** |
2405 * Set the script library defined by the script tag's content. | 2780 * Set the script library defined by the script tag's content. |
2406 * @param scriptLibrary the library or {@code null} if none | 2781 * @param scriptLibrary the library or {@code null} if none |
2407 */ | 2782 */ |
2408 void set scriptLibrary(LibraryElementImpl scriptLibrary2) { | 2783 void set scriptLibrary(LibraryElementImpl scriptLibrary2) { |
2409 scriptLibrary2.enclosingElement = this; | 2784 scriptLibrary2.enclosingElement = this; |
2410 this._scriptLibrary = scriptLibrary2; | 2785 this._scriptLibrary = scriptLibrary2; |
2411 } | 2786 } |
2412 void visitChildren(ElementVisitor<Object> visitor) { | 2787 void visitChildren(ElementVisitor<Object> visitor) { |
2413 safelyVisitChild(_scriptLibrary, visitor); | 2788 safelyVisitChild(_scriptLibrary, visitor); |
2414 } | 2789 } |
2415 } | 2790 } |
| 2791 |
2416 /** | 2792 /** |
2417 * The abstract class {@code ExecutableElementImpl} implements the behavior comm
on to{@code ExecutableElement}s. | 2793 * The abstract class {@code ExecutableElementImpl} implements the behavior comm
on to{@code ExecutableElement}s. |
2418 * @coverage dart.engine.element | 2794 * @coverage dart.engine.element |
2419 */ | 2795 */ |
2420 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl
ement { | 2796 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl
ement { |
| 2797 |
2421 /** | 2798 /** |
2422 * An array containing all of the functions defined within this executable ele
ment. | 2799 * An array containing all of the functions defined within this executable ele
ment. |
2423 */ | 2800 */ |
2424 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; | 2801 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; |
| 2802 |
2425 /** | 2803 /** |
2426 * An array containing all of the labels defined within this executable elemen
t. | 2804 * An array containing all of the labels defined within this executable elemen
t. |
2427 */ | 2805 */ |
2428 List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY; | 2806 List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY; |
| 2807 |
2429 /** | 2808 /** |
2430 * An array containing all of the local variables defined within this executab
le element. | 2809 * An array containing all of the local variables defined within this executab
le element. |
2431 */ | 2810 */ |
2432 List<LocalVariableElement> _localVariables = LocalVariableElementImpl.EMPTY_AR
RAY; | 2811 List<LocalVariableElement> _localVariables = LocalVariableElementImpl.EMPTY_AR
RAY; |
| 2812 |
2433 /** | 2813 /** |
2434 * An array containing all of the parameters defined by this executable elemen
t. | 2814 * An array containing all of the parameters defined by this executable elemen
t. |
2435 */ | 2815 */ |
2436 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 2816 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 2817 |
2437 /** | 2818 /** |
2438 * The type of function defined by this executable element. | 2819 * The type of function defined by this executable element. |
2439 */ | 2820 */ |
2440 FunctionType _type; | 2821 FunctionType _type; |
| 2822 |
2441 /** | 2823 /** |
2442 * An empty array of executable elements. | 2824 * An empty array of executable elements. |
2443 */ | 2825 */ |
2444 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); | 2826 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); |
| 2827 |
2445 /** | 2828 /** |
2446 * Initialize a newly created executable element to have the given name. | 2829 * Initialize a newly created executable element to have the given name. |
2447 * @param name the name of this element | 2830 * @param name the name of this element |
2448 */ | 2831 */ |
2449 ExecutableElementImpl.con1(Identifier name) : super.con1(name) { | 2832 ExecutableElementImpl.con1(Identifier name) : super.con1(name) { |
2450 _jtd_constructor_194_impl(name); | 2833 _jtd_constructor_198_impl(name); |
2451 } | 2834 } |
2452 _jtd_constructor_194_impl(Identifier name) { | 2835 _jtd_constructor_198_impl(Identifier name) { |
2453 } | 2836 } |
| 2837 |
2454 /** | 2838 /** |
2455 * Initialize a newly created executable element to have the given name. | 2839 * Initialize a newly created executable element to have the given name. |
2456 * @param name the name of this element | 2840 * @param name the name of this element |
2457 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 2841 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
2458 * declaration of this element | 2842 * declaration of this element |
2459 */ | 2843 */ |
2460 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam
eOffset) { | 2844 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam
eOffset) { |
2461 _jtd_constructor_195_impl(name, nameOffset); | 2845 _jtd_constructor_199_impl(name, nameOffset); |
2462 } | 2846 } |
2463 _jtd_constructor_195_impl(String name, int nameOffset) { | 2847 _jtd_constructor_199_impl(String name, int nameOffset) { |
2464 } | 2848 } |
2465 ElementImpl getChild(String identifier2) { | 2849 ElementImpl getChild(String identifier2) { |
2466 for (ExecutableElement function in _functions) { | 2850 for (ExecutableElement function in _functions) { |
2467 if (((function as ExecutableElementImpl)).identifier == identifier2) { | 2851 if (((function as ExecutableElementImpl)).identifier == identifier2) { |
2468 return function as ExecutableElementImpl; | 2852 return function as ExecutableElementImpl; |
2469 } | 2853 } |
2470 } | 2854 } |
2471 for (LabelElement label in _labels) { | 2855 for (LabelElement label in _labels) { |
2472 if (((label as LabelElementImpl)).identifier == identifier2) { | 2856 if (((label as LabelElementImpl)).identifier == identifier2) { |
2473 return label as LabelElementImpl; | 2857 return label as LabelElementImpl; |
(...skipping 10 matching lines...) Expand all Loading... |
2484 } | 2868 } |
2485 } | 2869 } |
2486 return null; | 2870 return null; |
2487 } | 2871 } |
2488 List<FunctionElement> get functions => _functions; | 2872 List<FunctionElement> get functions => _functions; |
2489 List<LabelElement> get labels => _labels; | 2873 List<LabelElement> get labels => _labels; |
2490 List<LocalVariableElement> get localVariables => _localVariables; | 2874 List<LocalVariableElement> get localVariables => _localVariables; |
2491 List<ParameterElement> get parameters => _parameters; | 2875 List<ParameterElement> get parameters => _parameters; |
2492 FunctionType get type => _type; | 2876 FunctionType get type => _type; |
2493 bool isOperator() => false; | 2877 bool isOperator() => false; |
| 2878 |
2494 /** | 2879 /** |
2495 * Set the functions defined within this executable element to the given funct
ions. | 2880 * Set the functions defined within this executable element to the given funct
ions. |
2496 * @param functions the functions defined within this executable element | 2881 * @param functions the functions defined within this executable element |
2497 */ | 2882 */ |
2498 void set functions(List<FunctionElement> functions2) { | 2883 void set functions(List<FunctionElement> functions2) { |
2499 for (FunctionElement function in functions2) { | 2884 for (FunctionElement function in functions2) { |
2500 ((function as FunctionElementImpl)).enclosingElement = this; | 2885 ((function as FunctionElementImpl)).enclosingElement = this; |
2501 } | 2886 } |
2502 this._functions = functions2; | 2887 this._functions = functions2; |
2503 } | 2888 } |
| 2889 |
2504 /** | 2890 /** |
2505 * Set the labels defined within this executable element to the given labels. | 2891 * Set the labels defined within this executable element to the given labels. |
2506 * @param labels the labels defined within this executable element | 2892 * @param labels the labels defined within this executable element |
2507 */ | 2893 */ |
2508 void set labels(List<LabelElement> labels2) { | 2894 void set labels(List<LabelElement> labels2) { |
2509 for (LabelElement label in labels2) { | 2895 for (LabelElement label in labels2) { |
2510 ((label as LabelElementImpl)).enclosingElement = this; | 2896 ((label as LabelElementImpl)).enclosingElement = this; |
2511 } | 2897 } |
2512 this._labels = labels2; | 2898 this._labels = labels2; |
2513 } | 2899 } |
| 2900 |
2514 /** | 2901 /** |
2515 * Set the local variables defined within this executable element to the given
variables. | 2902 * Set the local variables defined within this executable element to the given
variables. |
2516 * @param localVariables the local variables defined within this executable el
ement | 2903 * @param localVariables the local variables defined within this executable el
ement |
2517 */ | 2904 */ |
2518 void set localVariables(List<LocalVariableElement> localVariables2) { | 2905 void set localVariables(List<LocalVariableElement> localVariables2) { |
2519 for (LocalVariableElement variable in localVariables2) { | 2906 for (LocalVariableElement variable in localVariables2) { |
2520 ((variable as LocalVariableElementImpl)).enclosingElement = this; | 2907 ((variable as LocalVariableElementImpl)).enclosingElement = this; |
2521 } | 2908 } |
2522 this._localVariables = localVariables2; | 2909 this._localVariables = localVariables2; |
2523 } | 2910 } |
| 2911 |
2524 /** | 2912 /** |
2525 * Set the parameters defined by this executable element to the given paramete
rs. | 2913 * Set the parameters defined by this executable element to the given paramete
rs. |
2526 * @param parameters the parameters defined by this executable element | 2914 * @param parameters the parameters defined by this executable element |
2527 */ | 2915 */ |
2528 void set parameters(List<ParameterElement> parameters2) { | 2916 void set parameters(List<ParameterElement> parameters2) { |
2529 for (ParameterElement parameter in parameters2) { | 2917 for (ParameterElement parameter in parameters2) { |
2530 ((parameter as ParameterElementImpl)).enclosingElement = this; | 2918 ((parameter as ParameterElementImpl)).enclosingElement = this; |
2531 } | 2919 } |
2532 this._parameters = parameters2; | 2920 this._parameters = parameters2; |
2533 } | 2921 } |
| 2922 |
2534 /** | 2923 /** |
2535 * Set the type of function defined by this executable element to the given ty
pe. | 2924 * Set the type of function defined by this executable element to the given ty
pe. |
2536 * @param type the type of function defined by this executable element | 2925 * @param type the type of function defined by this executable element |
2537 */ | 2926 */ |
2538 void set type(FunctionType type2) { | 2927 void set type(FunctionType type2) { |
2539 this._type = type2; | 2928 this._type = type2; |
2540 } | 2929 } |
2541 void visitChildren(ElementVisitor<Object> visitor) { | 2930 void visitChildren(ElementVisitor<Object> visitor) { |
2542 super.visitChildren(visitor); | 2931 super.visitChildren(visitor); |
2543 safelyVisitChildren(_functions, visitor); | 2932 safelyVisitChildren(_functions, visitor); |
(...skipping 10 matching lines...) Expand all Loading... |
2554 } | 2943 } |
2555 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); | 2944 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); |
2556 } | 2945 } |
2557 builder.append(")"); | 2946 builder.append(")"); |
2558 if (_type != null) { | 2947 if (_type != null) { |
2559 builder.append(" -> "); | 2948 builder.append(" -> "); |
2560 builder.append(_type.returnType); | 2949 builder.append(_type.returnType); |
2561 } | 2950 } |
2562 } | 2951 } |
2563 } | 2952 } |
| 2953 |
2564 /** | 2954 /** |
2565 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl
ement}. | 2955 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl
ement}. |
2566 * @coverage dart.engine.element | 2956 * @coverage dart.engine.element |
2567 */ | 2957 */ |
2568 class ExportElementImpl extends ElementImpl implements ExportElement { | 2958 class ExportElementImpl extends ElementImpl implements ExportElement { |
| 2959 |
| 2960 /** |
| 2961 * The URI that is specified by this directive. |
| 2962 */ |
| 2963 String _uri; |
| 2964 |
2569 /** | 2965 /** |
2570 * The library that is exported from this library by this export directive. | 2966 * The library that is exported from this library by this export directive. |
2571 */ | 2967 */ |
2572 LibraryElement _exportedLibrary; | 2968 LibraryElement _exportedLibrary; |
| 2969 |
2573 /** | 2970 /** |
2574 * The combinators that were specified as part of the export directive in the
order in which they | 2971 * The combinators that were specified as part of the export directive in the
order in which they |
2575 * were specified. | 2972 * were specified. |
2576 */ | 2973 */ |
2577 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; | 2974 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; |
| 2975 |
2578 /** | 2976 /** |
2579 * Initialize a newly created export element. | 2977 * Initialize a newly created export element. |
2580 */ | 2978 */ |
2581 ExportElementImpl() : super.con1(null) { | 2979 ExportElementImpl() : super.con1(null) { |
2582 } | 2980 } |
2583 accept(ElementVisitor visitor) => visitor.visitExportElement(this); | 2981 accept(ElementVisitor visitor) => visitor.visitExportElement(this); |
2584 List<NamespaceCombinator> get combinators => _combinators; | 2982 List<NamespaceCombinator> get combinators => _combinators; |
2585 LibraryElement get exportedLibrary => _exportedLibrary; | 2983 LibraryElement get exportedLibrary => _exportedLibrary; |
2586 ElementKind get kind => ElementKind.EXPORT; | 2984 ElementKind get kind => ElementKind.EXPORT; |
| 2985 String get uri => _uri; |
| 2986 |
2587 /** | 2987 /** |
2588 * Set the combinators that were specified as part of the export directive to
the given array of | 2988 * Set the combinators that were specified as part of the export directive to
the given array of |
2589 * combinators. | 2989 * combinators. |
2590 * @param combinators the combinators that were specified as part of the expor
t directive | 2990 * @param combinators the combinators that were specified as part of the expor
t directive |
2591 */ | 2991 */ |
2592 void set combinators(List<NamespaceCombinator> combinators2) { | 2992 void set combinators(List<NamespaceCombinator> combinators2) { |
2593 this._combinators = combinators2; | 2993 this._combinators = combinators2; |
2594 } | 2994 } |
| 2995 |
2595 /** | 2996 /** |
2596 * Set the library that is exported from this library by this import directive
to the given | 2997 * Set the library that is exported from this library by this import directive
to the given |
2597 * library. | 2998 * library. |
2598 * @param exportedLibrary the library that is exported from this library | 2999 * @param exportedLibrary the library that is exported from this library |
2599 */ | 3000 */ |
2600 void set exportedLibrary(LibraryElement exportedLibrary2) { | 3001 void set exportedLibrary(LibraryElement exportedLibrary2) { |
2601 this._exportedLibrary = exportedLibrary2; | 3002 this._exportedLibrary = exportedLibrary2; |
2602 } | 3003 } |
| 3004 |
| 3005 /** |
| 3006 * Set the URI that is specified by this directive. |
| 3007 * @param uri the URI that is specified by this directive. |
| 3008 */ |
| 3009 void set uri(String uri2) { |
| 3010 this._uri = uri2; |
| 3011 } |
2603 void appendTo(JavaStringBuilder builder) { | 3012 void appendTo(JavaStringBuilder builder) { |
2604 builder.append("export "); | 3013 builder.append("export "); |
2605 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); | 3014 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); |
2606 } | 3015 } |
2607 String get identifier => _exportedLibrary.name; | 3016 String get identifier => _exportedLibrary.name; |
2608 } | 3017 } |
| 3018 |
2609 /** | 3019 /** |
2610 * Instances of the class {@code ExternalHtmlScriptElementImpl} implement an{@li
nk ExternalHtmlScriptElement}. | 3020 * Instances of the class {@code ExternalHtmlScriptElementImpl} implement an{@li
nk ExternalHtmlScriptElement}. |
2611 * @coverage dart.engine.element | 3021 * @coverage dart.engine.element |
2612 */ | 3022 */ |
2613 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext
ernalHtmlScriptElement { | 3023 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext
ernalHtmlScriptElement { |
| 3024 |
2614 /** | 3025 /** |
2615 * The source specified in the {@code source} attribute or {@code null} if uns
pecified. | 3026 * The source specified in the {@code source} attribute or {@code null} if uns
pecified. |
2616 */ | 3027 */ |
2617 Source _scriptSource; | 3028 Source _scriptSource; |
| 3029 |
2618 /** | 3030 /** |
2619 * Initialize a newly created script element to have the specified tag name an
d offset. | 3031 * Initialize a newly created script element to have the specified tag name an
d offset. |
2620 * @param node the XML node from which this element is derived (not {@code nul
l}) | 3032 * @param node the XML node from which this element is derived (not {@code nul
l}) |
2621 */ | 3033 */ |
2622 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node) { | 3034 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node) { |
2623 } | 3035 } |
2624 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this)
; | 3036 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this)
; |
2625 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; | 3037 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; |
2626 Source get scriptSource => _scriptSource; | 3038 Source get scriptSource => _scriptSource; |
| 3039 |
2627 /** | 3040 /** |
2628 * Set the source specified in the {@code source} attribute. | 3041 * Set the source specified in the {@code source} attribute. |
2629 * @param scriptSource the script source or {@code null} if unspecified | 3042 * @param scriptSource the script source or {@code null} if unspecified |
2630 */ | 3043 */ |
2631 void set scriptSource(Source scriptSource2) { | 3044 void set scriptSource(Source scriptSource2) { |
2632 this._scriptSource = scriptSource2; | 3045 this._scriptSource = scriptSource2; |
2633 } | 3046 } |
2634 } | 3047 } |
| 3048 |
2635 /** | 3049 /** |
2636 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme
nt}. | 3050 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme
nt}. |
2637 * @coverage dart.engine.element | 3051 * @coverage dart.engine.element |
2638 */ | 3052 */ |
2639 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme
nt { | 3053 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme
nt { |
| 3054 |
2640 /** | 3055 /** |
2641 * An empty array of field elements. | 3056 * An empty array of field elements. |
2642 */ | 3057 */ |
2643 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); | 3058 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); |
| 3059 |
2644 /** | 3060 /** |
2645 * Initialize a newly created field element to have the given name. | 3061 * Initialize a newly created field element to have the given name. |
2646 * @param name the name of this element | 3062 * @param name the name of this element |
2647 */ | 3063 */ |
2648 FieldElementImpl.con1(Identifier name) : super.con1(name) { | 3064 FieldElementImpl.con1(Identifier name) : super.con1(name) { |
2649 _jtd_constructor_198_impl(name); | 3065 _jtd_constructor_202_impl(name); |
2650 } | 3066 } |
2651 _jtd_constructor_198_impl(Identifier name) { | 3067 _jtd_constructor_202_impl(Identifier name) { |
2652 } | 3068 } |
| 3069 |
2653 /** | 3070 /** |
2654 * Initialize a newly created synthetic field element to have the given name. | 3071 * Initialize a newly created synthetic field element to have the given name. |
2655 * @param name the name of this element | 3072 * @param name the name of this element |
2656 */ | 3073 */ |
2657 FieldElementImpl.con2(String name) : super.con2(name) { | 3074 FieldElementImpl.con2(String name) : super.con2(name) { |
2658 _jtd_constructor_199_impl(name); | 3075 _jtd_constructor_203_impl(name); |
2659 } | 3076 } |
2660 _jtd_constructor_199_impl(String name) { | 3077 _jtd_constructor_203_impl(String name) { |
2661 } | 3078 } |
2662 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 3079 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
2663 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 3080 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
2664 ElementKind get kind => ElementKind.FIELD; | 3081 ElementKind get kind => ElementKind.FIELD; |
2665 bool isStatic() => hasModifier(Modifier.STATIC); | 3082 bool isStatic() => hasModifier(Modifier.STATIC); |
| 3083 |
2666 /** | 3084 /** |
2667 * Set whether this field is static to correspond to the given value. | 3085 * Set whether this field is static to correspond to the given value. |
2668 * @param isStatic {@code true} if the field is static | 3086 * @param isStatic {@code true} if the field is static |
2669 */ | 3087 */ |
2670 void set static(bool isStatic) { | 3088 void set static(bool isStatic) { |
2671 setModifier(Modifier.STATIC, isStatic); | 3089 setModifier(Modifier.STATIC, isStatic); |
2672 } | 3090 } |
2673 } | 3091 } |
| 3092 |
2674 /** | 3093 /** |
2675 * Instances of the class {@code FieldFormalParameterElementImpl} extend{@link P
arameterElementImpl} to provide the additional information of the {@link FieldEl
ement}associated with the parameter. | 3094 * Instances of the class {@code FieldFormalParameterElementImpl} extend{@link P
arameterElementImpl} to provide the additional information of the {@link FieldEl
ement}associated with the parameter. |
2676 * @coverage dart.engine.element | 3095 * @coverage dart.engine.element |
2677 */ | 3096 */ |
2678 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi
eldFormalParameterElement { | 3097 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi
eldFormalParameterElement { |
| 3098 |
2679 /** | 3099 /** |
2680 * The field associated with this field formal parameter. | 3100 * The field associated with this field formal parameter. |
2681 */ | 3101 */ |
2682 FieldElement _field; | 3102 FieldElement _field; |
| 3103 |
2683 /** | 3104 /** |
2684 * Initialize a newly created parameter element to have the given name. | 3105 * Initialize a newly created parameter element to have the given name. |
2685 * @param name the name of this element | 3106 * @param name the name of this element |
2686 */ | 3107 */ |
2687 FieldFormalParameterElementImpl(Identifier name) : super(name) { | 3108 FieldFormalParameterElementImpl(Identifier name) : super(name) { |
2688 } | 3109 } |
2689 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi
s); | 3110 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi
s); |
2690 FieldElement get field => _field; | 3111 FieldElement get field => _field; |
| 3112 bool isInitializingFormal() => true; |
| 3113 |
2691 /** | 3114 /** |
2692 * Set the field element associated with this field formal parameter to the gi
ven element. | 3115 * Set the field element associated with this field formal parameter to the gi
ven element. |
2693 * @param field the new field element | 3116 * @param field the new field element |
2694 */ | 3117 */ |
2695 void set field(FieldElement field2) { | 3118 void set field(FieldElement field2) { |
2696 this._field = field2; | 3119 this._field = field2; |
2697 } | 3120 } |
2698 } | 3121 } |
| 3122 |
2699 /** | 3123 /** |
2700 * Instances of the class {@code FunctionElementImpl} implement a {@code Functio
nElement}. | 3124 * Instances of the class {@code FunctionElementImpl} implement a {@code Functio
nElement}. |
2701 * @coverage dart.engine.element | 3125 * @coverage dart.engine.element |
2702 */ | 3126 */ |
2703 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
nt { | 3127 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
nt { |
| 3128 |
2704 /** | 3129 /** |
2705 * The offset to the beginning of the visible range for this element. | 3130 * The offset to the beginning of the visible range for this element. |
2706 */ | 3131 */ |
2707 int _visibleRangeOffset = 0; | 3132 int _visibleRangeOffset = 0; |
| 3133 |
2708 /** | 3134 /** |
2709 * The length of the visible range for this element, or {@code -1} if this ele
ment does not have a | 3135 * The length of the visible range for this element, or {@code -1} if this ele
ment does not have a |
2710 * visible range. | 3136 * visible range. |
2711 */ | 3137 */ |
2712 int _visibleRangeLength = -1; | 3138 int _visibleRangeLength = -1; |
| 3139 |
2713 /** | 3140 /** |
2714 * An empty array of function elements. | 3141 * An empty array of function elements. |
2715 */ | 3142 */ |
2716 static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>(0); | 3143 static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>(0); |
| 3144 |
2717 /** | 3145 /** |
2718 * Initialize a newly created synthetic function element. | 3146 * Initialize a newly created synthetic function element. |
2719 */ | 3147 */ |
2720 FunctionElementImpl() : super.con2("", -1) { | 3148 FunctionElementImpl() : super.con2("", -1) { |
2721 _jtd_constructor_201_impl(); | 3149 _jtd_constructor_205_impl(); |
2722 } | 3150 } |
2723 _jtd_constructor_201_impl() { | 3151 _jtd_constructor_205_impl() { |
2724 synthetic = true; | 3152 synthetic = true; |
2725 } | 3153 } |
| 3154 |
2726 /** | 3155 /** |
2727 * Initialize a newly created function element to have the given name. | 3156 * Initialize a newly created function element to have the given name. |
2728 * @param name the name of this element | 3157 * @param name the name of this element |
2729 */ | 3158 */ |
2730 FunctionElementImpl.con1(Identifier name) : super.con1(name) { | 3159 FunctionElementImpl.con1(Identifier name) : super.con1(name) { |
2731 _jtd_constructor_202_impl(name); | 3160 _jtd_constructor_206_impl(name); |
2732 } | 3161 } |
2733 _jtd_constructor_202_impl(Identifier name) { | 3162 _jtd_constructor_206_impl(Identifier name) { |
2734 } | 3163 } |
| 3164 |
2735 /** | 3165 /** |
2736 * Initialize a newly created function element to have no name and the given o
ffset. This is used | 3166 * Initialize a newly created function element to have no name and the given o
ffset. This is used |
2737 * for function expressions, which have no name. | 3167 * for function expressions, which have no name. |
2738 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 3168 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
2739 * declaration of this element | 3169 * declaration of this element |
2740 */ | 3170 */ |
2741 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) { | 3171 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) { |
2742 _jtd_constructor_203_impl(nameOffset); | 3172 _jtd_constructor_207_impl(nameOffset); |
2743 } | 3173 } |
2744 _jtd_constructor_203_impl(int nameOffset) { | 3174 _jtd_constructor_207_impl(int nameOffset) { |
2745 } | 3175 } |
2746 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); | 3176 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
2747 String get identifier => name; | 3177 String get identifier => name; |
2748 ElementKind get kind => ElementKind.FUNCTION; | 3178 ElementKind get kind => ElementKind.FUNCTION; |
2749 SourceRange get visibleRange { | 3179 SourceRange get visibleRange { |
2750 if (_visibleRangeLength < 0) { | 3180 if (_visibleRangeLength < 0) { |
2751 return null; | 3181 return null; |
2752 } | 3182 } |
2753 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 3183 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
2754 } | 3184 } |
2755 bool isStatic() => enclosingElement is CompilationUnitElement; | 3185 bool isStatic() => enclosingElement is CompilationUnitElement; |
| 3186 |
2756 /** | 3187 /** |
2757 * Set the visible range for this element to the range starting at the given o
ffset with the given | 3188 * Set the visible range for this element to the range starting at the given o
ffset with the given |
2758 * length. | 3189 * length. |
2759 * @param offset the offset to the beginning of the visible range for this ele
ment | 3190 * @param offset the offset to the beginning of the visible range for this ele
ment |
2760 * @param length the length of the visible range for this element, or {@code -
1} if this element | 3191 * @param length the length of the visible range for this element, or {@code -
1} if this element |
2761 * does not have a visible range | 3192 * does not have a visible range |
2762 */ | 3193 */ |
2763 void setVisibleRange(int offset, int length) { | 3194 void setVisibleRange(int offset, int length) { |
2764 _visibleRangeOffset = offset; | 3195 _visibleRangeOffset = offset; |
2765 _visibleRangeLength = length; | 3196 _visibleRangeLength = length; |
2766 } | 3197 } |
2767 void appendTo(JavaStringBuilder builder) { | 3198 void appendTo(JavaStringBuilder builder) { |
2768 String name2 = name; | 3199 String name = displayName; |
2769 if (name2 != null) { | 3200 if (name != null) { |
2770 builder.append(name2); | 3201 builder.append(name); |
2771 } | 3202 } |
2772 super.appendTo(builder); | 3203 super.appendTo(builder); |
2773 } | 3204 } |
2774 } | 3205 } |
| 3206 |
2775 /** | 3207 /** |
2776 * Instances of the class {@code FunctionTypeAliasElementImpl} implement a{@code
FunctionTypeAliasElement}. | 3208 * Instances of the class {@code FunctionTypeAliasElementImpl} implement a{@code
FunctionTypeAliasElement}. |
2777 * @coverage dart.engine.element | 3209 * @coverage dart.engine.element |
2778 */ | 3210 */ |
2779 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { | 3211 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { |
| 3212 |
2780 /** | 3213 /** |
2781 * An array containing all of the parameters defined by this type alias. | 3214 * An array containing all of the parameters defined by this type alias. |
2782 */ | 3215 */ |
2783 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 3216 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 3217 |
2784 /** | 3218 /** |
2785 * The type of function defined by this type alias. | 3219 * The type of function defined by this type alias. |
2786 */ | 3220 */ |
2787 FunctionType _type; | 3221 FunctionType _type; |
| 3222 |
2788 /** | 3223 /** |
2789 * An array containing all of the type variables defined for this type. | 3224 * An array containing all of the type variables defined for this type. |
2790 */ | 3225 */ |
2791 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY
; | 3226 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY
; |
| 3227 |
2792 /** | 3228 /** |
2793 * An empty array of type alias elements. | 3229 * An empty array of type alias elements. |
2794 */ | 3230 */ |
2795 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); | 3231 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); |
| 3232 |
2796 /** | 3233 /** |
2797 * Initialize a newly created type alias element to have the given name. | 3234 * Initialize a newly created type alias element to have the given name. |
2798 * @param name the name of this element | 3235 * @param name the name of this element |
2799 */ | 3236 */ |
2800 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name) { | 3237 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name) { |
2801 } | 3238 } |
2802 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); | 3239 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); |
2803 ElementImpl getChild(String identifier2) { | 3240 ElementImpl getChild(String identifier2) { |
2804 for (VariableElement parameter in _parameters) { | 3241 for (VariableElement parameter in _parameters) { |
2805 if (((parameter as VariableElementImpl)).identifier == identifier2) { | 3242 if (((parameter as VariableElementImpl)).identifier == identifier2) { |
2806 return parameter as VariableElementImpl; | 3243 return parameter as VariableElementImpl; |
2807 } | 3244 } |
2808 } | 3245 } |
2809 for (TypeVariableElement typeVariable in _typeVariables) { | 3246 for (TypeVariableElement typeVariable in _typeVariables) { |
2810 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2)
{ | 3247 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2)
{ |
2811 return typeVariable as TypeVariableElementImpl; | 3248 return typeVariable as TypeVariableElementImpl; |
2812 } | 3249 } |
2813 } | 3250 } |
2814 return null; | 3251 return null; |
2815 } | 3252 } |
2816 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; | 3253 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; |
2817 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; | 3254 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
2818 List<ParameterElement> get parameters => _parameters; | 3255 List<ParameterElement> get parameters => _parameters; |
2819 FunctionType get type => _type; | 3256 FunctionType get type => _type; |
2820 List<TypeVariableElement> get typeVariables => _typeVariables; | 3257 List<TypeVariableElement> get typeVariables => _typeVariables; |
| 3258 |
2821 /** | 3259 /** |
2822 * Set the parameters defined by this type alias to the given parameters. | 3260 * Set the parameters defined by this type alias to the given parameters. |
2823 * @param parameters the parameters defined by this type alias | 3261 * @param parameters the parameters defined by this type alias |
2824 */ | 3262 */ |
2825 void set parameters(List<ParameterElement> parameters2) { | 3263 void set parameters(List<ParameterElement> parameters2) { |
2826 if (parameters2 != null) { | 3264 if (parameters2 != null) { |
2827 for (ParameterElement parameter in parameters2) { | 3265 for (ParameterElement parameter in parameters2) { |
2828 ((parameter as ParameterElementImpl)).enclosingElement = this; | 3266 ((parameter as ParameterElementImpl)).enclosingElement = this; |
2829 } | 3267 } |
2830 } | 3268 } |
2831 this._parameters = parameters2; | 3269 this._parameters = parameters2; |
2832 } | 3270 } |
| 3271 |
2833 /** | 3272 /** |
2834 * Set the type of function defined by this type alias to the given type. | 3273 * Set the type of function defined by this type alias to the given type. |
2835 * @param type the type of function defined by this type alias | 3274 * @param type the type of function defined by this type alias |
2836 */ | 3275 */ |
2837 void set type(FunctionType type2) { | 3276 void set type(FunctionType type2) { |
2838 this._type = type2; | 3277 this._type = type2; |
2839 } | 3278 } |
| 3279 |
2840 /** | 3280 /** |
2841 * Set the type variables defined for this type to the given variables. | 3281 * Set the type variables defined for this type to the given variables. |
2842 * @param typeVariables the type variables defined for this type | 3282 * @param typeVariables the type variables defined for this type |
2843 */ | 3283 */ |
2844 void set typeVariables(List<TypeVariableElement> typeVariables2) { | 3284 void set typeVariables(List<TypeVariableElement> typeVariables2) { |
2845 for (TypeVariableElement variable in typeVariables2) { | 3285 for (TypeVariableElement variable in typeVariables2) { |
2846 ((variable as TypeVariableElementImpl)).enclosingElement = this; | 3286 ((variable as TypeVariableElementImpl)).enclosingElement = this; |
2847 } | 3287 } |
2848 this._typeVariables = typeVariables2; | 3288 this._typeVariables = typeVariables2; |
2849 } | 3289 } |
2850 void visitChildren(ElementVisitor<Object> visitor) { | 3290 void visitChildren(ElementVisitor<Object> visitor) { |
2851 super.visitChildren(visitor); | 3291 super.visitChildren(visitor); |
2852 safelyVisitChildren(_parameters, visitor); | 3292 safelyVisitChildren(_parameters, visitor); |
2853 safelyVisitChildren(_typeVariables, visitor); | 3293 safelyVisitChildren(_typeVariables, visitor); |
2854 } | 3294 } |
2855 void appendTo(JavaStringBuilder builder) { | 3295 void appendTo(JavaStringBuilder builder) { |
2856 builder.append("typedef "); | 3296 builder.append("typedef "); |
2857 builder.append(name); | 3297 builder.append(displayName); |
2858 int variableCount = _typeVariables.length; | 3298 int variableCount = _typeVariables.length; |
2859 if (variableCount > 0) { | 3299 if (variableCount > 0) { |
2860 builder.append("<"); | 3300 builder.append("<"); |
2861 for (int i = 0; i < variableCount; i++) { | 3301 for (int i = 0; i < variableCount; i++) { |
2862 if (i > 0) { | 3302 if (i > 0) { |
2863 builder.append(", "); | 3303 builder.append(", "); |
2864 } | 3304 } |
2865 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); | 3305 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); |
2866 } | 3306 } |
2867 builder.append(">"); | 3307 builder.append(">"); |
2868 } | 3308 } |
2869 builder.append("("); | 3309 builder.append("("); |
2870 int parameterCount = _parameters.length; | 3310 int parameterCount = _parameters.length; |
2871 for (int i = 0; i < parameterCount; i++) { | 3311 for (int i = 0; i < parameterCount; i++) { |
2872 if (i > 0) { | 3312 if (i > 0) { |
2873 builder.append(", "); | 3313 builder.append(", "); |
2874 } | 3314 } |
2875 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); | 3315 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); |
2876 } | 3316 } |
2877 builder.append(")"); | 3317 builder.append(")"); |
2878 if (_type != null) { | 3318 if (_type != null) { |
2879 builder.append(" -> "); | 3319 builder.append(" -> "); |
2880 builder.append(_type.returnType); | 3320 builder.append(_type.returnType); |
2881 } | 3321 } |
2882 } | 3322 } |
2883 } | 3323 } |
| 3324 |
2884 /** | 3325 /** |
2885 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb
inator}. | 3326 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb
inator}. |
2886 * @coverage dart.engine.element | 3327 * @coverage dart.engine.element |
2887 */ | 3328 */ |
2888 class HideCombinatorImpl implements HideCombinator { | 3329 class HideCombinatorImpl implements HideCombinator { |
| 3330 |
2889 /** | 3331 /** |
2890 * The names that are not to be made visible in the importing library even if
they are defined in | 3332 * The names that are not to be made visible in the importing library even if
they are defined in |
2891 * the imported library. | 3333 * the imported library. |
2892 */ | 3334 */ |
2893 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; | 3335 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; |
2894 /** | |
2895 * Initialize a newly created combinator. | |
2896 */ | |
2897 HideCombinatorImpl() : super() { | |
2898 } | |
2899 List<String> get hiddenNames => _hiddenNames; | 3336 List<String> get hiddenNames => _hiddenNames; |
| 3337 |
2900 /** | 3338 /** |
2901 * Set the names that are not to be made visible in the importing library even
if they are defined | 3339 * Set the names that are not to be made visible in the importing library even
if they are defined |
2902 * in the imported library to the given names. | 3340 * in the imported library to the given names. |
2903 * @param hiddenNames the names that are not to be made visible in the importi
ng library | 3341 * @param hiddenNames the names that are not to be made visible in the importi
ng library |
2904 */ | 3342 */ |
2905 void set hiddenNames(List<String> hiddenNames2) { | 3343 void set hiddenNames(List<String> hiddenNames2) { |
2906 this._hiddenNames = hiddenNames2; | 3344 this._hiddenNames = hiddenNames2; |
2907 } | 3345 } |
2908 String toString() { | 3346 String toString() { |
2909 JavaStringBuilder builder = new JavaStringBuilder(); | 3347 JavaStringBuilder builder = new JavaStringBuilder(); |
2910 builder.append("show "); | 3348 builder.append("show "); |
2911 int count = _hiddenNames.length; | 3349 int count = _hiddenNames.length; |
2912 for (int i = 0; i < count; i++) { | 3350 for (int i = 0; i < count; i++) { |
2913 if (i > 0) { | 3351 if (i > 0) { |
2914 builder.append(", "); | 3352 builder.append(", "); |
2915 } | 3353 } |
2916 builder.append(_hiddenNames[i]); | 3354 builder.append(_hiddenNames[i]); |
2917 } | 3355 } |
2918 return builder.toString(); | 3356 return builder.toString(); |
2919 } | 3357 } |
2920 } | 3358 } |
| 3359 |
2921 /** | 3360 /** |
2922 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen
t}. | 3361 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen
t}. |
2923 * @coverage dart.engine.element | 3362 * @coverage dart.engine.element |
2924 */ | 3363 */ |
2925 class HtmlElementImpl extends ElementImpl implements HtmlElement { | 3364 class HtmlElementImpl extends ElementImpl implements HtmlElement { |
| 3365 |
2926 /** | 3366 /** |
2927 * An empty array of HTML file elements. | 3367 * An empty array of HTML file elements. |
2928 */ | 3368 */ |
2929 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); | 3369 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); |
| 3370 |
2930 /** | 3371 /** |
2931 * The analysis context in which this library is defined. | 3372 * The analysis context in which this library is defined. |
2932 */ | 3373 */ |
2933 AnalysisContext _context; | 3374 AnalysisContext _context; |
| 3375 |
2934 /** | 3376 /** |
2935 * The scripts contained in or referenced from script tags in the HTML file. | 3377 * The scripts contained in or referenced from script tags in the HTML file. |
2936 */ | 3378 */ |
2937 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; | 3379 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; |
| 3380 |
2938 /** | 3381 /** |
2939 * The source that corresponds to this HTML file. | 3382 * The source that corresponds to this HTML file. |
2940 */ | 3383 */ |
2941 Source _source; | 3384 Source _source; |
| 3385 |
2942 /** | 3386 /** |
2943 * Initialize a newly created HTML element to have the given name. | 3387 * Initialize a newly created HTML element to have the given name. |
2944 * @param context the analysis context in which the HTML file is defined | 3388 * @param context the analysis context in which the HTML file is defined |
2945 * @param name the name of this element | 3389 * @param name the name of this element |
2946 */ | 3390 */ |
2947 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { | 3391 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { |
2948 this._context = context; | 3392 this._context = context; |
2949 } | 3393 } |
2950 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); | 3394 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); |
2951 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc
e == ((object as CompilationUnitElementImpl)).source; | 3395 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc
e == ((object as CompilationUnitElementImpl)).source; |
2952 AnalysisContext get context => _context; | 3396 AnalysisContext get context => _context; |
2953 ElementKind get kind => ElementKind.HTML; | 3397 ElementKind get kind => ElementKind.HTML; |
2954 List<HtmlScriptElement> get scripts => _scripts; | 3398 List<HtmlScriptElement> get scripts => _scripts; |
2955 Source get source => _source; | 3399 Source get source => _source; |
2956 int get hashCode => _source.hashCode; | 3400 int get hashCode => _source.hashCode; |
| 3401 |
2957 /** | 3402 /** |
2958 * Set the scripts contained in the HTML file to the given scripts. | 3403 * Set the scripts contained in the HTML file to the given scripts. |
2959 * @param scripts the scripts | 3404 * @param scripts the scripts |
2960 */ | 3405 */ |
2961 void set scripts(List<HtmlScriptElement> scripts2) { | 3406 void set scripts(List<HtmlScriptElement> scripts2) { |
2962 if (scripts2.length == 0) { | 3407 if (scripts2.length == 0) { |
2963 scripts2 = HtmlScriptElementImpl.EMPTY_ARRAY; | 3408 scripts2 = HtmlScriptElementImpl.EMPTY_ARRAY; |
2964 } | 3409 } |
2965 for (HtmlScriptElement script in scripts2) { | 3410 for (HtmlScriptElement script in scripts2) { |
2966 ((script as HtmlScriptElementImpl)).enclosingElement = this; | 3411 ((script as HtmlScriptElementImpl)).enclosingElement = this; |
2967 } | 3412 } |
2968 this._scripts = scripts2; | 3413 this._scripts = scripts2; |
2969 } | 3414 } |
| 3415 |
2970 /** | 3416 /** |
2971 * Set the source that corresponds to this HTML file to the given source. | 3417 * Set the source that corresponds to this HTML file to the given source. |
2972 * @param source the source that corresponds to this HTML file | 3418 * @param source the source that corresponds to this HTML file |
2973 */ | 3419 */ |
2974 void set source(Source source2) { | 3420 void set source(Source source2) { |
2975 this._source = source2; | 3421 this._source = source2; |
2976 } | 3422 } |
2977 void visitChildren(ElementVisitor<Object> visitor) { | 3423 void visitChildren(ElementVisitor<Object> visitor) { |
2978 super.visitChildren(visitor); | 3424 super.visitChildren(visitor); |
2979 safelyVisitChildren(_scripts, visitor); | 3425 safelyVisitChildren(_scripts, visitor); |
2980 } | 3426 } |
2981 void appendTo(JavaStringBuilder builder) { | 3427 void appendTo(JavaStringBuilder builder) { |
2982 if (_source == null) { | 3428 if (_source == null) { |
2983 builder.append("{HTML file}"); | 3429 builder.append("{HTML file}"); |
2984 } else { | 3430 } else { |
2985 builder.append(_source.fullName); | 3431 builder.append(_source.fullName); |
2986 } | 3432 } |
2987 } | 3433 } |
2988 } | 3434 } |
| 3435 |
2989 /** | 3436 /** |
2990 * Instances of the class {@code HtmlScriptElementImpl} implement an {@link Html
ScriptElement}. | 3437 * Instances of the class {@code HtmlScriptElementImpl} implement an {@link Html
ScriptElement}. |
2991 * @coverage dart.engine.element | 3438 * @coverage dart.engine.element |
2992 */ | 3439 */ |
2993 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl
ement { | 3440 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl
ement { |
| 3441 |
2994 /** | 3442 /** |
2995 * An empty array of HTML script elements. | 3443 * An empty array of HTML script elements. |
2996 */ | 3444 */ |
2997 static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0); | 3445 static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0); |
| 3446 |
2998 /** | 3447 /** |
2999 * Initialize a newly created script element to have the specified tag name an
d offset. | 3448 * Initialize a newly created script element to have the specified tag name an
d offset. |
3000 * @param node the XML node from which this element is derived (not {@code nul
l}) | 3449 * @param node the XML node from which this element is derived (not {@code nul
l}) |
3001 */ | 3450 */ |
3002 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag.
offset) { | 3451 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag.
offset) { |
3003 } | 3452 } |
3004 } | 3453 } |
| 3454 |
3005 /** | 3455 /** |
3006 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl
ement}. | 3456 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl
ement}. |
3007 * @coverage dart.engine.element | 3457 * @coverage dart.engine.element |
3008 */ | 3458 */ |
3009 class ImportElementImpl extends ElementImpl implements ImportElement { | 3459 class ImportElementImpl extends ElementImpl implements ImportElement { |
| 3460 |
| 3461 /** |
| 3462 * The URI that is specified by this directive. |
| 3463 */ |
| 3464 String _uri; |
| 3465 |
3010 /** | 3466 /** |
3011 * The library that is imported into this library by this import directive. | 3467 * The library that is imported into this library by this import directive. |
3012 */ | 3468 */ |
3013 LibraryElement _importedLibrary; | 3469 LibraryElement _importedLibrary; |
| 3470 |
3014 /** | 3471 /** |
3015 * The combinators that were specified as part of the import directive in the
order in which they | 3472 * The combinators that were specified as part of the import directive in the
order in which they |
3016 * were specified. | 3473 * were specified. |
3017 */ | 3474 */ |
3018 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; | 3475 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; |
| 3476 |
3019 /** | 3477 /** |
3020 * The prefix that was specified as part of the import directive, or {@code nu
ll} if there was no | 3478 * The prefix that was specified as part of the import directive, or {@code nu
ll} if there was no |
3021 * prefix specified. | 3479 * prefix specified. |
3022 */ | 3480 */ |
3023 PrefixElement _prefix; | 3481 PrefixElement _prefix; |
| 3482 |
3024 /** | 3483 /** |
3025 * Initialize a newly created import element. | 3484 * Initialize a newly created import element. |
3026 */ | 3485 */ |
3027 ImportElementImpl() : super.con1(null) { | 3486 ImportElementImpl() : super.con1(null) { |
3028 } | 3487 } |
3029 accept(ElementVisitor visitor) => visitor.visitImportElement(this); | 3488 accept(ElementVisitor visitor) => visitor.visitImportElement(this); |
3030 List<NamespaceCombinator> get combinators => _combinators; | 3489 List<NamespaceCombinator> get combinators => _combinators; |
3031 LibraryElement get importedLibrary => _importedLibrary; | 3490 LibraryElement get importedLibrary => _importedLibrary; |
3032 ElementKind get kind => ElementKind.IMPORT; | 3491 ElementKind get kind => ElementKind.IMPORT; |
3033 PrefixElement get prefix => _prefix; | 3492 PrefixElement get prefix => _prefix; |
| 3493 String get uri => _uri; |
| 3494 |
3034 /** | 3495 /** |
3035 * Set the combinators that were specified as part of the import directive to
the given array of | 3496 * Set the combinators that were specified as part of the import directive to
the given array of |
3036 * combinators. | 3497 * combinators. |
3037 * @param combinators the combinators that were specified as part of the impor
t directive | 3498 * @param combinators the combinators that were specified as part of the impor
t directive |
3038 */ | 3499 */ |
3039 void set combinators(List<NamespaceCombinator> combinators2) { | 3500 void set combinators(List<NamespaceCombinator> combinators2) { |
3040 this._combinators = combinators2; | 3501 this._combinators = combinators2; |
3041 } | 3502 } |
| 3503 |
3042 /** | 3504 /** |
3043 * Set the library that is imported into this library by this import directive
to the given | 3505 * Set the library that is imported into this library by this import directive
to the given |
3044 * library. | 3506 * library. |
3045 * @param importedLibrary the library that is imported into this library | 3507 * @param importedLibrary the library that is imported into this library |
3046 */ | 3508 */ |
3047 void set importedLibrary(LibraryElement importedLibrary2) { | 3509 void set importedLibrary(LibraryElement importedLibrary2) { |
3048 this._importedLibrary = importedLibrary2; | 3510 this._importedLibrary = importedLibrary2; |
3049 } | 3511 } |
| 3512 |
3050 /** | 3513 /** |
3051 * Set the prefix that was specified as part of the import directive to the gi
ven prefix. | 3514 * Set the prefix that was specified as part of the import directive to the gi
ven prefix. |
3052 * @param prefix the prefix that was specified as part of the import directive | 3515 * @param prefix the prefix that was specified as part of the import directive |
3053 */ | 3516 */ |
3054 void set prefix(PrefixElement prefix2) { | 3517 void set prefix(PrefixElement prefix2) { |
3055 this._prefix = prefix2; | 3518 this._prefix = prefix2; |
3056 } | 3519 } |
| 3520 |
| 3521 /** |
| 3522 * Set the URI that is specified by this directive. |
| 3523 * @param uri the URI that is specified by this directive. |
| 3524 */ |
| 3525 void set uri(String uri2) { |
| 3526 this._uri = uri2; |
| 3527 } |
3057 void visitChildren(ElementVisitor<Object> visitor) { | 3528 void visitChildren(ElementVisitor<Object> visitor) { |
3058 super.visitChildren(visitor); | 3529 super.visitChildren(visitor); |
3059 safelyVisitChild(_prefix, visitor); | 3530 safelyVisitChild(_prefix, visitor); |
3060 } | 3531 } |
3061 void appendTo(JavaStringBuilder builder) { | 3532 void appendTo(JavaStringBuilder builder) { |
3062 builder.append("import "); | 3533 builder.append("import "); |
3063 ((_importedLibrary as LibraryElementImpl)).appendTo(builder); | 3534 ((_importedLibrary as LibraryElementImpl)).appendTo(builder); |
3064 } | 3535 } |
3065 String get identifier => "${_importedLibrary.name}:${(_prefix == null ? "" : _
prefix.name)}"; | 3536 String get identifier => ((_importedLibrary as LibraryElementImpl)).identifier
; |
3066 } | 3537 } |
| 3538 |
3067 /** | 3539 /** |
3068 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme
nt}. | 3540 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme
nt}. |
3069 * @coverage dart.engine.element | 3541 * @coverage dart.engine.element |
3070 */ | 3542 */ |
3071 class LabelElementImpl extends ElementImpl implements LabelElement { | 3543 class LabelElementImpl extends ElementImpl implements LabelElement { |
| 3544 |
3072 /** | 3545 /** |
3073 * A flag indicating whether this label is associated with a {@code switch} st
atement. | 3546 * A flag indicating whether this label is associated with a {@code switch} st
atement. |
3074 */ | 3547 */ |
3075 bool _onSwitchStatement = false; | 3548 bool _onSwitchStatement = false; |
| 3549 |
3076 /** | 3550 /** |
3077 * A flag indicating whether this label is associated with a {@code switch} me
mber ({@code case}or {@code default}). | 3551 * A flag indicating whether this label is associated with a {@code switch} me
mber ({@code case}or {@code default}). |
3078 */ | 3552 */ |
3079 bool _onSwitchMember = false; | 3553 bool _onSwitchMember = false; |
| 3554 |
3080 /** | 3555 /** |
3081 * An empty array of label elements. | 3556 * An empty array of label elements. |
3082 */ | 3557 */ |
3083 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); | 3558 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); |
| 3559 |
3084 /** | 3560 /** |
3085 * Initialize a newly created label element to have the given name. | 3561 * Initialize a newly created label element to have the given name. |
3086 * @param name the name of this element | 3562 * @param name the name of this element |
3087 * @param onSwitchStatement {@code true} if this label is associated with a {@
code switch}statement | 3563 * @param onSwitchStatement {@code true} if this label is associated with a {@
code switch}statement |
3088 * @param onSwitchMember {@code true} if this label is associated with a {@cod
e switch} member | 3564 * @param onSwitchMember {@code true} if this label is associated with a {@cod
e switch} member |
3089 */ | 3565 */ |
3090 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember)
: super.con1(name) { | 3566 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember)
: super.con1(name) { |
3091 this._onSwitchStatement = onSwitchStatement; | 3567 this._onSwitchStatement = onSwitchStatement; |
3092 this._onSwitchMember = onSwitchMember; | 3568 this._onSwitchMember = onSwitchMember; |
3093 } | 3569 } |
3094 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); | 3570 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); |
3095 ExecutableElement get enclosingElement => super.enclosingElement as Executable
Element; | 3571 ExecutableElement get enclosingElement => super.enclosingElement as Executable
Element; |
3096 ElementKind get kind => ElementKind.LABEL; | 3572 ElementKind get kind => ElementKind.LABEL; |
| 3573 |
3097 /** | 3574 /** |
3098 * Return {@code true} if this label is associated with a {@code switch} membe
r ({@code case} or{@code default}). | 3575 * Return {@code true} if this label is associated with a {@code switch} membe
r ({@code case} or{@code default}). |
3099 * @return {@code true} if this label is associated with a {@code switch} memb
er | 3576 * @return {@code true} if this label is associated with a {@code switch} memb
er |
3100 */ | 3577 */ |
3101 bool isOnSwitchMember() => _onSwitchMember; | 3578 bool isOnSwitchMember() => _onSwitchMember; |
| 3579 |
3102 /** | 3580 /** |
3103 * Return {@code true} if this label is associated with a {@code switch} state
ment. | 3581 * Return {@code true} if this label is associated with a {@code switch} state
ment. |
3104 * @return {@code true} if this label is associated with a {@code switch} stat
ement | 3582 * @return {@code true} if this label is associated with a {@code switch} stat
ement |
3105 */ | 3583 */ |
3106 bool isOnSwitchStatement() => _onSwitchStatement; | 3584 bool isOnSwitchStatement() => _onSwitchStatement; |
3107 } | 3585 } |
| 3586 |
3108 /** | 3587 /** |
3109 * Instances of the class {@code LibraryElementImpl} implement a {@code LibraryE
lement}. | 3588 * Instances of the class {@code LibraryElementImpl} implement a {@code LibraryE
lement}. |
3110 * @coverage dart.engine.element | 3589 * @coverage dart.engine.element |
3111 */ | 3590 */ |
3112 class LibraryElementImpl extends ElementImpl implements LibraryElement { | 3591 class LibraryElementImpl extends ElementImpl implements LibraryElement { |
| 3592 |
3113 /** | 3593 /** |
3114 * An empty array of library elements. | 3594 * An empty array of library elements. |
3115 */ | 3595 */ |
3116 static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0); | 3596 static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0); |
| 3597 |
3117 /** | 3598 /** |
3118 * Determine if the given library is up to date with respect to the given time
stamp. | 3599 * Determine if the given library is up to date with respect to the given time
stamp. |
3119 * @param library the library to process | 3600 * @param library the library to process |
3120 * @param timeStamp the time stamp to check against | 3601 * @param timeStamp the time stamp to check against |
3121 * @param visitedLibraries the set of visited libraries | 3602 * @param visitedLibraries the set of visited libraries |
3122 */ | 3603 */ |
3123 static bool isUpToDate(LibraryElement library, int timeStamp, Set<LibraryEleme
nt> visitedLibraries) { | 3604 static bool isUpToDate(LibraryElement library, int timeStamp, Set<LibraryEleme
nt> visitedLibraries) { |
3124 if (!visitedLibraries.contains(library)) { | 3605 if (!visitedLibraries.contains(library)) { |
3125 javaSetAdd(visitedLibraries, library); | 3606 javaSetAdd(visitedLibraries, library); |
3126 if (timeStamp < library.definingCompilationUnit.source.modificationStamp)
{ | 3607 if (timeStamp < library.definingCompilationUnit.source.modificationStamp)
{ |
(...skipping 10 matching lines...) Expand all Loading... |
3137 } | 3618 } |
3138 } | 3619 } |
3139 for (LibraryElement exportedLibrary in library.exportedLibraries) { | 3620 for (LibraryElement exportedLibrary in library.exportedLibraries) { |
3140 if (!isUpToDate(exportedLibrary, timeStamp, visitedLibraries)) { | 3621 if (!isUpToDate(exportedLibrary, timeStamp, visitedLibraries)) { |
3141 return false; | 3622 return false; |
3142 } | 3623 } |
3143 } | 3624 } |
3144 } | 3625 } |
3145 return true; | 3626 return true; |
3146 } | 3627 } |
| 3628 |
3147 /** | 3629 /** |
3148 * The analysis context in which this library is defined. | 3630 * The analysis context in which this library is defined. |
3149 */ | 3631 */ |
3150 AnalysisContext _context; | 3632 AnalysisContext _context; |
| 3633 |
3151 /** | 3634 /** |
3152 * The compilation unit that defines this library. | 3635 * The compilation unit that defines this library. |
3153 */ | 3636 */ |
3154 CompilationUnitElement _definingCompilationUnit; | 3637 CompilationUnitElement _definingCompilationUnit; |
| 3638 |
3155 /** | 3639 /** |
3156 * The entry point for this library, or {@code null} if this library does not
have an entry point. | 3640 * The entry point for this library, or {@code null} if this library does not
have an entry point. |
3157 */ | 3641 */ |
3158 FunctionElement _entryPoint; | 3642 FunctionElement _entryPoint; |
| 3643 |
3159 /** | 3644 /** |
3160 * An array containing specifications of all of the imports defined in this li
brary. | 3645 * An array containing specifications of all of the imports defined in this li
brary. |
3161 */ | 3646 */ |
3162 List<ImportElement> _imports = ImportElement.EMPTY_ARRAY; | 3647 List<ImportElement> _imports = ImportElement.EMPTY_ARRAY; |
| 3648 |
3163 /** | 3649 /** |
3164 * An array containing specifications of all of the exports defined in this li
brary. | 3650 * An array containing specifications of all of the exports defined in this li
brary. |
3165 */ | 3651 */ |
3166 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; | 3652 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; |
| 3653 |
3167 /** | 3654 /** |
3168 * An array containing all of the compilation units that are included in this
library using a{@code part} directive. | 3655 * An array containing all of the compilation units that are included in this
library using a{@code part} directive. |
3169 */ | 3656 */ |
3170 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; | 3657 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; |
| 3658 |
3171 /** | 3659 /** |
3172 * Initialize a newly created library element to have the given name. | 3660 * Initialize a newly created library element to have the given name. |
3173 * @param context the analysis context in which the library is defined | 3661 * @param context the analysis context in which the library is defined |
3174 * @param name the name of this element | 3662 * @param name the name of this element |
3175 */ | 3663 */ |
3176 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co
n1(name) { | 3664 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co
n1(name) { |
3177 this._context = context; | 3665 this._context = context; |
3178 } | 3666 } |
3179 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); | 3667 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); |
3180 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definin
gCompilationUnit; | 3668 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definin
gCompilationUnit; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3257 } | 3745 } |
3258 return null; | 3746 return null; |
3259 } | 3747 } |
3260 int get hashCode => _definingCompilationUnit.hashCode; | 3748 int get hashCode => _definingCompilationUnit.hashCode; |
3261 bool isBrowserApplication() => _entryPoint != null && isOrImportsBrowserLibrar
y(); | 3749 bool isBrowserApplication() => _entryPoint != null && isOrImportsBrowserLibrar
y(); |
3262 bool isDartCore() => name == "dart.core"; | 3750 bool isDartCore() => name == "dart.core"; |
3263 bool isUpToDate2(int timeStamp) { | 3751 bool isUpToDate2(int timeStamp) { |
3264 Set<LibraryElement> visitedLibraries = new Set(); | 3752 Set<LibraryElement> visitedLibraries = new Set(); |
3265 return isUpToDate(this, timeStamp, visitedLibraries); | 3753 return isUpToDate(this, timeStamp, visitedLibraries); |
3266 } | 3754 } |
| 3755 |
3267 /** | 3756 /** |
3268 * Set the compilation unit that defines this library to the given compilation
unit. | 3757 * Set the compilation unit that defines this library to the given compilation
unit. |
3269 * @param definingCompilationUnit the compilation unit that defines this libra
ry | 3758 * @param definingCompilationUnit the compilation unit that defines this libra
ry |
3270 */ | 3759 */ |
3271 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni
t2) { | 3760 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni
t2) { |
3272 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement
= this; | 3761 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement
= this; |
3273 this._definingCompilationUnit = definingCompilationUnit2; | 3762 this._definingCompilationUnit = definingCompilationUnit2; |
3274 } | 3763 } |
| 3764 |
3275 /** | 3765 /** |
3276 * Set the entry point for this library to the given function. | 3766 * Set the entry point for this library to the given function. |
3277 * @param entryPoint the entry point for this library | 3767 * @param entryPoint the entry point for this library |
3278 */ | 3768 */ |
3279 void set entryPoint(FunctionElement entryPoint2) { | 3769 void set entryPoint(FunctionElement entryPoint2) { |
3280 this._entryPoint = entryPoint2; | 3770 this._entryPoint = entryPoint2; |
3281 } | 3771 } |
| 3772 |
3282 /** | 3773 /** |
3283 * Set the specifications of all of the exports defined in this library to the
given array. | 3774 * Set the specifications of all of the exports defined in this library to the
given array. |
3284 * @param exports the specifications of all of the exports defined in this lib
rary | 3775 * @param exports the specifications of all of the exports defined in this lib
rary |
3285 */ | 3776 */ |
3286 void set exports(List<ExportElement> exports2) { | 3777 void set exports(List<ExportElement> exports2) { |
3287 for (ExportElement exportElement in exports2) { | 3778 for (ExportElement exportElement in exports2) { |
3288 ((exportElement as ExportElementImpl)).enclosingElement = this; | 3779 ((exportElement as ExportElementImpl)).enclosingElement = this; |
3289 } | 3780 } |
3290 this._exports = exports2; | 3781 this._exports = exports2; |
3291 } | 3782 } |
| 3783 |
3292 /** | 3784 /** |
3293 * Set the specifications of all of the imports defined in this library to the
given array. | 3785 * Set the specifications of all of the imports defined in this library to the
given array. |
3294 * @param imports the specifications of all of the imports defined in this lib
rary | 3786 * @param imports the specifications of all of the imports defined in this lib
rary |
3295 */ | 3787 */ |
3296 void set imports(List<ImportElement> imports2) { | 3788 void set imports(List<ImportElement> imports2) { |
3297 for (ImportElement importElement in imports2) { | 3789 for (ImportElement importElement in imports2) { |
3298 ((importElement as ImportElementImpl)).enclosingElement = this; | 3790 ((importElement as ImportElementImpl)).enclosingElement = this; |
3299 PrefixElementImpl prefix2 = importElement.prefix as PrefixElementImpl; | 3791 PrefixElementImpl prefix2 = importElement.prefix as PrefixElementImpl; |
3300 if (prefix2 != null) { | 3792 if (prefix2 != null) { |
3301 prefix2.enclosingElement = this; | 3793 prefix2.enclosingElement = this; |
3302 } | 3794 } |
3303 } | 3795 } |
3304 this._imports = imports2; | 3796 this._imports = imports2; |
3305 } | 3797 } |
| 3798 |
3306 /** | 3799 /** |
3307 * Set the compilation units that are included in this library using a {@code
part} directive. | 3800 * Set the compilation units that are included in this library using a {@code
part} directive. |
3308 * @param parts the compilation units that are included in this library using
a {@code part}directive | 3801 * @param parts the compilation units that are included in this library using
a {@code part}directive |
3309 */ | 3802 */ |
3310 void set parts(List<CompilationUnitElement> parts2) { | 3803 void set parts(List<CompilationUnitElement> parts2) { |
3311 for (CompilationUnitElement compilationUnit in parts2) { | 3804 for (CompilationUnitElement compilationUnit in parts2) { |
3312 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this; | 3805 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this; |
3313 } | 3806 } |
3314 this._parts = parts2; | 3807 this._parts = parts2; |
3315 } | 3808 } |
3316 void visitChildren(ElementVisitor<Object> visitor) { | 3809 void visitChildren(ElementVisitor<Object> visitor) { |
3317 super.visitChildren(visitor); | 3810 super.visitChildren(visitor); |
3318 safelyVisitChild(_definingCompilationUnit, visitor); | 3811 safelyVisitChild(_definingCompilationUnit, visitor); |
3319 safelyVisitChildren(_exports, visitor); | 3812 safelyVisitChildren(_exports, visitor); |
3320 safelyVisitChildren(_imports, visitor); | 3813 safelyVisitChildren(_imports, visitor); |
3321 safelyVisitChildren(_parts, visitor); | 3814 safelyVisitChildren(_parts, visitor); |
3322 } | 3815 } |
| 3816 |
3323 /** | 3817 /** |
3324 * Answer {@code true} if the receiver directly or indirectly imports the dart
:html libraries. | 3818 * Answer {@code true} if the receiver directly or indirectly imports the dart
:html libraries. |
3325 * @return {@code true} if the receiver directly or indirectly imports the dar
t:html libraries | 3819 * @return {@code true} if the receiver directly or indirectly imports the dar
t:html libraries |
3326 */ | 3820 */ |
3327 bool isOrImportsBrowserLibrary() { | 3821 bool isOrImportsBrowserLibrary() { |
3328 List<LibraryElement> visited = new List<LibraryElement>(); | 3822 List<LibraryElement> visited = new List<LibraryElement>(); |
3329 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); | 3823 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); |
3330 visited.add(this); | 3824 visited.add(this); |
3331 for (int index = 0; index < visited.length; index++) { | 3825 for (int index = 0; index < visited.length; index++) { |
3332 LibraryElement library = visited[index]; | 3826 LibraryElement library = visited[index]; |
3333 Source source2 = library.definingCompilationUnit.source; | 3827 Source source2 = library.definingCompilationUnit.source; |
3334 if (source2 == htmlLibSource) { | 3828 if (source2 == htmlLibSource) { |
3335 return true; | 3829 return true; |
3336 } | 3830 } |
3337 for (LibraryElement importedLibrary in library.importedLibraries) { | 3831 for (LibraryElement importedLibrary in library.importedLibraries) { |
3338 if (!visited.contains(importedLibrary)) { | 3832 if (!visited.contains(importedLibrary)) { |
3339 visited.add(importedLibrary); | 3833 visited.add(importedLibrary); |
3340 } | 3834 } |
3341 } | 3835 } |
3342 for (LibraryElement exportedLibrary in library.exportedLibraries) { | 3836 for (LibraryElement exportedLibrary in library.exportedLibraries) { |
3343 if (!visited.contains(exportedLibrary)) { | 3837 if (!visited.contains(exportedLibrary)) { |
3344 visited.add(exportedLibrary); | 3838 visited.add(exportedLibrary); |
3345 } | 3839 } |
3346 } | 3840 } |
3347 } | 3841 } |
3348 return false; | 3842 return false; |
3349 } | 3843 } |
3350 } | 3844 } |
| 3845 |
3351 /** | 3846 /** |
3352 * Instances of the class {@code LocalVariableElementImpl} implement a {@code Lo
calVariableElement}. | 3847 * Instances of the class {@code LocalVariableElementImpl} implement a {@code Lo
calVariableElement}. |
3353 * @coverage dart.engine.element | 3848 * @coverage dart.engine.element |
3354 */ | 3849 */ |
3355 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { | 3850 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { |
| 3851 |
3356 /** | 3852 /** |
3357 * The offset to the beginning of the visible range for this element. | 3853 * The offset to the beginning of the visible range for this element. |
3358 */ | 3854 */ |
3359 int _visibleRangeOffset = 0; | 3855 int _visibleRangeOffset = 0; |
| 3856 |
3360 /** | 3857 /** |
3361 * The length of the visible range for this element, or {@code -1} if this ele
ment does not have a | 3858 * The length of the visible range for this element, or {@code -1} if this ele
ment does not have a |
3362 * visible range. | 3859 * visible range. |
3363 */ | 3860 */ |
3364 int _visibleRangeLength = -1; | 3861 int _visibleRangeLength = -1; |
| 3862 |
3365 /** | 3863 /** |
3366 * An empty array of field elements. | 3864 * An empty array of field elements. |
3367 */ | 3865 */ |
3368 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); | 3866 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); |
| 3867 |
3369 /** | 3868 /** |
3370 * Initialize a newly created local variable element to have the given name. | 3869 * Initialize a newly created local variable element to have the given name. |
3371 * @param name the name of this element | 3870 * @param name the name of this element |
3372 */ | 3871 */ |
3373 LocalVariableElementImpl(Identifier name) : super.con1(name) { | 3872 LocalVariableElementImpl(Identifier name) : super.con1(name) { |
3374 } | 3873 } |
3375 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); | 3874 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); |
3376 ElementKind get kind => ElementKind.LOCAL_VARIABLE; | 3875 ElementKind get kind => ElementKind.LOCAL_VARIABLE; |
3377 SourceRange get visibleRange { | 3876 SourceRange get visibleRange { |
3378 if (_visibleRangeLength < 0) { | 3877 if (_visibleRangeLength < 0) { |
3379 return null; | 3878 return null; |
3380 } | 3879 } |
3381 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 3880 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
3382 } | 3881 } |
| 3882 |
3383 /** | 3883 /** |
3384 * Set the visible range for this element to the range starting at the given o
ffset with the given | 3884 * Set the visible range for this element to the range starting at the given o
ffset with the given |
3385 * length. | 3885 * length. |
3386 * @param offset the offset to the beginning of the visible range for this ele
ment | 3886 * @param offset the offset to the beginning of the visible range for this ele
ment |
3387 * @param length the length of the visible range for this element, or {@code -
1} if this element | 3887 * @param length the length of the visible range for this element, or {@code -
1} if this element |
3388 * does not have a visible range | 3888 * does not have a visible range |
3389 */ | 3889 */ |
3390 void setVisibleRange(int offset, int length) { | 3890 void setVisibleRange(int offset, int length) { |
3391 _visibleRangeOffset = offset; | 3891 _visibleRangeOffset = offset; |
3392 _visibleRangeLength = length; | 3892 _visibleRangeLength = length; |
3393 } | 3893 } |
3394 void appendTo(JavaStringBuilder builder) { | 3894 void appendTo(JavaStringBuilder builder) { |
3395 builder.append(type); | 3895 builder.append(type); |
3396 builder.append(" "); | 3896 builder.append(" "); |
3397 builder.append(name); | 3897 builder.append(displayName); |
3398 } | 3898 } |
3399 } | 3899 } |
| 3900 |
3400 /** | 3901 /** |
3401 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle
ment}. | 3902 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle
ment}. |
3402 * @coverage dart.engine.element | 3903 * @coverage dart.engine.element |
3403 */ | 3904 */ |
3404 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { | 3905 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { |
| 3906 |
3405 /** | 3907 /** |
3406 * An empty array of method elements. | 3908 * An empty array of method elements. |
3407 */ | 3909 */ |
3408 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); | 3910 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); |
| 3911 |
3409 /** | 3912 /** |
3410 * Initialize a newly created method element to have the given name. | 3913 * Initialize a newly created method element to have the given name. |
3411 * @param name the name of this element | 3914 * @param name the name of this element |
3412 */ | 3915 */ |
3413 MethodElementImpl.con1(Identifier name) : super.con1(name) { | 3916 MethodElementImpl.con1(Identifier name) : super.con1(name) { |
3414 _jtd_constructor_212_impl(name); | 3917 _jtd_constructor_216_impl(name); |
3415 } | 3918 } |
3416 _jtd_constructor_212_impl(Identifier name) { | 3919 _jtd_constructor_216_impl(Identifier name) { |
3417 } | 3920 } |
| 3921 |
3418 /** | 3922 /** |
3419 * Initialize a newly created method element to have the given name. | 3923 * Initialize a newly created method element to have the given name. |
3420 * @param name the name of this element | 3924 * @param name the name of this element |
3421 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 3925 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
3422 * declaration of this element | 3926 * declaration of this element |
3423 */ | 3927 */ |
3424 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff
set) { | 3928 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff
set) { |
3425 _jtd_constructor_213_impl(name, nameOffset); | 3929 _jtd_constructor_217_impl(name, nameOffset); |
3426 } | 3930 } |
3427 _jtd_constructor_213_impl(String name, int nameOffset) { | 3931 _jtd_constructor_217_impl(String name, int nameOffset) { |
3428 } | 3932 } |
3429 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 3933 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
3430 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 3934 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
3431 ElementKind get kind => ElementKind.METHOD; | 3935 ElementKind get kind => ElementKind.METHOD; |
| 3936 String get name { |
| 3937 String name2 = super.name; |
| 3938 if (isOperator() && name2 == "-") { |
| 3939 if (parameters.length == 0) { |
| 3940 return "unary-"; |
| 3941 } |
| 3942 } |
| 3943 return super.name; |
| 3944 } |
3432 bool isAbstract() => hasModifier(Modifier.ABSTRACT); | 3945 bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
3433 bool isOperator() { | 3946 bool isOperator() { |
3434 String name2 = name; | 3947 String name = displayName; |
3435 if (name2.isEmpty) { | 3948 if (name.isEmpty) { |
3436 return false; | 3949 return false; |
3437 } | 3950 } |
3438 int first = name2.codeUnitAt(0); | 3951 int first = name.codeUnitAt(0); |
3439 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A
) || first == 0x5F || first == 0x24); | 3952 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A
) || first == 0x5F || first == 0x24); |
3440 } | 3953 } |
3441 bool isStatic() => hasModifier(Modifier.STATIC); | 3954 bool isStatic() => hasModifier(Modifier.STATIC); |
| 3955 |
3442 /** | 3956 /** |
3443 * Set whether this method is abstract to correspond to the given value. | 3957 * Set whether this method is abstract to correspond to the given value. |
3444 * @param isAbstract {@code true} if the method is abstract | 3958 * @param isAbstract {@code true} if the method is abstract |
3445 */ | 3959 */ |
3446 void set abstract(bool isAbstract) { | 3960 void set abstract(bool isAbstract) { |
3447 setModifier(Modifier.ABSTRACT, isAbstract); | 3961 setModifier(Modifier.ABSTRACT, isAbstract); |
3448 } | 3962 } |
| 3963 |
3449 /** | 3964 /** |
3450 * Set whether this method is static to correspond to the given value. | 3965 * Set whether this method is static to correspond to the given value. |
3451 * @param isStatic {@code true} if the method is static | 3966 * @param isStatic {@code true} if the method is static |
3452 */ | 3967 */ |
3453 void set static(bool isStatic) { | 3968 void set static(bool isStatic) { |
3454 setModifier(Modifier.STATIC, isStatic); | 3969 setModifier(Modifier.STATIC, isStatic); |
3455 } | 3970 } |
3456 void appendTo(JavaStringBuilder builder) { | 3971 void appendTo(JavaStringBuilder builder) { |
3457 builder.append(enclosingElement.name); | 3972 builder.append(enclosingElement.displayName); |
3458 builder.append("."); | 3973 builder.append("."); |
3459 builder.append(name); | 3974 builder.append(displayName); |
3460 super.appendTo(builder); | 3975 super.appendTo(builder); |
3461 } | 3976 } |
3462 } | 3977 } |
| 3978 |
3463 /** | 3979 /** |
3464 * The enumeration {@code Modifier} defines constants for all of the modifiers d
efined by the Dart | 3980 * The enumeration {@code Modifier} defines constants for all of the modifiers d
efined by the Dart |
3465 * language and for a few additional flags that are useful. | 3981 * language and for a few additional flags that are useful. |
3466 * @coverage dart.engine.element | 3982 * @coverage dart.engine.element |
3467 */ | 3983 */ |
3468 class Modifier implements Comparable<Modifier> { | 3984 class Modifier implements Comparable<Modifier> { |
3469 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); | 3985 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); |
3470 static final Modifier CONST = new Modifier('CONST', 1); | 3986 static final Modifier CONST = new Modifier('CONST', 1); |
3471 static final Modifier FACTORY = new Modifier('FACTORY', 2); | 3987 static final Modifier FACTORY = new Modifier('FACTORY', 2); |
3472 static final Modifier FINAL = new Modifier('FINAL', 3); | 3988 static final Modifier FINAL = new Modifier('FINAL', 3); |
3473 static final Modifier GETTER = new Modifier('GETTER', 4); | 3989 static final Modifier GETTER = new Modifier('GETTER', 4); |
3474 static final Modifier INITIALIZING_FORMAL = new Modifier('INITIALIZING_FORMAL'
, 5); | 3990 static final Modifier MIXIN = new Modifier('MIXIN', 5); |
3475 static final Modifier MIXIN = new Modifier('MIXIN', 6); | 3991 static final Modifier REFERENCES_SUPER = new Modifier('REFERENCES_SUPER', 6); |
3476 static final Modifier SETTER = new Modifier('SETTER', 7); | 3992 static final Modifier SETTER = new Modifier('SETTER', 7); |
3477 static final Modifier STATIC = new Modifier('STATIC', 8); | 3993 static final Modifier STATIC = new Modifier('STATIC', 8); |
3478 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 9); | 3994 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 9); |
3479 static final Modifier TYPEDEF = new Modifier('TYPEDEF', 10); | 3995 static final Modifier TYPEDEF = new Modifier('TYPEDEF', 10); |
3480 static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER,
INITIALIZING_FORMAL, MIXIN, SETTER, STATIC, SYNTHETIC, TYPEDEF]; | 3996 static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER,
MIXIN, REFERENCES_SUPER, SETTER, STATIC, SYNTHETIC, TYPEDEF]; |
3481 final String __name; | 3997 |
3482 final int __ordinal; | 3998 /// The name of this enum constant, as declared in the enum declaration. |
3483 int get ordinal => __ordinal; | 3999 final String name; |
3484 Modifier(this.__name, this.__ordinal) { | 4000 |
| 4001 /// The position in the enum declaration. |
| 4002 final int ordinal; |
| 4003 Modifier(this.name, this.ordinal) { |
3485 } | 4004 } |
3486 int compareTo(Modifier other) => __ordinal - other.__ordinal; | 4005 int compareTo(Modifier other) => ordinal - other.ordinal; |
3487 String toString() => __name; | 4006 String toString() => name; |
3488 } | 4007 } |
| 4008 |
3489 /** | 4009 /** |
3490 * Instances of the class {@code MultiplyDefinedElementImpl} represent a collect
ion of elements that | 4010 * Instances of the class {@code MultiplyDefinedElementImpl} represent a collect
ion of elements that |
3491 * have the same name within the same scope. | 4011 * have the same name within the same scope. |
3492 * @coverage dart.engine.element | 4012 * @coverage dart.engine.element |
3493 */ | 4013 */ |
3494 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { | 4014 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
| 4015 |
3495 /** | 4016 /** |
3496 * The analysis context in which the multiply defined elements are defined. | 4017 * The analysis context in which the multiply defined elements are defined. |
3497 */ | 4018 */ |
3498 AnalysisContext _context; | 4019 AnalysisContext _context; |
| 4020 |
3499 /** | 4021 /** |
3500 * The name of the conflicting elements. | 4022 * The name of the conflicting elements. |
3501 */ | 4023 */ |
3502 String _name; | 4024 String _name; |
| 4025 |
3503 /** | 4026 /** |
3504 * A list containing all of the elements that conflict. | 4027 * A list containing all of the elements that conflict. |
3505 */ | 4028 */ |
3506 List<Element> _conflictingElements; | 4029 List<Element> _conflictingElements; |
| 4030 |
3507 /** | 4031 /** |
3508 * Initialize a newly created element to represent a list of conflicting eleme
nts. | 4032 * Initialize a newly created element to represent a list of conflicting eleme
nts. |
3509 * @param context the analysis context in which the multiply defined elements
are defined | 4033 * @param context the analysis context in which the multiply defined elements
are defined |
3510 * @param firstElement the first element that conflicts | 4034 * @param firstElement the first element that conflicts |
3511 * @param secondElement the second element that conflicts | 4035 * @param secondElement the second element that conflicts |
3512 */ | 4036 */ |
3513 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem
ent secondElement) { | 4037 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem
ent secondElement) { |
3514 _name = firstElement.name; | 4038 _name = firstElement.name; |
3515 _conflictingElements = computeConflictingElements(firstElement, secondElemen
t); | 4039 _conflictingElements = computeConflictingElements(firstElement, secondElemen
t); |
3516 } | 4040 } |
3517 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 4041 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
3518 String computeDocumentationComment() => null; | 4042 String computeDocumentationComment() => null; |
3519 Element getAncestor(Type elementClass) => null; | 4043 Element getAncestor(Type elementClass) => null; |
3520 List<Element> get conflictingElements => _conflictingElements; | 4044 List<Element> get conflictingElements => _conflictingElements; |
3521 AnalysisContext get context => _context; | 4045 AnalysisContext get context => _context; |
| 4046 String get displayName => _name; |
3522 Element get enclosingElement => null; | 4047 Element get enclosingElement => null; |
3523 ElementKind get kind => ElementKind.ERROR; | 4048 ElementKind get kind => ElementKind.ERROR; |
3524 LibraryElement get library => null; | 4049 LibraryElement get library => null; |
3525 ElementLocation get location => null; | 4050 ElementLocation get location => null; |
3526 List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY; | 4051 List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY; |
3527 String get name => _name; | 4052 String get name => _name; |
3528 int get nameOffset => -1; | 4053 int get nameOffset => -1; |
3529 Source get source => null; | 4054 Source get source => null; |
3530 bool isAccessibleIn(LibraryElement library) { | 4055 bool isAccessibleIn(LibraryElement library) { |
3531 for (Element element in _conflictingElements) { | 4056 for (Element element in _conflictingElements) { |
(...skipping 12 matching lines...) Expand all Loading... |
3544 if (i > 0) { | 4069 if (i > 0) { |
3545 builder.append(", "); | 4070 builder.append(", "); |
3546 } | 4071 } |
3547 ((_conflictingElements[i] as ElementImpl)).appendTo(builder); | 4072 ((_conflictingElements[i] as ElementImpl)).appendTo(builder); |
3548 } | 4073 } |
3549 builder.append("]"); | 4074 builder.append("]"); |
3550 return builder.toString(); | 4075 return builder.toString(); |
3551 } | 4076 } |
3552 void visitChildren(ElementVisitor<Object> visitor) { | 4077 void visitChildren(ElementVisitor<Object> visitor) { |
3553 } | 4078 } |
| 4079 |
3554 /** | 4080 /** |
3555 * Add the given element to the list of elements. If the element is a multiply
-defined element, | 4081 * Add the given element to the list of elements. If the element is a multiply
-defined element, |
3556 * add all of the conflicting elements that it represents. | 4082 * add all of the conflicting elements that it represents. |
3557 * @param elements the list to which the element(s) are to be added | 4083 * @param elements the list to which the element(s) are to be added |
3558 * @param element the element(s) to be added | 4084 * @param element the element(s) to be added |
3559 */ | 4085 */ |
3560 void add(List<Element> elements, Element element) { | 4086 void add(List<Element> elements, Element element) { |
3561 if (element is MultiplyDefinedElementImpl) { | 4087 if (element is MultiplyDefinedElementImpl) { |
3562 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl
))._conflictingElements) { | 4088 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl
))._conflictingElements) { |
3563 elements.add(conflictingElement); | 4089 elements.add(conflictingElement); |
3564 } | 4090 } |
3565 } else { | 4091 } else { |
3566 elements.add(element); | 4092 elements.add(element); |
3567 } | 4093 } |
3568 } | 4094 } |
| 4095 |
3569 /** | 4096 /** |
3570 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given | 4097 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given |
3571 * elements are multiply-defined elements then the conflicting elements they r
epresent will be | 4098 * elements are multiply-defined elements then the conflicting elements they r
epresent will be |
3572 * included in the array. Otherwise, the element itself will be included. | 4099 * included in the array. Otherwise, the element itself will be included. |
3573 * @param firstElement the first element to be included | 4100 * @param firstElement the first element to be included |
3574 * @param secondElement the second element to be included | 4101 * @param secondElement the second element to be included |
3575 * @return an array containing all of the conflicting elements | 4102 * @return an array containing all of the conflicting elements |
3576 */ | 4103 */ |
3577 List<Element> computeConflictingElements(Element firstElement, Element secondE
lement) { | 4104 List<Element> computeConflictingElements(Element firstElement, Element secondE
lement) { |
3578 List<Element> elements = new List<Element>(); | 4105 List<Element> elements = new List<Element>(); |
3579 add(elements, firstElement); | 4106 add(elements, firstElement); |
3580 add(elements, secondElement); | 4107 add(elements, secondElement); |
3581 return new List.from(elements); | 4108 return new List.from(elements); |
3582 } | 4109 } |
3583 } | 4110 } |
| 4111 |
3584 /** | 4112 /** |
3585 * Instances of the class {@code ParameterElementImpl} implement a {@code Parame
terElement}. | 4113 * Instances of the class {@code ParameterElementImpl} implement a {@code Parame
terElement}. |
3586 * @coverage dart.engine.element | 4114 * @coverage dart.engine.element |
3587 */ | 4115 */ |
3588 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { | 4116 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { |
| 4117 |
3589 /** | 4118 /** |
3590 * An array containing all of the parameters defined by this parameter element
. There will only be | 4119 * An array containing all of the parameters defined by this parameter element
. There will only be |
3591 * parameters if this parameter is a function typed parameter. | 4120 * parameters if this parameter is a function typed parameter. |
3592 */ | 4121 */ |
3593 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 4122 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 4123 |
3594 /** | 4124 /** |
3595 * The kind of this parameter. | 4125 * The kind of this parameter. |
3596 */ | 4126 */ |
3597 ParameterKind _parameterKind; | 4127 ParameterKind _parameterKind; |
| 4128 |
3598 /** | 4129 /** |
3599 * The offset to the beginning of the visible range for this element. | 4130 * The offset to the beginning of the visible range for this element. |
3600 */ | 4131 */ |
3601 int _visibleRangeOffset = 0; | 4132 int _visibleRangeOffset = 0; |
| 4133 |
3602 /** | 4134 /** |
3603 * The length of the visible range for this element, or {@code -1} if this ele
ment does not have a | 4135 * The length of the visible range for this element, or {@code -1} if this ele
ment does not have a |
3604 * visible range. | 4136 * visible range. |
3605 */ | 4137 */ |
3606 int _visibleRangeLength = -1; | 4138 int _visibleRangeLength = -1; |
| 4139 |
3607 /** | 4140 /** |
3608 * An empty array of field elements. | 4141 * An empty array of field elements. |
3609 */ | 4142 */ |
3610 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0); | 4143 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0); |
| 4144 |
3611 /** | 4145 /** |
3612 * Initialize a newly created parameter element to have the given name. | 4146 * Initialize a newly created parameter element to have the given name. |
3613 * @param name the name of this element | 4147 * @param name the name of this element |
3614 */ | 4148 */ |
3615 ParameterElementImpl(Identifier name) : super.con1(name) { | 4149 ParameterElementImpl(Identifier name) : super.con1(name) { |
3616 } | 4150 } |
3617 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); | 4151 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
3618 ElementKind get kind => ElementKind.PARAMETER; | 4152 ElementKind get kind => ElementKind.PARAMETER; |
3619 ParameterKind get parameterKind => _parameterKind; | 4153 ParameterKind get parameterKind => _parameterKind; |
3620 List<ParameterElement> get parameters => _parameters; | 4154 List<ParameterElement> get parameters => _parameters; |
3621 SourceRange get visibleRange { | 4155 SourceRange get visibleRange { |
3622 if (_visibleRangeLength < 0) { | 4156 if (_visibleRangeLength < 0) { |
3623 return null; | 4157 return null; |
3624 } | 4158 } |
3625 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4159 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
3626 } | 4160 } |
3627 bool isInitializingFormal() => hasModifier(Modifier.INITIALIZING_FORMAL); | 4161 bool isInitializingFormal() => false; |
3628 /** | 4162 |
3629 * Set whether this parameter is an initializing formal parameter to match the
given value. | |
3630 * @param isInitializingFormal {@code true} if this parameter is an initializi
ng formal parameter | |
3631 */ | |
3632 void set initializingFormal(bool isInitializingFormal) { | |
3633 setModifier(Modifier.INITIALIZING_FORMAL, isInitializingFormal); | |
3634 } | |
3635 /** | 4163 /** |
3636 * Set the kind of this parameter to the given kind. | 4164 * Set the kind of this parameter to the given kind. |
3637 * @param parameterKind the new kind of this parameter | 4165 * @param parameterKind the new kind of this parameter |
3638 */ | 4166 */ |
3639 void set parameterKind(ParameterKind parameterKind2) { | 4167 void set parameterKind(ParameterKind parameterKind2) { |
3640 this._parameterKind = parameterKind2; | 4168 this._parameterKind = parameterKind2; |
3641 } | 4169 } |
| 4170 |
3642 /** | 4171 /** |
3643 * Set the parameters defined by this executable element to the given paramete
rs. | 4172 * Set the parameters defined by this executable element to the given paramete
rs. |
3644 * @param parameters the parameters defined by this executable element | 4173 * @param parameters the parameters defined by this executable element |
3645 */ | 4174 */ |
3646 void set parameters(List<ParameterElement> parameters2) { | 4175 void set parameters(List<ParameterElement> parameters2) { |
3647 for (ParameterElement parameter in parameters2) { | 4176 for (ParameterElement parameter in parameters2) { |
3648 ((parameter as ParameterElementImpl)).enclosingElement = this; | 4177 ((parameter as ParameterElementImpl)).enclosingElement = this; |
3649 } | 4178 } |
3650 this._parameters = parameters2; | 4179 this._parameters = parameters2; |
3651 } | 4180 } |
| 4181 |
3652 /** | 4182 /** |
3653 * Set the visible range for this element to the range starting at the given o
ffset with the given | 4183 * Set the visible range for this element to the range starting at the given o
ffset with the given |
3654 * length. | 4184 * length. |
3655 * @param offset the offset to the beginning of the visible range for this ele
ment | 4185 * @param offset the offset to the beginning of the visible range for this ele
ment |
3656 * @param length the length of the visible range for this element, or {@code -
1} if this element | 4186 * @param length the length of the visible range for this element, or {@code -
1} if this element |
3657 * does not have a visible range | 4187 * does not have a visible range |
3658 */ | 4188 */ |
3659 void setVisibleRange(int offset, int length) { | 4189 void setVisibleRange(int offset, int length) { |
3660 _visibleRangeOffset = offset; | 4190 _visibleRangeOffset = offset; |
3661 _visibleRangeLength = length; | 4191 _visibleRangeLength = length; |
(...skipping 11 matching lines...) Expand all Loading... |
3673 right = "}"; | 4203 right = "}"; |
3674 } else if (parameterKind == ParameterKind.POSITIONAL) { | 4204 } else if (parameterKind == ParameterKind.POSITIONAL) { |
3675 left = "["; | 4205 left = "["; |
3676 right = "]"; | 4206 right = "]"; |
3677 } | 4207 } |
3678 break; | 4208 break; |
3679 } | 4209 } |
3680 builder.append(left); | 4210 builder.append(left); |
3681 builder.append(type); | 4211 builder.append(type); |
3682 builder.append(" "); | 4212 builder.append(" "); |
3683 builder.append(name); | 4213 builder.append(displayName); |
3684 builder.append(right); | 4214 builder.append(right); |
3685 } | 4215 } |
3686 } | 4216 } |
| 4217 |
3687 /** | 4218 /** |
3688 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle
ment}. | 4219 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle
ment}. |
3689 * @coverage dart.engine.element | 4220 * @coverage dart.engine.element |
3690 */ | 4221 */ |
3691 class PrefixElementImpl extends ElementImpl implements PrefixElement { | 4222 class PrefixElementImpl extends ElementImpl implements PrefixElement { |
| 4223 |
3692 /** | 4224 /** |
3693 * An array containing all of the libraries that are imported using this prefi
x. | 4225 * An array containing all of the libraries that are imported using this prefi
x. |
3694 */ | 4226 */ |
3695 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; | 4227 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; |
| 4228 |
3696 /** | 4229 /** |
3697 * An empty array of prefix elements. | 4230 * An empty array of prefix elements. |
3698 */ | 4231 */ |
3699 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); | 4232 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); |
| 4233 |
3700 /** | 4234 /** |
3701 * Initialize a newly created prefix element to have the given name. | 4235 * Initialize a newly created prefix element to have the given name. |
3702 * @param name the name of this element | 4236 * @param name the name of this element |
3703 */ | 4237 */ |
3704 PrefixElementImpl(Identifier name) : super.con1(name) { | 4238 PrefixElementImpl(Identifier name) : super.con1(name) { |
3705 } | 4239 } |
3706 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); | 4240 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); |
3707 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; | 4241 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; |
3708 List<LibraryElement> get importedLibraries => _importedLibraries; | 4242 List<LibraryElement> get importedLibraries => _importedLibraries; |
3709 ElementKind get kind => ElementKind.PREFIX; | 4243 ElementKind get kind => ElementKind.PREFIX; |
| 4244 |
3710 /** | 4245 /** |
3711 * Set the libraries that are imported using this prefix to the given librarie
s. | 4246 * Set the libraries that are imported using this prefix to the given librarie
s. |
3712 * @param importedLibraries the libraries that are imported using this prefix | 4247 * @param importedLibraries the libraries that are imported using this prefix |
3713 */ | 4248 */ |
3714 void set importedLibraries(List<LibraryElement> importedLibraries2) { | 4249 void set importedLibraries(List<LibraryElement> importedLibraries2) { |
3715 for (LibraryElement library in importedLibraries2) { | 4250 for (LibraryElement library in importedLibraries2) { |
3716 ((library as LibraryElementImpl)).enclosingElement = this; | 4251 ((library as LibraryElementImpl)).enclosingElement = this; |
3717 } | 4252 } |
3718 this._importedLibraries = importedLibraries2; | 4253 this._importedLibraries = importedLibraries2; |
3719 } | 4254 } |
3720 void appendTo(JavaStringBuilder builder) { | 4255 void appendTo(JavaStringBuilder builder) { |
3721 builder.append("as "); | 4256 builder.append("as "); |
3722 super.appendTo(builder); | 4257 super.appendTo(builder); |
3723 } | 4258 } |
3724 } | 4259 } |
| 4260 |
3725 /** | 4261 /** |
3726 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code
PropertyAccessorElement}. | 4262 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code
PropertyAccessorElement}. |
3727 * @coverage dart.engine.element | 4263 * @coverage dart.engine.element |
3728 */ | 4264 */ |
3729 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
rtyAccessorElement { | 4265 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
rtyAccessorElement { |
| 4266 |
3730 /** | 4267 /** |
3731 * The variable associated with this accessor. | 4268 * The variable associated with this accessor. |
3732 */ | 4269 */ |
3733 PropertyInducingElement _variable; | 4270 PropertyInducingElement _variable; |
| 4271 |
3734 /** | 4272 /** |
3735 * An empty array of property accessor elements. | 4273 * An empty array of property accessor elements. |
3736 */ | 4274 */ |
3737 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl
ement>(0); | 4275 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl
ement>(0); |
| 4276 |
3738 /** | 4277 /** |
3739 * Initialize a newly created property accessor element to have the given name
. | 4278 * Initialize a newly created property accessor element to have the given name
. |
3740 * @param name the name of this element | 4279 * @param name the name of this element |
3741 */ | 4280 */ |
3742 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) { | 4281 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) { |
3743 _jtd_constructor_218_impl(name); | 4282 _jtd_constructor_222_impl(name); |
3744 } | 4283 } |
3745 _jtd_constructor_218_impl(Identifier name) { | 4284 _jtd_constructor_222_impl(Identifier name) { |
3746 } | 4285 } |
| 4286 |
3747 /** | 4287 /** |
3748 * Initialize a newly created synthetic property accessor element to be associ
ated with the given | 4288 * Initialize a newly created synthetic property accessor element to be associ
ated with the given |
3749 * variable. | 4289 * variable. |
3750 * @param variable the variable with which this access is associated | 4290 * @param variable the variable with which this access is associated |
3751 */ | 4291 */ |
3752 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : supe
r.con2(variable2.name, -1) { | 4292 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : supe
r.con2(variable2.name, variable2.nameOffset) { |
3753 _jtd_constructor_219_impl(variable2); | 4293 _jtd_constructor_223_impl(variable2); |
3754 } | 4294 } |
3755 _jtd_constructor_219_impl(PropertyInducingElementImpl variable2) { | 4295 _jtd_constructor_223_impl(PropertyInducingElementImpl variable2) { |
3756 this._variable = variable2; | 4296 this._variable = variable2; |
3757 synthetic = true; | 4297 synthetic = true; |
3758 } | 4298 } |
3759 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 4299 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
3760 bool operator ==(Object object) => super == object && identical(isGetter(), ((
object as PropertyAccessorElement)).isGetter()); | 4300 bool operator ==(Object object) => super == object && identical(isGetter(), ((
object as PropertyAccessorElement)).isGetter()); |
| 4301 PropertyAccessorElement get correspondingGetter { |
| 4302 if (isGetter() || _variable == null) { |
| 4303 return null; |
| 4304 } |
| 4305 return _variable.getter; |
| 4306 } |
| 4307 PropertyAccessorElement get correspondingSetter { |
| 4308 if (isSetter() || _variable == null) { |
| 4309 return null; |
| 4310 } |
| 4311 return _variable.setter; |
| 4312 } |
3761 ElementKind get kind { | 4313 ElementKind get kind { |
3762 if (isGetter()) { | 4314 if (isGetter()) { |
3763 return ElementKind.GETTER; | 4315 return ElementKind.GETTER; |
3764 } | 4316 } |
3765 return ElementKind.SETTER; | 4317 return ElementKind.SETTER; |
3766 } | 4318 } |
| 4319 String get name { |
| 4320 if (isSetter()) { |
| 4321 return "${super.name}="; |
| 4322 } |
| 4323 return super.name; |
| 4324 } |
3767 PropertyInducingElement get variable => _variable; | 4325 PropertyInducingElement get variable => _variable; |
| 4326 bool isAbstract() => hasModifier(Modifier.ABSTRACT); |
3768 bool isGetter() => hasModifier(Modifier.GETTER); | 4327 bool isGetter() => hasModifier(Modifier.GETTER); |
3769 bool isSetter() => hasModifier(Modifier.SETTER); | 4328 bool isSetter() => hasModifier(Modifier.SETTER); |
3770 bool isStatic() => variable.isStatic(); | 4329 bool isStatic() => hasModifier(Modifier.STATIC); |
| 4330 |
| 4331 /** |
| 4332 * Set whether this accessor is abstract to correspond to the given value. |
| 4333 * @param isAbstract {@code true} if the accessor is abstract |
| 4334 */ |
| 4335 void set abstract(bool isAbstract) { |
| 4336 setModifier(Modifier.ABSTRACT, isAbstract); |
| 4337 } |
| 4338 |
3771 /** | 4339 /** |
3772 * Set whether this accessor is a getter to correspond to the given value. | 4340 * Set whether this accessor is a getter to correspond to the given value. |
3773 * @param isGetter {@code true} if the accessor is a getter | 4341 * @param isGetter {@code true} if the accessor is a getter |
3774 */ | 4342 */ |
3775 void set getter(bool isGetter) { | 4343 void set getter(bool isGetter) { |
3776 setModifier(Modifier.GETTER, isGetter); | 4344 setModifier(Modifier.GETTER, isGetter); |
3777 } | 4345 } |
| 4346 |
3778 /** | 4347 /** |
3779 * Set whether this accessor is a setter to correspond to the given value. | 4348 * Set whether this accessor is a setter to correspond to the given value. |
3780 * @param isSetter {@code true} if the accessor is a setter | 4349 * @param isSetter {@code true} if the accessor is a setter |
3781 */ | 4350 */ |
3782 void set setter(bool isSetter) { | 4351 void set setter(bool isSetter) { |
3783 setModifier(Modifier.SETTER, isSetter); | 4352 setModifier(Modifier.SETTER, isSetter); |
3784 } | 4353 } |
| 4354 |
| 4355 /** |
| 4356 * Set whether this accessor is static to correspond to the given value. |
| 4357 * @param isStatic {@code true} if the accessor is static |
| 4358 */ |
| 4359 void set static(bool isStatic) { |
| 4360 setModifier(Modifier.STATIC, isStatic); |
| 4361 } |
| 4362 |
3785 /** | 4363 /** |
3786 * Set the variable associated with this accessor to the given variable. | 4364 * Set the variable associated with this accessor to the given variable. |
3787 * @param variable the variable associated with this accessor | 4365 * @param variable the variable associated with this accessor |
3788 */ | 4366 */ |
3789 void set variable(PropertyInducingElement variable2) { | 4367 void set variable(PropertyInducingElement variable2) { |
3790 this._variable = variable2; | 4368 this._variable = variable2; |
3791 } | 4369 } |
3792 void appendTo(JavaStringBuilder builder) { | 4370 void appendTo(JavaStringBuilder builder) { |
3793 builder.append(isGetter() ? "get " : "set "); | 4371 builder.append(isGetter() ? "get " : "set "); |
3794 builder.append(variable.name); | 4372 builder.append(variable.displayName); |
3795 super.appendTo(builder); | 4373 super.appendTo(builder); |
3796 } | 4374 } |
3797 } | 4375 } |
| 4376 |
3798 /** | 4377 /** |
3799 * Instances of the class {@code PropertyInducingElementImpl} implement a{@code
PropertyInducingElement}. | 4378 * Instances of the class {@code PropertyInducingElementImpl} implement a{@code
PropertyInducingElement}. |
3800 * @coverage dart.engine.element | 4379 * @coverage dart.engine.element |
3801 */ | 4380 */ |
3802 abstract class PropertyInducingElementImpl extends VariableElementImpl implement
s PropertyInducingElement { | 4381 abstract class PropertyInducingElementImpl extends VariableElementImpl implement
s PropertyInducingElement { |
| 4382 |
3803 /** | 4383 /** |
3804 * The getter associated with this element. | 4384 * The getter associated with this element. |
3805 */ | 4385 */ |
3806 PropertyAccessorElement _getter; | 4386 PropertyAccessorElement _getter; |
| 4387 |
3807 /** | 4388 /** |
3808 * The setter associated with this element, or {@code null} if the element is
effectively{@code final} and therefore does not have a setter associated with it
. | 4389 * The setter associated with this element, or {@code null} if the element is
effectively{@code final} and therefore does not have a setter associated with it
. |
3809 */ | 4390 */ |
3810 PropertyAccessorElement _setter; | 4391 PropertyAccessorElement _setter; |
| 4392 |
3811 /** | 4393 /** |
3812 * An empty array of elements. | 4394 * An empty array of elements. |
3813 */ | 4395 */ |
3814 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl
ement>(0); | 4396 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl
ement>(0); |
| 4397 |
3815 /** | 4398 /** |
3816 * Initialize a newly created element to have the given name. | 4399 * Initialize a newly created element to have the given name. |
3817 * @param name the name of this element | 4400 * @param name the name of this element |
3818 */ | 4401 */ |
3819 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) { | 4402 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) { |
3820 _jtd_constructor_220_impl(name); | 4403 _jtd_constructor_224_impl(name); |
3821 } | 4404 } |
3822 _jtd_constructor_220_impl(Identifier name) { | 4405 _jtd_constructor_224_impl(Identifier name) { |
3823 } | 4406 } |
| 4407 |
3824 /** | 4408 /** |
3825 * Initialize a newly created synthetic element to have the given name. | 4409 * Initialize a newly created synthetic element to have the given name. |
3826 * @param name the name of this element | 4410 * @param name the name of this element |
3827 */ | 4411 */ |
3828 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { | 4412 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { |
3829 _jtd_constructor_221_impl(name); | 4413 _jtd_constructor_225_impl(name); |
3830 } | 4414 } |
3831 _jtd_constructor_221_impl(String name) { | 4415 _jtd_constructor_225_impl(String name) { |
3832 synthetic = true; | 4416 synthetic = true; |
3833 } | 4417 } |
3834 PropertyAccessorElement get getter => _getter; | 4418 PropertyAccessorElement get getter => _getter; |
3835 PropertyAccessorElement get setter => _setter; | 4419 PropertyAccessorElement get setter => _setter; |
| 4420 |
3836 /** | 4421 /** |
3837 * Set the getter associated with this element to the given accessor. | 4422 * Set the getter associated with this element to the given accessor. |
3838 * @param getter the getter associated with this element | 4423 * @param getter the getter associated with this element |
3839 */ | 4424 */ |
3840 void set getter(PropertyAccessorElement getter2) { | 4425 void set getter(PropertyAccessorElement getter2) { |
3841 this._getter = getter2; | 4426 this._getter = getter2; |
3842 } | 4427 } |
| 4428 |
3843 /** | 4429 /** |
3844 * Set the setter associated with this element to the given accessor. | 4430 * Set the setter associated with this element to the given accessor. |
3845 * @param setter the setter associated with this element | 4431 * @param setter the setter associated with this element |
3846 */ | 4432 */ |
3847 void set setter(PropertyAccessorElement setter2) { | 4433 void set setter(PropertyAccessorElement setter2) { |
3848 this._setter = setter2; | 4434 this._setter = setter2; |
3849 } | 4435 } |
3850 } | 4436 } |
| 4437 |
3851 /** | 4438 /** |
3852 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb
inator}. | 4439 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb
inator}. |
3853 * @coverage dart.engine.element | 4440 * @coverage dart.engine.element |
3854 */ | 4441 */ |
3855 class ShowCombinatorImpl implements ShowCombinator { | 4442 class ShowCombinatorImpl implements ShowCombinator { |
| 4443 |
3856 /** | 4444 /** |
3857 * The names that are to be made visible in the importing library if they are
defined in the | 4445 * The names that are to be made visible in the importing library if they are
defined in the |
3858 * imported library. | 4446 * imported library. |
3859 */ | 4447 */ |
3860 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; | 4448 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; |
3861 /** | |
3862 * Initialize a newly created combinator. | |
3863 */ | |
3864 ShowCombinatorImpl() : super() { | |
3865 } | |
3866 List<String> get shownNames => _shownNames; | 4449 List<String> get shownNames => _shownNames; |
| 4450 |
3867 /** | 4451 /** |
3868 * Set the names that are to be made visible in the importing library if they
are defined in the | 4452 * Set the names that are to be made visible in the importing library if they
are defined in the |
3869 * imported library to the given names. | 4453 * imported library to the given names. |
3870 * @param shownNames the names that are to be made visible in the importing li
brary | 4454 * @param shownNames the names that are to be made visible in the importing li
brary |
3871 */ | 4455 */ |
3872 void set shownNames(List<String> shownNames2) { | 4456 void set shownNames(List<String> shownNames2) { |
3873 this._shownNames = shownNames2; | 4457 this._shownNames = shownNames2; |
3874 } | 4458 } |
3875 String toString() { | 4459 String toString() { |
3876 JavaStringBuilder builder = new JavaStringBuilder(); | 4460 JavaStringBuilder builder = new JavaStringBuilder(); |
3877 builder.append("show "); | 4461 builder.append("show "); |
3878 int count = _shownNames.length; | 4462 int count = _shownNames.length; |
3879 for (int i = 0; i < count; i++) { | 4463 for (int i = 0; i < count; i++) { |
3880 if (i > 0) { | 4464 if (i > 0) { |
3881 builder.append(", "); | 4465 builder.append(", "); |
3882 } | 4466 } |
3883 builder.append(_shownNames[i]); | 4467 builder.append(_shownNames[i]); |
3884 } | 4468 } |
3885 return builder.toString(); | 4469 return builder.toString(); |
3886 } | 4470 } |
3887 } | 4471 } |
| 4472 |
3888 /** | 4473 /** |
3889 * Instances of the class {@code TopLevelVariableElementImpl} implement a{@code
TopLevelVariableElement}. | 4474 * Instances of the class {@code TopLevelVariableElementImpl} implement a{@code
TopLevelVariableElement}. |
3890 * @coverage dart.engine.element | 4475 * @coverage dart.engine.element |
3891 */ | 4476 */ |
3892 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements
TopLevelVariableElement { | 4477 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements
TopLevelVariableElement { |
| 4478 |
3893 /** | 4479 /** |
3894 * An empty array of top-level variable elements. | 4480 * An empty array of top-level variable elements. |
3895 */ | 4481 */ |
3896 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl
ement>(0); | 4482 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl
ement>(0); |
| 4483 |
3897 /** | 4484 /** |
3898 * Initialize a newly created top-level variable element to have the given nam
e. | 4485 * Initialize a newly created top-level variable element to have the given nam
e. |
3899 * @param name the name of this element | 4486 * @param name the name of this element |
3900 */ | 4487 */ |
3901 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) { | 4488 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) { |
3902 _jtd_constructor_223_impl(name); | 4489 _jtd_constructor_227_impl(name); |
3903 } | 4490 } |
3904 _jtd_constructor_223_impl(Identifier name) { | 4491 _jtd_constructor_227_impl(Identifier name) { |
3905 } | 4492 } |
| 4493 |
3906 /** | 4494 /** |
3907 * Initialize a newly created synthetic top-level variable element to have the
given name. | 4495 * Initialize a newly created synthetic top-level variable element to have the
given name. |
3908 * @param name the name of this element | 4496 * @param name the name of this element |
3909 */ | 4497 */ |
3910 TopLevelVariableElementImpl.con2(String name) : super.con2(name) { | 4498 TopLevelVariableElementImpl.con2(String name) : super.con2(name) { |
3911 _jtd_constructor_224_impl(name); | 4499 _jtd_constructor_228_impl(name); |
3912 } | 4500 } |
3913 _jtd_constructor_224_impl(String name) { | 4501 _jtd_constructor_228_impl(String name) { |
3914 } | 4502 } |
3915 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); | 4503 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); |
3916 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; | 4504 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; |
3917 bool isStatic() => true; | 4505 bool isStatic() => true; |
3918 } | 4506 } |
| 4507 |
3919 /** | 4508 /** |
3920 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ
eVariableElement}. | 4509 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ
eVariableElement}. |
3921 * @coverage dart.engine.element | 4510 * @coverage dart.engine.element |
3922 */ | 4511 */ |
3923 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement
{ | 4512 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement
{ |
| 4513 |
3924 /** | 4514 /** |
3925 * The type defined by this type variable. | 4515 * The type defined by this type variable. |
3926 */ | 4516 */ |
3927 TypeVariableType _type; | 4517 TypeVariableType _type; |
| 4518 |
3928 /** | 4519 /** |
3929 * The type representing the bound associated with this variable, or {@code nu
ll} if this variable | 4520 * The type representing the bound associated with this variable, or {@code nu
ll} if this variable |
3930 * does not have an explicit bound. | 4521 * does not have an explicit bound. |
3931 */ | 4522 */ |
3932 Type2 _bound; | 4523 Type2 _bound; |
| 4524 |
3933 /** | 4525 /** |
3934 * An empty array of type variable elements. | 4526 * An empty array of type variable elements. |
3935 */ | 4527 */ |
3936 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0
); | 4528 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0
); |
| 4529 |
3937 /** | 4530 /** |
3938 * Initialize a newly created type variable element to have the given name. | 4531 * Initialize a newly created type variable element to have the given name. |
3939 * @param name the name of this element | 4532 * @param name the name of this element |
3940 */ | 4533 */ |
3941 TypeVariableElementImpl(Identifier name) : super.con1(name) { | 4534 TypeVariableElementImpl(Identifier name) : super.con1(name) { |
3942 } | 4535 } |
3943 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this); | 4536 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this); |
3944 Type2 get bound => _bound; | 4537 Type2 get bound => _bound; |
3945 ElementKind get kind => ElementKind.TYPE_VARIABLE; | 4538 ElementKind get kind => ElementKind.TYPE_VARIABLE; |
3946 TypeVariableType get type => _type; | 4539 TypeVariableType get type => _type; |
| 4540 |
3947 /** | 4541 /** |
3948 * Set the type representing the bound associated with this variable to the gi
ven type. | 4542 * Set the type representing the bound associated with this variable to the gi
ven type. |
3949 * @param bound the type representing the bound associated with this variable | 4543 * @param bound the type representing the bound associated with this variable |
3950 */ | 4544 */ |
3951 void set bound(Type2 bound2) { | 4545 void set bound(Type2 bound2) { |
3952 this._bound = bound2; | 4546 this._bound = bound2; |
3953 } | 4547 } |
| 4548 |
3954 /** | 4549 /** |
3955 * Set the type defined by this type variable to the given type | 4550 * Set the type defined by this type variable to the given type |
3956 * @param type the type defined by this type variable | 4551 * @param type the type defined by this type variable |
3957 */ | 4552 */ |
3958 void set type(TypeVariableType type2) { | 4553 void set type(TypeVariableType type2) { |
3959 this._type = type2; | 4554 this._type = type2; |
3960 } | 4555 } |
3961 void appendTo(JavaStringBuilder builder) { | 4556 void appendTo(JavaStringBuilder builder) { |
3962 builder.append(name); | 4557 builder.append(displayName); |
3963 if (_bound != null) { | 4558 if (_bound != null) { |
3964 builder.append(" extends "); | 4559 builder.append(" extends "); |
3965 builder.append(_bound); | 4560 builder.append(_bound); |
3966 } | 4561 } |
3967 } | 4562 } |
3968 } | 4563 } |
| 4564 |
3969 /** | 4565 /** |
3970 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl
eElement}. | 4566 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl
eElement}. |
3971 * @coverage dart.engine.element | 4567 * @coverage dart.engine.element |
3972 */ | 4568 */ |
3973 abstract class VariableElementImpl extends ElementImpl implements VariableElemen
t { | 4569 abstract class VariableElementImpl extends ElementImpl implements VariableElemen
t { |
| 4570 |
3974 /** | 4571 /** |
3975 * The declared type of this variable. | 4572 * The declared type of this variable. |
3976 */ | 4573 */ |
3977 Type2 _type; | 4574 Type2 _type; |
| 4575 |
3978 /** | 4576 /** |
3979 * A synthetic function representing this variable's initializer, or {@code nu
ll} if this variable | 4577 * A synthetic function representing this variable's initializer, or {@code nu
ll} if this variable |
3980 * does not have an initializer. | 4578 * does not have an initializer. |
3981 */ | 4579 */ |
3982 FunctionElement _initializer; | 4580 FunctionElement _initializer; |
| 4581 |
3983 /** | 4582 /** |
3984 * An empty array of variable elements. | 4583 * An empty array of variable elements. |
3985 */ | 4584 */ |
3986 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0); | 4585 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0); |
| 4586 |
3987 /** | 4587 /** |
3988 * Initialize a newly created variable element to have the given name. | 4588 * Initialize a newly created variable element to have the given name. |
3989 * @param name the name of this element | 4589 * @param name the name of this element |
3990 */ | 4590 */ |
3991 VariableElementImpl.con1(Identifier name) : super.con1(name) { | 4591 VariableElementImpl.con1(Identifier name) : super.con1(name) { |
3992 _jtd_constructor_226_impl(name); | 4592 _jtd_constructor_230_impl(name); |
3993 } | 4593 } |
3994 _jtd_constructor_226_impl(Identifier name) { | 4594 _jtd_constructor_230_impl(Identifier name) { |
3995 } | 4595 } |
| 4596 |
3996 /** | 4597 /** |
3997 * Initialize a newly created variable element to have the given name. | 4598 * Initialize a newly created variable element to have the given name. |
3998 * @param name the name of this element | 4599 * @param name the name of this element |
3999 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 4600 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
4000 * declaration of this element | 4601 * declaration of this element |
4001 */ | 4602 */ |
4002 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO
ffset) { | 4603 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO
ffset) { |
4003 _jtd_constructor_227_impl(name, nameOffset); | 4604 _jtd_constructor_231_impl(name, nameOffset); |
4004 } | 4605 } |
4005 _jtd_constructor_227_impl(String name, int nameOffset) { | 4606 _jtd_constructor_231_impl(String name, int nameOffset) { |
4006 } | 4607 } |
| 4608 |
4007 /** | 4609 /** |
4008 * Return the result of evaluating this variable's initializer as a compile-ti
me constant | 4610 * Return the result of evaluating this variable's initializer as a compile-ti
me constant |
4009 * expression, or {@code null} if this variable is not a 'const' variable or d
oes not have an | 4611 * expression, or {@code null} if this variable is not a 'const' variable or d
oes not have an |
4010 * initializer. | 4612 * initializer. |
4011 * @return the result of evaluating this variable's initializer | 4613 * @return the result of evaluating this variable's initializer |
4012 */ | 4614 */ |
4013 EvaluationResultImpl get evaluationResult => null; | 4615 EvaluationResultImpl get evaluationResult => null; |
4014 FunctionElement get initializer => _initializer; | 4616 FunctionElement get initializer => _initializer; |
4015 Type2 get type => _type; | 4617 Type2 get type => _type; |
4016 bool isConst() => hasModifier(Modifier.CONST); | 4618 bool isConst() => hasModifier(Modifier.CONST); |
4017 bool isFinal() => hasModifier(Modifier.FINAL); | 4619 bool isFinal() => hasModifier(Modifier.FINAL); |
| 4620 |
4018 /** | 4621 /** |
4019 * Set whether this variable is const to correspond to the given value. | 4622 * Set whether this variable is const to correspond to the given value. |
4020 * @param isConst {@code true} if the variable is const | 4623 * @param isConst {@code true} if the variable is const |
4021 */ | 4624 */ |
4022 void set const3(bool isConst) { | 4625 void set const3(bool isConst) { |
4023 setModifier(Modifier.CONST, isConst); | 4626 setModifier(Modifier.CONST, isConst); |
4024 } | 4627 } |
| 4628 |
4025 /** | 4629 /** |
4026 * Set the result of evaluating this variable's initializer as a compile-time
constant expression | 4630 * Set the result of evaluating this variable's initializer as a compile-time
constant expression |
4027 * to the given result. | 4631 * to the given result. |
4028 * @param result the result of evaluating this variable's initializer | 4632 * @param result the result of evaluating this variable's initializer |
4029 */ | 4633 */ |
4030 void set evaluationResult(EvaluationResultImpl result) { | 4634 void set evaluationResult(EvaluationResultImpl result) { |
4031 throw new IllegalStateException("Invalid attempt to set a compile-time const
ant result"); | 4635 throw new IllegalStateException("Invalid attempt to set a compile-time const
ant result"); |
4032 } | 4636 } |
| 4637 |
4033 /** | 4638 /** |
4034 * Set whether this variable is final to correspond to the given value. | 4639 * Set whether this variable is final to correspond to the given value. |
4035 * @param isFinal {@code true} if the variable is final | 4640 * @param isFinal {@code true} if the variable is final |
4036 */ | 4641 */ |
4037 void set final2(bool isFinal) { | 4642 void set final2(bool isFinal) { |
4038 setModifier(Modifier.FINAL, isFinal); | 4643 setModifier(Modifier.FINAL, isFinal); |
4039 } | 4644 } |
| 4645 |
4040 /** | 4646 /** |
4041 * Set the function representing this variable's initializer to the given func
tion. | 4647 * Set the function representing this variable's initializer to the given func
tion. |
4042 * @param initializer the function representing this variable's initializer | 4648 * @param initializer the function representing this variable's initializer |
4043 */ | 4649 */ |
4044 void set initializer(FunctionElement initializer2) { | 4650 void set initializer(FunctionElement initializer2) { |
4045 if (initializer2 != null) { | 4651 if (initializer2 != null) { |
4046 ((initializer2 as FunctionElementImpl)).enclosingElement = this; | 4652 ((initializer2 as FunctionElementImpl)).enclosingElement = this; |
4047 } | 4653 } |
4048 this._initializer = initializer2; | 4654 this._initializer = initializer2; |
4049 } | 4655 } |
| 4656 |
4050 /** | 4657 /** |
4051 * Set the declared type of this variable to the given type. | 4658 * Set the declared type of this variable to the given type. |
4052 * @param type the declared type of this variable | 4659 * @param type the declared type of this variable |
4053 */ | 4660 */ |
4054 void set type(Type2 type2) { | 4661 void set type(Type2 type2) { |
4055 this._type = type2; | 4662 this._type = type2; |
4056 } | 4663 } |
4057 void visitChildren(ElementVisitor<Object> visitor) { | 4664 void visitChildren(ElementVisitor<Object> visitor) { |
4058 super.visitChildren(visitor); | 4665 super.visitChildren(visitor); |
4059 safelyVisitChild(_initializer, visitor); | 4666 safelyVisitChild(_initializer, visitor); |
4060 } | 4667 } |
4061 void appendTo(JavaStringBuilder builder) { | 4668 void appendTo(JavaStringBuilder builder) { |
4062 builder.append(type); | 4669 builder.append(type); |
4063 builder.append(" "); | 4670 builder.append(" "); |
4064 builder.append(name); | 4671 builder.append(displayName); |
4065 } | 4672 } |
4066 } | 4673 } |
| 4674 |
| 4675 /** |
| 4676 * Instances of the class {@code ConstructorMember} represent a constructor elem
ent defined in a |
| 4677 * parameterized type where the values of the type parameters are known. |
| 4678 */ |
| 4679 class ConstructorMember extends ExecutableMember implements ConstructorElement { |
| 4680 |
| 4681 /** |
| 4682 * If the given constructor's type is different when any type parameters from
the defining type's |
| 4683 * declaration are replaced with the actual type arguments from the defining t
ype, create a |
| 4684 * constructor member representing the given constructor. Return the member th
at was created, or |
| 4685 * the base constructor if no member was created. |
| 4686 * @param baseConstructor the base constructor for which a member might be cre
ated |
| 4687 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 4688 * substitution |
| 4689 * @return the constructor element that will return the correctly substituted
types |
| 4690 */ |
| 4691 static ConstructorElement from(ConstructorElement baseConstructor, InterfaceTy
pe definingType) { |
| 4692 if (baseConstructor == null || definingType.typeArguments.length == 0) { |
| 4693 return baseConstructor; |
| 4694 } |
| 4695 FunctionType baseType = baseConstructor.type; |
| 4696 List<Type2> argumentTypes = definingType.typeArguments; |
| 4697 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); |
| 4698 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter
Types); |
| 4699 if (baseType == substitutedType) { |
| 4700 return baseConstructor; |
| 4701 } |
| 4702 return new ConstructorMember(baseConstructor, definingType); |
| 4703 } |
| 4704 |
| 4705 /** |
| 4706 * Initialize a newly created element to represent a constructor of the given
parameterized type. |
| 4707 * @param baseElement the element on which the parameterized element was creat
ed |
| 4708 * @param definingType the type in which the element is defined |
| 4709 */ |
| 4710 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType)
: super(baseElement, definingType) { |
| 4711 } |
| 4712 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 4713 ConstructorElement get baseElement => super.baseElement as ConstructorElement; |
| 4714 ClassElement get enclosingElement => baseElement.enclosingElement; |
| 4715 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon
structor, definingType); |
| 4716 bool isConst() => baseElement.isConst(); |
| 4717 bool isFactory() => baseElement.isFactory(); |
| 4718 String toString() { |
| 4719 ConstructorElement baseElement2 = baseElement; |
| 4720 List<ParameterElement> parameters2 = parameters; |
| 4721 FunctionType type2 = type; |
| 4722 JavaStringBuilder builder = new JavaStringBuilder(); |
| 4723 builder.append(baseElement2.enclosingElement.displayName); |
| 4724 String name = displayName; |
| 4725 if (name != null && !name.isEmpty) { |
| 4726 builder.append("."); |
| 4727 builder.append(name); |
| 4728 } |
| 4729 builder.append("("); |
| 4730 int parameterCount = parameters2.length; |
| 4731 for (int i = 0; i < parameterCount; i++) { |
| 4732 if (i > 0) { |
| 4733 builder.append(", "); |
| 4734 } |
| 4735 builder.append(parameters2[i]).toString(); |
| 4736 } |
| 4737 builder.append(")"); |
| 4738 if (type2 != null) { |
| 4739 builder.append(" -> "); |
| 4740 builder.append(type2.returnType); |
| 4741 } |
| 4742 return builder.toString(); |
| 4743 } |
| 4744 InterfaceType get definingType => super.definingType as InterfaceType; |
| 4745 } |
| 4746 |
4067 /** | 4747 /** |
4068 * The abstract class {@code ExecutableMember} defines the behavior common to me
mbers that represent | 4748 * The abstract class {@code ExecutableMember} defines the behavior common to me
mbers that represent |
4069 * an executable element defined in a parameterized type where the values of the
type parameters are | 4749 * an executable element defined in a parameterized type where the values of the
type parameters are |
4070 * known. | 4750 * known. |
4071 */ | 4751 */ |
4072 abstract class ExecutableMember extends Member implements ExecutableElement { | 4752 abstract class ExecutableMember extends Member implements ExecutableElement { |
| 4753 |
4073 /** | 4754 /** |
4074 * Initialize a newly created element to represent an executable element of th
e given | 4755 * Initialize a newly created element to represent an executable element of th
e given |
4075 * parameterized type. | 4756 * parameterized type. |
4076 * @param baseElement the element on which the parameterized element was creat
ed | 4757 * @param baseElement the element on which the parameterized element was creat
ed |
4077 * @param definingType the type in which the element is defined | 4758 * @param definingType the type in which the element is defined |
4078 */ | 4759 */ |
4079 ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) :
super(baseElement, definingType) { | 4760 ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) :
super(baseElement, definingType) { |
4080 } | 4761 } |
4081 ExecutableElement get baseElement => super.baseElement as ExecutableElement; | 4762 ExecutableElement get baseElement => super.baseElement as ExecutableElement; |
4082 List<FunctionElement> get functions { | 4763 List<FunctionElement> get functions { |
(...skipping 19 matching lines...) Expand all Loading... |
4102 bool isOperator() => baseElement.isOperator(); | 4783 bool isOperator() => baseElement.isOperator(); |
4103 bool isStatic() => baseElement.isStatic(); | 4784 bool isStatic() => baseElement.isStatic(); |
4104 void visitChildren(ElementVisitor<Object> visitor) { | 4785 void visitChildren(ElementVisitor<Object> visitor) { |
4105 super.visitChildren(visitor); | 4786 super.visitChildren(visitor); |
4106 safelyVisitChildren(baseElement.functions, visitor); | 4787 safelyVisitChildren(baseElement.functions, visitor); |
4107 safelyVisitChildren(labels, visitor); | 4788 safelyVisitChildren(labels, visitor); |
4108 safelyVisitChildren(baseElement.localVariables, visitor); | 4789 safelyVisitChildren(baseElement.localVariables, visitor); |
4109 safelyVisitChildren(parameters, visitor); | 4790 safelyVisitChildren(parameters, visitor); |
4110 } | 4791 } |
4111 } | 4792 } |
| 4793 |
4112 /** | 4794 /** |
4113 * Instances of the class {@code FieldMember} represent a field element defined
in a parameterized | 4795 * Instances of the class {@code FieldMember} represent a field element defined
in a parameterized |
4114 * type where the values of the type parameters are known. | 4796 * type where the values of the type parameters are known. |
4115 */ | 4797 */ |
4116 class FieldMember extends VariableMember implements FieldElement { | 4798 class FieldMember extends VariableMember implements FieldElement { |
| 4799 |
4117 /** | 4800 /** |
4118 * If the given field's type is different when any type parameters from the de
fining type's | 4801 * If the given field's type is different when any type parameters from the de
fining type's |
4119 * declaration are replaced with the actual type arguments from the defining t
ype, create a field | 4802 * declaration are replaced with the actual type arguments from the defining t
ype, create a field |
4120 * member representing the given field. Return the member that was created, or
the base field if | 4803 * member representing the given field. Return the member that was created, or
the base field if |
4121 * no member was created. | 4804 * no member was created. |
4122 * @param baseField the base field for which a member might be created | 4805 * @param baseField the base field for which a member might be created |
4123 * @param definingType the type defining the parameters and arguments to be us
ed in the | 4806 * @param definingType the type defining the parameters and arguments to be us
ed in the |
4124 * substitution | 4807 * substitution |
4125 * @return the field element that will return the correctly substituted types | 4808 * @return the field element that will return the correctly substituted types |
4126 */ | 4809 */ |
4127 static FieldElement from(FieldElement baseField, InterfaceType definingType) { | 4810 static FieldElement from(FieldElement baseField, InterfaceType definingType) { |
4128 if (baseField == null || definingType.typeArguments.length == 0) { | 4811 if (baseField == null || definingType.typeArguments.length == 0) { |
4129 return baseField; | 4812 return baseField; |
4130 } | 4813 } |
4131 Type2 baseType = baseField.type; | 4814 Type2 baseType = baseField.type; |
4132 if (baseType == null) { | 4815 if (baseType == null) { |
4133 return baseField; | 4816 return baseField; |
4134 } | 4817 } |
4135 List<Type2> argumentTypes = definingType.typeArguments; | 4818 List<Type2> argumentTypes = definingType.typeArguments; |
4136 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); | 4819 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); |
4137 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); | 4820 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); |
4138 if (baseType == substitutedType) { | 4821 if (baseType == substitutedType) { |
4139 return baseField; | 4822 return baseField; |
4140 } | 4823 } |
4141 return new FieldMember(baseField, definingType); | 4824 return new FieldMember(baseField, definingType); |
4142 } | 4825 } |
| 4826 |
4143 /** | 4827 /** |
4144 * Initialize a newly created element to represent a field of the given parame
terized type. | 4828 * Initialize a newly created element to represent a field of the given parame
terized type. |
4145 * @param baseElement the element on which the parameterized element was creat
ed | 4829 * @param baseElement the element on which the parameterized element was creat
ed |
4146 * @param definingType the type in which the element is defined | 4830 * @param definingType the type in which the element is defined |
4147 */ | 4831 */ |
4148 FieldMember(FieldElement baseElement, InterfaceType definingType) : super(base
Element, definingType) { | 4832 FieldMember(FieldElement baseElement, InterfaceType definingType) : super(base
Element, definingType) { |
4149 } | 4833 } |
4150 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 4834 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
4151 FieldElement get baseElement => super.baseElement as FieldElement; | 4835 FieldElement get baseElement => super.baseElement as FieldElement; |
4152 ClassElement get enclosingElement => baseElement.enclosingElement; | 4836 ClassElement get enclosingElement => baseElement.enclosingElement; |
4153 PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement.
getter, definingType); | 4837 PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement.
getter, definingType); |
4154 PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement.
setter, definingType); | 4838 PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement.
setter, definingType); |
4155 bool isStatic() => baseElement.isStatic(); | 4839 bool isStatic() => baseElement.isStatic(); |
| 4840 InterfaceType get definingType => super.definingType as InterfaceType; |
4156 } | 4841 } |
| 4842 |
4157 /** | 4843 /** |
4158 * The abstract class {@code Member} defines the behavior common to elements tha
t represent members | 4844 * The abstract class {@code Member} defines the behavior common to elements tha
t represent members |
4159 * of parameterized types. | 4845 * of parameterized types. |
4160 */ | 4846 */ |
4161 abstract class Member implements Element { | 4847 abstract class Member implements Element { |
| 4848 |
4162 /** | 4849 /** |
4163 * The element on which the parameterized element was created. | 4850 * The element on which the parameterized element was created. |
4164 */ | 4851 */ |
4165 Element _baseElement; | 4852 Element _baseElement; |
| 4853 |
4166 /** | 4854 /** |
4167 * The type in which the element is defined. | 4855 * The type in which the element is defined. |
4168 */ | 4856 */ |
4169 InterfaceType _definingType; | 4857 ParameterizedType _definingType; |
| 4858 |
4170 /** | 4859 /** |
4171 * Initialize a newly created element to represent the member of the given par
ameterized type. | 4860 * Initialize a newly created element to represent the member of the given par
ameterized type. |
4172 * @param baseElement the element on which the parameterized element was creat
ed | 4861 * @param baseElement the element on which the parameterized element was creat
ed |
4173 * @param definingType the type in which the element is defined | 4862 * @param definingType the type in which the element is defined |
4174 */ | 4863 */ |
4175 Member(Element baseElement, InterfaceType definingType) { | 4864 Member(Element baseElement, ParameterizedType definingType) { |
4176 this._baseElement = baseElement; | 4865 this._baseElement = baseElement; |
4177 this._definingType = definingType; | 4866 this._definingType = definingType; |
4178 } | 4867 } |
4179 String computeDocumentationComment() => _baseElement.computeDocumentationComme
nt(); | 4868 String computeDocumentationComment() => _baseElement.computeDocumentationComme
nt(); |
4180 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass
); | 4869 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass
); |
| 4870 |
4181 /** | 4871 /** |
4182 * Return the element on which the parameterized element was created. | 4872 * Return the element on which the parameterized element was created. |
4183 * @return the element on which the parameterized element was created | 4873 * @return the element on which the parameterized element was created |
4184 */ | 4874 */ |
4185 Element get baseElement => _baseElement; | 4875 Element get baseElement => _baseElement; |
4186 AnalysisContext get context => _baseElement.context; | 4876 AnalysisContext get context => _baseElement.context; |
| 4877 String get displayName => _baseElement.displayName; |
4187 ElementKind get kind => _baseElement.kind; | 4878 ElementKind get kind => _baseElement.kind; |
4188 LibraryElement get library => _baseElement.library; | 4879 LibraryElement get library => _baseElement.library; |
4189 ElementLocation get location => _baseElement.location; | 4880 ElementLocation get location => _baseElement.location; |
4190 List<Annotation> get metadata { | 4881 List<Annotation> get metadata => _baseElement.metadata; |
4191 throw new UnsupportedOperationException(); | |
4192 } | |
4193 String get name => _baseElement.name; | 4882 String get name => _baseElement.name; |
4194 int get nameOffset => _baseElement.nameOffset; | 4883 int get nameOffset => _baseElement.nameOffset; |
4195 Source get source => _baseElement.source; | 4884 Source get source => _baseElement.source; |
4196 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib
rary); | 4885 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib
rary); |
4197 bool isSynthetic() => _baseElement.isSynthetic(); | 4886 bool isSynthetic() => _baseElement.isSynthetic(); |
4198 void visitChildren(ElementVisitor<Object> visitor) { | 4887 void visitChildren(ElementVisitor<Object> visitor) { |
4199 } | 4888 } |
| 4889 |
4200 /** | 4890 /** |
4201 * Return the type in which the element is defined. | 4891 * Return the type in which the element is defined. |
4202 * @return the type in which the element is defined | 4892 * @return the type in which the element is defined |
4203 */ | 4893 */ |
4204 InterfaceType get definingType => _definingType; | 4894 ParameterizedType get definingType => _definingType; |
| 4895 |
4205 /** | 4896 /** |
4206 * If the given child is not {@code null}, use the given visitor to visit it. | 4897 * If the given child is not {@code null}, use the given visitor to visit it. |
4207 * @param child the child to be visited | 4898 * @param child the child to be visited |
4208 * @param visitor the visitor to be used to visit the child | 4899 * @param visitor the visitor to be used to visit the child |
4209 */ | 4900 */ |
4210 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { | 4901 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { |
4211 if (child != null) { | 4902 if (child != null) { |
4212 child.accept(visitor); | 4903 child.accept(visitor); |
4213 } | 4904 } |
4214 } | 4905 } |
| 4906 |
4215 /** | 4907 /** |
4216 * Use the given visitor to visit all of the children in the given array. | 4908 * Use the given visitor to visit all of the children in the given array. |
4217 * @param children the children to be visited | 4909 * @param children the children to be visited |
4218 * @param visitor the visitor being used to visit the children | 4910 * @param visitor the visitor being used to visit the children |
4219 */ | 4911 */ |
4220 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito
r) { | 4912 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito
r) { |
4221 if (children != null) { | 4913 if (children != null) { |
4222 for (Element child in children) { | 4914 for (Element child in children) { |
4223 child.accept(visitor); | 4915 child.accept(visitor); |
4224 } | 4916 } |
4225 } | 4917 } |
4226 } | 4918 } |
| 4919 |
4227 /** | 4920 /** |
4228 * Return the type that results from replacing the type parameters in the give
n type with the type | 4921 * Return the type that results from replacing the type parameters in the give
n type with the type |
4229 * arguments. | 4922 * arguments. |
4230 * @param type the type to be transformed | 4923 * @param type the type to be transformed |
4231 * @return the result of transforming the type | 4924 * @return the result of transforming the type |
4232 */ | 4925 */ |
4233 Type2 substituteFor(Type2 type) { | 4926 Type2 substituteFor(Type2 type) { |
4234 List<Type2> argumentTypes = _definingType.typeArguments; | 4927 List<Type2> argumentTypes = _definingType.typeArguments; |
4235 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.ele
ment.typeVariables); | 4928 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.typ
eVariables); |
4236 return type.substitute2(argumentTypes, parameterTypes) as Type2; | 4929 return type.substitute2(argumentTypes, parameterTypes) as Type2; |
4237 } | 4930 } |
| 4931 |
4238 /** | 4932 /** |
4239 * Return the array of types that results from replacing the type parameters i
n the given types | 4933 * Return the array of types that results from replacing the type parameters i
n the given types |
4240 * with the type arguments. | 4934 * with the type arguments. |
4241 * @param types the types to be transformed | 4935 * @param types the types to be transformed |
4242 * @return the result of transforming the types | 4936 * @return the result of transforming the types |
4243 */ | 4937 */ |
4244 List<InterfaceType> substituteFor2(List<InterfaceType> types) { | 4938 List<InterfaceType> substituteFor2(List<InterfaceType> types) { |
4245 int count = types.length; | 4939 int count = types.length; |
4246 List<InterfaceType> substitutedTypes = new List<InterfaceType>(count); | 4940 List<InterfaceType> substitutedTypes = new List<InterfaceType>(count); |
4247 for (int i = 0; i < count; i++) { | 4941 for (int i = 0; i < count; i++) { |
4248 substitutedTypes[i] = substituteFor(types[i]); | 4942 substitutedTypes[i] = substituteFor(types[i]); |
4249 } | 4943 } |
4250 return substitutedTypes; | 4944 return substitutedTypes; |
4251 } | 4945 } |
4252 } | 4946 } |
| 4947 |
4253 /** | 4948 /** |
4254 * Instances of the class {@code MethodMember} represent a method element define
d in a parameterized | 4949 * Instances of the class {@code MethodMember} represent a method element define
d in a parameterized |
4255 * type where the values of the type parameters are known. | 4950 * type where the values of the type parameters are known. |
4256 */ | 4951 */ |
4257 class MethodMember extends ExecutableMember implements MethodElement { | 4952 class MethodMember extends ExecutableMember implements MethodElement { |
| 4953 |
4258 /** | 4954 /** |
4259 * If the given method's type is different when any type parameters from the d
efining type's | 4955 * If the given method's type is different when any type parameters from the d
efining type's |
4260 * declaration are replaced with the actual type arguments from the defining t
ype, create a method | 4956 * declaration are replaced with the actual type arguments from the defining t
ype, create a method |
4261 * member representing the given method. Return the member that was created, o
r the base method if | 4957 * member representing the given method. Return the member that was created, o
r the base method if |
4262 * no member was created. | 4958 * no member was created. |
4263 * @param baseMethod the base method for which a member might be created | 4959 * @param baseMethod the base method for which a member might be created |
4264 * @param definingType the type defining the parameters and arguments to be us
ed in the | 4960 * @param definingType the type defining the parameters and arguments to be us
ed in the |
4265 * substitution | 4961 * substitution |
4266 * @return the method element that will return the correctly substituted types | 4962 * @return the method element that will return the correctly substituted types |
4267 */ | 4963 */ |
4268 static MethodElement from(MethodElement baseMethod, InterfaceType definingType
) { | 4964 static MethodElement from(MethodElement baseMethod, InterfaceType definingType
) { |
4269 if (baseMethod == null || definingType.typeArguments.length == 0) { | 4965 if (baseMethod == null || definingType.typeArguments.length == 0) { |
4270 return baseMethod; | 4966 return baseMethod; |
4271 } | 4967 } |
4272 FunctionType baseType = baseMethod.type; | 4968 FunctionType baseType = baseMethod.type; |
4273 List<Type2> argumentTypes = definingType.typeArguments; | 4969 List<Type2> argumentTypes = definingType.typeArguments; |
4274 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); | 4970 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); |
4275 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter
Types); | 4971 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter
Types); |
4276 if (baseType == substitutedType) { | 4972 if (baseType == substitutedType) { |
4277 return baseMethod; | 4973 return baseMethod; |
4278 } | 4974 } |
4279 return new MethodMember(baseMethod, definingType); | 4975 return new MethodMember(baseMethod, definingType); |
4280 } | 4976 } |
| 4977 |
4281 /** | 4978 /** |
4282 * Initialize a newly created element to represent a method of the given param
eterized type. | 4979 * Initialize a newly created element to represent a method of the given param
eterized type. |
4283 * @param baseElement the element on which the parameterized element was creat
ed | 4980 * @param baseElement the element on which the parameterized element was creat
ed |
4284 * @param definingType the type in which the element is defined | 4981 * @param definingType the type in which the element is defined |
4285 */ | 4982 */ |
4286 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba
seElement, definingType) { | 4983 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba
seElement, definingType) { |
4287 } | 4984 } |
4288 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 4985 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
4289 MethodElement get baseElement => super.baseElement as MethodElement; | 4986 MethodElement get baseElement => super.baseElement as MethodElement; |
4290 ClassElement get enclosingElement => baseElement.enclosingElement; | 4987 ClassElement get enclosingElement => baseElement.enclosingElement; |
4291 bool isAbstract() => baseElement.isAbstract(); | 4988 bool isAbstract() => baseElement.isAbstract(); |
4292 String toString() { | 4989 String toString() { |
4293 MethodElement baseElement2 = baseElement; | 4990 MethodElement baseElement2 = baseElement; |
4294 List<ParameterElement> parameters2 = parameters; | 4991 List<ParameterElement> parameters2 = parameters; |
4295 FunctionType type2 = type; | 4992 FunctionType type2 = type; |
4296 JavaStringBuilder builder = new JavaStringBuilder(); | 4993 JavaStringBuilder builder = new JavaStringBuilder(); |
4297 builder.append(baseElement2.enclosingElement.name); | 4994 builder.append(baseElement2.enclosingElement.displayName); |
4298 builder.append("."); | 4995 builder.append("."); |
4299 builder.append(baseElement2.name); | 4996 builder.append(baseElement2.displayName); |
4300 builder.append("("); | 4997 builder.append("("); |
4301 int parameterCount = parameters2.length; | 4998 int parameterCount = parameters2.length; |
4302 for (int i = 0; i < parameterCount; i++) { | 4999 for (int i = 0; i < parameterCount; i++) { |
4303 if (i > 0) { | 5000 if (i > 0) { |
4304 builder.append(", "); | 5001 builder.append(", "); |
4305 } | 5002 } |
4306 builder.append(parameters2[i]).toString(); | 5003 builder.append(parameters2[i]).toString(); |
4307 } | 5004 } |
4308 builder.append(")"); | 5005 builder.append(")"); |
4309 if (type2 != null) { | 5006 if (type2 != null) { |
4310 builder.append(" -> "); | 5007 builder.append(" -> "); |
4311 builder.append(type2.returnType); | 5008 builder.append(type2.returnType); |
4312 } | 5009 } |
4313 return builder.toString(); | 5010 return builder.toString(); |
4314 } | 5011 } |
4315 } | 5012 } |
| 5013 |
4316 /** | 5014 /** |
4317 * Instances of the class {@code ParameterMember} represent a parameter element
defined in a | 5015 * Instances of the class {@code ParameterMember} represent a parameter element
defined in a |
4318 * parameterized type where the values of the type parameters are known. | 5016 * parameterized type where the values of the type parameters are known. |
4319 */ | 5017 */ |
4320 class ParameterMember extends VariableMember implements ParameterElement { | 5018 class ParameterMember extends VariableMember implements ParameterElement { |
| 5019 |
4321 /** | 5020 /** |
4322 * If the given parameter's type is different when any type parameters from th
e defining type's | 5021 * If the given parameter's type is different when any type parameters from th
e defining type's |
4323 * declaration are replaced with the actual type arguments from the defining t
ype, create a | 5022 * declaration are replaced with the actual type arguments from the defining t
ype, create a |
4324 * parameter member representing the given parameter. Return the member that w
as created, or the | 5023 * parameter member representing the given parameter. Return the member that w
as created, or the |
4325 * base parameter if no member was created. | 5024 * base parameter if no member was created. |
4326 * @param baseParameter the base parameter for which a member might be created | 5025 * @param baseParameter the base parameter for which a member might be created |
4327 * @param definingType the type defining the parameters and arguments to be us
ed in the | 5026 * @param definingType the type defining the parameters and arguments to be us
ed in the |
4328 * substitution | 5027 * substitution |
4329 * @return the parameter element that will return the correctly substituted ty
pes | 5028 * @return the parameter element that will return the correctly substituted ty
pes |
4330 */ | 5029 */ |
4331 static ParameterElement from(ParameterElement baseParameter, InterfaceType def
iningType) { | 5030 static ParameterElement from(ParameterElement baseParameter, ParameterizedType
definingType) { |
4332 if (baseParameter == null || definingType.typeArguments.length == 0) { | 5031 if (baseParameter == null || definingType.typeArguments.length == 0) { |
4333 return baseParameter; | 5032 return baseParameter; |
4334 } | 5033 } |
4335 Type2 baseType = baseParameter.type; | 5034 Type2 baseType = baseParameter.type; |
4336 List<Type2> argumentTypes = definingType.typeArguments; | 5035 List<Type2> argumentTypes = definingType.typeArguments; |
4337 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); | 5036 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.type
Variables); |
4338 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); | 5037 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); |
4339 if (baseType == substitutedType) { | 5038 if (baseType == substitutedType) { |
4340 return baseParameter; | 5039 return baseParameter; |
4341 } | 5040 } |
4342 return new ParameterMember(baseParameter, definingType); | 5041 return new ParameterMember(baseParameter, definingType); |
4343 } | 5042 } |
| 5043 |
4344 /** | 5044 /** |
4345 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. | 5045 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. |
4346 * @param baseElement the element on which the parameterized element was creat
ed | 5046 * @param baseElement the element on which the parameterized element was creat
ed |
4347 * @param definingType the type in which the element is defined | 5047 * @param definingType the type in which the element is defined |
4348 */ | 5048 */ |
4349 ParameterMember(ParameterElement baseElement, InterfaceType definingType) : su
per(baseElement, definingType) { | 5049 ParameterMember(ParameterElement baseElement, ParameterizedType definingType)
: super(baseElement, definingType) { |
4350 } | 5050 } |
4351 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); | 5051 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
4352 Element getAncestor(Type elementClass) { | 5052 Element getAncestor(Type elementClass) { |
4353 Element element = baseElement.getAncestor(elementClass); | 5053 Element element = baseElement.getAncestor(elementClass); |
4354 if (element is MethodElement) { | 5054 ParameterizedType definingType2 = definingType; |
4355 return MethodMember.from((element as MethodElement), definingType) as Elem
ent; | 5055 if (definingType2 is InterfaceType) { |
4356 } else if (element is PropertyAccessorElement) { | 5056 InterfaceType definingInterfaceType = definingType2 as InterfaceType; |
4357 return PropertyAccessorMember.from((element as PropertyAccessorElement), d
efiningType) as Element; | 5057 if (element is ConstructorElement) { |
| 5058 return ConstructorMember.from((element as ConstructorElement), definingI
nterfaceType) as Element; |
| 5059 } else if (element is MethodElement) { |
| 5060 return MethodMember.from((element as MethodElement), definingInterfaceTy
pe) as Element; |
| 5061 } else if (element is PropertyAccessorElement) { |
| 5062 return PropertyAccessorMember.from((element as PropertyAccessorElement),
definingInterfaceType) as Element; |
| 5063 } |
4358 } | 5064 } |
4359 return element; | 5065 return element; |
4360 } | 5066 } |
4361 ParameterElement get baseElement => super.baseElement as ParameterElement; | 5067 ParameterElement get baseElement => super.baseElement as ParameterElement; |
4362 Element get enclosingElement => baseElement.enclosingElement; | 5068 Element get enclosingElement => baseElement.enclosingElement; |
4363 ParameterKind get parameterKind => baseElement.parameterKind; | 5069 ParameterKind get parameterKind => baseElement.parameterKind; |
4364 List<ParameterElement> get parameters { | 5070 List<ParameterElement> get parameters { |
4365 List<ParameterElement> baseParameters = baseElement.parameters; | 5071 List<ParameterElement> baseParameters = baseElement.parameters; |
4366 int parameterCount = baseParameters.length; | 5072 int parameterCount = baseParameters.length; |
4367 if (parameterCount == 0) { | 5073 if (parameterCount == 0) { |
(...skipping 18 matching lines...) Expand all Loading... |
4386 } else if (baseElement2.parameterKind == ParameterKind.POSITIONAL) { | 5092 } else if (baseElement2.parameterKind == ParameterKind.POSITIONAL) { |
4387 left = "["; | 5093 left = "["; |
4388 right = "]"; | 5094 right = "]"; |
4389 } | 5095 } |
4390 break; | 5096 break; |
4391 } | 5097 } |
4392 JavaStringBuilder builder = new JavaStringBuilder(); | 5098 JavaStringBuilder builder = new JavaStringBuilder(); |
4393 builder.append(left); | 5099 builder.append(left); |
4394 builder.append(type); | 5100 builder.append(type); |
4395 builder.append(" "); | 5101 builder.append(" "); |
4396 builder.append(baseElement2.name); | 5102 builder.append(baseElement2.displayName); |
4397 builder.append(right); | 5103 builder.append(right); |
4398 return builder.toString(); | 5104 return builder.toString(); |
4399 } | 5105 } |
4400 void visitChildren(ElementVisitor<Object> visitor) { | 5106 void visitChildren(ElementVisitor<Object> visitor) { |
4401 super.visitChildren(visitor); | 5107 super.visitChildren(visitor); |
4402 safelyVisitChildren(parameters, visitor); | 5108 safelyVisitChildren(parameters, visitor); |
4403 } | 5109 } |
4404 } | 5110 } |
| 5111 |
4405 /** | 5112 /** |
4406 * Instances of the class {@code PropertyAccessorMember} represent a property ac
cessor element | 5113 * Instances of the class {@code PropertyAccessorMember} represent a property ac
cessor element |
4407 * defined in a parameterized type where the values of the type parameters are k
nown. | 5114 * defined in a parameterized type where the values of the type parameters are k
nown. |
4408 */ | 5115 */ |
4409 class PropertyAccessorMember extends ExecutableMember implements PropertyAccesso
rElement { | 5116 class PropertyAccessorMember extends ExecutableMember implements PropertyAccesso
rElement { |
| 5117 |
4410 /** | 5118 /** |
4411 * If the given property accessor's type is different when any type parameters
from the defining | 5119 * If the given property accessor's type is different when any type parameters
from the defining |
4412 * type's declaration are replaced with the actual type arguments from the def
ining type, create a | 5120 * type's declaration are replaced with the actual type arguments from the def
ining type, create a |
4413 * property accessor member representing the given property accessor. Return t
he member that was | 5121 * property accessor member representing the given property accessor. Return t
he member that was |
4414 * created, or the base accessor if no member was created. | 5122 * created, or the base accessor if no member was created. |
4415 * @param baseAccessor the base property accessor for which a member might be
created | 5123 * @param baseAccessor the base property accessor for which a member might be
created |
4416 * @param definingType the type defining the parameters and arguments to be us
ed in the | 5124 * @param definingType the type defining the parameters and arguments to be us
ed in the |
4417 * substitution | 5125 * substitution |
4418 * @return the property accessor element that will return the correctly substi
tuted types | 5126 * @return the property accessor element that will return the correctly substi
tuted types |
4419 */ | 5127 */ |
4420 static PropertyAccessorElement from(PropertyAccessorElement baseAccessor, Inte
rfaceType definingType) { | 5128 static PropertyAccessorElement from(PropertyAccessorElement baseAccessor, Inte
rfaceType definingType) { |
4421 if (baseAccessor == null || definingType.typeArguments.length == 0) { | 5129 if (baseAccessor == null || definingType.typeArguments.length == 0) { |
4422 return baseAccessor; | 5130 return baseAccessor; |
4423 } | 5131 } |
4424 FunctionType baseType = baseAccessor.type; | 5132 FunctionType baseType = baseAccessor.type; |
4425 List<Type2> argumentTypes = definingType.typeArguments; | 5133 List<Type2> argumentTypes = definingType.typeArguments; |
4426 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); | 5134 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.elem
ent.typeVariables); |
4427 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter
Types); | 5135 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter
Types); |
4428 if (baseType == substitutedType) { | 5136 if (baseType == substitutedType) { |
4429 return baseAccessor; | 5137 return baseAccessor; |
4430 } | 5138 } |
4431 return new PropertyAccessorMember(baseAccessor, definingType); | 5139 return new PropertyAccessorMember(baseAccessor, definingType); |
4432 } | 5140 } |
| 5141 |
4433 /** | 5142 /** |
4434 * Initialize a newly created element to represent a property accessor of the
given parameterized | 5143 * Initialize a newly created element to represent a property accessor of the
given parameterized |
4435 * type. | 5144 * type. |
4436 * @param baseElement the element on which the parameterized element was creat
ed | 5145 * @param baseElement the element on which the parameterized element was creat
ed |
4437 * @param definingType the type in which the element is defined | 5146 * @param definingType the type in which the element is defined |
4438 */ | 5147 */ |
4439 PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType defi
ningType) : super(baseElement, definingType) { | 5148 PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType defi
ningType) : super(baseElement, definingType) { |
4440 } | 5149 } |
4441 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 5150 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
4442 PropertyAccessorElement get baseElement => super.baseElement as PropertyAccess
orElement; | 5151 PropertyAccessorElement get baseElement => super.baseElement as PropertyAccess
orElement; |
| 5152 PropertyAccessorElement get correspondingGetter => from(baseElement.correspond
ingGetter, definingType); |
| 5153 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond
ingSetter, definingType); |
4443 Element get enclosingElement => baseElement.enclosingElement; | 5154 Element get enclosingElement => baseElement.enclosingElement; |
4444 PropertyInducingElement get variable { | 5155 PropertyInducingElement get variable { |
4445 PropertyInducingElement variable2 = baseElement.variable; | 5156 PropertyInducingElement variable2 = baseElement.variable; |
4446 if (variable2 is FieldElement) { | 5157 if (variable2 is FieldElement) { |
4447 return FieldMember.from(((variable2 as FieldElement)), definingType); | 5158 return FieldMember.from(((variable2 as FieldElement)), definingType); |
4448 } | 5159 } |
4449 return variable2; | 5160 return variable2; |
4450 } | 5161 } |
| 5162 bool isAbstract() => baseElement.isAbstract(); |
4451 bool isGetter() => baseElement.isGetter(); | 5163 bool isGetter() => baseElement.isGetter(); |
4452 bool isSetter() => baseElement.isSetter(); | 5164 bool isSetter() => baseElement.isSetter(); |
| 5165 InterfaceType get definingType => super.definingType as InterfaceType; |
4453 } | 5166 } |
| 5167 |
4454 /** | 5168 /** |
4455 * The abstract class {@code VariableMember} defines the behavior common to memb
ers that represent a | 5169 * The abstract class {@code VariableMember} defines the behavior common to memb
ers that represent a |
4456 * variable element defined in a parameterized type where the values of the type
parameters are | 5170 * variable element defined in a parameterized type where the values of the type
parameters are |
4457 * known. | 5171 * known. |
4458 */ | 5172 */ |
4459 abstract class VariableMember extends Member implements VariableElement { | 5173 abstract class VariableMember extends Member implements VariableElement { |
| 5174 |
4460 /** | 5175 /** |
4461 * Initialize a newly created element to represent an executable element of th
e given | 5176 * Initialize a newly created element to represent an executable element of th
e given |
4462 * parameterized type. | 5177 * parameterized type. |
4463 * @param baseElement the element on which the parameterized element was creat
ed | 5178 * @param baseElement the element on which the parameterized element was creat
ed |
4464 * @param definingType the type in which the element is defined | 5179 * @param definingType the type in which the element is defined |
4465 */ | 5180 */ |
4466 VariableMember(VariableElement baseElement, InterfaceType definingType) : supe
r(baseElement, definingType) { | 5181 VariableMember(VariableElement baseElement, ParameterizedType definingType) :
super(baseElement, definingType) { |
4467 } | 5182 } |
4468 VariableElement get baseElement => super.baseElement as VariableElement; | 5183 VariableElement get baseElement => super.baseElement as VariableElement; |
4469 FunctionElement get initializer { | 5184 FunctionElement get initializer { |
4470 throw new UnsupportedOperationException(); | 5185 throw new UnsupportedOperationException(); |
4471 } | 5186 } |
4472 Type2 get type => substituteFor(baseElement.type); | 5187 Type2 get type => substituteFor(baseElement.type); |
4473 bool isConst() => baseElement.isConst(); | 5188 bool isConst() => baseElement.isConst(); |
4474 bool isFinal() => baseElement.isFinal(); | 5189 bool isFinal() => baseElement.isFinal(); |
4475 void visitChildren(ElementVisitor<Object> visitor) { | 5190 void visitChildren(ElementVisitor<Object> visitor) { |
4476 super.visitChildren(visitor); | 5191 super.visitChildren(visitor); |
4477 safelyVisitChild(baseElement.initializer, visitor); | 5192 safelyVisitChild(baseElement.initializer, visitor); |
4478 } | 5193 } |
4479 } | 5194 } |
| 5195 |
| 5196 /** |
| 5197 * Instances of the class {@code AnonymousFunctionTypeImpl} extend the behavior
of{@link FunctionTypeImpl} to support anonymous function types created for funct
ion typed |
| 5198 * parameters. |
| 5199 * @coverage dart.engine.type |
| 5200 */ |
| 5201 class AnonymousFunctionTypeImpl extends FunctionTypeImpl { |
| 5202 |
| 5203 /** |
| 5204 * An array of parameters elements of this type of function. |
| 5205 */ |
| 5206 List<ParameterElement> _baseParameters = ParameterElementImpl.EMPTY_ARRAY; |
| 5207 AnonymousFunctionTypeImpl() : super.con2((null as FunctionTypeAliasElement)) { |
| 5208 } |
| 5209 |
| 5210 /** |
| 5211 * Sets the parameters elements of this type of function. |
| 5212 * @param parameters the parameters elements of this type of function |
| 5213 */ |
| 5214 void set baseParameters(List<ParameterElement> parameters) { |
| 5215 this._baseParameters = parameters; |
| 5216 } |
| 5217 List<ParameterElement> get baseParameters => _baseParameters; |
| 5218 } |
| 5219 |
4480 /** | 5220 /** |
4481 * The unique instance of the class {@code BottomTypeImpl} implements the type {
@code bottom}. | 5221 * The unique instance of the class {@code BottomTypeImpl} implements the type {
@code bottom}. |
4482 * @coverage dart.engine.type | 5222 * @coverage dart.engine.type |
4483 */ | 5223 */ |
4484 class BottomTypeImpl extends TypeImpl { | 5224 class BottomTypeImpl extends TypeImpl { |
| 5225 |
4485 /** | 5226 /** |
4486 * The unique instance of this class. | 5227 * The unique instance of this class. |
4487 */ | 5228 */ |
4488 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); | 5229 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); |
| 5230 |
4489 /** | 5231 /** |
4490 * Return the unique instance of this class. | 5232 * Return the unique instance of this class. |
4491 * @return the unique instance of this class | 5233 * @return the unique instance of this class |
4492 */ | 5234 */ |
4493 static BottomTypeImpl get instance => _INSTANCE; | 5235 static BottomTypeImpl get instance => _INSTANCE; |
| 5236 |
4494 /** | 5237 /** |
4495 * Prevent the creation of instances of this class. | 5238 * Prevent the creation of instances of this class. |
4496 */ | 5239 */ |
4497 BottomTypeImpl() : super(null, "<bottom>") { | 5240 BottomTypeImpl() : super(null, "<bottom>") { |
4498 } | 5241 } |
4499 bool operator ==(Object object) => identical(object, this); | 5242 bool operator ==(Object object) => identical(object, this); |
4500 bool isMoreSpecificThan(Type2 type) => true; | 5243 bool isMoreSpecificThan(Type2 type) => true; |
4501 bool isSubtypeOf(Type2 type) => true; | 5244 bool isSubtypeOf(Type2 type) => true; |
4502 bool isSupertypeOf(Type2 type) => false; | 5245 bool isSupertypeOf(Type2 type) => false; |
4503 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp
es) => this; | 5246 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp
es) => this; |
4504 } | 5247 } |
| 5248 |
4505 /** | 5249 /** |
4506 * The unique instance of the class {@code DynamicTypeImpl} implements the type
{@code dynamic}. | 5250 * The unique instance of the class {@code DynamicTypeImpl} implements the type
{@code dynamic}. |
4507 * @coverage dart.engine.type | 5251 * @coverage dart.engine.type |
4508 */ | 5252 */ |
4509 class DynamicTypeImpl extends TypeImpl { | 5253 class DynamicTypeImpl extends TypeImpl { |
| 5254 |
4510 /** | 5255 /** |
4511 * The unique instance of this class. | 5256 * The unique instance of this class. |
4512 */ | 5257 */ |
4513 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); | 5258 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); |
| 5259 |
4514 /** | 5260 /** |
4515 * Return the unique instance of this class. | 5261 * Return the unique instance of this class. |
4516 * @return the unique instance of this class | 5262 * @return the unique instance of this class |
4517 */ | 5263 */ |
4518 static DynamicTypeImpl get instance => _INSTANCE; | 5264 static DynamicTypeImpl get instance => _INSTANCE; |
| 5265 |
4519 /** | 5266 /** |
4520 * Prevent the creation of instances of this class. | 5267 * Prevent the creation of instances of this class. |
4521 */ | 5268 */ |
4522 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { | 5269 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { |
4523 ((element as DynamicElementImpl)).type = this; | 5270 ((element as DynamicElementImpl)).type = this; |
4524 } | 5271 } |
4525 bool operator ==(Object object) => object is DynamicTypeImpl; | 5272 bool operator ==(Object object) => object is DynamicTypeImpl; |
4526 bool isDynamic() => true; | 5273 bool isDynamic() => true; |
4527 bool isMoreSpecificThan(Type2 type) => false; | 5274 bool isMoreSpecificThan(Type2 type) => false; |
4528 bool isSubtypeOf(Type2 type) => identical(this, type); | 5275 bool isSubtypeOf(Type2 type) => identical(this, type); |
4529 bool isSupertypeOf(Type2 type) => true; | 5276 bool isSupertypeOf(Type2 type) => true; |
4530 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy
pes) => this; | 5277 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy
pes) => this; |
4531 } | 5278 } |
| 5279 |
4532 /** | 5280 /** |
4533 * Instances of the class {@code FunctionTypeImpl} defines the behavior common t
o objects | 5281 * Instances of the class {@code FunctionTypeImpl} defines the behavior common t
o objects |
4534 * representing the type of a function, method, constructor, getter, or setter. | 5282 * representing the type of a function, method, constructor, getter, or setter. |
4535 * @coverage dart.engine.type | 5283 * @coverage dart.engine.type |
4536 */ | 5284 */ |
4537 class FunctionTypeImpl extends TypeImpl implements FunctionType { | 5285 class FunctionTypeImpl extends TypeImpl implements FunctionType { |
| 5286 |
4538 /** | 5287 /** |
4539 * Return {@code true} if all of the name/type pairs in the first map are equa
l to the | 5288 * Return {@code true} if all of the name/type pairs in the first map are equa
l to the |
4540 * corresponding name/type pairs in the second map. The maps are expected to i
terate over their | 5289 * corresponding name/type pairs in the second map. The maps are expected to i
terate over their |
4541 * entries in the same order in which those entries were added to the map. | 5290 * entries in the same order in which those entries were added to the map. |
4542 * @param firstTypes the first map of name/type pairs being compared | 5291 * @param firstTypes the first map of name/type pairs being compared |
4543 * @param secondTypes the second map of name/type pairs being compared | 5292 * @param secondTypes the second map of name/type pairs being compared |
4544 * @return {@code true} if all of the name/type pairs in the first map are equ
al to the | 5293 * @return {@code true} if all of the name/type pairs in the first map are equ
al to the |
4545 * corresponding name/type pairs in the second map | 5294 * corresponding name/type pairs in the second map |
4546 */ | 5295 */ |
4547 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy
pes) { | 5296 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy
pes) { |
4548 if (secondTypes.length != firstTypes.length) { | 5297 if (secondTypes.length != firstTypes.length) { |
4549 return false; | 5298 return false; |
4550 } | 5299 } |
4551 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa
pEntrySet(firstTypes)); | 5300 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa
pEntrySet(firstTypes)); |
4552 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM
apEntrySet(firstTypes)); | 5301 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM
apEntrySet(firstTypes)); |
4553 while (firstIterator.hasNext) { | 5302 while (firstIterator.hasNext) { |
4554 MapEntry<String, Type2> firstEntry = firstIterator.next(); | 5303 MapEntry<String, Type2> firstEntry = firstIterator.next(); |
4555 MapEntry<String, Type2> secondEntry = secondIterator.next(); | 5304 MapEntry<String, Type2> secondEntry = secondIterator.next(); |
4556 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() !
= secondEntry.getValue()) { | 5305 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() !
= secondEntry.getValue()) { |
4557 return false; | 5306 return false; |
4558 } | 5307 } |
4559 } | 5308 } |
4560 return true; | 5309 return true; |
4561 } | 5310 } |
| 5311 |
4562 /** | 5312 /** |
4563 * Return a map containing the results of using the given argument types and p
arameter types to | 5313 * Return a map containing the results of using the given argument types and p
arameter types to |
4564 * perform a substitution on all of the values in the given map. The order of
the entries will be | 5314 * perform a substitution on all of the values in the given map. The order of
the entries will be |
4565 * preserved. | 5315 * preserved. |
4566 * @param types the types on which a substitution is to be performed | 5316 * @param types the types on which a substitution is to be performed |
4567 * @param argumentTypes the argument types for the substitution | 5317 * @param argumentTypes the argument types for the substitution |
4568 * @param parameterTypes the parameter types for the substitution | 5318 * @param parameterTypes the parameter types for the substitution |
4569 * @return the result of performing the substitution on each of the types | 5319 * @return the result of performing the substitution on each of the types |
4570 */ | 5320 */ |
4571 static Map<String, Type2> substitute3(Map<String, Type2> types, List<Type2> ar
gumentTypes, List<Type2> parameterTypes) { | 5321 static Map<String, Type2> substitute3(Map<String, Type2> types, List<Type2> ar
gumentTypes, List<Type2> parameterTypes) { |
4572 if (types.isEmpty) { | 5322 if (types.isEmpty) { |
4573 return types; | 5323 return types; |
4574 } | 5324 } |
4575 LinkedHashMap<String, Type2> newTypes = new LinkedHashMap<String, Type2>(); | 5325 LinkedHashMap<String, Type2> newTypes = new LinkedHashMap<String, Type2>(); |
4576 for (MapEntry<String, Type2> entry in getMapEntrySet(types)) { | 5326 for (MapEntry<String, Type2> entry in getMapEntrySet(types)) { |
4577 newTypes[entry.getKey()] = entry.getValue().substitute2(argumentTypes, par
ameterTypes); | 5327 newTypes[entry.getKey()] = entry.getValue().substitute2(argumentTypes, par
ameterTypes); |
4578 } | 5328 } |
4579 return newTypes; | 5329 return newTypes; |
4580 } | 5330 } |
| 5331 |
4581 /** | 5332 /** |
4582 * An array containing the actual types of the type arguments. | 5333 * An array containing the actual types of the type arguments. |
4583 */ | 5334 */ |
4584 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; | 5335 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; |
| 5336 |
4585 /** | 5337 /** |
4586 * An array containing the types of the normal parameters of this type of func
tion. The parameter | 5338 * An array containing the types of the normal parameters of this type of func
tion. The parameter |
4587 * types are in the same order as they appear in the declaration of the functi
on. | 5339 * types are in the same order as they appear in the declaration of the functi
on. |
4588 * @return the types of the normal parameters of this type of function | 5340 * @return the types of the normal parameters of this type of function |
4589 */ | 5341 */ |
4590 List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY; | 5342 List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY; |
| 5343 |
4591 /** | 5344 /** |
4592 * A table mapping the names of optional (positional) parameters to the types
of the optional | 5345 * A table mapping the names of optional (positional) parameters to the types
of the optional |
4593 * parameters of this type of function. | 5346 * parameters of this type of function. |
4594 */ | 5347 */ |
4595 List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY; | 5348 List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY; |
| 5349 |
4596 /** | 5350 /** |
4597 * A table mapping the names of named parameters to the types of the named par
ameters of this type | 5351 * A table mapping the names of named parameters to the types of the named par
ameters of this type |
4598 * of function. | 5352 * of function. |
4599 */ | 5353 */ |
4600 Map<String, Type2> _namedParameterTypes = new Map(); | 5354 Map<String, Type2> _namedParameterTypes = new Map(); |
| 5355 |
4601 /** | 5356 /** |
4602 * The type of object returned by this type of function. | 5357 * The type of object returned by this type of function. |
4603 */ | 5358 */ |
4604 Type2 _returnType = VoidTypeImpl.instance; | 5359 Type2 _returnType = VoidTypeImpl.instance; |
| 5360 |
4605 /** | 5361 /** |
4606 * Initialize a newly created function type to be declared by the given elemen
t and to have the | 5362 * Initialize a newly created function type to be declared by the given elemen
t and to have the |
4607 * given name. | 5363 * given name. |
4608 * @param element the element representing the declaration of the function typ
e | 5364 * @param element the element representing the declaration of the function typ
e |
4609 */ | 5365 */ |
4610 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n
ull ? null : element.name) { | 5366 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n
ull ? null : element.name) { |
4611 _jtd_constructor_291_impl(element); | 5367 _jtd_constructor_298_impl(element); |
4612 } | 5368 } |
4613 _jtd_constructor_291_impl(ExecutableElement element) { | 5369 _jtd_constructor_298_impl(ExecutableElement element) { |
4614 } | 5370 } |
| 5371 |
4615 /** | 5372 /** |
4616 * Initialize a newly created function type to be declared by the given elemen
t and to have the | 5373 * Initialize a newly created function type to be declared by the given elemen
t and to have the |
4617 * given name. | 5374 * given name. |
4618 * @param element the element representing the declaration of the function typ
e | 5375 * @param element the element representing the declaration of the function typ
e |
4619 */ | 5376 */ |
4620 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme
nt == null ? null : element.name) { | 5377 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme
nt == null ? null : element.name) { |
4621 _jtd_constructor_292_impl(element); | 5378 _jtd_constructor_299_impl(element); |
4622 } | 5379 } |
4623 _jtd_constructor_292_impl(FunctionTypeAliasElement element) { | 5380 _jtd_constructor_299_impl(FunctionTypeAliasElement element) { |
4624 } | 5381 } |
4625 bool operator ==(Object object) { | 5382 bool operator ==(Object object) { |
4626 if (object is! FunctionTypeImpl) { | 5383 if (object is! FunctionTypeImpl) { |
4627 return false; | 5384 return false; |
4628 } | 5385 } |
4629 FunctionTypeImpl otherType = object as FunctionTypeImpl; | 5386 FunctionTypeImpl otherType = object as FunctionTypeImpl; |
4630 return element == otherType.element && JavaArrays.equals(_normalParameterTyp
es, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterType
s, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType
._namedParameterTypes) && _returnType == otherType._returnType; | 5387 return element == otherType.element && JavaArrays.equals(_normalParameterTyp
es, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterType
s, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType
._namedParameterTypes) && _returnType == otherType._returnType; |
4631 } | 5388 } |
| 5389 String get displayName { |
| 5390 String name2 = name; |
| 5391 if (name2 == null) { |
| 5392 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5393 builder.append("("); |
| 5394 bool needsComma = false; |
| 5395 if (_normalParameterTypes.length > 0) { |
| 5396 for (Type2 type in _normalParameterTypes) { |
| 5397 if (needsComma) { |
| 5398 builder.append(", "); |
| 5399 } else { |
| 5400 needsComma = true; |
| 5401 } |
| 5402 builder.append(type.displayName); |
| 5403 } |
| 5404 } |
| 5405 if (_optionalParameterTypes.length > 0) { |
| 5406 if (needsComma) { |
| 5407 builder.append(", "); |
| 5408 needsComma = false; |
| 5409 } |
| 5410 builder.append("["); |
| 5411 for (Type2 type in _optionalParameterTypes) { |
| 5412 if (needsComma) { |
| 5413 builder.append(", "); |
| 5414 } else { |
| 5415 needsComma = true; |
| 5416 } |
| 5417 builder.append(type.displayName); |
| 5418 } |
| 5419 builder.append("]"); |
| 5420 needsComma = true; |
| 5421 } |
| 5422 if (_namedParameterTypes.length > 0) { |
| 5423 if (needsComma) { |
| 5424 builder.append(", "); |
| 5425 needsComma = false; |
| 5426 } |
| 5427 builder.append("{"); |
| 5428 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterType
s)) { |
| 5429 if (needsComma) { |
| 5430 builder.append(", "); |
| 5431 } else { |
| 5432 needsComma = true; |
| 5433 } |
| 5434 builder.append(entry.getKey()); |
| 5435 builder.append(": "); |
| 5436 builder.append(entry.getValue().displayName); |
| 5437 } |
| 5438 builder.append("}"); |
| 5439 needsComma = true; |
| 5440 } |
| 5441 builder.append(") -> "); |
| 5442 if (_returnType == null) { |
| 5443 builder.append("null"); |
| 5444 } else { |
| 5445 builder.append(_returnType.displayName); |
| 5446 } |
| 5447 name2 = builder.toString(); |
| 5448 } |
| 5449 return name2; |
| 5450 } |
4632 Map<String, Type2> get namedParameterTypes => _namedParameterTypes; | 5451 Map<String, Type2> get namedParameterTypes => _namedParameterTypes; |
4633 List<Type2> get normalParameterTypes => _normalParameterTypes; | 5452 List<Type2> get normalParameterTypes => _normalParameterTypes; |
4634 List<Type2> get optionalParameterTypes => _optionalParameterTypes; | 5453 List<Type2> get optionalParameterTypes => _optionalParameterTypes; |
| 5454 List<ParameterElement> get parameters { |
| 5455 List<ParameterElement> baseParameters2 = baseParameters; |
| 5456 int parameterCount = baseParameters2.length; |
| 5457 if (parameterCount == 0) { |
| 5458 return baseParameters2; |
| 5459 } |
| 5460 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); |
| 5461 for (int i = 0; i < parameterCount; i++) { |
| 5462 specializedParameters[i] = ParameterMember.from(baseParameters2[i], this); |
| 5463 } |
| 5464 return specializedParameters; |
| 5465 } |
4635 Type2 get returnType => _returnType; | 5466 Type2 get returnType => _returnType; |
4636 List<Type2> get typeArguments => _typeArguments; | 5467 List<Type2> get typeArguments => _typeArguments; |
| 5468 List<TypeVariableElement> get typeVariables { |
| 5469 Element element2 = element; |
| 5470 if (element2 is FunctionTypeAliasElement) { |
| 5471 return ((element2 as FunctionTypeAliasElement)).typeVariables; |
| 5472 } |
| 5473 return TypeVariableElementImpl.EMPTY_ARRAY; |
| 5474 } |
4637 int get hashCode { | 5475 int get hashCode { |
4638 Element element2 = element; | 5476 Element element2 = element; |
4639 if (element2 == null) { | 5477 if (element2 == null) { |
4640 return 0; | 5478 return 0; |
4641 } | 5479 } |
4642 return element2.hashCode; | 5480 return element2.hashCode; |
4643 } | 5481 } |
4644 bool isSubtypeOf(Type2 type) { | 5482 bool isSubtypeOf(Type2 type) { |
4645 if (type == null) { | 5483 if (type == null) { |
4646 return false; | 5484 return false; |
4647 } else if (identical(this, type) || type.isDynamic() || type.isDartCoreFunct
ion()) { | 5485 } else if (identical(this, type) || type.isDynamic() || type.isDartCoreFunct
ion() || type.isObject()) { |
4648 return true; | 5486 return true; |
4649 } else if (type is! FunctionType) { | 5487 } else if (type is! FunctionType) { |
4650 return false; | 5488 return false; |
4651 } else if (this == type) { | 5489 } else if (this == type) { |
4652 return true; | 5490 return true; |
4653 } | 5491 } |
4654 FunctionType t = this; | 5492 FunctionType t = this; |
4655 FunctionType s = type as FunctionType; | 5493 FunctionType s = type as FunctionType; |
4656 if (t.normalParameterTypes.length != s.normalParameterTypes.length) { | 5494 if (t.normalParameterTypes.length != s.normalParameterTypes.length) { |
4657 return false; | 5495 return false; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4696 } | 5534 } |
4697 if (!entryS.getValue().isAssignableTo(typeT)) { | 5535 if (!entryS.getValue().isAssignableTo(typeT)) { |
4698 return false; | 5536 return false; |
4699 } | 5537 } |
4700 } | 5538 } |
4701 } else if (s.namedParameterTypes.length > 0) { | 5539 } else if (s.namedParameterTypes.length > 0) { |
4702 return false; | 5540 return false; |
4703 } | 5541 } |
4704 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo(
s.returnType); | 5542 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo(
s.returnType); |
4705 } | 5543 } |
| 5544 |
4706 /** | 5545 /** |
4707 * Set the mapping of the names of named parameters to the types of the named
parameters of this | 5546 * Set the mapping of the names of named parameters to the types of the named
parameters of this |
4708 * type of function to the given mapping. | 5547 * type of function to the given mapping. |
4709 * @param namedParameterTypes the mapping of the names of named parameters to
the types of the | 5548 * @param namedParameterTypes the mapping of the names of named parameters to
the types of the |
4710 * named parameters of this type of function | 5549 * named parameters of this type of function |
4711 */ | 5550 */ |
4712 void set namedParameterTypes(LinkedHashMap<String, Type2> namedParameterTypes2
) { | 5551 void set namedParameterTypes(LinkedHashMap<String, Type2> namedParameterTypes2
) { |
4713 this._namedParameterTypes = namedParameterTypes2; | 5552 this._namedParameterTypes = namedParameterTypes2; |
4714 } | 5553 } |
| 5554 |
4715 /** | 5555 /** |
4716 * Set the types of the normal parameters of this type of function to the type
s in the given | 5556 * Set the types of the normal parameters of this type of function to the type
s in the given |
4717 * array. | 5557 * array. |
4718 * @param normalParameterTypes the types of the normal parameters of this type
of function | 5558 * @param normalParameterTypes the types of the normal parameters of this type
of function |
4719 */ | 5559 */ |
4720 void set normalParameterTypes(List<Type2> normalParameterTypes2) { | 5560 void set normalParameterTypes(List<Type2> normalParameterTypes2) { |
4721 this._normalParameterTypes = normalParameterTypes2; | 5561 this._normalParameterTypes = normalParameterTypes2; |
4722 } | 5562 } |
| 5563 |
4723 /** | 5564 /** |
4724 * Set the types of the optional parameters of this type of function to the ty
pes in the given | 5565 * Set the types of the optional parameters of this type of function to the ty
pes in the given |
4725 * array. | 5566 * array. |
4726 * @param optionalParameterTypes the types of the optional parameters of this
type of function | 5567 * @param optionalParameterTypes the types of the optional parameters of this
type of function |
4727 */ | 5568 */ |
4728 void set optionalParameterTypes(List<Type2> optionalParameterTypes2) { | 5569 void set optionalParameterTypes(List<Type2> optionalParameterTypes2) { |
4729 this._optionalParameterTypes = optionalParameterTypes2; | 5570 this._optionalParameterTypes = optionalParameterTypes2; |
4730 } | 5571 } |
| 5572 |
4731 /** | 5573 /** |
4732 * Set the type of object returned by this type of function to the given type. | 5574 * Set the type of object returned by this type of function to the given type. |
4733 * @param returnType the type of object returned by this type of function | 5575 * @param returnType the type of object returned by this type of function |
4734 */ | 5576 */ |
4735 void set returnType(Type2 returnType2) { | 5577 void set returnType(Type2 returnType2) { |
4736 this._returnType = returnType2; | 5578 this._returnType = returnType2; |
4737 } | 5579 } |
| 5580 |
4738 /** | 5581 /** |
4739 * Set the actual types of the type arguments to the given types. | 5582 * Set the actual types of the type arguments to the given types. |
4740 * @param typeArguments the actual types of the type arguments | 5583 * @param typeArguments the actual types of the type arguments |
4741 */ | 5584 */ |
4742 void set typeArguments(List<Type2> typeArguments2) { | 5585 void set typeArguments(List<Type2> typeArguments2) { |
4743 this._typeArguments = typeArguments2; | 5586 this._typeArguments = typeArguments2; |
4744 } | 5587 } |
4745 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen
tTypes, typeArguments); | 5588 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen
tTypes, typeArguments); |
4746 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT
ypes) { | 5589 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT
ypes) { |
4747 if (argumentTypes.length != parameterTypes.length) { | 5590 if (argumentTypes.length != parameterTypes.length) { |
4748 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); | 5591 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); |
4749 } | 5592 } |
4750 if (argumentTypes.length == 0) { | 5593 if (argumentTypes.length == 0) { |
4751 return this; | 5594 return this; |
4752 } | 5595 } |
4753 Element element2 = element; | 5596 Element element2 = element; |
4754 FunctionTypeImpl newType = (element2 is ExecutableElement) ? new FunctionTyp
eImpl.con1((element2 as ExecutableElement)) : new FunctionTypeImpl.con2((element
2 as FunctionTypeAliasElement)); | 5597 FunctionTypeImpl newType = (element2 is ExecutableElement) ? new FunctionTyp
eImpl.con1((element2 as ExecutableElement)) : new FunctionTypeImpl.con2((element
2 as FunctionTypeAliasElement)); |
4755 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes); | 5598 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes); |
4756 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar
gumentTypes, parameterTypes); | 5599 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar
gumentTypes, parameterTypes); |
4757 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes
, argumentTypes, parameterTypes); | 5600 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes
, argumentTypes, parameterTypes); |
4758 newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTyp
es, parameterTypes); | 5601 newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTyp
es, parameterTypes); |
| 5602 newType.typeArguments = argumentTypes; |
4759 return newType; | 5603 return newType; |
4760 } | 5604 } |
4761 void appendTo(JavaStringBuilder builder) { | 5605 void appendTo(JavaStringBuilder builder) { |
4762 builder.append("("); | 5606 builder.append("("); |
4763 bool needsComma = false; | 5607 bool needsComma = false; |
4764 if (_normalParameterTypes.length > 0) { | 5608 if (_normalParameterTypes.length > 0) { |
4765 for (Type2 type in _normalParameterTypes) { | 5609 for (Type2 type in _normalParameterTypes) { |
4766 if (needsComma) { | 5610 if (needsComma) { |
4767 builder.append(", "); | 5611 builder.append(", "); |
4768 } else { | 5612 } else { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4807 builder.append("}"); | 5651 builder.append("}"); |
4808 needsComma = true; | 5652 needsComma = true; |
4809 } | 5653 } |
4810 builder.append(") -> "); | 5654 builder.append(") -> "); |
4811 if (_returnType == null) { | 5655 if (_returnType == null) { |
4812 builder.append("null"); | 5656 builder.append("null"); |
4813 } else { | 5657 } else { |
4814 ((_returnType as TypeImpl)).appendTo(builder); | 5658 ((_returnType as TypeImpl)).appendTo(builder); |
4815 } | 5659 } |
4816 } | 5660 } |
| 5661 |
| 5662 /** |
| 5663 * @return the base parameter elements of this function element, not {@code nu
ll}. |
| 5664 */ |
| 5665 List<ParameterElement> get baseParameters { |
| 5666 Element element2 = element; |
| 5667 if (element2 is ExecutableElement) { |
| 5668 return ((element2 as ExecutableElement)).parameters; |
| 5669 } else { |
| 5670 return ((element2 as FunctionTypeAliasElement)).parameters; |
| 5671 } |
| 5672 } |
4817 } | 5673 } |
| 5674 |
4818 /** | 5675 /** |
4819 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common
to objects | 5676 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common
to objects |
4820 * representing the type introduced by either a class or an interface, or a refe
rence to such a | 5677 * representing the type introduced by either a class or an interface, or a refe
rence to such a |
4821 * type. | 5678 * type. |
4822 * @coverage dart.engine.type | 5679 * @coverage dart.engine.type |
4823 */ | 5680 */ |
4824 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { | 5681 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { |
| 5682 |
4825 /** | 5683 /** |
4826 * An empty array of types. | 5684 * An empty array of types. |
4827 */ | 5685 */ |
4828 static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0); | 5686 static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0); |
| 5687 |
4829 /** | 5688 /** |
4830 * This method computes the longest inheritance path from some passed {@link T
ype} to Object. | 5689 * This method computes the longest inheritance path from some passed {@link T
ype} to Object. |
4831 * @param type the {@link Type} to compute the longest inheritance path of fro
m the passed{@link Type} to Object | 5690 * @param type the {@link Type} to compute the longest inheritance path of fro
m the passed{@link Type} to Object |
4832 * @return the computed longest inheritance path to Object | 5691 * @return the computed longest inheritance path to Object |
4833 * @see #computeLongestInheritancePathToObject(Type,int) | |
4834 * @see InterfaceType#getLeastUpperBound(Type) | 5692 * @see InterfaceType#getLeastUpperBound(Type) |
4835 */ | 5693 */ |
4836 static int computeLongestInheritancePathToObject(InterfaceType type) => comput
eLongestInheritancePathToObject2(type, 0); | 5694 static int computeLongestInheritancePathToObject(InterfaceType type) => comput
eLongestInheritancePathToObject2(type, 0, new Set<ClassElement>()); |
| 5695 |
4837 /** | 5696 /** |
4838 * Returns the set of all superinterfaces of the passed {@link Type}. | 5697 * Returns the set of all superinterfaces of the passed {@link Type}. |
4839 * @param type the {@link Type} to compute the set of superinterfaces of | 5698 * @param type the {@link Type} to compute the set of superinterfaces of |
4840 * @return the {@link Set} of superinterfaces of the passed {@link Type} | 5699 * @return the {@link Set} of superinterfaces of the passed {@link Type} |
4841 * @see #computeSuperinterfaceSet(Type,HashSet) | |
4842 * @see #getLeastUpperBound(Type) | 5700 * @see #getLeastUpperBound(Type) |
4843 */ | 5701 */ |
4844 static Set<InterfaceType> computeSuperinterfaceSet(InterfaceType type) => comp
uteSuperinterfaceSet2(type, new Set<InterfaceType>()); | 5702 static Set<InterfaceType> computeSuperinterfaceSet(InterfaceType type) => comp
uteSuperinterfaceSet2(type, new Set<InterfaceType>()); |
| 5703 List<TypeVariableElement> get typeVariables => element.typeVariables; |
| 5704 |
4845 /** | 5705 /** |
4846 * This method computes the longest inheritance path from some passed {@link T
ype} to Object. This | 5706 * This method computes the longest inheritance path from some passed {@link T
ype} to Object. This |
4847 * method calls itself recursively, callers should use the public method{@link
#computeLongestInheritancePathToObject(Type)}. | 5707 * method calls itself recursively, callers should use the public method{@link
#computeLongestInheritancePathToObject(Type)}. |
4848 * @param type the {@link Type} to compute the longest inheritance path of fro
m the passed{@link Type} to Object | 5708 * @param type the {@link Type} to compute the longest inheritance path of fro
m the passed{@link Type} to Object |
4849 * @param depth a field used recursively | 5709 * @param depth a field used recursively |
| 5710 * @param visitedClasses the classes that have already been visited |
4850 * @return the computed longest inheritance path to Object | 5711 * @return the computed longest inheritance path to Object |
4851 * @see #computeLongestInheritancePathToObject(Type) | 5712 * @see #computeLongestInheritancePathToObject(Type) |
4852 * @see #getLeastUpperBound(Type) | 5713 * @see #getLeastUpperBound(Type) |
4853 */ | 5714 */ |
4854 static int computeLongestInheritancePathToObject2(InterfaceType type, int dept
h) { | 5715 static int computeLongestInheritancePathToObject2(InterfaceType type, int dept
h, Set<ClassElement> visitedClasses) { |
4855 ClassElement classElement = type.element; | 5716 ClassElement classElement = type.element; |
4856 if (classElement.supertype == null) { | 5717 if (classElement.supertype == null || visitedClasses.contains(classElement))
{ |
4857 return depth; | 5718 return depth; |
4858 } | 5719 } |
4859 List<InterfaceType> superinterfaces = classElement.interfaces; | |
4860 int longestPath = 1; | 5720 int longestPath = 1; |
4861 int pathLength; | 5721 try { |
4862 if (superinterfaces.length > 0) { | 5722 javaSetAdd(visitedClasses, classElement); |
4863 for (InterfaceType superinterface in superinterfaces) { | 5723 List<InterfaceType> superinterfaces = classElement.interfaces; |
4864 pathLength = computeLongestInheritancePathToObject2(superinterface, dept
h + 1); | 5724 int pathLength; |
4865 if (pathLength > longestPath) { | 5725 if (superinterfaces.length > 0) { |
4866 longestPath = pathLength; | 5726 for (InterfaceType superinterface in superinterfaces) { |
| 5727 pathLength = computeLongestInheritancePathToObject2(superinterface, de
pth + 1, visitedClasses); |
| 5728 if (pathLength > longestPath) { |
| 5729 longestPath = pathLength; |
| 5730 } |
4867 } | 5731 } |
4868 } | 5732 } |
4869 } | 5733 InterfaceType supertype2 = classElement.supertype; |
4870 InterfaceType supertype2 = classElement.supertype; | 5734 pathLength = computeLongestInheritancePathToObject2(supertype2, depth + 1,
visitedClasses); |
4871 pathLength = computeLongestInheritancePathToObject2(supertype2, depth + 1); | 5735 if (pathLength > longestPath) { |
4872 if (pathLength > longestPath) { | 5736 longestPath = pathLength; |
4873 longestPath = pathLength; | 5737 } |
| 5738 } finally { |
| 5739 visitedClasses.remove(classElement); |
4874 } | 5740 } |
4875 return longestPath; | 5741 return longestPath; |
4876 } | 5742 } |
| 5743 |
4877 /** | 5744 /** |
4878 * Returns the set of all superinterfaces of the passed {@link Type}. This is
a recursive method, | 5745 * Returns the set of all superinterfaces of the passed {@link Type}. This is
a recursive method, |
4879 * callers should call the public {@link #computeSuperinterfaceSet(Type)}. | 5746 * callers should call the public {@link #computeSuperinterfaceSet(Type)}. |
4880 * @param type the {@link Type} to compute the set of superinterfaces of | 5747 * @param type the {@link Type} to compute the set of superinterfaces of |
4881 * @param set a {@link HashSet} used recursively by this method | 5748 * @param set a {@link HashSet} used recursively by this method |
4882 * @return the {@link Set} of superinterfaces of the passed {@link Type} | 5749 * @return the {@link Set} of superinterfaces of the passed {@link Type} |
4883 * @see #computeSuperinterfaceSet(Type) | 5750 * @see #computeSuperinterfaceSet(Type) |
4884 * @see #getLeastUpperBound(Type) | 5751 * @see #getLeastUpperBound(Type) |
4885 */ | 5752 */ |
4886 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In
terfaceType> set) { | 5753 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In
terfaceType> set) { |
4887 Element element2 = type.element; | 5754 Element element2 = type.element; |
4888 if (element2 != null && element2 is ClassElement) { | 5755 if (element2 != null && element2 is ClassElement) { |
4889 ClassElement classElement = element2 as ClassElement; | 5756 ClassElement classElement = element2 as ClassElement; |
4890 List<InterfaceType> superinterfaces = classElement.interfaces; | 5757 List<InterfaceType> superinterfaces = classElement.interfaces; |
4891 for (InterfaceType superinterface in superinterfaces) { | 5758 for (InterfaceType superinterface in superinterfaces) { |
4892 javaSetAdd(set, superinterface); | 5759 if (javaSetAdd(set, superinterface)) { |
4893 computeSuperinterfaceSet2(superinterface, set); | 5760 computeSuperinterfaceSet2(superinterface, set); |
| 5761 } |
4894 } | 5762 } |
4895 InterfaceType supertype2 = classElement.supertype; | 5763 InterfaceType supertype2 = classElement.supertype; |
4896 if (supertype2 != null) { | 5764 if (supertype2 != null) { |
4897 javaSetAdd(set, supertype2); | 5765 if (javaSetAdd(set, supertype2)) { |
4898 computeSuperinterfaceSet2(supertype2, set); | 5766 computeSuperinterfaceSet2(supertype2, set); |
| 5767 } |
4899 } | 5768 } |
4900 } | 5769 } |
4901 return set; | 5770 return set; |
4902 } | 5771 } |
| 5772 |
4903 /** | 5773 /** |
4904 * Return the intersection of the given sets of types, where intersection is b
ased on the equality | 5774 * Return the intersection of the given sets of types, where intersection is b
ased on the equality |
4905 * of the elements of the types rather than on the equality of the types thems
elves. In cases | 5775 * of the elements of the types rather than on the equality of the types thems
elves. In cases |
4906 * where two non-equal types have equal elements, which only happens when the
class is | 5776 * where two non-equal types have equal elements, which only happens when the
class is |
4907 * parameterized, the type that is added to the intersection is the base type
with type arguments | 5777 * parameterized, the type that is added to the intersection is the base type
with type arguments |
4908 * that are the least upper bound of the type arguments of the two types. | 5778 * that are the least upper bound of the type arguments of the two types. |
4909 * @param first the first set of types to be intersected | 5779 * @param first the first set of types to be intersected |
4910 * @param second the second set of types to be intersected | 5780 * @param second the second set of types to be intersected |
4911 * @return the intersection of the given sets of types | 5781 * @return the intersection of the given sets of types |
4912 */ | 5782 */ |
4913 static List<InterfaceType> intersection(Set<InterfaceType> first, Set<Interfac
eType> second) { | 5783 static List<InterfaceType> intersection(Set<InterfaceType> first, Set<Interfac
eType> second) { |
4914 Map<ClassElement, InterfaceType> firstMap = new Map<ClassElement, InterfaceT
ype>(); | 5784 Map<ClassElement, InterfaceType> firstMap = new Map<ClassElement, InterfaceT
ype>(); |
4915 for (InterfaceType firstType in first) { | 5785 for (InterfaceType firstType in first) { |
4916 firstMap[firstType.element] = firstType; | 5786 firstMap[firstType.element] = firstType; |
4917 } | 5787 } |
4918 Set<InterfaceType> result = new Set<InterfaceType>(); | 5788 Set<InterfaceType> result = new Set<InterfaceType>(); |
4919 for (InterfaceType secondType in second) { | 5789 for (InterfaceType secondType in second) { |
4920 InterfaceType firstType = firstMap[secondType.element]; | 5790 InterfaceType firstType = firstMap[secondType.element]; |
4921 if (firstType != null) { | 5791 if (firstType != null) { |
4922 javaSetAdd(result, leastUpperBound(firstType, secondType)); | 5792 javaSetAdd(result, leastUpperBound(firstType, secondType)); |
4923 } | 5793 } |
4924 } | 5794 } |
4925 return new List.from(result); | 5795 return new List.from(result); |
4926 } | 5796 } |
| 5797 |
4927 /** | 5798 /** |
4928 * Return the "least upper bound" of the given types under the assumption that
the types have the | 5799 * Return the "least upper bound" of the given types under the assumption that
the types have the |
4929 * same element and differ only in terms of the type arguments. The resulting
type is composed by | 5800 * same element and differ only in terms of the type arguments. The resulting
type is composed by |
4930 * using the least upper bound of the corresponding type arguments. | 5801 * comparing the corresponding type arguments, keeping those that are the same
, and using |
| 5802 * 'dynamic' for those that are different. |
4931 * @param firstType the first type | 5803 * @param firstType the first type |
4932 * @param secondType the second type | 5804 * @param secondType the second type |
4933 * @return the "least upper bound" of the given types | 5805 * @return the "least upper bound" of the given types |
4934 */ | 5806 */ |
4935 static InterfaceType leastUpperBound(InterfaceType firstType, InterfaceType se
condType) { | 5807 static InterfaceType leastUpperBound(InterfaceType firstType, InterfaceType se
condType) { |
4936 if (firstType == secondType) { | 5808 if (firstType == secondType) { |
4937 return firstType; | 5809 return firstType; |
4938 } | 5810 } |
4939 List<Type2> firstArguments = firstType.typeArguments; | 5811 List<Type2> firstArguments = firstType.typeArguments; |
4940 List<Type2> secondArguments = secondType.typeArguments; | 5812 List<Type2> secondArguments = secondType.typeArguments; |
4941 int argumentCount = firstArguments.length; | 5813 int argumentCount = firstArguments.length; |
4942 if (argumentCount == 0) { | 5814 if (argumentCount == 0) { |
4943 return firstType; | 5815 return firstType; |
4944 } | 5816 } |
4945 List<Type2> lubArguments = new List<Type2>(argumentCount); | 5817 List<Type2> lubArguments = new List<Type2>(argumentCount); |
4946 for (int i = 0; i < argumentCount; i++) { | 5818 for (int i = 0; i < argumentCount; i++) { |
4947 lubArguments[i] = firstArguments[i].getLeastUpperBound(secondArguments[i])
; | 5819 if (firstArguments[i] == secondArguments[i]) { |
| 5820 lubArguments[i] = firstArguments[i]; |
| 5821 } |
4948 if (lubArguments[i] == null) { | 5822 if (lubArguments[i] == null) { |
4949 lubArguments[i] = DynamicTypeImpl.instance; | 5823 lubArguments[i] = DynamicTypeImpl.instance; |
4950 } | 5824 } |
4951 } | 5825 } |
4952 InterfaceTypeImpl lub = new InterfaceTypeImpl.con1(firstType.element); | 5826 InterfaceTypeImpl lub = new InterfaceTypeImpl.con1(firstType.element); |
4953 lub.typeArguments = lubArguments; | 5827 lub.typeArguments = lubArguments; |
4954 return lub; | 5828 return lub; |
4955 } | 5829 } |
| 5830 |
4956 /** | 5831 /** |
4957 * An array containing the actual types of the type arguments. | 5832 * An array containing the actual types of the type arguments. |
4958 */ | 5833 */ |
4959 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; | 5834 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; |
| 5835 |
4960 /** | 5836 /** |
4961 * Initialize a newly created type to be declared by the given element. | 5837 * Initialize a newly created type to be declared by the given element. |
4962 * @param element the element representing the declaration of the type | 5838 * @param element the element representing the declaration of the type |
4963 */ | 5839 */ |
4964 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) { | 5840 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame) { |
4965 _jtd_constructor_293_impl(element); | 5841 _jtd_constructor_300_impl(element); |
4966 } | 5842 } |
4967 _jtd_constructor_293_impl(ClassElement element) { | 5843 _jtd_constructor_300_impl(ClassElement element) { |
4968 } | 5844 } |
| 5845 |
4969 /** | 5846 /** |
4970 * Initialize a newly created type to have the given name. This constructor sh
ould only be used in | 5847 * Initialize a newly created type to have the given name. This constructor sh
ould only be used in |
4971 * cases where there is no declaration of the type. | 5848 * cases where there is no declaration of the type. |
4972 * @param name the name of the type | 5849 * @param name the name of the type |
4973 */ | 5850 */ |
4974 InterfaceTypeImpl.con2(String name) : super(null, name) { | 5851 InterfaceTypeImpl.con2(String name) : super(null, name) { |
4975 _jtd_constructor_294_impl(name); | 5852 _jtd_constructor_301_impl(name); |
4976 } | 5853 } |
4977 _jtd_constructor_294_impl(String name) { | 5854 _jtd_constructor_301_impl(String name) { |
4978 } | 5855 } |
4979 bool operator ==(Object object) { | 5856 bool operator ==(Object object) { |
4980 if (object is! InterfaceTypeImpl) { | 5857 if (object is! InterfaceTypeImpl) { |
4981 return false; | 5858 return false; |
4982 } | 5859 } |
4983 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; | 5860 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; |
4984 return element == otherType.element && JavaArrays.equals(_typeArguments, oth
erType._typeArguments); | 5861 return element == otherType.element && JavaArrays.equals(_typeArguments, oth
erType._typeArguments); |
4985 } | 5862 } |
4986 ClassElement get element => super.element as ClassElement; | 5863 ClassElement get element => super.element as ClassElement; |
4987 PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getGetter(getterName), this); | 5864 PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getGetter(getterName), this); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5098 } | 5975 } |
5099 } | 5976 } |
5100 return false; | 5977 return false; |
5101 } | 5978 } |
5102 bool isMoreSpecificThan(Type2 type) { | 5979 bool isMoreSpecificThan(Type2 type) { |
5103 if (identical(type, DynamicTypeImpl.instance)) { | 5980 if (identical(type, DynamicTypeImpl.instance)) { |
5104 return true; | 5981 return true; |
5105 } else if (type is! InterfaceType) { | 5982 } else if (type is! InterfaceType) { |
5106 return false; | 5983 return false; |
5107 } | 5984 } |
5108 InterfaceType s = type as InterfaceType; | 5985 return isMoreSpecificThan2((type as InterfaceType), new Set<ClassElement>())
; |
5109 if (this == s) { | |
5110 return true; | |
5111 } | |
5112 if (s.isDirectSupertypeOf(this)) { | |
5113 return true; | |
5114 } | |
5115 ClassElement tElement = element; | |
5116 ClassElement sElement = s.element; | |
5117 if (tElement == sElement) { | |
5118 List<Type2> tArguments = typeArguments; | |
5119 List<Type2> sArguments = s.typeArguments; | |
5120 if (tArguments.length != sArguments.length) { | |
5121 return false; | |
5122 } | |
5123 for (int i = 0; i < tArguments.length; i++) { | |
5124 if (!tArguments[i].isMoreSpecificThan(sArguments[i])) { | |
5125 return false; | |
5126 } | |
5127 } | |
5128 return true; | |
5129 } | |
5130 if (element.supertype == null) { | |
5131 return false; | |
5132 } | |
5133 return element.supertype.isMoreSpecificThan(type); | |
5134 } | 5986 } |
| 5987 bool isObject() => element.supertype == null; |
5135 bool isSubtypeOf(Type2 type) { | 5988 bool isSubtypeOf(Type2 type) { |
5136 if (identical(type, DynamicTypeImpl.instance)) { | 5989 if (identical(type, DynamicTypeImpl.instance)) { |
5137 return true; | 5990 return true; |
5138 } else if (type is TypeVariableType) { | 5991 } else if (type is TypeVariableType) { |
5139 return true; | 5992 return true; |
5140 } else if (type is! InterfaceType) { | 5993 } else if (type is! InterfaceType) { |
5141 return false; | 5994 return false; |
5142 } else if (this == type) { | 5995 } else if (this == type) { |
5143 return true; | 5996 return true; |
5144 } | 5997 } |
5145 InterfaceType typeT = this; | 5998 return isSubtypeOf2((type as InterfaceType), new Set<ClassElement>()); |
5146 InterfaceType typeS = type as InterfaceType; | 5999 } |
5147 ClassElement elementT = element; | 6000 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li
brary) { |
5148 if (elementT == null) { | 6001 ConstructorElement constructorElement; |
5149 return false; | 6002 if (constructorName == null) { |
| 6003 constructorElement = element.unnamedConstructor; |
| 6004 } else { |
| 6005 constructorElement = element.getNamedConstructor(constructorName); |
5150 } | 6006 } |
5151 typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.t
ypeVariables)); | 6007 if (constructorElement == null || !constructorElement.isAccessibleIn(library
)) { |
5152 if (typeT == typeS) { | 6008 return null; |
5153 return true; | |
5154 } else if (elementT == typeS.element) { | |
5155 List<Type2> typeTArgs = typeT.typeArguments; | |
5156 List<Type2> typeSArgs = typeS.typeArguments; | |
5157 if (typeTArgs.length != typeSArgs.length) { | |
5158 return false; | |
5159 } | |
5160 for (int i = 0; i < typeTArgs.length; i++) { | |
5161 if (!typeTArgs[i].isSubtypeOf(typeSArgs[i])) { | |
5162 return false; | |
5163 } | |
5164 } | |
5165 return true; | |
5166 } | 6009 } |
5167 Type2 supertype2 = elementT.supertype; | 6010 return ConstructorMember.from(constructorElement, this); |
5168 if (supertype2 == null) { | |
5169 return false; | |
5170 } | |
5171 List<Type2> interfaceTypes = elementT.interfaces; | |
5172 for (Type2 interfaceType in interfaceTypes) { | |
5173 if (interfaceType.isSubtypeOf(typeS)) { | |
5174 return true; | |
5175 } | |
5176 } | |
5177 List<Type2> mixinTypes = elementT.mixins; | |
5178 for (Type2 mixinType in mixinTypes) { | |
5179 if (mixinType == typeS) { | |
5180 return true; | |
5181 } | |
5182 } | |
5183 return supertype2.isSubtypeOf(typeS); | |
5184 } | 6011 } |
5185 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { | 6012 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { |
5186 PropertyAccessorElement element = getGetter(getterName); | 6013 PropertyAccessorElement element = getGetter(getterName); |
5187 if (element != null && element.isAccessibleIn(library)) { | 6014 if (element != null && element.isAccessibleIn(library)) { |
5188 return element; | 6015 return element; |
5189 } | 6016 } |
| 6017 return lookUpGetterInSuperclass(getterName, library); |
| 6018 } |
| 6019 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryEle
ment library) { |
5190 for (InterfaceType mixin in mixins) { | 6020 for (InterfaceType mixin in mixins) { |
5191 element = mixin.getGetter(getterName); | 6021 PropertyAccessorElement element = mixin.getGetter(getterName); |
5192 if (element != null && element.isAccessibleIn(library)) { | 6022 if (element != null && element.isAccessibleIn(library)) { |
5193 return element; | 6023 return element; |
5194 } | 6024 } |
5195 } | 6025 } |
| 6026 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
5196 InterfaceType supertype = superclass; | 6027 InterfaceType supertype = superclass; |
5197 while (supertype != null) { | 6028 ClassElement supertypeElement = supertype == null ? null : supertype.element
; |
5198 element = supertype.getGetter(getterName); | 6029 while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
| 6030 javaSetAdd(visitedClasses, supertypeElement); |
| 6031 PropertyAccessorElement element = supertype.getGetter(getterName); |
5199 if (element != null && element.isAccessibleIn(library)) { | 6032 if (element != null && element.isAccessibleIn(library)) { |
5200 return element; | 6033 return element; |
5201 } | 6034 } |
5202 for (InterfaceType mixin in supertype.mixins) { | 6035 for (InterfaceType mixin in supertype.mixins) { |
5203 element = mixin.getGetter(getterName); | 6036 element = mixin.getGetter(getterName); |
5204 if (element != null && element.isAccessibleIn(library)) { | 6037 if (element != null && element.isAccessibleIn(library)) { |
5205 return element; | 6038 return element; |
5206 } | 6039 } |
5207 } | 6040 } |
5208 supertype = supertype.superclass; | 6041 supertype = supertype.superclass; |
| 6042 supertypeElement = supertype == null ? null : supertype.element; |
5209 } | 6043 } |
5210 return null; | 6044 return null; |
5211 } | 6045 } |
5212 MethodElement lookUpMethod(String methodName, LibraryElement library) { | 6046 MethodElement lookUpMethod(String methodName, LibraryElement library) { |
5213 MethodElement element = getMethod(methodName); | 6047 MethodElement element = getMethod(methodName); |
5214 if (element != null && element.isAccessibleIn(library)) { | 6048 if (element != null && element.isAccessibleIn(library)) { |
5215 return element; | 6049 return element; |
5216 } | 6050 } |
| 6051 return lookUpMethodInSuperclass(methodName, library); |
| 6052 } |
| 6053 MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement libra
ry) { |
5217 for (InterfaceType mixin in mixins) { | 6054 for (InterfaceType mixin in mixins) { |
5218 element = mixin.getMethod(methodName); | 6055 MethodElement element = mixin.getMethod(methodName); |
5219 if (element != null && element.isAccessibleIn(library)) { | 6056 if (element != null && element.isAccessibleIn(library)) { |
5220 return element; | 6057 return element; |
5221 } | 6058 } |
5222 } | 6059 } |
| 6060 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
5223 InterfaceType supertype = superclass; | 6061 InterfaceType supertype = superclass; |
5224 while (supertype != null) { | 6062 ClassElement supertypeElement = supertype == null ? null : supertype.element
; |
5225 element = supertype.getMethod(methodName); | 6063 while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
| 6064 javaSetAdd(visitedClasses, supertypeElement); |
| 6065 MethodElement element = supertype.getMethod(methodName); |
5226 if (element != null && element.isAccessibleIn(library)) { | 6066 if (element != null && element.isAccessibleIn(library)) { |
5227 return element; | 6067 return element; |
5228 } | 6068 } |
5229 for (InterfaceType mixin in supertype.mixins) { | 6069 for (InterfaceType mixin in supertype.mixins) { |
5230 element = mixin.getMethod(methodName); | 6070 element = mixin.getMethod(methodName); |
5231 if (element != null && element.isAccessibleIn(library)) { | 6071 if (element != null && element.isAccessibleIn(library)) { |
5232 return element; | 6072 return element; |
5233 } | 6073 } |
5234 } | 6074 } |
5235 supertype = supertype.superclass; | 6075 supertype = supertype.superclass; |
| 6076 supertypeElement = supertype == null ? null : supertype.element; |
5236 } | 6077 } |
5237 return null; | 6078 return null; |
5238 } | 6079 } |
5239 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { | 6080 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { |
5240 PropertyAccessorElement element = getSetter(setterName); | 6081 PropertyAccessorElement element = getSetter(setterName); |
5241 if (element != null && element.isAccessibleIn(library)) { | 6082 if (element != null && element.isAccessibleIn(library)) { |
5242 return element; | 6083 return element; |
5243 } | 6084 } |
| 6085 return lookUpSetterInSuperclass(setterName, library); |
| 6086 } |
| 6087 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle
ment library) { |
5244 for (InterfaceType mixin in mixins) { | 6088 for (InterfaceType mixin in mixins) { |
5245 element = mixin.getSetter(setterName); | 6089 PropertyAccessorElement element = mixin.getSetter(setterName); |
5246 if (element != null && element.isAccessibleIn(library)) { | 6090 if (element != null && element.isAccessibleIn(library)) { |
5247 return element; | 6091 return element; |
5248 } | 6092 } |
5249 } | 6093 } |
| 6094 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
5250 InterfaceType supertype = superclass; | 6095 InterfaceType supertype = superclass; |
5251 while (supertype != null) { | 6096 ClassElement supertypeElement = supertype == null ? null : supertype.element
; |
5252 element = supertype.getSetter(setterName); | 6097 while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
| 6098 javaSetAdd(visitedClasses, supertypeElement); |
| 6099 PropertyAccessorElement element = supertype.getSetter(setterName); |
5253 if (element != null && element.isAccessibleIn(library)) { | 6100 if (element != null && element.isAccessibleIn(library)) { |
5254 return element; | 6101 return element; |
5255 } | 6102 } |
5256 for (InterfaceType mixin in supertype.mixins) { | 6103 for (InterfaceType mixin in supertype.mixins) { |
5257 element = mixin.getSetter(setterName); | 6104 element = mixin.getSetter(setterName); |
5258 if (element != null && element.isAccessibleIn(library)) { | 6105 if (element != null && element.isAccessibleIn(library)) { |
5259 return element; | 6106 return element; |
5260 } | 6107 } |
5261 } | 6108 } |
5262 supertype = supertype.superclass; | 6109 supertype = supertype.superclass; |
| 6110 supertypeElement = supertype == null ? null : supertype.element; |
5263 } | 6111 } |
5264 return null; | 6112 return null; |
5265 } | 6113 } |
| 6114 |
5266 /** | 6115 /** |
5267 * Set the actual types of the type arguments to those in the given array. | 6116 * Set the actual types of the type arguments to those in the given array. |
5268 * @param typeArguments the actual types of the type arguments | 6117 * @param typeArguments the actual types of the type arguments |
5269 */ | 6118 */ |
5270 void set typeArguments(List<Type2> typeArguments2) { | 6119 void set typeArguments(List<Type2> typeArguments2) { |
5271 this._typeArguments = typeArguments2; | 6120 this._typeArguments = typeArguments2; |
5272 } | 6121 } |
5273 InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argume
ntTypes, typeArguments); | 6122 InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argume
ntTypes, typeArguments); |
5274 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter
Types) { | 6123 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter
Types) { |
5275 if (argumentTypes.length != parameterTypes.length) { | 6124 if (argumentTypes.length != parameterTypes.length) { |
(...skipping 13 matching lines...) Expand all Loading... |
5289 builder.append("<"); | 6138 builder.append("<"); |
5290 for (int i = 0; i < argumentCount; i++) { | 6139 for (int i = 0; i < argumentCount; i++) { |
5291 if (i > 0) { | 6140 if (i > 0) { |
5292 builder.append(", "); | 6141 builder.append(", "); |
5293 } | 6142 } |
5294 ((_typeArguments[i] as TypeImpl)).appendTo(builder); | 6143 ((_typeArguments[i] as TypeImpl)).appendTo(builder); |
5295 } | 6144 } |
5296 builder.append(">"); | 6145 builder.append(">"); |
5297 } | 6146 } |
5298 } | 6147 } |
| 6148 bool isMoreSpecificThan2(InterfaceType s, Set<ClassElement> visitedClasses) { |
| 6149 if (this == s) { |
| 6150 return true; |
| 6151 } |
| 6152 if (s.isDirectSupertypeOf(this)) { |
| 6153 return true; |
| 6154 } |
| 6155 ClassElement tElement = element; |
| 6156 ClassElement sElement = s.element; |
| 6157 if (tElement == sElement) { |
| 6158 List<Type2> tArguments = typeArguments; |
| 6159 List<Type2> sArguments = s.typeArguments; |
| 6160 if (tArguments.length != sArguments.length) { |
| 6161 return false; |
| 6162 } |
| 6163 for (int i = 0; i < tArguments.length; i++) { |
| 6164 if (!tArguments[i].isMoreSpecificThan(sArguments[i])) { |
| 6165 return false; |
| 6166 } |
| 6167 } |
| 6168 return true; |
| 6169 } |
| 6170 ClassElement element2 = element; |
| 6171 if (element2 == null || visitedClasses.contains(element2)) { |
| 6172 return false; |
| 6173 } |
| 6174 javaSetAdd(visitedClasses, element2); |
| 6175 InterfaceType supertype2 = element2.supertype; |
| 6176 if (supertype2 != null && ((supertype2 as InterfaceTypeImpl)).isMoreSpecific
Than2(s, visitedClasses)) { |
| 6177 return true; |
| 6178 } |
| 6179 for (InterfaceType interfaceType in element2.interfaces) { |
| 6180 if (((interfaceType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedC
lasses)) { |
| 6181 return true; |
| 6182 } |
| 6183 } |
| 6184 for (InterfaceType mixinType in element2.mixins) { |
| 6185 if (((mixinType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClass
es)) { |
| 6186 return true; |
| 6187 } |
| 6188 } |
| 6189 return false; |
| 6190 } |
| 6191 bool isSubtypeOf2(InterfaceType type, Set<ClassElement> visitedClasses) { |
| 6192 InterfaceType typeT = this; |
| 6193 InterfaceType typeS = type; |
| 6194 ClassElement elementT = element; |
| 6195 if (elementT == null || visitedClasses.contains(elementT)) { |
| 6196 return false; |
| 6197 } |
| 6198 javaSetAdd(visitedClasses, elementT); |
| 6199 typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.t
ypeVariables)); |
| 6200 if (typeT == typeS) { |
| 6201 return true; |
| 6202 } else if (elementT == typeS.element) { |
| 6203 List<Type2> typeTArgs = typeT.typeArguments; |
| 6204 List<Type2> typeSArgs = typeS.typeArguments; |
| 6205 if (typeTArgs.length != typeSArgs.length) { |
| 6206 return false; |
| 6207 } |
| 6208 for (int i = 0; i < typeTArgs.length; i++) { |
| 6209 if (!typeTArgs[i].isSubtypeOf(typeSArgs[i])) { |
| 6210 return false; |
| 6211 } |
| 6212 } |
| 6213 return true; |
| 6214 } |
| 6215 InterfaceType supertype2 = elementT.supertype; |
| 6216 if (supertype2 != null && ((supertype2 as InterfaceTypeImpl)).isSubtypeOf2(t
ypeS, visitedClasses)) { |
| 6217 return true; |
| 6218 } |
| 6219 List<InterfaceType> interfaceTypes = elementT.interfaces; |
| 6220 for (InterfaceType interfaceType in interfaceTypes) { |
| 6221 if (((interfaceType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClas
ses)) { |
| 6222 return true; |
| 6223 } |
| 6224 } |
| 6225 List<InterfaceType> mixinTypes = elementT.mixins; |
| 6226 for (InterfaceType mixinType in mixinTypes) { |
| 6227 if (((mixinType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)
) { |
| 6228 return true; |
| 6229 } |
| 6230 } |
| 6231 return false; |
| 6232 } |
5299 } | 6233 } |
| 6234 |
5300 /** | 6235 /** |
5301 * The abstract class {@code TypeImpl} implements the behavior common to objects
representing the | 6236 * The abstract class {@code TypeImpl} implements the behavior common to objects
representing the |
5302 * declared type of elements in the element model. | 6237 * declared type of elements in the element model. |
5303 * @coverage dart.engine.type | 6238 * @coverage dart.engine.type |
5304 */ | 6239 */ |
5305 abstract class TypeImpl implements Type2 { | 6240 abstract class TypeImpl implements Type2 { |
| 6241 |
5306 /** | 6242 /** |
5307 * Return an array containing the results of using the given argument types an
d parameter types to | 6243 * Return an array containing the results of using the given argument types an
d parameter types to |
5308 * perform a substitution on all of the given types. | 6244 * perform a substitution on all of the given types. |
5309 * @param types the types on which a substitution is to be performed | 6245 * @param types the types on which a substitution is to be performed |
5310 * @param argumentTypes the argument types for the substitution | 6246 * @param argumentTypes the argument types for the substitution |
5311 * @param parameterTypes the parameter types for the substitution | 6247 * @param parameterTypes the parameter types for the substitution |
5312 * @return the result of performing the substitution on each of the types | 6248 * @return the result of performing the substitution on each of the types |
5313 */ | 6249 */ |
5314 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li
st<Type2> parameterTypes) { | 6250 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li
st<Type2> parameterTypes) { |
5315 int length2 = types.length; | 6251 int length2 = types.length; |
5316 if (length2 == 0) { | 6252 if (length2 == 0) { |
5317 return types; | 6253 return types; |
5318 } | 6254 } |
5319 List<Type2> newTypes = new List<Type2>(length2); | 6255 List<Type2> newTypes = new List<Type2>(length2); |
5320 for (int i = 0; i < length2; i++) { | 6256 for (int i = 0; i < length2; i++) { |
5321 newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes); | 6257 newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes); |
5322 } | 6258 } |
5323 return newTypes; | 6259 return newTypes; |
5324 } | 6260 } |
| 6261 |
5325 /** | 6262 /** |
5326 * The element representing the declaration of this type, or {@code null} if t
he type has not, or | 6263 * The element representing the declaration of this type, or {@code null} if t
he type has not, or |
5327 * cannot, be associated with an element. | 6264 * cannot, be associated with an element. |
5328 */ | 6265 */ |
5329 Element _element; | 6266 Element _element; |
| 6267 |
5330 /** | 6268 /** |
5331 * The name of this type, or {@code null} if the type does not have a name. | 6269 * The name of this type, or {@code null} if the type does not have a name. |
5332 */ | 6270 */ |
5333 String _name; | 6271 String _name; |
| 6272 |
5334 /** | 6273 /** |
5335 * An empty array of types. | 6274 * An empty array of types. |
5336 */ | 6275 */ |
5337 static List<Type2> EMPTY_ARRAY = new List<Type2>(0); | 6276 static List<Type2> EMPTY_ARRAY = new List<Type2>(0); |
| 6277 |
5338 /** | 6278 /** |
5339 * Initialize a newly created type to be declared by the given element and to
have the given name. | 6279 * Initialize a newly created type to be declared by the given element and to
have the given name. |
5340 * @param element the element representing the declaration of the type | 6280 * @param element the element representing the declaration of the type |
5341 * @param name the name of the type | 6281 * @param name the name of the type |
5342 */ | 6282 */ |
5343 TypeImpl(Element element, String name) { | 6283 TypeImpl(Element element, String name) { |
5344 this._element = element; | 6284 this._element = element; |
5345 this._name = name; | 6285 this._name = name; |
5346 } | 6286 } |
| 6287 String get displayName => name; |
5347 Element get element => _element; | 6288 Element get element => _element; |
5348 Type2 getLeastUpperBound(Type2 type) => null; | 6289 Type2 getLeastUpperBound(Type2 type) => null; |
5349 String get name => _name; | 6290 String get name => _name; |
5350 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf(
this); | 6291 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf(
this); |
5351 bool isDartCoreFunction() => false; | 6292 bool isDartCoreFunction() => false; |
5352 bool isDynamic() => false; | 6293 bool isDynamic() => false; |
5353 bool isMoreSpecificThan(Type2 type) => false; | 6294 bool isMoreSpecificThan(Type2 type) => false; |
| 6295 bool isObject() => false; |
5354 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); | 6296 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); |
5355 bool isVoid() => false; | 6297 bool isVoid() => false; |
5356 String toString() { | 6298 String toString() { |
5357 JavaStringBuilder builder = new JavaStringBuilder(); | 6299 JavaStringBuilder builder = new JavaStringBuilder(); |
5358 appendTo(builder); | 6300 appendTo(builder); |
5359 return builder.toString(); | 6301 return builder.toString(); |
5360 } | 6302 } |
| 6303 |
5361 /** | 6304 /** |
5362 * Append a textual representation of this type to the given builder. | 6305 * Append a textual representation of this type to the given builder. |
5363 * @param builder the builder to which the text is to be appended | 6306 * @param builder the builder to which the text is to be appended |
5364 */ | 6307 */ |
5365 void appendTo(JavaStringBuilder builder) { | 6308 void appendTo(JavaStringBuilder builder) { |
5366 if (_name == null) { | 6309 if (_name == null) { |
5367 builder.append("<unnamed type>"); | 6310 builder.append("<unnamed type>"); |
5368 } else { | 6311 } else { |
5369 builder.append(_name); | 6312 builder.append(_name); |
5370 } | 6313 } |
5371 } | 6314 } |
5372 } | 6315 } |
| 6316 |
5373 /** | 6317 /** |
5374 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o
bjects representing | 6318 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o
bjects representing |
5375 * the type introduced by a type variable. | 6319 * the type introduced by a type variable. |
5376 * @coverage dart.engine.type | 6320 * @coverage dart.engine.type |
5377 */ | 6321 */ |
5378 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { | 6322 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { |
| 6323 |
5379 /** | 6324 /** |
5380 * Return an array containing the type variable types defined by the given arr
ay of type variable | 6325 * Return an array containing the type variable types defined by the given arr
ay of type variable |
5381 * elements. | 6326 * elements. |
5382 * @param typeVariables the type variable elements defining the type variable
types to be returned | 6327 * @param typeVariables the type variable elements defining the type variable
types to be returned |
5383 * @return the type variable types defined by the type variable elements | 6328 * @return the type variable types defined by the type variable elements |
5384 */ | 6329 */ |
5385 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables
) { | 6330 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables
) { |
5386 int count = typeVariables.length; | 6331 int count = typeVariables.length; |
5387 List<TypeVariableType> types = new List<TypeVariableType>(count); | 6332 List<TypeVariableType> types = new List<TypeVariableType>(count); |
5388 for (int i = 0; i < count; i++) { | 6333 for (int i = 0; i < count; i++) { |
5389 types[i] = typeVariables[i].type; | 6334 types[i] = typeVariables[i].type; |
5390 } | 6335 } |
5391 return types; | 6336 return types; |
5392 } | 6337 } |
| 6338 |
5393 /** | 6339 /** |
5394 * Initialize a newly created type variable to be declared by the given elemen
t and to have the | 6340 * Initialize a newly created type variable to be declared by the given elemen
t and to have the |
5395 * given name. | 6341 * given name. |
5396 * @param element the element representing the declaration of the type variabl
e | 6342 * @param element the element representing the declaration of the type variabl
e |
5397 */ | 6343 */ |
5398 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam
e) { | 6344 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam
e) { |
5399 } | 6345 } |
5400 bool operator ==(Object object) => object is TypeVariableTypeImpl && element =
= ((object as TypeVariableTypeImpl)).element; | 6346 bool operator ==(Object object) => object is TypeVariableTypeImpl && element =
= ((object as TypeVariableTypeImpl)).element; |
5401 TypeVariableElement get element => super.element as TypeVariableElement; | 6347 TypeVariableElement get element => super.element as TypeVariableElement; |
5402 int get hashCode => element.hashCode; | 6348 int get hashCode => element.hashCode; |
5403 bool isMoreSpecificThan(Type2 type) { | 6349 bool isMoreSpecificThan(Type2 type) { |
5404 Type2 upperBound = element.bound; | 6350 Type2 upperBound = element.bound; |
5405 return type == upperBound; | 6351 return type == upperBound; |
5406 } | 6352 } |
5407 bool isSubtypeOf(Type2 type) => true; | 6353 bool isSubtypeOf(Type2 type) => true; |
5408 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { | 6354 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { |
5409 int length2 = parameterTypes.length; | 6355 int length2 = parameterTypes.length; |
5410 for (int i = 0; i < length2; i++) { | 6356 for (int i = 0; i < length2; i++) { |
5411 if (parameterTypes[i] == this) { | 6357 if (parameterTypes[i] == this) { |
5412 return argumentTypes[i]; | 6358 return argumentTypes[i]; |
5413 } | 6359 } |
5414 } | 6360 } |
5415 return this; | 6361 return this; |
5416 } | 6362 } |
5417 } | 6363 } |
| 6364 |
5418 /** | 6365 /** |
5419 * The unique instance of the class {@code VoidTypeImpl} implements the type {@c
ode void}. | 6366 * The unique instance of the class {@code VoidTypeImpl} implements the type {@c
ode void}. |
5420 * @coverage dart.engine.type | 6367 * @coverage dart.engine.type |
5421 */ | 6368 */ |
5422 class VoidTypeImpl extends TypeImpl implements VoidType { | 6369 class VoidTypeImpl extends TypeImpl implements VoidType { |
| 6370 |
5423 /** | 6371 /** |
5424 * The unique instance of this class. | 6372 * The unique instance of this class. |
5425 */ | 6373 */ |
5426 static VoidTypeImpl _INSTANCE = new VoidTypeImpl(); | 6374 static VoidTypeImpl _INSTANCE = new VoidTypeImpl(); |
| 6375 |
5427 /** | 6376 /** |
5428 * Return the unique instance of this class. | 6377 * Return the unique instance of this class. |
5429 * @return the unique instance of this class | 6378 * @return the unique instance of this class |
5430 */ | 6379 */ |
5431 static VoidTypeImpl get instance => _INSTANCE; | 6380 static VoidTypeImpl get instance => _INSTANCE; |
| 6381 |
5432 /** | 6382 /** |
5433 * Prevent the creation of instances of this class. | 6383 * Prevent the creation of instances of this class. |
5434 */ | 6384 */ |
5435 VoidTypeImpl() : super(null, Keyword.VOID.syntax) { | 6385 VoidTypeImpl() : super(null, Keyword.VOID.syntax) { |
5436 } | 6386 } |
5437 bool operator ==(Object object) => identical(object, this); | 6387 bool operator ==(Object object) => identical(object, this); |
5438 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam
icTypeImpl.instance); | 6388 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam
icTypeImpl.instance); |
5439 bool isVoid() => true; | 6389 bool isVoid() => true; |
5440 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
) => this; | 6390 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
) => this; |
5441 } | 6391 } |
| 6392 |
5442 /** | 6393 /** |
5443 * The interface {@code FunctionType} defines the behavior common to objects rep
resenting the type | 6394 * The interface {@code FunctionType} defines the behavior common to objects rep
resenting the type |
5444 * of a function, method, constructor, getter, or setter. Function types come in
three variations: | 6395 * of a function, method, constructor, getter, or setter. Function types come in
three variations: |
5445 * <ol> | 6396 * <ol> |
5446 * <li>The types of functions that only have required parameters. These have the
general form | 6397 * <li>The types of functions that only have required parameters. These have the
general form |
5447 * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>.</li> | 6398 * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>.</li> |
5448 * <li>The types of functions with optional positional parameters. These have th
e general form | 6399 * <li>The types of functions with optional positional parameters. These have th
e general form |
5449 * <i>(T<sub>1</sub>, …, T<sub>n</sub>, \[T<sub>n+1</sub>, …, T<su
b>n+k</sub>\]) → | 6400 * <i>(T<sub>1</sub>, …, T<sub>n</sub>, \[T<sub>n+1</sub>, …, T<su
b>n+k</sub>\]) → |
5450 * T</i>.</li> | 6401 * T</i>.</li> |
5451 * <li>The types of functions with named positional parameters. These have the g
eneral form | 6402 * <li>The types of functions with named parameters. These have the general form
<i>(T<sub>1</sub>, |
5452 * <i>(T<sub>1</sub>, …, T<sub>n</sub>, {T<sub>x1</sub> x1, …, T<s
ub>xk</sub> xk}) | 6403 * …, T<sub>n</sub>, {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) &r
arr; T</i>.</li> |
5453 * → T</i>.</li> | |
5454 * </ol> | 6404 * </ol> |
5455 * @coverage dart.engine.type | 6405 * @coverage dart.engine.type |
5456 */ | 6406 */ |
5457 abstract class FunctionType implements Type2 { | 6407 abstract class FunctionType implements ParameterizedType { |
| 6408 |
5458 /** | 6409 /** |
5459 * Return a map from the names of named parameters to the types of the named p
arameters of this | 6410 * Return a map from the names of named parameters to the types of the named p
arameters of this |
5460 * type of function. The entries in the map will be iterated in the same order
as the order in | 6411 * type of function. The entries in the map will be iterated in the same order
as the order in |
5461 * which the named parameters were defined. If there were no named parameters
declared then the | 6412 * which the named parameters were defined. If there were no named parameters
declared then the |
5462 * map will be empty. | 6413 * map will be empty. |
5463 * @return a map from the name to the types of the named parameters of this ty
pe of function | 6414 * @return a map from the name to the types of the named parameters of this ty
pe of function |
5464 */ | 6415 */ |
5465 Map<String, Type2> get namedParameterTypes; | 6416 Map<String, Type2> get namedParameterTypes; |
| 6417 |
5466 /** | 6418 /** |
5467 * Return an array containing the types of the normal parameters of this type
of function. The | 6419 * Return an array containing the types of the normal parameters of this type
of function. The |
5468 * parameter types are in the same order as they appear in the declaration of
the function. | 6420 * parameter types are in the same order as they appear in the declaration of
the function. |
5469 * @return the types of the normal parameters of this type of function | 6421 * @return the types of the normal parameters of this type of function |
5470 */ | 6422 */ |
5471 List<Type2> get normalParameterTypes; | 6423 List<Type2> get normalParameterTypes; |
| 6424 |
5472 /** | 6425 /** |
5473 * Return a map from the names of optional (positional) parameters to the type
s of the optional | 6426 * Return a map from the names of optional (positional) parameters to the type
s of the optional |
5474 * parameters of this type of function. The entries in the map will be iterate
d in the same order | 6427 * parameters of this type of function. The entries in the map will be iterate
d in the same order |
5475 * as the order in which the optional parameters were defined. If there were n
o optional | 6428 * as the order in which the optional parameters were defined. If there were n
o optional |
5476 * parameters declared then the map will be empty. | 6429 * parameters declared then the map will be empty. |
5477 * @return a map from the name to the types of the optional parameters of this
type of function | 6430 * @return a map from the name to the types of the optional parameters of this
type of function |
5478 */ | 6431 */ |
5479 List<Type2> get optionalParameterTypes; | 6432 List<Type2> get optionalParameterTypes; |
| 6433 |
| 6434 /** |
| 6435 * Return an array containing the parameters elements of this type of function
. The parameter |
| 6436 * types are in the same order as they appear in the declaration of the functi
on. |
| 6437 * @return the parameters elements of this type of function |
| 6438 */ |
| 6439 List<ParameterElement> get parameters; |
| 6440 |
5480 /** | 6441 /** |
5481 * Return the type of object returned by this type of function. | 6442 * Return the type of object returned by this type of function. |
5482 * @return the type of object returned by this type of function | 6443 * @return the type of object returned by this type of function |
5483 */ | 6444 */ |
5484 Type2 get returnType; | 6445 Type2 get returnType; |
5485 /** | 6446 |
5486 * Return an array containing the actual types of the type arguments. If this
type's element does | |
5487 * not have type parameters, then the array should be empty (although it is po
ssible for type | |
5488 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type | |
5489 * does not explicitly include argument values, then the type "dynamic" will b
e automatically | |
5490 * provided. | |
5491 * @return the actual types of the type arguments | |
5492 */ | |
5493 List<Type2> get typeArguments; | |
5494 /** | 6447 /** |
5495 * Return {@code true} if this type is a subtype of the given type. | 6448 * Return {@code true} if this type is a subtype of the given type. |
5496 * <p> | 6449 * <p> |
5497 * A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i> is
a subtype of the | 6450 * A function type <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i> is
a subtype of the |
5498 * function type <i>(S<sub>1</sub>, …, S<sub>n</sub>) → S</i>, if
all of the following | 6451 * function type <i>(S<sub>1</sub>, …, S<sub>n</sub>) → S</i>, if
all of the following |
5499 * conditions are met: | 6452 * conditions are met: |
5500 * <ul> | 6453 * <ul> |
5501 * <li>Either | 6454 * <li>Either |
5502 * <ul> | 6455 * <ul> |
5503 * <li><i>S</i> is void, or</li> | 6456 * <li><i>S</i> is void, or</li> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5548 * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>, &he
llip;, | 6501 * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T <: (T<sub>1</sub>, &he
llip;, |
5549 * T<sub>n</sub>, \[\]) → T.</i> | 6502 * T<sub>n</sub>, \[\]) → T.</i> |
5550 * <p> | 6503 * <p> |
5551 * All functions implement the class {@code Function}. However not all functio
n types are a | 6504 * All functions implement the class {@code Function}. However not all functio
n types are a |
5552 * subtype of {@code Function}. If an interface type <i>I</i> includes a metho
d named{@code call()}, and the type of {@code call()} is the function type <i>F<
/i>, then <i>I</i> is | 6505 * subtype of {@code Function}. If an interface type <i>I</i> includes a metho
d named{@code call()}, and the type of {@code call()} is the function type <i>F<
/i>, then <i>I</i> is |
5553 * considered to be a subtype of <i>F</i>. | 6506 * considered to be a subtype of <i>F</i>. |
5554 * @param type the type being compared with this type | 6507 * @param type the type being compared with this type |
5555 * @return {@code true} if this type is a subtype of the given type | 6508 * @return {@code true} if this type is a subtype of the given type |
5556 */ | 6509 */ |
5557 bool isSubtypeOf(Type2 type); | 6510 bool isSubtypeOf(Type2 type); |
| 6511 |
5558 /** | 6512 /** |
5559 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. | 6513 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. |
5560 * This is fully equivalent to {@code substitute(argumentTypes, getTypeArgumen
ts())}. | 6514 * This is fully equivalent to {@code substitute(argumentTypes, getTypeArgumen
ts())}. |
5561 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters | 6515 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters |
5562 * @return the result of performing the substitution | 6516 * @return the result of performing the substitution |
5563 */ | 6517 */ |
5564 FunctionType substitute4(List<Type2> argumentTypes); | 6518 FunctionType substitute4(List<Type2> argumentTypes); |
5565 FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
); | 6519 FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
); |
5566 } | 6520 } |
| 6521 |
5567 /** | 6522 /** |
5568 * The interface {@code InterfaceType} defines the behavior common to objects re
presenting the type | 6523 * The interface {@code InterfaceType} defines the behavior common to objects re
presenting the type |
5569 * introduced by either a class or an interface, or a reference to such a type. | 6524 * introduced by either a class or an interface, or a reference to such a type. |
5570 * @coverage dart.engine.type | 6525 * @coverage dart.engine.type |
5571 */ | 6526 */ |
5572 abstract class InterfaceType implements Type2 { | 6527 abstract class InterfaceType implements ParameterizedType { |
5573 ClassElement get element; | 6528 ClassElement get element; |
| 6529 |
5574 /** | 6530 /** |
5575 * Return the element representing the getter with the given name that is decl
ared in this class, | 6531 * Return the element representing the getter with the given name that is decl
ared in this class, |
5576 * or {@code null} if this class does not declare a getter with the given name
. | 6532 * or {@code null} if this class does not declare a getter with the given name
. |
5577 * @param getterName the name of the getter to be returned | 6533 * @param getterName the name of the getter to be returned |
5578 * @return the getter declared in this class with the given name | 6534 * @return the getter declared in this class with the given name |
5579 */ | 6535 */ |
5580 PropertyAccessorElement getGetter(String getterName); | 6536 PropertyAccessorElement getGetter(String getterName); |
| 6537 |
5581 /** | 6538 /** |
5582 * Return an array containing all of the interfaces that are implemented by th
is interface. Note | 6539 * Return an array containing all of the interfaces that are implemented by th
is interface. Note |
5583 * that this is <b>not</b>, in general, equivalent to getting the interfaces f
rom this type's | 6540 * that this is <b>not</b>, in general, equivalent to getting the interfaces f
rom this type's |
5584 * element because the types returned by this method will have had their type
parameters replaced. | 6541 * element because the types returned by this method will have had their type
parameters replaced. |
5585 * @return the interfaces that are implemented by this type | 6542 * @return the interfaces that are implemented by this type |
5586 */ | 6543 */ |
5587 List<InterfaceType> get interfaces; | 6544 List<InterfaceType> get interfaces; |
| 6545 |
5588 /** | 6546 /** |
5589 * Return the least upper bound of this type and the given type, or {@code nul
l} if there is no | 6547 * Return the least upper bound of this type and the given type, or {@code nul
l} if there is no |
5590 * least upper bound. | 6548 * least upper bound. |
5591 * <p> | 6549 * <p> |
5592 * Given two interfaces <i>I</i> and <i>J</i>, let <i>S<sub>I</sub></i> be the
set of | 6550 * Given two interfaces <i>I</i> and <i>J</i>, let <i>S<sub>I</sub></i> be the
set of |
5593 * superinterfaces of <i>I<i>, let <i>S<sub>J</sub></i> be the set of superint
erfaces of <i>J</i> | 6551 * superinterfaces of <i>I<i>, let <i>S<sub>J</sub></i> be the set of superint
erfaces of <i>J</i> |
5594 * and let <i>S = (I ∪ S<sub>I</sub>) ∩ (J ∪ S<sub>J</sub>)</i>. F
urthermore, we | 6552 * and let <i>S = (I ∪ S<sub>I</sub>) ∩ (J ∪ S<sub>J</sub>)</i>. F
urthermore, we |
5595 * define <i>S<sub>n</sub> = {T | T ∈ S ∧ depth(T) = n}</i> for any f
inite <i>n</i>, | 6553 * define <i>S<sub>n</sub> = {T | T ∈ S ∧ depth(T) = n}</i> for any f
inite <i>n</i>, |
5596 * where <i>depth(T)</i> is the number of steps in the longest inheritance pat
h from <i>T</i> to | 6554 * where <i>depth(T)</i> is the number of steps in the longest inheritance pat
h from <i>T</i> to |
5597 * <i>Object</i>. Let <i>q</i> be the largest number such that <i>S<sub>q</sub
></i> has | 6555 * <i>Object</i>. Let <i>q</i> be the largest number such that <i>S<sub>q</sub
></i> has |
5598 * cardinality one. The least upper bound of <i>I</i> and <i>J</i> is the sole
element of | 6556 * cardinality one. The least upper bound of <i>I</i> and <i>J</i> is the sole
element of |
5599 * <i>S<sub>q</sub></i>. | 6557 * <i>S<sub>q</sub></i>. |
5600 * @param type the other type used to compute the least upper bound | 6558 * @param type the other type used to compute the least upper bound |
5601 * @return the least upper bound of this type and the given type | 6559 * @return the least upper bound of this type and the given type |
5602 */ | 6560 */ |
5603 Type2 getLeastUpperBound(Type2 type); | 6561 Type2 getLeastUpperBound(Type2 type); |
| 6562 |
5604 /** | 6563 /** |
5605 * Return the element representing the method with the given name that is decl
ared in this class, | 6564 * Return the element representing the method with the given name that is decl
ared in this class, |
5606 * or {@code null} if this class does not declare a method with the given name
. | 6565 * or {@code null} if this class does not declare a method with the given name
. |
5607 * @param methodName the name of the method to be returned | 6566 * @param methodName the name of the method to be returned |
5608 * @return the method declared in this class with the given name | 6567 * @return the method declared in this class with the given name |
5609 */ | 6568 */ |
5610 MethodElement getMethod(String methodName); | 6569 MethodElement getMethod(String methodName); |
| 6570 |
5611 /** | 6571 /** |
5612 * Return an array containing all of the mixins that are applied to the class
being extended in | 6572 * Return an array containing all of the mixins that are applied to the class
being extended in |
5613 * order to derive the superclass of this class. Note that this is <b>not</b>,
in general, | 6573 * order to derive the superclass of this class. Note that this is <b>not</b>,
in general, |
5614 * equivalent to getting the mixins from this type's element because the types
returned by this | 6574 * equivalent to getting the mixins from this type's element because the types
returned by this |
5615 * method will have had their type parameters replaced. | 6575 * method will have had their type parameters replaced. |
5616 * @return the mixins that are applied to derive the superclass of this class | 6576 * @return the mixins that are applied to derive the superclass of this class |
5617 */ | 6577 */ |
5618 List<InterfaceType> get mixins; | 6578 List<InterfaceType> get mixins; |
| 6579 |
5619 /** | 6580 /** |
5620 * Return the element representing the setter with the given name that is decl
ared in this class, | 6581 * Return the element representing the setter with the given name that is decl
ared in this class, |
5621 * or {@code null} if this class does not declare a setter with the given name
. | 6582 * or {@code null} if this class does not declare a setter with the given name
. |
5622 * @param setterName the name of the setter to be returned | 6583 * @param setterName the name of the setter to be returned |
5623 * @return the setter declared in this class with the given name | 6584 * @return the setter declared in this class with the given name |
5624 */ | 6585 */ |
5625 PropertyAccessorElement getSetter(String setterName); | 6586 PropertyAccessorElement getSetter(String setterName); |
| 6587 |
5626 /** | 6588 /** |
5627 * Return the type representing the superclass of this type, or null if this t
ype represents the | 6589 * Return the type representing the superclass of this type, or null if this t
ype represents the |
5628 * class 'Object'. Note that this is <b>not</b>, in general, equivalent to get
ting the superclass | 6590 * class 'Object'. Note that this is <b>not</b>, in general, equivalent to get
ting the superclass |
5629 * from this type's element because the type returned by this method will have
had it's type | 6591 * from this type's element because the type returned by this method will have
had it's type |
5630 * parameters replaced. | 6592 * parameters replaced. |
5631 * @return the superclass of this type | 6593 * @return the superclass of this type |
5632 */ | 6594 */ |
5633 InterfaceType get superclass; | 6595 InterfaceType get superclass; |
5634 /** | 6596 |
5635 * Return an array containing the actual types of the type arguments. If this
type's element does | |
5636 * not have type parameters, then the array should be empty (although it is po
ssible for type | |
5637 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type | |
5638 * does not explicitly include argument values, then the type "dynamic" will b
e automatically | |
5639 * provided. | |
5640 * @return the actual types of the type arguments | |
5641 */ | |
5642 List<Type2> get typeArguments; | |
5643 /** | 6597 /** |
5644 * Return {@code true} if this type is a direct supertype of the given type. T
he implicit | 6598 * Return {@code true} if this type is a direct supertype of the given type. T
he implicit |
5645 * interface of class <i>I</i> is a direct supertype of the implicit interface
of class <i>J</i> | 6599 * interface of class <i>I</i> is a direct supertype of the implicit interface
of class <i>J</i> |
5646 * iff: | 6600 * iff: |
5647 * <ul> | 6601 * <ul> |
5648 * <li><i>I</i> is Object, and <i>J</i> has no extends clause.</li> | 6602 * <li><i>I</i> is Object, and <i>J</i> has no extends clause.</li> |
5649 * <li><i>I</i> is listed in the extends clause of <i>J</i>.</li> | 6603 * <li><i>I</i> is listed in the extends clause of <i>J</i>.</li> |
5650 * <li><i>I</i> is listed in the implements clause of <i>J</i>.</li> | 6604 * <li><i>I</i> is listed in the implements clause of <i>J</i>.</li> |
5651 * <li><i>I</i> is listed in the with clause of <i>J</i>.</li> | 6605 * <li><i>I</i> is listed in the with clause of <i>J</i>.</li> |
5652 * <li><i>J</i> is a mixin application of the mixin of <i>I</i>.</li> | 6606 * <li><i>J</i> is a mixin application of the mixin of <i>I</i>.</li> |
5653 * </ul> | 6607 * </ul> |
5654 * @param type the type being compared with this type | 6608 * @param type the type being compared with this type |
5655 * @return {@code true} if this type is a direct supertype of the given type | 6609 * @return {@code true} if this type is a direct supertype of the given type |
5656 */ | 6610 */ |
5657 bool isDirectSupertypeOf(InterfaceType type); | 6611 bool isDirectSupertypeOf(InterfaceType type); |
| 6612 |
5658 /** | 6613 /** |
5659 * Return {@code true} if this type is more specific than the given type. An i
nterface type | 6614 * Return {@code true} if this type is more specific than the given type. An i
nterface type |
5660 * <i>T</i> is more specific than an interface type <i>S</i>, written <i>T &la
quo; S</i>, if one | 6615 * <i>T</i> is more specific than an interface type <i>S</i>, written <i>T &la
quo; S</i>, if one |
5661 * of the following conditions is met: | 6616 * of the following conditions is met: |
5662 * <ul> | 6617 * <ul> |
5663 * <li>Reflexivity: <i>T</i> is <i>S</i>. | 6618 * <li>Reflexivity: <i>T</i> is <i>S</i>. |
5664 * <li><i>T</i> is bottom. | 6619 * <li><i>T</i> is bottom. |
5665 * <li><i>S</i> is dynamic. | 6620 * <li><i>S</i> is dynamic. |
5666 * <li>Direct supertype: <i>S</i> is a direct supertype of <i>T</i>. | 6621 * <li>Direct supertype: <i>S</i> is a direct supertype of <i>T</i>. |
5667 * <li><i>T</i> is a type variable and <i>S</i> is the upper bound of <i>T</i>
. | 6622 * <li><i>T</i> is a type variable and <i>S</i> is the upper bound of <i>T</i>
. |
5668 * <li>Covariance: <i>T</i> is of the form <i>I<T<sub>1</sub>, …, T<
sub>n</sub>></i> | 6623 * <li>Covariance: <i>T</i> is of the form <i>I<T<sub>1</sub>, …, T<
sub>n</sub>></i> |
5669 * and S</i> is of the form <i>I<S<sub>1</sub>, …, S<sub>n</sub>>
</i> and | 6624 * and S</i> is of the form <i>I<S<sub>1</sub>, …, S<sub>n</sub>>
</i> and |
5670 * <i>T<sub>i</sub> « S<sub>i</sub></i>, <i>1 <= i <= n</i>. | 6625 * <i>T<sub>i</sub> « S<sub>i</sub></i>, <i>1 <= i <= n</i>. |
5671 * <li>Transitivity: <i>T « U</i> and <i>U « S</i>. | 6626 * <li>Transitivity: <i>T « U</i> and <i>U « S</i>. |
5672 * </ul> | 6627 * </ul> |
5673 * @param type the type being compared with this type | 6628 * @param type the type being compared with this type |
5674 * @return {@code true} if this type is more specific than the given type | 6629 * @return {@code true} if this type is more specific than the given type |
5675 */ | 6630 */ |
5676 bool isMoreSpecificThan(Type2 type); | 6631 bool isMoreSpecificThan(Type2 type); |
| 6632 |
5677 /** | 6633 /** |
5678 * Return {@code true} if this type is a subtype of the given type. An interfa
ce type <i>T</i> is | 6634 * Return {@code true} if this type is a subtype of the given type. An interfa
ce type <i>T</i> is |
5679 * a subtype of an interface type <i>S</i>, written <i>T</i> <: <i>S</i>, iff | 6635 * a subtype of an interface type <i>S</i>, written <i>T</i> <: <i>S</i>, iff |
5680 * <i>\[bottom/dynamic\]T</i> « <i>S</i> (<i>T</i> is more specific than
<i>S</i>). If an | 6636 * <i>\[bottom/dynamic\]T</i> « <i>S</i> (<i>T</i> is more specific than
<i>S</i>). If an |
5681 * interface type <i>I</i> includes a method named <i>call()</i>, and the type
of <i>call()</i> is | 6637 * interface type <i>I</i> includes a method named <i>call()</i>, and the type
of <i>call()</i> is |
5682 * the function type <i>F</i>, then <i>I</i> is considered to be a subtype of
<i>F</i>. | 6638 * the function type <i>F</i>, then <i>I</i> is considered to be a subtype of
<i>F</i>. |
5683 * @param type the type being compared with this type | 6639 * @param type the type being compared with this type |
5684 * @return {@code true} if this type is a subtype of the given type | 6640 * @return {@code true} if this type is a subtype of the given type |
5685 */ | 6641 */ |
5686 bool isSubtypeOf(Type2 type); | 6642 bool isSubtypeOf(Type2 type); |
| 6643 |
| 6644 /** |
| 6645 * Return the element representing the constructor that results from looking u
p the given |
| 6646 * constructor in this class with respect to the given library, or {@code null
} if the look up |
| 6647 * fails. The behavior of this method is defined by the Dart Language Specific
ation in section |
| 6648 * 12.11.1: <blockquote>If <i>e</i> is of the form <b>new</b> <i>T.id()</i> th
en let <i>q<i> be |
| 6649 * the constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor <i>T<
i>. Otherwise, if |
| 6650 * <i>q</i> is not defined or not accessible, a NoSuchMethodException is throw
n. </blockquote> |
| 6651 * @param constructorName the name of the constructor being looked up |
| 6652 * @param library the library with respect to which the lookup is being perfor
med |
| 6653 * @return the result of looking up the given constructor in this class with r
espect to the given |
| 6654 * library |
| 6655 */ |
| 6656 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li
brary); |
| 6657 |
5687 /** | 6658 /** |
5688 * Return the element representing the getter that results from looking up the
given getter in | 6659 * Return the element representing the getter that results from looking up the
given getter in |
5689 * this class with respect to the given library, or {@code null} if the look u
p fails. The | 6660 * this class with respect to the given library, or {@code null} if the look u
p fails. The |
5690 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: | 6661 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: |
5691 * <blockquote>The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> | 6662 * <blockquote>The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> |
5692 * with respect to library <i>L</i> is: | 6663 * with respect to library <i>L</i> is: |
5693 * <ul> | 6664 * <ul> |
5694 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is | 6665 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is |
5695 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. | 6666 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. |
5696 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result | 6667 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result |
5697 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. | 6668 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. |
5698 * Otherwise, we say that the lookup has failed.</li> | 6669 * Otherwise, we say that the lookup has failed.</li> |
5699 * </ul> | 6670 * </ul> |
5700 * </blockquote> | 6671 * </blockquote> |
5701 * @param getterName the name of the getter being looked up | 6672 * @param getterName the name of the getter being looked up |
5702 * @param library the library with respect to which the lookup is being perfor
med | 6673 * @param library the library with respect to which the lookup is being perfor
med |
5703 * @return the result of looking up the given getter in this class with respec
t to the given | 6674 * @return the result of looking up the given getter in this class with respec
t to the given |
5704 * library | 6675 * library |
5705 */ | 6676 */ |
5706 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
); | 6677 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
); |
| 6678 |
| 6679 /** |
| 6680 * Return the element representing the getter that results from looking up the
given getter in the |
| 6681 * superclass of this class with respect to the given library, or {@code null}
if the look up |
| 6682 * fails. The behavior of this method is defined by the Dart Language Specific
ation in section |
| 6683 * 12.15.1: <blockquote>The result of looking up getter (respectively setter)
<i>m</i> in class |
| 6684 * <i>C</i> with respect to library <i>L</i> is: |
| 6685 * <ul> |
| 6686 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is |
| 6687 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. |
| 6688 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result |
| 6689 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. |
| 6690 * Otherwise, we say that the lookup has failed.</li> |
| 6691 * </ul> |
| 6692 * </blockquote> |
| 6693 * @param getterName the name of the getter being looked up |
| 6694 * @param library the library with respect to which the lookup is being perfor
med |
| 6695 * @return the result of looking up the given getter in this class with respec
t to the given |
| 6696 * library |
| 6697 */ |
| 6698 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryEle
ment library); |
| 6699 |
5707 /** | 6700 /** |
5708 * Return the element representing the method that results from looking up the
given method in | 6701 * Return the element representing the method that results from looking up the
given method in |
5709 * this class with respect to the given library, or {@code null} if the look u
p fails. The | 6702 * this class with respect to the given library, or {@code null} if the look u
p fails. The |
5710 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: | 6703 * behavior of this method is defined by the Dart Language Specification in se
ction 12.15.1: |
5711 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit
h respect to library | 6704 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit
h respect to library |
5712 * <i>L</i> is: | 6705 * <i>L</i> is: |
5713 * <ul> | 6706 * <ul> |
5714 * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessib
le to <i>L</i>, then | 6707 * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessib
le to <i>L</i>, then |
5715 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super
class <i>S</i>, then | 6708 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super
class <i>S</i>, then |
5716 * the result of the lookup is the result of looking up method <i>m</i> in <i>
S</i> with respect | 6709 * the result of the lookup is the result of looking up method <i>m</i> in <i>
S</i> with respect |
5717 * to <i>L</i>. Otherwise, we say that the lookup has failed.</li> | 6710 * to <i>L</i>. Otherwise, we say that the lookup has failed.</li> |
5718 * </ul> | 6711 * </ul> |
5719 * </blockquote> | 6712 * </blockquote> |
5720 * @param methodName the name of the method being looked up | 6713 * @param methodName the name of the method being looked up |
5721 * @param library the library with respect to which the lookup is being perfor
med | 6714 * @param library the library with respect to which the lookup is being perfor
med |
5722 * @return the result of looking up the given method in this class with respec
t to the given | 6715 * @return the result of looking up the given method in this class with respec
t to the given |
5723 * library | 6716 * library |
5724 */ | 6717 */ |
5725 MethodElement lookUpMethod(String methodName, LibraryElement library); | 6718 MethodElement lookUpMethod(String methodName, LibraryElement library); |
| 6719 |
| 6720 /** |
| 6721 * Return the element representing the method that results from looking up the
given method in the |
| 6722 * superclass of this class with respect to the given library, or {@code null}
if the look up |
| 6723 * fails. The behavior of this method is defined by the Dart Language Specific
ation in section |
| 6724 * 12.15.1: <blockquote> The result of looking up method <i>m</i> in class <i>
C</i> with respect |
| 6725 * to library <i>L</i> is: |
| 6726 * <ul> |
| 6727 * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessib
le to <i>L</i>, then |
| 6728 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super
class <i>S</i>, then |
| 6729 * the result of the lookup is the result of looking up method <i>m</i> in <i>
S</i> with respect |
| 6730 * to <i>L</i>. Otherwise, we say that the lookup has failed.</li> |
| 6731 * </ul> |
| 6732 * </blockquote> |
| 6733 * @param methodName the name of the method being looked up |
| 6734 * @param library the library with respect to which the lookup is being perfor
med |
| 6735 * @return the result of looking up the given method in this class with respec
t to the given |
| 6736 * library |
| 6737 */ |
| 6738 MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement libra
ry); |
| 6739 |
5726 /** | 6740 /** |
5727 * Return the element representing the setter that results from looking up the
given setter in | 6741 * Return the element representing the setter that results from looking up the
given setter in |
5728 * this class with respect to the given library, or {@code null} if the look u
p fails. The | 6742 * this class with respect to the given library, or {@code null} if the look u
p fails. The |
5729 * behavior of this method is defined by the Dart Language Specification in se
ction 12.16: | 6743 * behavior of this method is defined by the Dart Language Specification in se
ction 12.16: |
5730 * <blockquote> The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> | 6744 * <blockquote> The result of looking up getter (respectively setter) <i>m</i>
in class <i>C</i> |
5731 * with respect to library <i>L</i> is: | 6745 * with respect to library <i>L</i> is: |
5732 * <ul> | 6746 * <ul> |
5733 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is | 6747 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is |
5734 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. | 6748 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. |
5735 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result | 6749 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result |
5736 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. | 6750 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. |
5737 * Otherwise, we say that the lookup has failed.</li> | 6751 * Otherwise, we say that the lookup has failed.</li> |
5738 * </ul> | 6752 * </ul> |
5739 * </blockquote> | 6753 * </blockquote> |
5740 * @param setterName the name of the setter being looked up | 6754 * @param setterName the name of the setter being looked up |
5741 * @param library the library with respect to which the lookup is being perfor
med | 6755 * @param library the library with respect to which the lookup is being perfor
med |
5742 * @return the result of looking up the given setter in this class with respec
t to the given | 6756 * @return the result of looking up the given setter in this class with respec
t to the given |
5743 * library | 6757 * library |
5744 */ | 6758 */ |
5745 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
); | 6759 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
); |
| 6760 |
| 6761 /** |
| 6762 * Return the element representing the setter that results from looking up the
given setter in the |
| 6763 * superclass of this class with respect to the given library, or {@code null}
if the look up |
| 6764 * fails. The behavior of this method is defined by the Dart Language Specific
ation in section |
| 6765 * 12.16: <blockquote> The result of looking up getter (respectively setter) <
i>m</i> in class |
| 6766 * <i>C</i> with respect to library <i>L</i> is: |
| 6767 * <ul> |
| 6768 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>
m</i> that is |
| 6769 * accessible to <i>L</i>, then that getter (respectively setter) is the resul
t of the lookup. |
| 6770 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo
okup is the result |
| 6771 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec
t to <i>L</i>. |
| 6772 * Otherwise, we say that the lookup has failed.</li> |
| 6773 * </ul> |
| 6774 * </blockquote> |
| 6775 * @param setterName the name of the setter being looked up |
| 6776 * @param library the library with respect to which the lookup is being perfor
med |
| 6777 * @return the result of looking up the given setter in this class with respec
t to the given |
| 6778 * library |
| 6779 */ |
| 6780 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle
ment library); |
| 6781 |
5746 /** | 6782 /** |
5747 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. | 6783 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. |
5748 * This is fully equivalent to {@code substitute(argumentTypes, getTypeArgumen
ts())}. | 6784 * This is fully equivalent to {@code substitute(argumentTypes, getTypeArgumen
ts())}. |
5749 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters | 6785 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters |
5750 * @return the result of performing the substitution | 6786 * @return the result of performing the substitution |
5751 */ | 6787 */ |
5752 InterfaceType substitute5(List<Type2> argumentTypes); | 6788 InterfaceType substitute5(List<Type2> argumentTypes); |
5753 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType
s); | 6789 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType
s); |
5754 } | 6790 } |
| 6791 |
| 6792 /** |
| 6793 * The interface {@code ParameterizedType} defines the behavior common to object
s representing the |
| 6794 * type with type parameters, such as class and function type alias. |
| 6795 * @coverage dart.engine.type |
| 6796 */ |
| 6797 abstract class ParameterizedType implements Type2 { |
| 6798 |
| 6799 /** |
| 6800 * Return an array containing the actual types of the type arguments. If this
type's element does |
| 6801 * not have type parameters, then the array should be empty (although it is po
ssible for type |
| 6802 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type |
| 6803 * does not explicitly include argument values, then the type "dynamic" will b
e automatically |
| 6804 * provided. |
| 6805 * @return the actual types of the type arguments |
| 6806 */ |
| 6807 List<Type2> get typeArguments; |
| 6808 |
| 6809 /** |
| 6810 * Return an array containing all of the type variables declared for this type
. |
| 6811 * @return the type variables declared for this type |
| 6812 */ |
| 6813 List<TypeVariableElement> get typeVariables; |
| 6814 } |
| 6815 |
5755 /** | 6816 /** |
5756 * The interface {@code Type} defines the behavior of objects representing the d
eclared type of | 6817 * The interface {@code Type} defines the behavior of objects representing the d
eclared type of |
5757 * elements in the element model. | 6818 * elements in the element model. |
5758 * @coverage dart.engine.type | 6819 * @coverage dart.engine.type |
5759 */ | 6820 */ |
5760 abstract class Type2 { | 6821 abstract class Type2 { |
| 6822 |
| 6823 /** |
| 6824 * Return the name of this type as it should appear when presented to users in
contexts such as |
| 6825 * error messages. |
| 6826 * @return the name of this type |
| 6827 */ |
| 6828 String get displayName; |
| 6829 |
5761 /** | 6830 /** |
5762 * Return the element representing the declaration of this type, or {@code nul
l} if the type has | 6831 * Return the element representing the declaration of this type, or {@code nul
l} if the type has |
5763 * not, or cannot, be associated with an element. The former case will occur i
f the element model | 6832 * not, or cannot, be associated with an element. The former case will occur i
f the element model |
5764 * is not yet complete; the latter case will occur if this object represents a
n undefined type. | 6833 * is not yet complete; the latter case will occur if this object represents a
n undefined type. |
5765 * @return the element representing the declaration of this type | 6834 * @return the element representing the declaration of this type |
5766 */ | 6835 */ |
5767 Element get element; | 6836 Element get element; |
| 6837 |
5768 /** | 6838 /** |
5769 * Return the least upper bound of this type and the given type, or {@code nul
l} if there is no | 6839 * Return the least upper bound of this type and the given type, or {@code nul
l} if there is no |
5770 * least upper bound. | 6840 * least upper bound. |
5771 * @param type the other type used to compute the least upper bound | 6841 * @param type the other type used to compute the least upper bound |
5772 * @return the least upper bound of this type and the given type | 6842 * @return the least upper bound of this type and the given type |
5773 */ | 6843 */ |
5774 Type2 getLeastUpperBound(Type2 type); | 6844 Type2 getLeastUpperBound(Type2 type); |
| 6845 |
5775 /** | 6846 /** |
5776 * Return the name of this type, or {@code null} if the type does not have a n
ame, such as when | 6847 * Return the name of this type, or {@code null} if the type does not have a n
ame, such as when |
5777 * the type represents the type of an unnamed function. | 6848 * the type represents the type of an unnamed function. |
5778 * @return the name of this type | 6849 * @return the name of this type |
5779 */ | 6850 */ |
5780 String get name; | 6851 String get name; |
| 6852 |
5781 /** | 6853 /** |
5782 * Return {@code true} if this type is assignable to the given type. A type <i
>T</i> may be | 6854 * Return {@code true} if this type is assignable to the given type. A type <i
>T</i> may be |
5783 * assigned to a type <i>S</i>, written <i>T</i> ⇔ <i>S</i>, iff either <
i>T</i> <: <i>S</i> | 6855 * assigned to a type <i>S</i>, written <i>T</i> ⇔ <i>S</i>, iff either <
i>T</i> <: <i>S</i> |
5784 * or <i>S</i> <: <i>T</i>. | 6856 * or <i>S</i> <: <i>T</i>. |
5785 * @param type the type being compared with this type | 6857 * @param type the type being compared with this type |
5786 * @return {@code true} if this type is assignable to the given type | 6858 * @return {@code true} if this type is assignable to the given type |
5787 */ | 6859 */ |
5788 bool isAssignableTo(Type2 type); | 6860 bool isAssignableTo(Type2 type); |
| 6861 |
5789 /** | 6862 /** |
5790 * Return {@code true} if this type represents the type 'Function' defined in
the dart:core | 6863 * Return {@code true} if this type represents the type 'Function' defined in
the dart:core |
5791 * library. | 6864 * library. |
5792 * @return {@code true} if this type represents the type 'Function' defined in
the dart:core | 6865 * @return {@code true} if this type represents the type 'Function' defined in
the dart:core |
5793 * library | 6866 * library |
5794 */ | 6867 */ |
5795 bool isDartCoreFunction(); | 6868 bool isDartCoreFunction(); |
| 6869 |
5796 /** | 6870 /** |
5797 * Return {@code true} if this type represents the type 'dynamic'. | 6871 * Return {@code true} if this type represents the type 'dynamic'. |
5798 * @return {@code true} if this type represents the type 'dynamic' | 6872 * @return {@code true} if this type represents the type 'dynamic' |
5799 */ | 6873 */ |
5800 bool isDynamic(); | 6874 bool isDynamic(); |
| 6875 |
5801 /** | 6876 /** |
5802 * Return {@code true} if this type is more specific than the given type. | 6877 * Return {@code true} if this type is more specific than the given type. |
5803 * @param type the type being compared with this type | 6878 * @param type the type being compared with this type |
5804 * @return {@code true} if this type is more specific than the given type | 6879 * @return {@code true} if this type is more specific than the given type |
5805 */ | 6880 */ |
5806 bool isMoreSpecificThan(Type2 type); | 6881 bool isMoreSpecificThan(Type2 type); |
| 6882 |
| 6883 /** |
| 6884 * Return {@code true} if this type represents the type 'Object'. |
| 6885 * @return {@code true} if this type represents the type 'Object' |
| 6886 */ |
| 6887 bool isObject(); |
| 6888 |
5807 /** | 6889 /** |
5808 * Return {@code true} if this type is a subtype of the given type. | 6890 * Return {@code true} if this type is a subtype of the given type. |
5809 * @param type the type being compared with this type | 6891 * @param type the type being compared with this type |
5810 * @return {@code true} if this type is a subtype of the given type | 6892 * @return {@code true} if this type is a subtype of the given type |
5811 */ | 6893 */ |
5812 bool isSubtypeOf(Type2 type); | 6894 bool isSubtypeOf(Type2 type); |
| 6895 |
5813 /** | 6896 /** |
5814 * Return {@code true} if this type is a supertype of the given type. A type <
i>S</i> is a | 6897 * Return {@code true} if this type is a supertype of the given type. A type <
i>S</i> is a |
5815 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt
ype of <i>S</i>. | 6898 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt
ype of <i>S</i>. |
5816 * @param type the type being compared with this type | 6899 * @param type the type being compared with this type |
5817 * @return {@code true} if this type is a supertype of the given type | 6900 * @return {@code true} if this type is a supertype of the given type |
5818 */ | 6901 */ |
5819 bool isSupertypeOf(Type2 type); | 6902 bool isSupertypeOf(Type2 type); |
| 6903 |
5820 /** | 6904 /** |
5821 * Return {@code true} if this type represents the type 'void'. | 6905 * Return {@code true} if this type represents the type 'void'. |
5822 * @return {@code true} if this type represents the type 'void' | 6906 * @return {@code true} if this type represents the type 'void' |
5823 */ | 6907 */ |
5824 bool isVoid(); | 6908 bool isVoid(); |
| 6909 |
5825 /** | 6910 /** |
5826 * Return the type resulting from substituting the given arguments for the giv
en parameters in | 6911 * Return the type resulting from substituting the given arguments for the giv
en parameters in |
5827 * this type. The specification defines this operation in section 2: <blockquo
te> The notation | 6912 * this type. The specification defines this operation in section 2: <blockquo
te> The notation |
5828 * <i>\[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>\]E
</i> denotes a copy of | 6913 * <i>\[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>\]E
</i> denotes a copy of |
5829 * <i>E</i> in which all occurrences of <i>y<sub>i</sub>, 1 <= i <= n</i> have
been replaced with | 6914 * <i>E</i> in which all occurrences of <i>y<sub>i</sub>, 1 <= i <= n</i> have
been replaced with |
5830 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification
, this method will | 6915 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification
, this method will |
5831 * not create a copy of this type if no substitutions were required, but will
return this type | 6916 * not create a copy of this type if no substitutions were required, but will
return this type |
5832 * directly. | 6917 * directly. |
5833 * @param argumentTypes the actual type arguments being substituted for the pa
rameters | 6918 * @param argumentTypes the actual type arguments being substituted for the pa
rameters |
5834 * @param parameterTypes the parameters to be replaced | 6919 * @param parameterTypes the parameters to be replaced |
5835 * @return the result of performing the substitution | 6920 * @return the result of performing the substitution |
5836 */ | 6921 */ |
5837 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 6922 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
5838 } | 6923 } |
| 6924 |
5839 /** | 6925 /** |
5840 * The interface {@code TypeVariableType} defines the behavior of objects repres
enting the type | 6926 * The interface {@code TypeVariableType} defines the behavior of objects repres
enting the type |
5841 * introduced by a type variable. | 6927 * introduced by a type variable. |
5842 * @coverage dart.engine.type | 6928 * @coverage dart.engine.type |
5843 */ | 6929 */ |
5844 abstract class TypeVariableType implements Type2 { | 6930 abstract class TypeVariableType implements Type2 { |
5845 TypeVariableElement get element; | 6931 TypeVariableElement get element; |
5846 } | 6932 } |
| 6933 |
5847 /** | 6934 /** |
5848 * The interface {@code VoidType} defines the behavior of the unique object repr
esenting the type{@code void}. | 6935 * The interface {@code VoidType} defines the behavior of the unique object repr
esenting the type{@code void}. |
5849 * @coverage dart.engine.type | 6936 * @coverage dart.engine.type |
5850 */ | 6937 */ |
5851 abstract class VoidType implements Type2 { | 6938 abstract class VoidType implements Type2 { |
5852 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 6939 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
5853 } | 6940 } |
OLD | NEW |