Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/element.dart

Issue 17932005: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disable resolver tests Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 library engine.element; 3 library engine.element;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_engine.dart'; 6 import 'java_engine.dart';
7 import 'source.dart'; 7 import 'source.dart';
8 import 'scanner.dart' show Keyword; 8 import 'scanner.dart' show Keyword;
9 import 'ast.dart' show Identifier, LibraryIdentifier; 9 import 'ast.dart' show Identifier, LibraryIdentifier;
10 import 'sdk.dart' show DartSdk; 10 import 'sdk.dart' show DartSdk;
11 import 'html.dart' show XmlTagNode; 11 import 'html.dart' show XmlTagNode;
12 import 'engine.dart' show AnalysisContext; 12 import 'engine.dart' show AnalysisContext;
13 import 'constant.dart' show EvaluationResultImpl; 13 import 'constant.dart' show EvaluationResultImpl;
14 import 'utilities_dart.dart'; 14 import 'utilities_dart.dart';
15 /** 15 /**
16 * The interface `ClassElement` defines the behavior of elements that represent a class. 16 * The interface `ClassElement` defines the behavior of elements that represent a class.
17 *
17 * @coverage dart.engine.element 18 * @coverage dart.engine.element
18 */ 19 */
19 abstract class ClassElement implements Element { 20 abstract class ClassElement implements Element {
20 21
21 /** 22 /**
22 * Return an array containing all of the accessors (getters and setters) decla red in this class. 23 * Return an array containing all of the accessors (getters and setters) decla red in this class.
24 *
23 * @return the accessors declared in this class 25 * @return the accessors declared in this class
24 */ 26 */
25 List<PropertyAccessorElement> get accessors; 27 List<PropertyAccessorElement> get accessors;
26 28
27 /** 29 /**
28 * Return an array containing all the supertypes defined for this class and it s supertypes. This 30 * Return an array containing all the supertypes defined for this class and it s supertypes. This
29 * includes superclasses, mixins and interfaces. 31 * includes superclasses, mixins and interfaces.
32 *
30 * @return all the supertypes of this class, including mixins 33 * @return all the supertypes of this class, including mixins
31 */ 34 */
32 List<InterfaceType> get allSupertypes; 35 List<InterfaceType> get allSupertypes;
33 36
34 /** 37 /**
35 * Return an array containing all of the constructors declared in this class. 38 * Return an array containing all of the constructors declared in this class.
39 *
36 * @return the constructors declared in this class 40 * @return the constructors declared in this class
37 */ 41 */
38 List<ConstructorElement> get constructors; 42 List<ConstructorElement> get constructors;
39 43
40 /** 44 /**
41 * Return an array containing all of the fields declared in this class. 45 * Return an array containing all of the fields declared in this class.
46 *
42 * @return the fields declared in this class 47 * @return the fields declared in this class
43 */ 48 */
44 List<FieldElement> get fields; 49 List<FieldElement> get fields;
45 50
46 /** 51 /**
47 * Return the element representing the getter with the given name that is decl ared in this class, 52 * Return the element representing the getter with the given name that is decl ared in this class,
48 * or `null` if this class does not declare a getter with the given name. 53 * or `null` if this class does not declare a getter with the given name.
54 *
49 * @param getterName the name of the getter to be returned 55 * @param getterName the name of the getter to be returned
50 * @return the getter declared in this class with the given name 56 * @return the getter declared in this class with the given name
51 */ 57 */
52 PropertyAccessorElement getGetter(String getterName); 58 PropertyAccessorElement getGetter(String getterName);
53 59
54 /** 60 /**
55 * Return an array containing all of the interfaces that are implemented by th is class. 61 * Return an array containing all of the interfaces that are implemented by th is class.
56 * 62 *
57 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it 63 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it
58 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance 64 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance
59 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure 65 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure
60 * must explicitly guard against infinite loops. 66 * must explicitly guard against infinite loops.
67 *
61 * @return the interfaces that are implemented by this class 68 * @return the interfaces that are implemented by this class
62 */ 69 */
63 List<InterfaceType> get interfaces; 70 List<InterfaceType> get interfaces;
64 71
65 /** 72 /**
66 * Return the element representing the method with the given name that is decl ared in this class, 73 * Return the element representing the method with the given name that is decl ared in this class,
67 * or `null` if this class does not declare a method with the given name. 74 * or `null` if this class does not declare a method with the given name.
75 *
68 * @param methodName the name of the method to be returned 76 * @param methodName the name of the method to be returned
69 * @return the method declared in this class with the given name 77 * @return the method declared in this class with the given name
70 */ 78 */
71 MethodElement getMethod(String methodName); 79 MethodElement getMethod(String methodName);
72 80
73 /** 81 /**
74 * Return an array containing all of the methods declared in this class. 82 * Return an array containing all of the methods declared in this class.
83 *
75 * @return the methods declared in this class 84 * @return the methods declared in this class
76 */ 85 */
77 List<MethodElement> get methods; 86 List<MethodElement> get methods;
78 87
79 /** 88 /**
80 * Return an array containing all of the mixins that are applied to the class being extended in 89 * Return an array containing all of the mixins that are applied to the class being extended in
81 * order to derive the superclass of this class. 90 * order to derive the superclass of this class.
82 * 91 *
83 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it 92 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it
84 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance 93 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance
85 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure 94 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure
86 * must explicitly guard against infinite loops. 95 * must explicitly guard against infinite loops.
96 *
87 * @return the mixins that are applied to derive the superclass of this class 97 * @return the mixins that are applied to derive the superclass of this class
88 */ 98 */
89 List<InterfaceType> get mixins; 99 List<InterfaceType> get mixins;
90 100
91 /** 101 /**
92 * Return the named constructor declared in this class with the given name, or `null` if 102 * Return the named constructor declared in this class with the given name, or `null` if
93 * this class does not declare a named constructor with the given name. 103 * this class does not declare a named constructor with the given name.
104 *
94 * @param name the name of the constructor to be returned 105 * @param name the name of the constructor to be returned
95 * @return the element representing the specified constructor 106 * @return the element representing the specified constructor
96 */ 107 */
97 ConstructorElement getNamedConstructor(String name); 108 ConstructorElement getNamedConstructor(String name);
98 109
99 /** 110 /**
100 * Return the element representing the setter with the given name that is decl ared in this class, 111 * Return the element representing the setter with the given name that is decl ared in this class,
101 * or `null` if this class does not declare a setter with the given name. 112 * or `null` if this class does not declare a setter with the given name.
113 *
102 * @param setterName the name of the getter to be returned 114 * @param setterName the name of the getter to be returned
103 * @return the setter declared in this class with the given name 115 * @return the setter declared in this class with the given name
104 */ 116 */
105 PropertyAccessorElement getSetter(String setterName); 117 PropertyAccessorElement getSetter(String setterName);
106 118
107 /** 119 /**
108 * Return the superclass of this class, or `null` if the class represents the class 120 * Return the superclass of this class, or `null` if the class represents the class
109 * 'Object'. All other classes will have a non-`null` superclass. If the super class was not 121 * 'Object'. All other classes will have a non-`null` superclass. If the super class was not
110 * explicitly declared then the implicit superclass 'Object' will be returned. 122 * explicitly declared then the implicit superclass 'Object' will be returned.
111 * 123 *
112 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it 124 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it
113 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance 125 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance
114 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure 126 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure
115 * must explicitly guard against infinite loops. 127 * must explicitly guard against infinite loops.
128 *
116 * @return the superclass of this class 129 * @return the superclass of this class
117 */ 130 */
118 InterfaceType get supertype; 131 InterfaceType get supertype;
119 132
120 /** 133 /**
121 * Return the type defined by the class. 134 * Return the type defined by the class.
135 *
122 * @return the type defined by the class 136 * @return the type defined by the class
123 */ 137 */
124 InterfaceType get type; 138 InterfaceType get type;
125 139
126 /** 140 /**
127 * Return an array containing all of the type variables declared for this clas s. 141 * Return an array containing all of the type variables declared for this clas s.
142 *
128 * @return the type variables declared for this class 143 * @return the type variables declared for this class
129 */ 144 */
130 List<TypeVariableElement> get typeVariables; 145 List<TypeVariableElement> get typeVariables;
131 146
132 /** 147 /**
133 * Return the unnamed constructor declared in this class, or `null` if this cl ass does not 148 * Return the unnamed constructor declared in this class, or `null` if this cl ass does not
134 * declare an unnamed constructor but does declare named constructors. The ret urned constructor 149 * declare an unnamed constructor but does declare named constructors. The ret urned constructor
135 * will be synthetic if this class does not declare any constructors, in which case it will 150 * will be synthetic if this class does not declare any constructors, in which case it will
136 * represent the default constructor for the class. 151 * represent the default constructor for the class.
152 *
137 * @return the unnamed constructor defined in this class 153 * @return the unnamed constructor defined in this class
138 */ 154 */
139 ConstructorElement get unnamedConstructor; 155 ConstructorElement get unnamedConstructor;
140 156
141 /** 157 /**
142 * Return `true` if this class has (implicit or explicit) default constructor.
143 * @return `true` if this class has (implicit or explicit) default constructor
144 */
145 bool hasDefaultConstructor();
146
147 /**
148 * Return `true` if this class or its superclass declares a non-final instance field. 158 * Return `true` if this class or its superclass declares a non-final instance field.
159 *
149 * @return `true` if this class or its superclass declares a non-final instanc e field 160 * @return `true` if this class or its superclass declares a non-final instanc e field
150 */ 161 */
151 bool hasNonFinalField(); 162 bool hasNonFinalField();
152 163
153 /** 164 /**
154 * Return `true` if this class has reference to super (so, for example, cannot be used as a 165 * Return `true` if this class has reference to super (so, for example, cannot be used as a
155 * mixin). 166 * mixin).
167 *
156 * @return `true` if this class has reference to super 168 * @return `true` if this class has reference to super
157 */ 169 */
158 bool hasReferenceToSuper(); 170 bool hasReferenceToSuper();
159 171
160 /** 172 /**
161 * Return `true` if this class is abstract. A class is abstract if it has an e xplicit`abstract` modifier. Note, that this definition of <i>abstract</i> is dif ferent from 173 * Return `true` if this class is abstract. A class is abstract if it has an e xplicit
174 * `abstract` modifier. Note, that this definition of <i>abstract</i> is diffe rent from
162 * <i>has unimplemented members</i>. 175 * <i>has unimplemented members</i>.
176 *
163 * @return `true` if this class is abstract 177 * @return `true` if this class is abstract
164 */ 178 */
165 bool get isAbstract; 179 bool get isAbstract;
166 180
167 /** 181 /**
168 * Return `true` if this class is defined by a typedef construct. 182 * Return `true` if this class is defined by a typedef construct.
183 *
169 * @return `true` if this class is defined by a typedef construct 184 * @return `true` if this class is defined by a typedef construct
170 */ 185 */
171 bool get isTypedef; 186 bool get isTypedef;
172 187
173 /** 188 /**
174 * Return `true` if this class can validly be used as a mixin when defining an other class. 189 * Return `true` if this class can validly be used as a mixin when defining an other class.
175 * The behavior of this method is defined by the Dart Language Specification i n section 9: 190 * The behavior of this method is defined by the Dart Language Specification i n section 9:
176 * <blockquote>It is a compile-time error if a declared or derived mixin refer s to super. It is a 191 * <blockquote>It is a compile-time error if a declared or derived mixin refer s to super. It is a
177 * compile-time error if a declared or derived mixin explicitly declares a con structor. It is a 192 * compile-time error if a declared or derived mixin explicitly declares a con structor. It is a
178 * compile-time error if a mixin is derived from a class whose superclass is n ot 193 * compile-time error if a mixin is derived from a class whose superclass is n ot
179 * Object.</blockquote> 194 * Object.</blockquote>
195 *
180 * @return `true` if this class can validly be used as a mixin 196 * @return `true` if this class can validly be used as a mixin
181 */ 197 */
182 bool get isValidMixin; 198 bool get isValidMixin;
183 199
184 /** 200 /**
185 * Return the element representing the getter that results from looking up the given getter in 201 * Return the element representing the getter that results from looking up the given getter in
186 * this class with respect to the given library, or `null` if the look up fail s. The 202 * this class with respect to the given library, or `null` if the look up fail s. The
187 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1: 203 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1:
188 * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> 204 * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
189 * with respect to library <i>L</i> is: 205 * with respect to library <i>L</i> is:
190 * 206 *
191 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is 207 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is
192 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 208 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
193 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 209 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
194 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 210 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
195 * Otherwise, we say that the lookup has failed. 211 * Otherwise, we say that the lookup has failed.
196 * 212 *
197 * </blockquote> 213 * </blockquote>
214 *
198 * @param getterName the name of the getter being looked up 215 * @param getterName the name of the getter being looked up
199 * @param library the library with respect to which the lookup is being perfor med 216 * @param library the library with respect to which the lookup is being perfor med
200 * @return the result of looking up the given getter in this class with respec t to the given 217 * @return the result of looking up the given getter in this class with respec t to the given
201 * library 218 * library
202 */ 219 */
203 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library ); 220 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library );
204 221
205 /** 222 /**
206 * Return the element representing the method that results from looking up the given method in 223 * Return the element representing the method that results from looking up the given method in
207 * this class with respect to the given library, or `null` if the look up fail s. The 224 * this class with respect to the given library, or `null` if the look up fail s. The
208 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1: 225 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1:
209 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit h respect to library 226 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit h respect to library
210 * <i>L</i> is: 227 * <i>L</i> is:
211 * 228 *
212 * * If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then 229 * * If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then
213 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then 230 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then
214 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect 231 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect
215 * to <i>L</i>. Otherwise, we say that the lookup has failed. 232 * to <i>L</i>. Otherwise, we say that the lookup has failed.
216 * 233 *
217 * </blockquote> 234 * </blockquote>
235 *
218 * @param methodName the name of the method being looked up 236 * @param methodName the name of the method being looked up
219 * @param library the library with respect to which the lookup is being perfor med 237 * @param library the library with respect to which the lookup is being perfor med
220 * @return the result of looking up the given method in this class with respec t to the given 238 * @return the result of looking up the given method in this class with respec t to the given
221 * library 239 * library
222 */ 240 */
223 MethodElement lookUpMethod(String methodName, LibraryElement library); 241 MethodElement lookUpMethod(String methodName, LibraryElement library);
224 242
225 /** 243 /**
226 * Return the element representing the setter that results from looking up the given setter in 244 * Return the element representing the setter that results from looking up the given setter in
227 * this class with respect to the given library, or `null` if the look up fail s. The 245 * this class with respect to the given library, or `null` if the look up fail s. The
228 * behavior of this method is defined by the Dart Language Specification in se ction 12.16: 246 * behavior of this method is defined by the Dart Language Specification in se ction 12.16:
229 * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> 247 * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
230 * with respect to library <i>L</i> is: 248 * with respect to library <i>L</i> is:
231 * 249 *
232 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is 250 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is
233 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 251 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
234 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 252 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
235 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 253 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
236 * Otherwise, we say that the lookup has failed. 254 * Otherwise, we say that the lookup has failed.
237 * 255 *
238 * </blockquote> 256 * </blockquote>
257 *
239 * @param setterName the name of the setter being looked up 258 * @param setterName the name of the setter being looked up
240 * @param library the library with respect to which the lookup is being perfor med 259 * @param library the library with respect to which the lookup is being perfor med
241 * @return the result of looking up the given setter in this class with respec t to the given 260 * @return the result of looking up the given setter in this class with respec t to the given
242 * library 261 * library
243 */ 262 */
244 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library ); 263 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library );
245 } 264 }
246 /** 265 /**
247 * The interface `ClassMemberElement` defines the behavior of elements that are contained 266 * The interface `ClassMemberElement` defines the behavior of elements that are contained
248 * within a [ClassElement]. 267 * within a [ClassElement].
249 */ 268 */
250 abstract class ClassMemberElement implements Element { 269 abstract class ClassMemberElement implements Element {
251 270
252 /** 271 /**
253 * Return the type in which this member is defined. 272 * Return the type in which this member is defined.
273 *
254 * @return the type in which this member is defined 274 * @return the type in which this member is defined
255 */ 275 */
256 ClassElement get enclosingElement; 276 ClassElement get enclosingElement;
257 } 277 }
258 /** 278 /**
259 * The interface `CompilationUnitElement` defines the behavior of elements repre senting a 279 * The interface `CompilationUnitElement` defines the behavior of elements repre senting a
260 * compilation unit. 280 * compilation unit.
281 *
261 * @coverage dart.engine.element 282 * @coverage dart.engine.element
262 */ 283 */
263 abstract class CompilationUnitElement implements Element, UriReferencedElement { 284 abstract class CompilationUnitElement implements Element, UriReferencedElement {
264 285
265 /** 286 /**
266 * Return an array containing all of the top-level accessors (getters and sett ers) contained in 287 * Return an array containing all of the top-level accessors (getters and sett ers) contained in
267 * this compilation unit. 288 * this compilation unit.
289 *
268 * @return the top-level accessors contained in this compilation unit 290 * @return the top-level accessors contained in this compilation unit
269 */ 291 */
270 List<PropertyAccessorElement> get accessors; 292 List<PropertyAccessorElement> get accessors;
271 293
272 /** 294 /**
273 * Return the library in which this compilation unit is defined. 295 * Return the library in which this compilation unit is defined.
296 *
274 * @return the library in which this compilation unit is defined 297 * @return the library in which this compilation unit is defined
275 */ 298 */
276 LibraryElement get enclosingElement; 299 LibraryElement get enclosingElement;
277 300
278 /** 301 /**
279 * Return an array containing all of the top-level functions contained in this compilation unit. 302 * Return an array containing all of the top-level functions contained in this compilation unit.
303 *
280 * @return the top-level functions contained in this compilation unit 304 * @return the top-level functions contained in this compilation unit
281 */ 305 */
282 List<FunctionElement> get functions; 306 List<FunctionElement> get functions;
283 307
284 /** 308 /**
285 * Return an array containing all of the function type aliases contained in th is compilation unit. 309 * Return an array containing all of the function type aliases contained in th is compilation unit.
310 *
286 * @return the function type aliases contained in this compilation unit 311 * @return the function type aliases contained in this compilation unit
287 */ 312 */
288 List<FunctionTypeAliasElement> get functionTypeAliases; 313 List<FunctionTypeAliasElement> get functionTypeAliases;
289 314
290 /** 315 /**
291 * Return an array containing all of the top-level variables contained in this compilation unit. 316 * Return an array containing all of the top-level variables contained in this compilation unit.
317 *
292 * @return the top-level variables contained in this compilation unit 318 * @return the top-level variables contained in this compilation unit
293 */ 319 */
294 List<TopLevelVariableElement> get topLevelVariables; 320 List<TopLevelVariableElement> get topLevelVariables;
295 321
296 /** 322 /**
297 * Return the class defined in this compilation unit that has the given name, or `null` if 323 * Return the class defined in this compilation unit that has the given name, or `null` if
298 * this compilation unit does not define a class with the given name. 324 * this compilation unit does not define a class with the given name.
325 *
299 * @param className the name of the class to be returned 326 * @param className the name of the class to be returned
300 * @return the class with the given name that is defined in this compilation u nit 327 * @return the class with the given name that is defined in this compilation u nit
301 */ 328 */
302 ClassElement getType(String className); 329 ClassElement getType(String className);
303 330
304 /** 331 /**
305 * Return an array containing all of the classes contained in this compilation unit. 332 * Return an array containing all of the classes contained in this compilation unit.
333 *
306 * @return the classes contained in this compilation unit 334 * @return the classes contained in this compilation unit
307 */ 335 */
308 List<ClassElement> get types; 336 List<ClassElement> get types;
309 } 337 }
310 /** 338 /**
311 * The interface `ConstructorElement` defines the behavior of elements represent ing a 339 * The interface `ConstructorElement` defines the behavior of elements represent ing a
312 * constructor or a factory method defined within a type. 340 * constructor or a factory method defined within a type.
341 *
313 * @coverage dart.engine.element 342 * @coverage dart.engine.element
314 */ 343 */
315 abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme nt { 344 abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme nt {
316 345
317 /** 346 /**
318 * Return the constructor to which this constructor is redirecting. 347 * Return the constructor to which this constructor is redirecting.
348 *
319 * @return the constructor to which this constructor is redirecting 349 * @return the constructor to which this constructor is redirecting
320 */ 350 */
321 ConstructorElement get redirectedConstructor; 351 ConstructorElement get redirectedConstructor;
322 352
323 /** 353 /**
324 * Return `true` if this constructor is a const constructor. 354 * Return `true` if this constructor is a const constructor.
355 *
325 * @return `true` if this constructor is a const constructor 356 * @return `true` if this constructor is a const constructor
326 */ 357 */
327 bool get isConst; 358 bool get isConst;
328 359
329 /** 360 /**
330 * Return `true` if this constructor can be used as a default constructor - un named and has 361 * Return `true` if this constructor can be used as a default constructor - un named and has
331 * no required parameters. 362 * no required parameters.
363 *
332 * @return `true` if this constructor can be used as a default constructor. 364 * @return `true` if this constructor can be used as a default constructor.
333 */ 365 */
334 bool get isDefaultConstructor; 366 bool get isDefaultConstructor;
335 367
336 /** 368 /**
337 * Return `true` if this constructor represents a factory constructor. 369 * Return `true` if this constructor represents a factory constructor.
370 *
338 * @return `true` if this constructor represents a factory constructor 371 * @return `true` if this constructor represents a factory constructor
339 */ 372 */
340 bool get isFactory; 373 bool get isFactory;
341 } 374 }
342 /** 375 /**
343 * The interface `Element` defines the behavior common to all of the elements in the element 376 * The interface `Element` defines the behavior common to all of the elements in the element
344 * model. Generally speaking, the element model is a semantic model of the progr am that represents 377 * model. Generally speaking, the element model is a semantic model of the progr am that represents
345 * things that are declared with a name and hence can be referenced elsewhere in the code. 378 * things that are declared with a name and hence can be referenced elsewhere in the code.
346 * 379 *
347 * There are two exceptions to the general case. First, there are elements in th e element model that 380 * There are two exceptions to the general case. First, there are elements in th e element model that
348 * are created for the convenience of various kinds of analysis but that do not have any 381 * are created for the convenience of various kinds of analysis but that do not have any
349 * corresponding declaration within the source code. Such elements are marked as being 382 * corresponding declaration within the source code. Such elements are marked as being
350 * <i>synthetic</i>. Examples of synthetic elements include 383 * <i>synthetic</i>. Examples of synthetic elements include
351 * 384 *
352 * * default constructors in classes that do not define any explicit constructor s, 385 * * default constructors in classes that do not define any explicit constructor s,
353 * * getters and setters that are induced by explicit field declarations, 386 * * getters and setters that are induced by explicit field declarations,
354 * * fields that are induced by explicit declarations of getters and setters, an d 387 * * fields that are induced by explicit declarations of getters and setters, an d
355 * * functions representing the initialization expression for a variable. 388 * * functions representing the initialization expression for a variable.
356 * 389 *
357 * 390 *
358 * Second, there are elements in the element model that do not have a name. Thes e correspond to 391 * Second, there are elements in the element model that do not have a name. Thes e correspond to
359 * unnamed functions and exist in order to more accurately represent the semanti c structure of the 392 * unnamed functions and exist in order to more accurately represent the semanti c structure of the
360 * program. 393 * program.
394 *
361 * @coverage dart.engine.element 395 * @coverage dart.engine.element
362 */ 396 */
363 abstract class Element { 397 abstract class Element {
364 398
365 /** 399 /**
366 * A comparator that can be used to sort elements by their name offset. Elemen ts with a smaller 400 * A comparator that can be used to sort elements by their name offset. Elemen ts with a smaller
367 * offset will be sorted to be before elements with a larger name offset. 401 * offset will be sorted to be before elements with a larger name offset.
368 */ 402 */
369 static final Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Eleme nt secondElement) => firstElement.nameOffset - secondElement.nameOffset; 403 static final Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Eleme nt secondElement) => firstElement.nameOffset - secondElement.nameOffset;
370 404
371 /** 405 /**
372 * Use the given visitor to visit this element. 406 * Use the given visitor to visit this element.
407 *
373 * @param visitor the visitor that will visit this element 408 * @param visitor the visitor that will visit this element
374 * @return the value returned by the visitor as a result of visiting this elem ent 409 * @return the value returned by the visitor as a result of visiting this elem ent
375 */ 410 */
376 accept(ElementVisitor visitor); 411 accept(ElementVisitor visitor);
377 412
378 /** 413 /**
379 * Return the documentation comment for this element as it appears in the orig inal source 414 * Return the documentation comment for this element as it appears in the orig inal source
380 * (complete with the beginning and ending delimiters), or `null` if this elem ent does not 415 * (complete with the beginning and ending delimiters), or `null` if this elem ent does not
381 * have a documentation comment associated with it. This can be a long-running operation if the 416 * have a documentation comment associated with it. This can be a long-running operation if the
382 * information needed to access the comment is not cached. 417 * information needed to access the comment is not cached.
418 *
383 * @return this element's documentation comment 419 * @return this element's documentation comment
384 * @throws AnalysisException if the documentation comment could not be determi ned because the 420 * @throws AnalysisException if the documentation comment could not be determi ned because the
385 * analysis could not be performed 421 * analysis could not be performed
386 */ 422 */
387 String computeDocumentationComment(); 423 String computeDocumentationComment();
388 424
389 /** 425 /**
390 * Return the element of the given class that most immediately encloses this e lement, or`null` if there is no enclosing element of the given class. 426 * Return the element of the given class that most immediately encloses this e lement, or
427 * `null` if there is no enclosing element of the given class.
428 *
391 * @param elementClass the class of the element to be returned 429 * @param elementClass the class of the element to be returned
392 * @return the element that encloses this element 430 * @return the element that encloses this element
393 */ 431 */
394 Element getAncestor(Type elementClass); 432 Element getAncestor(Type elementClass);
395 433
396 /** 434 /**
397 * Return the analysis context in which this element is defined. 435 * Return the analysis context in which this element is defined.
436 *
398 * @return the analysis context in which this element is defined 437 * @return the analysis context in which this element is defined
399 */ 438 */
400 AnalysisContext get context; 439 AnalysisContext get context;
401 440
402 /** 441 /**
403 * Return the display name of this element, or `null` if this element does not have a name. 442 * Return the display name of this element, or `null` if this element does not have a name.
404 * 443 *
405 * In most cases the name and the display name are the same. Differences thoug h are cases such as 444 * In most cases the name and the display name are the same. Differences thoug h are cases such as
406 * setters where the name of some setter `set f(x)` is `f=`, instead of `f`. 445 * setters where the name of some setter `set f(x)` is `f=`, instead of `f`.
446 *
407 * @return the display name of this element 447 * @return the display name of this element
408 */ 448 */
409 String get displayName; 449 String get displayName;
410 450
411 /** 451 /**
412 * Return the element that either physically or logically encloses this elemen t. This will be`null` if this element is a library because libraries are the top -level elements in the 452 * Return the element that either physically or logically encloses this elemen t. This will be
453 * `null` if this element is a library because libraries are the top-level ele ments in the
413 * model. 454 * model.
455 *
414 * @return the element that encloses this element 456 * @return the element that encloses this element
415 */ 457 */
416 Element get enclosingElement; 458 Element get enclosingElement;
417 459
418 /** 460 /**
419 * Return the kind of element that this is. 461 * Return the kind of element that this is.
462 *
420 * @return the kind of this element 463 * @return the kind of this element
421 */ 464 */
422 ElementKind get kind; 465 ElementKind get kind;
423 466
424 /** 467 /**
425 * Return the library that contains this element. This will be the element its elf if it is a 468 * Return the library that contains this element. This will be the element its elf if it is a
426 * library element. This will be `null` if this element is an HTML file becaus e HTML files 469 * library element. This will be `null` if this element is an HTML file becaus e HTML files
427 * are not contained in libraries. 470 * are not contained in libraries.
471 *
428 * @return the library that contains this element 472 * @return the library that contains this element
429 */ 473 */
430 LibraryElement get library; 474 LibraryElement get library;
431 475
432 /** 476 /**
433 * Return an object representing the location of this element in the element m odel. The object can 477 * Return an object representing the location of this element in the element m odel. The object can
434 * be used to locate this element at a later time. 478 * be used to locate this element at a later time.
479 *
435 * @return the location of this element in the element model 480 * @return the location of this element in the element model
436 */ 481 */
437 ElementLocation get location; 482 ElementLocation get location;
438 483
439 /** 484 /**
440 * Return an array containing all of the metadata associated with this element . 485 * Return an array containing all of the metadata associated with this element .
486 *
441 * @return the metadata associated with this element 487 * @return the metadata associated with this element
442 */ 488 */
443 List<ElementAnnotation> get metadata; 489 List<ElementAnnotation> get metadata;
444 490
445 /** 491 /**
446 * Return the name of this element, or `null` if this element does not have a name. 492 * Return the name of this element, or `null` if this element does not have a name.
493 *
447 * @return the name of this element 494 * @return the name of this element
448 */ 495 */
449 String get name; 496 String get name;
450 497
451 /** 498 /**
452 * Return the offset of the name of this element in the file that contains the declaration of this 499 * Return the offset of the name of this element in the file that contains the declaration of this
453 * element, or `-1` if this element is synthetic, does not have a name, or oth erwise does 500 * element, or `-1` if this element is synthetic, does not have a name, or oth erwise does
454 * not have an offset. 501 * not have an offset.
502 *
455 * @return the offset of the name of this element 503 * @return the offset of the name of this element
456 */ 504 */
457 int get nameOffset; 505 int get nameOffset;
458 506
459 /** 507 /**
460 * Return the source that contains this element, or `null` if this element is not contained 508 * Return the source that contains this element, or `null` if this element is not contained
461 * in a source. 509 * in a source.
510 *
462 * @return the source that contains this element 511 * @return the source that contains this element
463 */ 512 */
464 Source get source; 513 Source get source;
465 514
466 /** 515 /**
467 * Return `true` if this element, assuming that it is within scope, is accessi ble to code in 516 * Return `true` if this element, assuming that it is within scope, is accessi ble to code in
468 * the given library. This is defined by the Dart Language Specification in se ction 3.2: 517 * the given library. This is defined by the Dart Language Specification in se ction 3.2:
469 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i >m</i> is declared 518 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i >m</i> is declared
470 * in <i>L</i> or if <i>m</i> is public. </blockquote> 519 * in <i>L</i> or if <i>m</i> is public. </blockquote>
520 *
471 * @param library the library in which a possible reference to this element wo uld occur 521 * @param library the library in which a possible reference to this element wo uld occur
472 * @return `true` if this element is accessible to code in the given library 522 * @return `true` if this element is accessible to code in the given library
473 */ 523 */
474 bool isAccessibleIn(LibraryElement library); 524 bool isAccessibleIn(LibraryElement library);
475 525
476 /** 526 /**
477 * Return `true` if this element is synthetic. A synthetic element is an eleme nt that is not 527 * Return `true` if this element is synthetic. A synthetic element is an eleme nt that is not
478 * represented in the source code explicitly, but is implied by the source cod e, such as the 528 * represented in the source code explicitly, but is implied by the source cod e, such as the
479 * default constructor for a class that does not explicitly define any constru ctors. 529 * default constructor for a class that does not explicitly define any constru ctors.
530 *
480 * @return `true` if this element is synthetic 531 * @return `true` if this element is synthetic
481 */ 532 */
482 bool get isSynthetic; 533 bool get isSynthetic;
483 534
484 /** 535 /**
485 * Use the given visitor to visit all of the children of this element. There i s no guarantee of 536 * Use the given visitor to visit all of the children of this element. There i s no guarantee of
486 * the order in which the children will be visited. 537 * the order in which the children will be visited.
538 *
487 * @param visitor the visitor that will be used to visit the children of this element 539 * @param visitor the visitor that will be used to visit the children of this element
488 */ 540 */
489 void visitChildren(ElementVisitor<Object> visitor); 541 void visitChildren(ElementVisitor<Object> visitor);
490 } 542 }
491 /** 543 /**
492 * The interface `ElementAnnotation` defines the behavior of objects representin g a single 544 * The interface `ElementAnnotation` defines the behavior of objects representin g a single
493 * annotation associated with an element. 545 * annotation associated with an element.
546 *
494 * @coverage dart.engine.element 547 * @coverage dart.engine.element
495 */ 548 */
496 abstract class ElementAnnotation { 549 abstract class ElementAnnotation {
497 550
498 /** 551 /**
499 * Return the element representing the field, variable, or const constructor b eing used as an 552 * Return the element representing the field, variable, or const constructor b eing used as an
500 * annotation. 553 * annotation.
554 *
501 * @return the field, variable, or constructor being used as an annotation 555 * @return the field, variable, or constructor being used as an annotation
502 */ 556 */
503 Element get element; 557 Element get element;
504 } 558 }
505 /** 559 /**
506 * The enumeration `ElementKind` defines the various kinds of elements in the el ement model. 560 * The enumeration `ElementKind` defines the various kinds of elements in the el ement model.
561 *
507 * @coverage dart.engine.element 562 * @coverage dart.engine.element
508 */ 563 */
509 class ElementKind implements Comparable<ElementKind> { 564 class ElementKind implements Comparable<ElementKind> {
510 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class"); 565 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class");
511 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT' , 1, "compilation unit"); 566 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT' , 1, "compilation unit");
512 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons tructor"); 567 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons tructor");
513 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>"); 568 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>");
514 static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML _SCRIPT', 4, "embedded html script"); 569 static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML _SCRIPT', 4, "embedded html script");
515 static final ElementKind ERROR = new ElementKind('ERROR', 5, "<error>"); 570 static final ElementKind ERROR = new ElementKind('ERROR', 5, "<error>");
516 static final ElementKind EXPORT = new ElementKind('EXPORT', 6, "export directi ve"); 571 static final ElementKind EXPORT = new ElementKind('EXPORT', 6, "export directi ve");
(...skipping 19 matching lines...) Expand all
536 591
537 /// The name of this enum constant, as declared in the enum declaration. 592 /// The name of this enum constant, as declared in the enum declaration.
538 final String name; 593 final String name;
539 594
540 /// The position in the enum declaration. 595 /// The position in the enum declaration.
541 final int ordinal; 596 final int ordinal;
542 597
543 /** 598 /**
544 * Return the kind of the given element, or [ERROR] if the element is `null`. This is 599 * Return the kind of the given element, or [ERROR] if the element is `null`. This is
545 * a utility method that can reduce the need for null checks in other places. 600 * a utility method that can reduce the need for null checks in other places.
601 *
546 * @param element the element whose kind is to be returned 602 * @param element the element whose kind is to be returned
547 * @return the kind of the given element 603 * @return the kind of the given element
548 */ 604 */
549 static ElementKind of(Element element) { 605 static ElementKind of(Element element) {
550 if (element == null) { 606 if (element == null) {
551 return ERROR; 607 return ERROR;
552 } 608 }
553 return element.kind; 609 return element.kind;
554 } 610 }
555 611
556 /** 612 /**
557 * The name displayed in the UI for this kind of element. 613 * The name displayed in the UI for this kind of element.
558 */ 614 */
559 String _displayName; 615 String _displayName;
560 616
561 /** 617 /**
562 * Initialize a newly created element kind to have the given display name. 618 * Initialize a newly created element kind to have the given display name.
619 *
563 * @param displayName the name displayed in the UI for this kind of element 620 * @param displayName the name displayed in the UI for this kind of element
564 */ 621 */
565 ElementKind(this.name, this.ordinal, String displayName) { 622 ElementKind(this.name, this.ordinal, String displayName) {
566 this._displayName = displayName; 623 this._displayName = displayName;
567 } 624 }
568 625
569 /** 626 /**
570 * Return the name displayed in the UI for this kind of element. 627 * Return the name displayed in the UI for this kind of element.
628 *
571 * @return the name of this [ElementKind] to display in UI. 629 * @return the name of this [ElementKind] to display in UI.
572 */ 630 */
573 String get displayName => _displayName; 631 String get displayName => _displayName;
574 int compareTo(ElementKind other) => ordinal - other.ordinal; 632 int compareTo(ElementKind other) => ordinal - other.ordinal;
575 int get hashCode => ordinal; 633 int get hashCode => ordinal;
576 String toString() => name; 634 String toString() => name;
577 } 635 }
578 /** 636 /**
579 * The interface `ElementLocation` defines the behavior of objects that represen t the location 637 * The interface `ElementLocation` defines the behavior of objects that represen t the location
580 * of an element within the element model. 638 * of an element within the element model.
639 *
581 * @coverage dart.engine.element 640 * @coverage dart.engine.element
582 */ 641 */
583 abstract class ElementLocation { 642 abstract class ElementLocation {
584 643
585 /** 644 /**
586 * Return an encoded representation of this location that can be used to creat e a location that is 645 * Return an encoded representation of this location that can be used to creat e a location that is
587 * equal to this location. 646 * equal to this location.
647 *
588 * @return an encoded representation of this location 648 * @return an encoded representation of this location
589 */ 649 */
590 String get encoding; 650 String get encoding;
591 } 651 }
592 /** 652 /**
593 * The interface `ElementVisitor` defines the behavior of objects that can be us ed to visit an 653 * The interface `ElementVisitor` defines the behavior of objects that can be us ed to visit an
594 * element structure. 654 * element structure.
655 *
595 * @coverage dart.engine.element 656 * @coverage dart.engine.element
596 */ 657 */
597 abstract class ElementVisitor<R> { 658 abstract class ElementVisitor<R> {
598 R visitClassElement(ClassElement element); 659 R visitClassElement(ClassElement element);
599 R visitCompilationUnitElement(CompilationUnitElement element); 660 R visitCompilationUnitElement(CompilationUnitElement element);
600 R visitConstructorElement(ConstructorElement element); 661 R visitConstructorElement(ConstructorElement element);
601 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); 662 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element);
602 R visitExportElement(ExportElement element); 663 R visitExportElement(ExportElement element);
603 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element); 664 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element);
604 R visitFieldElement(FieldElement element); 665 R visitFieldElement(FieldElement element);
605 R visitFieldFormalParameterElement(FieldFormalParameterElement element); 666 R visitFieldFormalParameterElement(FieldFormalParameterElement element);
606 R visitFunctionElement(FunctionElement element); 667 R visitFunctionElement(FunctionElement element);
607 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element); 668 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element);
608 R visitHtmlElement(HtmlElement element); 669 R visitHtmlElement(HtmlElement element);
609 R visitImportElement(ImportElement element); 670 R visitImportElement(ImportElement element);
610 R visitLabelElement(LabelElement element); 671 R visitLabelElement(LabelElement element);
611 R visitLibraryElement(LibraryElement element); 672 R visitLibraryElement(LibraryElement element);
612 R visitLocalVariableElement(LocalVariableElement element); 673 R visitLocalVariableElement(LocalVariableElement element);
613 R visitMethodElement(MethodElement element); 674 R visitMethodElement(MethodElement element);
614 R visitMultiplyDefinedElement(MultiplyDefinedElement element); 675 R visitMultiplyDefinedElement(MultiplyDefinedElement element);
615 R visitParameterElement(ParameterElement element); 676 R visitParameterElement(ParameterElement element);
616 R visitPrefixElement(PrefixElement element); 677 R visitPrefixElement(PrefixElement element);
617 R visitPropertyAccessorElement(PropertyAccessorElement element); 678 R visitPropertyAccessorElement(PropertyAccessorElement element);
618 R visitTopLevelVariableElement(TopLevelVariableElement element); 679 R visitTopLevelVariableElement(TopLevelVariableElement element);
619 R visitTypeVariableElement(TypeVariableElement element); 680 R visitTypeVariableElement(TypeVariableElement element);
620 } 681 }
621 /** 682 /**
622 * The interface `EmbeddedHtmlScriptElement` defines the behavior of elements re presenting a 683 * The interface `EmbeddedHtmlScriptElement` defines the behavior of elements re presenting a
623 * script tag in an HTML file having content that defines a Dart library. 684 * script tag in an HTML file having content that defines a Dart library.
685 *
624 * @coverage dart.engine.element 686 * @coverage dart.engine.element
625 */ 687 */
626 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { 688 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement {
627 689
628 /** 690 /**
629 * Return the library element defined by the content of the script tag. 691 * Return the library element defined by the content of the script tag.
692 *
630 * @return the library element (not `null`) 693 * @return the library element (not `null`)
631 */ 694 */
632 LibraryElement get scriptLibrary; 695 LibraryElement get scriptLibrary;
633 } 696 }
634 /** 697 /**
635 * The interface `ExecutableElement` defines the behavior of elements representi ng an 698 * The interface `ExecutableElement` defines the behavior of elements representi ng an
636 * executable object, including functions, methods, constructors, getters, and s etters. 699 * executable object, including functions, methods, constructors, getters, and s etters.
700 *
637 * @coverage dart.engine.element 701 * @coverage dart.engine.element
638 */ 702 */
639 abstract class ExecutableElement implements Element { 703 abstract class ExecutableElement implements Element {
640 704
641 /** 705 /**
642 * Return an array containing all of the functions defined within this executa ble element. 706 * Return an array containing all of the functions defined within this executa ble element.
707 *
643 * @return the functions defined within this executable element 708 * @return the functions defined within this executable element
644 */ 709 */
645 List<FunctionElement> get functions; 710 List<FunctionElement> get functions;
646 711
647 /** 712 /**
648 * Return an array containing all of the labels defined within this executable element. 713 * Return an array containing all of the labels defined within this executable element.
714 *
649 * @return the labels defined within this executable element 715 * @return the labels defined within this executable element
650 */ 716 */
651 List<LabelElement> get labels; 717 List<LabelElement> get labels;
652 718
653 /** 719 /**
654 * Return an array containing all of the local variables defined within this e xecutable element. 720 * Return an array containing all of the local variables defined within this e xecutable element.
721 *
655 * @return the local variables defined within this executable element 722 * @return the local variables defined within this executable element
656 */ 723 */
657 List<LocalVariableElement> get localVariables; 724 List<LocalVariableElement> get localVariables;
658 725
659 /** 726 /**
660 * Return an array containing all of the parameters defined by this executable element. 727 * Return an array containing all of the parameters defined by this executable element.
728 *
661 * @return the parameters defined by this executable element 729 * @return the parameters defined by this executable element
662 */ 730 */
663 List<ParameterElement> get parameters; 731 List<ParameterElement> get parameters;
664 732
665 /** 733 /**
666 * Return the return type defined by this executable element. 734 * Return the return type defined by this executable element.
735 *
667 * @return the return type defined by this executable element 736 * @return the return type defined by this executable element
668 */ 737 */
669 Type2 get returnType; 738 Type2 get returnType;
670 739
671 /** 740 /**
672 * Return the type of function defined by this executable element. 741 * Return the type of function defined by this executable element.
742 *
673 * @return the type of function defined by this executable element 743 * @return the type of function defined by this executable element
674 */ 744 */
675 FunctionType get type; 745 FunctionType get type;
676 746
677 /** 747 /**
678 * Return `true` if this executable element is an operator. The test may be ba sed on the 748 * Return `true` if this executable element is an operator. The test may be ba sed on the
679 * name of the executable element, in which case the result will be correct wh en the name is 749 * name of the executable element, in which case the result will be correct wh en the name is
680 * legal. 750 * legal.
751 *
681 * @return `true` if this executable element is an operator 752 * @return `true` if this executable element is an operator
682 */ 753 */
683 bool get isOperator; 754 bool get isOperator;
684 755
685 /** 756 /**
686 * Return `true` if this element is a static element. A static element is an e lement that is 757 * Return `true` if this element is a static element. A static element is an e lement that is
687 * not associated with a particular instance, but rather with an entire librar y or class. 758 * not associated with a particular instance, but rather with an entire librar y or class.
759 *
688 * @return `true` if this executable element is a static element 760 * @return `true` if this executable element is a static element
689 */ 761 */
690 bool get isStatic; 762 bool get isStatic;
691 } 763 }
692 /** 764 /**
693 * The interface `ExportElement` defines the behavior of objects representing in formation 765 * The interface `ExportElement` defines the behavior of objects representing in formation
694 * about a single export directive within a library. 766 * about a single export directive within a library.
767 *
695 * @coverage dart.engine.element 768 * @coverage dart.engine.element
696 */ 769 */
697 abstract class ExportElement implements Element, UriReferencedElement { 770 abstract class ExportElement implements Element, UriReferencedElement {
698 771
699 /** 772 /**
700 * An empty array of export elements. 773 * An empty array of export elements.
701 */ 774 */
702 static final List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); 775 static final List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0);
703 776
704 /** 777 /**
705 * Return an array containing the combinators that were specified as part of t he export directive 778 * Return an array containing the combinators that were specified as part of t he export directive
706 * in the order in which they were specified. 779 * in the order in which they were specified.
780 *
707 * @return the combinators specified in the export directive 781 * @return the combinators specified in the export directive
708 */ 782 */
709 List<NamespaceCombinator> get combinators; 783 List<NamespaceCombinator> get combinators;
710 784
711 /** 785 /**
712 * Return the library that is exported from this library by this export direct ive. 786 * Return the library that is exported from this library by this export direct ive.
787 *
713 * @return the library that is exported from this library 788 * @return the library that is exported from this library
714 */ 789 */
715 LibraryElement get exportedLibrary; 790 LibraryElement get exportedLibrary;
716 } 791 }
717 /** 792 /**
718 * The interface `ExternalHtmlScriptElement` defines the behavior of elements re presenting a 793 * The interface `ExternalHtmlScriptElement` defines the behavior of elements re presenting a
719 * script tag in an HTML file having a `source` attribute that references a Dart library 794 * script tag in an HTML file having a `source` attribute that references a Dart library
720 * source file. 795 * source file.
796 *
721 * @coverage dart.engine.element 797 * @coverage dart.engine.element
722 */ 798 */
723 abstract class ExternalHtmlScriptElement implements HtmlScriptElement { 799 abstract class ExternalHtmlScriptElement implements HtmlScriptElement {
724 800
725 /** 801 /**
726 * Return the source referenced by this element, or `null` if this element doe s not 802 * Return the source referenced by this element, or `null` if this element doe s not
727 * reference a Dart library source file. 803 * reference a Dart library source file.
804 *
728 * @return the source for the external Dart library 805 * @return the source for the external Dart library
729 */ 806 */
730 Source get scriptSource; 807 Source get scriptSource;
731 } 808 }
732 /** 809 /**
733 * The interface `FieldElement` defines the behavior of elements representing a field defined 810 * The interface `FieldElement` defines the behavior of elements representing a field defined
734 * within a type. 811 * within a type.
812 *
735 * @coverage dart.engine.element 813 * @coverage dart.engine.element
736 */ 814 */
737 abstract class FieldElement implements ClassMemberElement, PropertyInducingEleme nt { 815 abstract class FieldElement implements ClassMemberElement, PropertyInducingEleme nt {
738 } 816 }
739 /** 817 /**
740 * The interface `FieldFormalParameterElement` defines the behavior of elements representing a 818 * The interface `FieldFormalParameterElement` defines the behavior of elements representing a
741 * field formal parameter defined within a constructor element. 819 * field formal parameter defined within a constructor element.
742 */ 820 */
743 abstract class FieldFormalParameterElement implements ParameterElement { 821 abstract class FieldFormalParameterElement implements ParameterElement {
744 822
745 /** 823 /**
746 * Return the field element associated with this field formal parameter, or `n ull` if the 824 * Return the field element associated with this field formal parameter, or `n ull` if the
747 * parameter references a field that doesn't exist. 825 * parameter references a field that doesn't exist.
826 *
748 * @return the field element associated with this field formal parameter 827 * @return the field element associated with this field formal parameter
749 */ 828 */
750 FieldElement get field; 829 FieldElement get field;
751 } 830 }
752 /** 831 /**
753 * The interface `FunctionElement` defines the behavior of elements representing a function. 832 * The interface `FunctionElement` defines the behavior of elements representing a function.
833 *
754 * @coverage dart.engine.element 834 * @coverage dart.engine.element
755 */ 835 */
756 abstract class FunctionElement implements ExecutableElement, LocalElement { 836 abstract class FunctionElement implements ExecutableElement, LocalElement {
757 } 837 }
758 /** 838 /**
759 * The interface `FunctionTypeAliasElement` defines the behavior of elements rep resenting a 839 * The interface `FunctionTypeAliasElement` defines the behavior of elements rep resenting a
760 * function type alias (`typedef`). 840 * function type alias (`typedef`).
841 *
761 * @coverage dart.engine.element 842 * @coverage dart.engine.element
762 */ 843 */
763 abstract class FunctionTypeAliasElement implements Element { 844 abstract class FunctionTypeAliasElement implements Element {
764 845
765 /** 846 /**
766 * Return the compilation unit in which this type alias is defined. 847 * Return the compilation unit in which this type alias is defined.
848 *
767 * @return the compilation unit in which this type alias is defined 849 * @return the compilation unit in which this type alias is defined
768 */ 850 */
769 CompilationUnitElement get enclosingElement; 851 CompilationUnitElement get enclosingElement;
770 852
771 /** 853 /**
772 * Return an array containing all of the parameters defined by this type alias . 854 * Return an array containing all of the parameters defined by this type alias .
855 *
773 * @return the parameters defined by this type alias 856 * @return the parameters defined by this type alias
774 */ 857 */
775 List<ParameterElement> get parameters; 858 List<ParameterElement> get parameters;
776 859
777 /** 860 /**
778 * Return the return type defined by this type alias. 861 * Return the return type defined by this type alias.
862 *
779 * @return the return type defined by this type alias 863 * @return the return type defined by this type alias
780 */ 864 */
781 Type2 get returnType; 865 Type2 get returnType;
782 866
783 /** 867 /**
784 * Return the type of function defined by this type alias. 868 * Return the type of function defined by this type alias.
869 *
785 * @return the type of function defined by this type alias 870 * @return the type of function defined by this type alias
786 */ 871 */
787 FunctionType get type; 872 FunctionType get type;
788 873
789 /** 874 /**
790 * Return an array containing all of the type variables defined for this type. 875 * Return an array containing all of the type variables defined for this type.
876 *
791 * @return the type variables defined for this type 877 * @return the type variables defined for this type
792 */ 878 */
793 List<TypeVariableElement> get typeVariables; 879 List<TypeVariableElement> get typeVariables;
794 } 880 }
795 /** 881 /**
796 * The interface `HideElementCombinator` defines the behavior of combinators tha t cause some 882 * The interface `HideElementCombinator` defines the behavior of combinators tha t cause some
797 * of the names in a namespace to be hidden when being imported. 883 * of the names in a namespace to be hidden when being imported.
884 *
798 * @coverage dart.engine.element 885 * @coverage dart.engine.element
799 */ 886 */
800 abstract class HideElementCombinator implements NamespaceCombinator { 887 abstract class HideElementCombinator implements NamespaceCombinator {
801 888
802 /** 889 /**
803 * Return an array containing the names that are not to be made visible in the importing library 890 * Return an array containing the names that are not to be made visible in the importing library
804 * even if they are defined in the imported library. 891 * even if they are defined in the imported library.
892 *
805 * @return the names from the imported library that are hidden from the import ing library 893 * @return the names from the imported library that are hidden from the import ing library
806 */ 894 */
807 List<String> get hiddenNames; 895 List<String> get hiddenNames;
808 } 896 }
809 /** 897 /**
810 * The interface `HtmlElement` defines the behavior of elements representing an HTML file. 898 * The interface `HtmlElement` defines the behavior of elements representing an HTML file.
899 *
811 * @coverage dart.engine.element 900 * @coverage dart.engine.element
812 */ 901 */
813 abstract class HtmlElement implements Element { 902 abstract class HtmlElement implements Element {
814 903
815 /** 904 /**
816 * Return an array containing all of the script elements contained in the HTML file. This includes 905 * Return an array containing all of the script elements contained in the HTML file. This includes
817 * scripts with libraries that are defined by the content of a script tag as w ell as libraries 906 * scripts with libraries that are defined by the content of a script tag as w ell as libraries
818 * that are referenced in the {@core source} attribute of a script tag. 907 * that are referenced in the {@core source} attribute of a script tag.
908 *
819 * @return the script elements in the HTML file (not `null`, contains no `null `s) 909 * @return the script elements in the HTML file (not `null`, contains no `null `s)
820 */ 910 */
821 List<HtmlScriptElement> get scripts; 911 List<HtmlScriptElement> get scripts;
822 } 912 }
823 /** 913 /**
824 * The interface `HtmlScriptElement` defines the behavior of elements representi ng a script 914 * The interface `HtmlScriptElement` defines the behavior of elements representi ng a script
825 * tag in an HTML file. 915 * tag in an HTML file.
916 *
826 * @see EmbeddedHtmlScriptElement 917 * @see EmbeddedHtmlScriptElement
827 * @see ExternalHtmlScriptElement 918 * @see ExternalHtmlScriptElement
828 * @coverage dart.engine.element 919 * @coverage dart.engine.element
829 */ 920 */
830 abstract class HtmlScriptElement implements Element { 921 abstract class HtmlScriptElement implements Element {
831 } 922 }
832 /** 923 /**
833 * The interface `ImportElement` defines the behavior of objects representing in formation 924 * The interface `ImportElement` defines the behavior of objects representing in formation
834 * about a single import directive within a library. 925 * about a single import directive within a library.
926 *
835 * @coverage dart.engine.element 927 * @coverage dart.engine.element
836 */ 928 */
837 abstract class ImportElement implements Element, UriReferencedElement { 929 abstract class ImportElement implements Element, UriReferencedElement {
838 930
839 /** 931 /**
840 * An empty array of import elements. 932 * An empty array of import elements.
841 */ 933 */
842 static final List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0); 934 static final List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0);
843 935
844 /** 936 /**
845 * Return an array containing the combinators that were specified as part of t he import directive 937 * Return an array containing the combinators that were specified as part of t he import directive
846 * in the order in which they were specified. 938 * in the order in which they were specified.
939 *
847 * @return the combinators specified in the import directive 940 * @return the combinators specified in the import directive
848 */ 941 */
849 List<NamespaceCombinator> get combinators; 942 List<NamespaceCombinator> get combinators;
850 943
851 /** 944 /**
852 * Return the library that is imported into this library by this import direct ive. 945 * Return the library that is imported into this library by this import direct ive.
946 *
853 * @return the library that is imported into this library 947 * @return the library that is imported into this library
854 */ 948 */
855 LibraryElement get importedLibrary; 949 LibraryElement get importedLibrary;
856 950
857 /** 951 /**
858 * Return the prefix that was specified as part of the import directive, or `n ull` if there 952 * Return the prefix that was specified as part of the import directive, or `n ull` if there
859 * was no prefix specified. 953 * was no prefix specified.
954 *
860 * @return the prefix that was specified as part of the import directive 955 * @return the prefix that was specified as part of the import directive
861 */ 956 */
862 PrefixElement get prefix; 957 PrefixElement get prefix;
863 } 958 }
864 /** 959 /**
865 * The interface `LabelElement` defines the behavior of elements representing a label 960 * The interface `LabelElement` defines the behavior of elements representing a label
866 * associated with a statement. 961 * associated with a statement.
962 *
867 * @coverage dart.engine.element 963 * @coverage dart.engine.element
868 */ 964 */
869 abstract class LabelElement implements Element { 965 abstract class LabelElement implements Element {
870 966
871 /** 967 /**
872 * Return the executable element in which this label is defined. 968 * Return the executable element in which this label is defined.
969 *
873 * @return the executable element in which this label is defined 970 * @return the executable element in which this label is defined
874 */ 971 */
875 ExecutableElement get enclosingElement; 972 ExecutableElement get enclosingElement;
876 } 973 }
877 /** 974 /**
878 * The interface `LibraryElement` defines the behavior of elements representing a library. 975 * The interface `LibraryElement` defines the behavior of elements representing a library.
976 *
879 * @coverage dart.engine.element 977 * @coverage dart.engine.element
880 */ 978 */
881 abstract class LibraryElement implements Element { 979 abstract class LibraryElement implements Element {
882 980
883 /** 981 /**
884 * Return the compilation unit that defines this library. 982 * Return the compilation unit that defines this library.
983 *
885 * @return the compilation unit that defines this library 984 * @return the compilation unit that defines this library
886 */ 985 */
887 CompilationUnitElement get definingCompilationUnit; 986 CompilationUnitElement get definingCompilationUnit;
888 987
889 /** 988 /**
890 * Return the entry point for this library, or `null` if this library does not have an entry 989 * Return the entry point for this library, or `null` if this library does not have an entry
891 * point. The entry point is defined to be a zero argument top-level function whose name is`main`. 990 * point. The entry point is defined to be a zero argument top-level function whose name is
991 * `main`.
992 *
892 * @return the entry point for this library 993 * @return the entry point for this library
893 */ 994 */
894 FunctionElement get entryPoint; 995 FunctionElement get entryPoint;
895 996
896 /** 997 /**
897 * Return an array containing all of the libraries that are exported from this library. 998 * Return an array containing all of the libraries that are exported from this library.
999 *
898 * @return an array containing all of the libraries that are exported from thi s library 1000 * @return an array containing all of the libraries that are exported from thi s library
899 */ 1001 */
900 List<LibraryElement> get exportedLibraries; 1002 List<LibraryElement> get exportedLibraries;
901 1003
902 /** 1004 /**
903 * Return an array containing all of the exports defined in this library. 1005 * Return an array containing all of the exports defined in this library.
1006 *
904 * @return the exports defined in this library 1007 * @return the exports defined in this library
905 */ 1008 */
906 List<ExportElement> get exports; 1009 List<ExportElement> get exports;
907 1010
908 /** 1011 /**
909 * Return an array containing all of the libraries that are imported into this library. This 1012 * Return an array containing all of the libraries that are imported into this library. This
910 * includes all of the libraries that are imported using a prefix (also availa ble through the 1013 * includes all of the libraries that are imported using a prefix (also availa ble through the
911 * prefixes returned by [getPrefixes]) and those that are imported without a p refix. 1014 * prefixes returned by [getPrefixes]) and those that are imported without a p refix.
1015 *
912 * @return an array containing all of the libraries that are imported into thi s library 1016 * @return an array containing all of the libraries that are imported into thi s library
913 */ 1017 */
914 List<LibraryElement> get importedLibraries; 1018 List<LibraryElement> get importedLibraries;
915 1019
916 /** 1020 /**
917 * Return an array containing all of the imports defined in this library. 1021 * Return an array containing all of the imports defined in this library.
1022 *
918 * @return the imports defined in this library 1023 * @return the imports defined in this library
919 */ 1024 */
920 List<ImportElement> get imports; 1025 List<ImportElement> get imports;
921 1026
922 /** 1027 /**
923 * Return an array containing all of the compilation units that are included i n this library using 1028 * Return an array containing all of the compilation units that are included i n this library using
924 * a `part` directive. This does not include the defining compilation unit tha t contains the`part` directives. 1029 * a `part` directive. This does not include the defining compilation unit tha t contains the
1030 * `part` directives.
1031 *
925 * @return the compilation units that are included in this library 1032 * @return the compilation units that are included in this library
926 */ 1033 */
927 List<CompilationUnitElement> get parts; 1034 List<CompilationUnitElement> get parts;
928 1035
929 /** 1036 /**
930 * Return an array containing elements for each of the prefixes used to `impor t` libraries 1037 * Return an array containing elements for each of the prefixes used to `impor t` libraries
931 * into this library. Each prefix can be used in more than one `import` direct ive. 1038 * into this library. Each prefix can be used in more than one `import` direct ive.
1039 *
932 * @return the prefixes used to `import` libraries into this library 1040 * @return the prefixes used to `import` libraries into this library
933 */ 1041 */
934 List<PrefixElement> get prefixes; 1042 List<PrefixElement> get prefixes;
935 1043
936 /** 1044 /**
937 * Return the class defined in this library that has the given name, or `null` if this 1045 * Return the class defined in this library that has the given name, or `null` if this
938 * library does not define a class with the given name. 1046 * library does not define a class with the given name.
1047 *
939 * @param className the name of the class to be returned 1048 * @param className the name of the class to be returned
940 * @return the class with the given name that is defined in this library 1049 * @return the class with the given name that is defined in this library
941 */ 1050 */
942 ClassElement getType(String className); 1051 ClassElement getType(String className);
943 1052
944 /** 1053 /**
945 * Answer `true` if this library is an application that can be run in the brow ser. 1054 * Answer `true` if this library is an application that can be run in the brow ser.
1055 *
946 * @return `true` if this library is an application that can be run in the bro wser 1056 * @return `true` if this library is an application that can be run in the bro wser
947 */ 1057 */
948 bool get isBrowserApplication; 1058 bool get isBrowserApplication;
949 1059
950 /** 1060 /**
951 * Return `true` if this library is the dart:core library. 1061 * Return `true` if this library is the dart:core library.
1062 *
952 * @return `true` if this library is the dart:core library 1063 * @return `true` if this library is the dart:core library
953 */ 1064 */
954 bool get isDartCore; 1065 bool get isDartCore;
955 1066
956 /** 1067 /**
957 * Return `true` if this library is up to date with respect to the given time stamp. If any 1068 * Return `true` if this library is up to date with respect to the given time stamp. If any
958 * transitively referenced Source is newer than the time stamp, this method re turns false. 1069 * transitively referenced Source is newer than the time stamp, this method re turns false.
1070 *
959 * @param timeStamp the time stamp to compare against 1071 * @param timeStamp the time stamp to compare against
960 * @return `true` if this library is up to date with respect to the given time stamp 1072 * @return `true` if this library is up to date with respect to the given time stamp
961 */ 1073 */
962 bool isUpToDate2(int timeStamp); 1074 bool isUpToDate2(int timeStamp);
963 } 1075 }
964 /** 1076 /**
965 * The interface `LocalElement` defines the behavior of elements that can be (bu t are not 1077 * The interface `LocalElement` defines the behavior of elements that can be (bu t are not
966 * required to be) defined within a method or function (an [ExecutableElement]). 1078 * required to be) defined within a method or function (an [ExecutableElement]).
1079 *
967 * @coverage dart.engine.element 1080 * @coverage dart.engine.element
968 */ 1081 */
969 abstract class LocalElement implements Element { 1082 abstract class LocalElement implements Element {
970 1083
971 /** 1084 /**
972 * Return a source range that covers the approximate portion of the source in which the name of 1085 * Return a source range that covers the approximate portion of the source in which the name of
973 * this element is visible, or `null` if there is no single range of character s within which 1086 * this element is visible, or `null` if there is no single range of character s within which
974 * the element name is visible. 1087 * the element name is visible.
975 * 1088 *
976 * * For a local variable, this includes everything from the end of the variab le's initializer 1089 * * For a local variable, this includes everything from the end of the variab le's initializer
977 * to the end of the block that encloses the variable declaration. 1090 * to the end of the block that encloses the variable declaration.
978 * * For a parameter, this includes the body of the method or function that de clares the 1091 * * For a parameter, this includes the body of the method or function that de clares the
979 * parameter. 1092 * parameter.
980 * * For a local function, this includes everything from the beginning of the function's body to 1093 * * For a local function, this includes everything from the beginning of the function's body to
981 * the end of the block that encloses the function declaration. 1094 * the end of the block that encloses the function declaration.
982 * * For top-level functions, `null` will be returned because they are potenti ally visible 1095 * * For top-level functions, `null` will be returned because they are potenti ally visible
983 * in multiple sources. 1096 * in multiple sources.
984 * 1097 *
1098 *
985 * @return the range of characters in which the name of this element is visibl e 1099 * @return the range of characters in which the name of this element is visibl e
986 */ 1100 */
987 SourceRange get visibleRange; 1101 SourceRange get visibleRange;
988 } 1102 }
989 /** 1103 /**
990 * The interface `LocalVariableElement` defines the behavior common to elements that represent 1104 * The interface `LocalVariableElement` defines the behavior common to elements that represent
991 * a local variable. 1105 * a local variable.
1106 *
992 * @coverage dart.engine.element 1107 * @coverage dart.engine.element
993 */ 1108 */
994 abstract class LocalVariableElement implements LocalElement, VariableElement { 1109 abstract class LocalVariableElement implements LocalElement, VariableElement {
995 } 1110 }
996 /** 1111 /**
997 * The interface `MethodElement` defines the behavior of elements that represent a method 1112 * The interface `MethodElement` defines the behavior of elements that represent a method
998 * defined within a type. 1113 * defined within a type.
1114 *
999 * @coverage dart.engine.element 1115 * @coverage dart.engine.element
1000 */ 1116 */
1001 abstract class MethodElement implements ClassMemberElement, ExecutableElement { 1117 abstract class MethodElement implements ClassMemberElement, ExecutableElement {
1002 1118
1003 /** 1119 /**
1004 * Return `true` if this method is abstract. Methods are abstract if they are not external 1120 * Return `true` if this method is abstract. Methods are abstract if they are not external
1005 * and have no body. 1121 * and have no body.
1122 *
1006 * @return `true` if this method is abstract 1123 * @return `true` if this method is abstract
1007 */ 1124 */
1008 bool get isAbstract; 1125 bool get isAbstract;
1009 } 1126 }
1010 /** 1127 /**
1011 * The interface `MultiplyDefinedElement` defines the behavior of pseudo-element s that 1128 * The interface `MultiplyDefinedElement` defines the behavior of pseudo-element s that
1012 * represent multiple elements defined within a single scope that have the same name. This situation 1129 * represent multiple elements defined within a single scope that have the same name. This situation
1013 * is not allowed by the language, so objects implementing this interface always represent an error. 1130 * is not allowed by the language, so objects implementing this interface always represent an error.
1014 * As a result, most of the normal operations on elements do not make sense and will return useless 1131 * As a result, most of the normal operations on elements do not make sense and will return useless
1015 * results. 1132 * results.
1133 *
1016 * @coverage dart.engine.element 1134 * @coverage dart.engine.element
1017 */ 1135 */
1018 abstract class MultiplyDefinedElement implements Element { 1136 abstract class MultiplyDefinedElement implements Element {
1019 1137
1020 /** 1138 /**
1021 * Return an array containing all of the elements that were defined within the scope to have the 1139 * Return an array containing all of the elements that were defined within the scope to have the
1022 * same name. 1140 * same name.
1141 *
1023 * @return the elements that were defined with the same name 1142 * @return the elements that were defined with the same name
1024 */ 1143 */
1025 List<Element> get conflictingElements; 1144 List<Element> get conflictingElements;
1026 } 1145 }
1027 /** 1146 /**
1028 * The interface `NamespaceCombinator` defines the behavior common to objects th at control how 1147 * The interface `NamespaceCombinator` defines the behavior common to objects th at control how
1029 * namespaces are combined. 1148 * namespaces are combined.
1149 *
1030 * @coverage dart.engine.element 1150 * @coverage dart.engine.element
1031 */ 1151 */
1032 abstract class NamespaceCombinator { 1152 abstract class NamespaceCombinator {
1033 1153
1034 /** 1154 /**
1035 * An empty array of namespace combinators. 1155 * An empty array of namespace combinators.
1036 */ 1156 */
1037 static final List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombina tor>(0); 1157 static final List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombina tor>(0);
1038 } 1158 }
1039 /** 1159 /**
1040 * The interface `ParameterElement` defines the behavior of elements representin g a parameter 1160 * The interface `ParameterElement` defines the behavior of elements representin g a parameter
1041 * defined within an executable element. 1161 * defined within an executable element.
1162 *
1042 * @coverage dart.engine.element 1163 * @coverage dart.engine.element
1043 */ 1164 */
1044 abstract class ParameterElement implements LocalElement, VariableElement { 1165 abstract class ParameterElement implements LocalElement, VariableElement {
1045 1166
1046 /** 1167 /**
1047 * Return a source range that covers the portion of the source in which the de fault value for this 1168 * Return a source range that covers the portion of the source in which the de fault value for this
1048 * parameter is specified, or `null` if there is no default value. 1169 * parameter is specified, or `null` if there is no default value.
1170 *
1049 * @return the range of characters in which the default value of this paramete r is specified 1171 * @return the range of characters in which the default value of this paramete r is specified
1050 */ 1172 */
1051 SourceRange get defaultValueRange; 1173 SourceRange get defaultValueRange;
1052 1174
1053 /** 1175 /**
1054 * Return the kind of this parameter. 1176 * Return the kind of this parameter.
1177 *
1055 * @return the kind of this parameter 1178 * @return the kind of this parameter
1056 */ 1179 */
1057 ParameterKind get parameterKind; 1180 ParameterKind get parameterKind;
1058 1181
1059 /** 1182 /**
1060 * Return an array containing all of the parameters defined by this parameter. A parameter will 1183 * Return an array containing all of the parameters defined by this parameter. A parameter will
1061 * only define other parameters if it is a function typed parameter. 1184 * only define other parameters if it is a function typed parameter.
1185 *
1062 * @return the parameters defined by this parameter element 1186 * @return the parameters defined by this parameter element
1063 */ 1187 */
1064 List<ParameterElement> get parameters; 1188 List<ParameterElement> get parameters;
1065 1189
1066 /** 1190 /**
1067 * Return `true` if this parameter is an initializing formal parameter. 1191 * Return `true` if this parameter is an initializing formal parameter.
1192 *
1068 * @return `true` if this parameter is an initializing formal parameter 1193 * @return `true` if this parameter is an initializing formal parameter
1069 */ 1194 */
1070 bool get isInitializingFormal; 1195 bool get isInitializingFormal;
1071 } 1196 }
1072 /** 1197 /**
1073 * The interface `PrefixElement` defines the behavior common to elements that re present a 1198 * The interface `PrefixElement` defines the behavior common to elements that re present a
1074 * prefix used to import one or more libraries into another library. 1199 * prefix used to import one or more libraries into another library.
1200 *
1075 * @coverage dart.engine.element 1201 * @coverage dart.engine.element
1076 */ 1202 */
1077 abstract class PrefixElement implements Element { 1203 abstract class PrefixElement implements Element {
1078 1204
1079 /** 1205 /**
1080 * Return the library into which other libraries are imported using this prefi x. 1206 * Return the library into which other libraries are imported using this prefi x.
1207 *
1081 * @return the library into which other libraries are imported using this pref ix 1208 * @return the library into which other libraries are imported using this pref ix
1082 */ 1209 */
1083 LibraryElement get enclosingElement; 1210 LibraryElement get enclosingElement;
1084 1211
1085 /** 1212 /**
1086 * Return an array containing all of the libraries that are imported using thi s prefix. 1213 * Return an array containing all of the libraries that are imported using thi s prefix.
1214 *
1087 * @return the libraries that are imported using this prefix 1215 * @return the libraries that are imported using this prefix
1088 */ 1216 */
1089 List<LibraryElement> get importedLibraries; 1217 List<LibraryElement> get importedLibraries;
1090 } 1218 }
1091 /** 1219 /**
1092 * The interface `PropertyAccessorElement` defines the behavior of elements repr esenting a 1220 * The interface `PropertyAccessorElement` defines the behavior of elements repr esenting a
1093 * getter or a setter. Note that explicitly defined property accessors implicitl y define a synthetic 1221 * getter or a setter. Note that explicitly defined property accessors implicitl y define a synthetic
1094 * field. Symmetrically, synthetic accessors are implicitly created for explicit ly defined fields. 1222 * field. Symmetrically, synthetic accessors are implicitly created for explicit ly defined fields.
1095 * The following rules apply: 1223 * The following rules apply:
1096 * 1224 *
1097 * * Every explicit field is represented by a non-synthetic [FieldElement]. 1225 * * Every explicit field is represented by a non-synthetic [FieldElement].
1098 * * Every explicit field induces a getter and possibly a setter, both of which are represented by 1226 * * Every explicit field induces a getter and possibly a setter, both of which are represented by
1099 * synthetic [PropertyAccessorElement]s. 1227 * synthetic [PropertyAccessorElement]s.
1100 * * Every explicit getter or setter is represented by a non-synthetic[PropertyA ccessorElement]. 1228 * * Every explicit getter or setter is represented by a non-synthetic
1229 * [PropertyAccessorElement].
1101 * * Every explicit getter or setter (or pair thereof if they have the same name ) induces a field 1230 * * Every explicit getter or setter (or pair thereof if they have the same name ) induces a field
1102 * that is represented by a synthetic [FieldElement]. 1231 * that is represented by a synthetic [FieldElement].
1103 * 1232 *
1233 *
1104 * @coverage dart.engine.element 1234 * @coverage dart.engine.element
1105 */ 1235 */
1106 abstract class PropertyAccessorElement implements ExecutableElement { 1236 abstract class PropertyAccessorElement implements ExecutableElement {
1107 1237
1108 /** 1238 /**
1109 * Return the accessor representing the getter that corresponds to (has the sa me name as) this 1239 * Return the accessor representing the getter that corresponds to (has the sa me name as) this
1110 * setter, or `null` if this accessor is not a setter or if there is no corres ponding 1240 * setter, or `null` if this accessor is not a setter or if there is no corres ponding
1111 * getter. 1241 * getter.
1242 *
1112 * @return the getter that corresponds to this setter 1243 * @return the getter that corresponds to this setter
1113 */ 1244 */
1114 PropertyAccessorElement get correspondingGetter; 1245 PropertyAccessorElement get correspondingGetter;
1115 1246
1116 /** 1247 /**
1117 * Return the accessor representing the setter that corresponds to (has the sa me name as) this 1248 * Return the accessor representing the setter that corresponds to (has the sa me name as) this
1118 * getter, or `null` if this accessor is not a getter or if there is no corres ponding 1249 * getter, or `null` if this accessor is not a getter or if there is no corres ponding
1119 * setter. 1250 * setter.
1251 *
1120 * @return the setter that corresponds to this getter 1252 * @return the setter that corresponds to this getter
1121 */ 1253 */
1122 PropertyAccessorElement get correspondingSetter; 1254 PropertyAccessorElement get correspondingSetter;
1123 1255
1124 /** 1256 /**
1125 * Return the field or top-level variable associated with this accessor. If th is accessor was 1257 * Return the field or top-level variable associated with this accessor. If th is accessor was
1126 * explicitly defined (is not synthetic) then the variable associated with it will be synthetic. 1258 * explicitly defined (is not synthetic) then the variable associated with it will be synthetic.
1259 *
1127 * @return the variable associated with this accessor 1260 * @return the variable associated with this accessor
1128 */ 1261 */
1129 PropertyInducingElement get variable; 1262 PropertyInducingElement get variable;
1130 1263
1131 /** 1264 /**
1132 * Return `true` if this accessor is abstract. Accessors are abstract if they are not 1265 * Return `true` if this accessor is abstract. Accessors are abstract if they are not
1133 * external and have no body. 1266 * external and have no body.
1267 *
1134 * @return `true` if this accessor is abstract 1268 * @return `true` if this accessor is abstract
1135 */ 1269 */
1136 bool get isAbstract; 1270 bool get isAbstract;
1137 1271
1138 /** 1272 /**
1139 * Return `true` if this accessor represents a getter. 1273 * Return `true` if this accessor represents a getter.
1274 *
1140 * @return `true` if this accessor represents a getter 1275 * @return `true` if this accessor represents a getter
1141 */ 1276 */
1142 bool get isGetter; 1277 bool get isGetter;
1143 1278
1144 /** 1279 /**
1145 * Return `true` if this accessor represents a setter. 1280 * Return `true` if this accessor represents a setter.
1281 *
1146 * @return `true` if this accessor represents a setter 1282 * @return `true` if this accessor represents a setter
1147 */ 1283 */
1148 bool get isSetter; 1284 bool get isSetter;
1149 } 1285 }
1150 /** 1286 /**
1151 * The interface `PropertyInducingElement` defines the behavior of elements repr esenting a 1287 * The interface `PropertyInducingElement` defines the behavior of elements repr esenting a
1152 * variable that has an associated getter and possibly a setter. Note that expli citly defined 1288 * variable that has an associated getter and possibly a setter. Note that expli citly defined
1153 * variables implicitly define a synthetic getter and that non-`final` explicitl y defined 1289 * variables implicitly define a synthetic getter and that non-`final` explicitl y defined
1154 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel ds are implicitly 1290 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel ds are implicitly
1155 * created for explicitly defined getters and setters. The following rules apply : 1291 * created for explicitly defined getters and setters. The following rules apply :
1156 * 1292 *
1157 * * Every explicit variable is represented by a non-synthetic [PropertyInducing Element]. 1293 * * Every explicit variable is represented by a non-synthetic [PropertyInducing Element].
1158 * * Every explicit variable induces a getter and possibly a setter, both of whi ch are represented 1294 * * Every explicit variable induces a getter and possibly a setter, both of whi ch are represented
1159 * by synthetic [PropertyAccessorElement]s. 1295 * by synthetic [PropertyAccessorElement]s.
1160 * * Every explicit getter or setter is represented by a non-synthetic[PropertyA ccessorElement]. 1296 * * Every explicit getter or setter is represented by a non-synthetic
1297 * [PropertyAccessorElement].
1161 * * Every explicit getter or setter (or pair thereof if they have the same name ) induces a 1298 * * Every explicit getter or setter (or pair thereof if they have the same name ) induces a
1162 * variable that is represented by a synthetic [PropertyInducingElement]. 1299 * variable that is represented by a synthetic [PropertyInducingElement].
1163 * 1300 *
1301 *
1164 * @coverage dart.engine.element 1302 * @coverage dart.engine.element
1165 */ 1303 */
1166 abstract class PropertyInducingElement implements VariableElement { 1304 abstract class PropertyInducingElement implements VariableElement {
1167 1305
1168 /** 1306 /**
1169 * Return the getter associated with this variable. If this variable was expli citly defined (is 1307 * Return the getter associated with this variable. If this variable was expli citly defined (is
1170 * not synthetic) then the getter associated with it will be synthetic. 1308 * not synthetic) then the getter associated with it will be synthetic.
1309 *
1171 * @return the getter associated with this variable 1310 * @return the getter associated with this variable
1172 */ 1311 */
1173 PropertyAccessorElement get getter; 1312 PropertyAccessorElement get getter;
1174 1313
1175 /** 1314 /**
1176 * Return the setter associated with this variable, or `null` if the variable is effectively`final` and therefore does not have a setter associated with it. ( This can happen either 1315 * Return the setter associated with this variable, or `null` if the variable is effectively
1316 * `final` and therefore does not have a setter associated with it. (This can happen either
1177 * because the variable is explicitly defined as being `final` or because the variable is 1317 * because the variable is explicitly defined as being `final` or because the variable is
1178 * induced by an explicit getter that does not have a corresponding setter.) I f this variable was 1318 * induced by an explicit getter that does not have a corresponding setter.) I f this variable was
1179 * explicitly defined (is not synthetic) then the setter associated with it wi ll be synthetic. 1319 * explicitly defined (is not synthetic) then the setter associated with it wi ll be synthetic.
1320 *
1180 * @return the setter associated with this variable 1321 * @return the setter associated with this variable
1181 */ 1322 */
1182 PropertyAccessorElement get setter; 1323 PropertyAccessorElement get setter;
1183 1324
1184 /** 1325 /**
1185 * Return `true` if this element is a static element. A static element is an e lement that is 1326 * Return `true` if this element is a static element. A static element is an e lement that is
1186 * not associated with a particular instance, but rather with an entire librar y or class. 1327 * not associated with a particular instance, but rather with an entire librar y or class.
1328 *
1187 * @return `true` if this executable element is a static element 1329 * @return `true` if this executable element is a static element
1188 */ 1330 */
1189 bool get isStatic; 1331 bool get isStatic;
1190 } 1332 }
1191 /** 1333 /**
1192 * The interface `ShowElementCombinator` defines the behavior of combinators tha t cause some 1334 * The interface `ShowElementCombinator` defines the behavior of combinators tha t cause some
1193 * of the names in a namespace to be visible (and the rest hidden) when being im ported. 1335 * of the names in a namespace to be visible (and the rest hidden) when being im ported.
1336 *
1194 * @coverage dart.engine.element 1337 * @coverage dart.engine.element
1195 */ 1338 */
1196 abstract class ShowElementCombinator implements NamespaceCombinator { 1339 abstract class ShowElementCombinator implements NamespaceCombinator {
1197 1340
1198 /** 1341 /**
1199 * Return an array containing the names that are to be made visible in the imp orting library if 1342 * Return an array containing the names that are to be made visible in the imp orting library if
1200 * they are defined in the imported library. 1343 * they are defined in the imported library.
1344 *
1201 * @return the names from the imported library that are visible in the importi ng library 1345 * @return the names from the imported library that are visible in the importi ng library
1202 */ 1346 */
1203 List<String> get shownNames; 1347 List<String> get shownNames;
1204 } 1348 }
1205 /** 1349 /**
1206 * The interface `TopLevelVariableElement` defines the behavior of elements repr esenting a 1350 * The interface `TopLevelVariableElement` defines the behavior of elements repr esenting a
1207 * top-level variable. 1351 * top-level variable.
1352 *
1208 * @coverage dart.engine.element 1353 * @coverage dart.engine.element
1209 */ 1354 */
1210 abstract class TopLevelVariableElement implements PropertyInducingElement { 1355 abstract class TopLevelVariableElement implements PropertyInducingElement {
1211 } 1356 }
1212 /** 1357 /**
1213 * The interface `TypeVariableElement` defines the behavior of elements represen ting a type 1358 * The interface `TypeVariableElement` defines the behavior of elements represen ting a type
1214 * variable. 1359 * variable.
1360 *
1215 * @coverage dart.engine.element 1361 * @coverage dart.engine.element
1216 */ 1362 */
1217 abstract class TypeVariableElement implements Element { 1363 abstract class TypeVariableElement implements Element {
1218 1364
1219 /** 1365 /**
1220 * Return the type representing the bound associated with this variable, or `n ull` if this 1366 * Return the type representing the bound associated with this variable, or `n ull` if this
1221 * variable does not have an explicit bound. 1367 * variable does not have an explicit bound.
1368 *
1222 * @return the type representing the bound associated with this variable 1369 * @return the type representing the bound associated with this variable
1223 */ 1370 */
1224 Type2 get bound; 1371 Type2 get bound;
1225 1372
1226 /** 1373 /**
1227 * Return the type defined by this type variable. 1374 * Return the type defined by this type variable.
1375 *
1228 * @return the type defined by this type variable 1376 * @return the type defined by this type variable
1229 */ 1377 */
1230 TypeVariableType get type; 1378 TypeVariableType get type;
1231 } 1379 }
1232 /** 1380 /**
1233 * The interface `UndefinedElement` defines the behavior of pseudo-elements that represent 1381 * The interface `UndefinedElement` defines the behavior of pseudo-elements that represent
1234 * names that are undefined. This situation is not allowed by the language, so o bjects implementing 1382 * names that are undefined. This situation is not allowed by the language, so o bjects implementing
1235 * this interface always represent an error. As a result, most of the normal ope rations on elements 1383 * this interface always represent an error. As a result, most of the normal ope rations on elements
1236 * do not make sense and will return useless results. 1384 * do not make sense and will return useless results.
1385 *
1237 * @coverage dart.engine.element 1386 * @coverage dart.engine.element
1238 */ 1387 */
1239 abstract class UndefinedElement implements Element { 1388 abstract class UndefinedElement implements Element {
1240 } 1389 }
1241 /** 1390 /**
1242 * The interface `UriReferencedElement` defines the behavior of objects included into a 1391 * The interface `UriReferencedElement` defines the behavior of objects included into a
1243 * library using some URI. 1392 * library using some URI.
1393 *
1244 * @coverage dart.engine.element 1394 * @coverage dart.engine.element
1245 */ 1395 */
1246 abstract class UriReferencedElement implements Element { 1396 abstract class UriReferencedElement implements Element {
1247 1397
1248 /** 1398 /**
1249 * Return the URI that is used to include this element into the enclosing libr ary, or `null`if this is the defining compilation unit of a library. 1399 * Return the URI that is used to include this element into the enclosing libr ary, or `null`
1400 * if this is the defining compilation unit of a library.
1401 *
1250 * @return the URI that is used to include this element into the enclosing lib rary 1402 * @return the URI that is used to include this element into the enclosing lib rary
1251 */ 1403 */
1252 String get uri; 1404 String get uri;
1253 } 1405 }
1254 /** 1406 /**
1255 * The interface `VariableElement` defines the behavior common to elements that represent a 1407 * The interface `VariableElement` defines the behavior common to elements that represent a
1256 * variable. 1408 * variable.
1409 *
1257 * @coverage dart.engine.element 1410 * @coverage dart.engine.element
1258 */ 1411 */
1259 abstract class VariableElement implements Element { 1412 abstract class VariableElement implements Element {
1260 1413
1261 /** 1414 /**
1262 * Return a synthetic function representing this variable's initializer, or `n ull` if this 1415 * Return a synthetic function representing this variable's initializer, or `n ull` if this
1263 * variable does not have an initializer. The function will have no parameters . The return type of 1416 * variable does not have an initializer. The function will have no parameters . The return type of
1264 * the function will be the compile-time type of the initialization expression . 1417 * the function will be the compile-time type of the initialization expression .
1418 *
1265 * @return a synthetic function representing this variable's initializer 1419 * @return a synthetic function representing this variable's initializer
1266 */ 1420 */
1267 FunctionElement get initializer; 1421 FunctionElement get initializer;
1268 1422
1269 /** 1423 /**
1270 * Return the declared type of this variable, or `null` if the variable did no t have a 1424 * Return the declared type of this variable, or `null` if the variable did no t have a
1271 * declared type (such as if it was declared using the keyword 'var'). 1425 * declared type (such as if it was declared using the keyword 'var').
1426 *
1272 * @return the declared type of this variable 1427 * @return the declared type of this variable
1273 */ 1428 */
1274 Type2 get type; 1429 Type2 get type;
1275 1430
1276 /** 1431 /**
1277 * Return `true` if this variable was declared with the 'const' modifier. 1432 * Return `true` if this variable was declared with the 'const' modifier.
1433 *
1278 * @return `true` if this variable was declared with the 'const' modifier 1434 * @return `true` if this variable was declared with the 'const' modifier
1279 */ 1435 */
1280 bool get isConst; 1436 bool get isConst;
1281 1437
1282 /** 1438 /**
1283 * Return `true` if this variable was declared with the 'final' modifier. Vari ables that are 1439 * Return `true` if this variable was declared with the 'final' modifier. Vari ables that are
1284 * declared with the 'const' modifier will return `false` even though they are implicitly 1440 * declared with the 'const' modifier will return `false` even though they are implicitly
1285 * final. 1441 * final.
1442 *
1286 * @return `true` if this variable was declared with the 'final' modifier 1443 * @return `true` if this variable was declared with the 'final' modifier
1287 */ 1444 */
1288 bool get isFinal; 1445 bool get isFinal;
1289 } 1446 }
1290 /** 1447 /**
1291 * Instances of the class `GeneralizingElementVisitor` implement an element visi tor that will 1448 * Instances of the class `GeneralizingElementVisitor` implement an element visi tor that will
1292 * recursively visit all of the elements in an element model (like instances of the class[RecursiveElementVisitor]). In addition, when an element of a specific type is visited not 1449 * recursively visit all of the elements in an element model (like instances of the class
1450 * [RecursiveElementVisitor]). In addition, when an element of a specific type i s visited not
1293 * only will the visit method for that specific type of element be invoked, but additional methods 1451 * only will the visit method for that specific type of element be invoked, but additional methods
1294 * for the supertypes of that element will also be invoked. For example, using a n instance of this 1452 * for the supertypes of that element will also be invoked. For example, using a n instance of this
1295 * class to visit a [MethodElement] will cause the method[visitMethodElement] to be invoked but will also cause the methods[visitExecutableElement] and [visitEl ement] to be 1453 * class to visit a [MethodElement] will cause the method
1454 * [visitMethodElement] to be invoked but will also cause the methods
1455 * [visitExecutableElement] and [visitElement] to be
1296 * subsequently invoked. This allows visitors to be written that visit all execu table elements 1456 * subsequently invoked. This allows visitors to be written that visit all execu table elements
1297 * without needing to override the visit method for each of the specific subclas ses of[ExecutableElement]. 1457 * without needing to override the visit method for each of the specific subclas ses of
1458 * [ExecutableElement].
1298 * 1459 *
1299 * Note, however, that unlike many visitors, element visitors visit objects base d on the interfaces 1460 * Note, however, that unlike many visitors, element visitors visit objects base d on the interfaces
1300 * implemented by those elements. Because interfaces form a graph structure rath er than a tree 1461 * implemented by those elements. Because interfaces form a graph structure rath er than a tree
1301 * structure the way classes do, and because it is generally undesirable for an object to be visited 1462 * structure the way classes do, and because it is generally undesirable for an object to be visited
1302 * more than once, this class flattens the interface graph into a pseudo-tree. I n particular, this 1463 * more than once, this class flattens the interface graph into a pseudo-tree. I n particular, this
1303 * class treats elements as if the element types were structured in the followin g way: 1464 * class treats elements as if the element types were structured in the followin g way:
1304 * 1465 *
1466 *
1305 * <pre> 1467 * <pre>
1306 * Element 1468 * Element
1307 * ClassElement 1469 * ClassElement
1308 * CompilationUnitElement 1470 * CompilationUnitElement
1309 * ExecutableElement 1471 * ExecutableElement
1310 * ConstructorElement 1472 * ConstructorElement
1311 * LocalElement 1473 * LocalElement
1312 * FunctionElement 1474 * FunctionElement
1313 * MethodElement 1475 * MethodElement
1314 * PropertyAccessorElement 1476 * PropertyAccessorElement
1315 * ExportElement 1477 * ExportElement
1316 * HtmlElement 1478 * HtmlElement
1317 * ImportElement 1479 * ImportElement
1318 * LabelElement 1480 * LabelElement
1319 * LibraryElement 1481 * LibraryElement
1320 * MultiplyDefinedElement 1482 * MultiplyDefinedElement
1321 * PrefixElement 1483 * PrefixElement
1322 * TypeAliasElement 1484 * TypeAliasElement
1323 * TypeVariableElement 1485 * TypeVariableElement
1324 * UndefinedElement 1486 * UndefinedElement
1325 * VariableElement 1487 * VariableElement
1326 * PropertyInducingElement 1488 * PropertyInducingElement
1327 * FieldElement 1489 * FieldElement
1328 * TopLevelVariableElement 1490 * TopLevelVariableElement
1329 * LocalElement 1491 * LocalElement
1330 * LocalVariableElement 1492 * LocalVariableElement
1331 * ParameterElement 1493 * ParameterElement
1332 * FieldFormalParameterElement 1494 * FieldFormalParameterElement
1333 * </pre> 1495 * </pre>
1334 * 1496 *
1335 * Subclasses that override a visit method must either invoke the overridden vis it method or 1497 * Subclasses that override a visit method must either invoke the overridden vis it method or
1336 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods 1498 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods
1337 * for superclasses of the element to not be invoked and will cause the children of the visited node 1499 * for superclasses of the element to not be invoked and will cause the children of the visited node
1338 * to not be visited. 1500 * to not be visited.
1501 *
1339 * @coverage dart.engine.element 1502 * @coverage dart.engine.element
1340 */ 1503 */
1341 class GeneralizingElementVisitor<R> implements ElementVisitor<R> { 1504 class GeneralizingElementVisitor<R> implements ElementVisitor<R> {
1342 R visitClassElement(ClassElement element) => visitElement(element); 1505 R visitClassElement(ClassElement element) => visitElement(element);
1343 R visitCompilationUnitElement(CompilationUnitElement element) => visitElement( element); 1506 R visitCompilationUnitElement(CompilationUnitElement element) => visitElement( element);
1344 R visitConstructorElement(ConstructorElement element) => visitExecutableElemen t(element); 1507 R visitConstructorElement(ConstructorElement element) => visitExecutableElemen t(element);
1345 R visitElement(Element element) { 1508 R visitElement(Element element) {
1346 element.visitChildren(this); 1509 element.visitChildren(this);
1347 return null; 1510 return null;
1348 } 1511 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 } 1545 }
1383 /** 1546 /**
1384 * Instances of the class `RecursiveElementVisitor` implement an element visitor that will 1547 * Instances of the class `RecursiveElementVisitor` implement an element visitor that will
1385 * recursively visit all of the element in an element model. For example, using an instance of this 1548 * recursively visit all of the element in an element model. For example, using an instance of this
1386 * class to visit a [CompilationUnitElement] will also cause all of the types in the 1549 * class to visit a [CompilationUnitElement] will also cause all of the types in the
1387 * compilation unit to be visited. 1550 * compilation unit to be visited.
1388 * 1551 *
1389 * Subclasses that override a visit method must either invoke the overridden vis it method or must 1552 * Subclasses that override a visit method must either invoke the overridden vis it method or must
1390 * explicitly ask the visited element to visit its children. Failure to do so wi ll cause the 1553 * explicitly ask the visited element to visit its children. Failure to do so wi ll cause the
1391 * children of the visited element to not be visited. 1554 * children of the visited element to not be visited.
1555 *
1392 * @coverage dart.engine.element 1556 * @coverage dart.engine.element
1393 */ 1557 */
1394 class RecursiveElementVisitor<R> implements ElementVisitor<R> { 1558 class RecursiveElementVisitor<R> implements ElementVisitor<R> {
1395 R visitClassElement(ClassElement element) { 1559 R visitClassElement(ClassElement element) {
1396 element.visitChildren(this); 1560 element.visitChildren(this);
1397 return null; 1561 return null;
1398 } 1562 }
1399 R visitCompilationUnitElement(CompilationUnitElement element) { 1563 R visitCompilationUnitElement(CompilationUnitElement element) {
1400 element.visitChildren(this); 1564 element.visitChildren(this);
1401 return null; 1565 return null;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 R visitTypeVariableElement(TypeVariableElement element) { 1643 R visitTypeVariableElement(TypeVariableElement element) {
1480 element.visitChildren(this); 1644 element.visitChildren(this);
1481 return null; 1645 return null;
1482 } 1646 }
1483 } 1647 }
1484 /** 1648 /**
1485 * Instances of the class `SimpleElementVisitor` implement an element visitor th at will do 1649 * Instances of the class `SimpleElementVisitor` implement an element visitor th at will do
1486 * nothing when visiting an element. It is intended to be a superclass for class es that use the 1650 * nothing when visiting an element. It is intended to be a superclass for class es that use the
1487 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re cursively visit a 1651 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re cursively visit a
1488 * whole structure) and that only need to visit a small number of element types. 1652 * whole structure) and that only need to visit a small number of element types.
1653 *
1489 * @coverage dart.engine.element 1654 * @coverage dart.engine.element
1490 */ 1655 */
1491 class SimpleElementVisitor<R> implements ElementVisitor<R> { 1656 class SimpleElementVisitor<R> implements ElementVisitor<R> {
1492 R visitClassElement(ClassElement element) => null; 1657 R visitClassElement(ClassElement element) => null;
1493 R visitCompilationUnitElement(CompilationUnitElement element) => null; 1658 R visitCompilationUnitElement(CompilationUnitElement element) => null;
1494 R visitConstructorElement(ConstructorElement element) => null; 1659 R visitConstructorElement(ConstructorElement element) => null;
1495 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null; 1660 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null;
1496 R visitExportElement(ExportElement element) => null; 1661 R visitExportElement(ExportElement element) => null;
1497 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => null; 1662 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => null;
1498 R visitFieldElement(FieldElement element) => null; 1663 R visitFieldElement(FieldElement element) => null;
1499 R visitFieldFormalParameterElement(FieldFormalParameterElement element) => nul l; 1664 R visitFieldFormalParameterElement(FieldFormalParameterElement element) => nul l;
1500 R visitFunctionElement(FunctionElement element) => null; 1665 R visitFunctionElement(FunctionElement element) => null;
1501 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null; 1666 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null;
1502 R visitHtmlElement(HtmlElement element) => null; 1667 R visitHtmlElement(HtmlElement element) => null;
1503 R visitImportElement(ImportElement element) => null; 1668 R visitImportElement(ImportElement element) => null;
1504 R visitLabelElement(LabelElement element) => null; 1669 R visitLabelElement(LabelElement element) => null;
1505 R visitLibraryElement(LibraryElement element) => null; 1670 R visitLibraryElement(LibraryElement element) => null;
1506 R visitLocalVariableElement(LocalVariableElement element) => null; 1671 R visitLocalVariableElement(LocalVariableElement element) => null;
1507 R visitMethodElement(MethodElement element) => null; 1672 R visitMethodElement(MethodElement element) => null;
1508 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; 1673 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null;
1509 R visitParameterElement(ParameterElement element) => null; 1674 R visitParameterElement(ParameterElement element) => null;
1510 R visitPrefixElement(PrefixElement element) => null; 1675 R visitPrefixElement(PrefixElement element) => null;
1511 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; 1676 R visitPropertyAccessorElement(PropertyAccessorElement element) => null;
1512 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; 1677 R visitTopLevelVariableElement(TopLevelVariableElement element) => null;
1513 R visitTypeVariableElement(TypeVariableElement element) => null; 1678 R visitTypeVariableElement(TypeVariableElement element) => null;
1514 } 1679 }
1515 /** 1680 /**
1516 * Instances of the class `ClassElementImpl` implement a `ClassElement`. 1681 * Instances of the class `ClassElementImpl` implement a `ClassElement`.
1682 *
1517 * @coverage dart.engine.element 1683 * @coverage dart.engine.element
1518 */ 1684 */
1519 class ClassElementImpl extends ElementImpl implements ClassElement { 1685 class ClassElementImpl extends ElementImpl implements ClassElement {
1520 1686
1521 /** 1687 /**
1522 * An array containing all of the accessors (getters and setters) contained in this class. 1688 * An array containing all of the accessors (getters and setters) contained in this class.
1523 */ 1689 */
1524 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY; 1690 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY;
1525 1691
1526 /** 1692 /**
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 */ 1730 */
1565 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ; 1731 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ;
1566 1732
1567 /** 1733 /**
1568 * An empty array of type elements. 1734 * An empty array of type elements.
1569 */ 1735 */
1570 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); 1736 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0);
1571 1737
1572 /** 1738 /**
1573 * Initialize a newly created class element to have the given name. 1739 * Initialize a newly created class element to have the given name.
1740 *
1574 * @param name the name of this element 1741 * @param name the name of this element
1575 */ 1742 */
1576 ClassElementImpl(Identifier name) : super.con1(name) { 1743 ClassElementImpl(Identifier name) : super.con1(name) {
1577 } 1744 }
1578 accept(ElementVisitor visitor) => visitor.visitClassElement(this); 1745 accept(ElementVisitor visitor) => visitor.visitClassElement(this);
1579 List<PropertyAccessorElement> get accessors => _accessors; 1746 List<PropertyAccessorElement> get accessors => _accessors;
1580 List<InterfaceType> get allSupertypes { 1747 List<InterfaceType> get allSupertypes {
1581 List<InterfaceType> list = new List<InterfaceType>(); 1748 List<InterfaceType> list = new List<InterfaceType>();
1582 collectAllSupertypes(list); 1749 collectAllSupertypes(list);
1583 return new List.from(list); 1750 return new List.from(list);
(...skipping 24 matching lines...) Expand all
1608 return typeVariable as TypeVariableElementImpl; 1775 return typeVariable as TypeVariableElementImpl;
1609 } 1776 }
1610 } 1777 }
1611 return null; 1778 return null;
1612 } 1779 }
1613 List<ConstructorElement> get constructors => _constructors; 1780 List<ConstructorElement> get constructors => _constructors;
1614 1781
1615 /** 1782 /**
1616 * Given some name, this returns the [FieldElement] with the matching name, if there is no 1783 * Given some name, this returns the [FieldElement] with the matching name, if there is no
1617 * such field, then `null` is returned. 1784 * such field, then `null` is returned.
1785 *
1618 * @param name some name to lookup a field element with 1786 * @param name some name to lookup a field element with
1619 * @return the matching field element, or `null` if no such element was found 1787 * @return the matching field element, or `null` if no such element was found
1620 */ 1788 */
1621 FieldElement getField(String name2) { 1789 FieldElement getField(String name2) {
1622 for (FieldElement fieldElement in _fields) { 1790 for (FieldElement fieldElement in _fields) {
1623 if (name2 == fieldElement.name) { 1791 if (name2 == fieldElement.name) {
1624 return fieldElement; 1792 return fieldElement;
1625 } 1793 }
1626 } 1794 }
1627 return null; 1795 return null;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 List<TypeVariableElement> get typeVariables => _typeVariables; 1840 List<TypeVariableElement> get typeVariables => _typeVariables;
1673 ConstructorElement get unnamedConstructor { 1841 ConstructorElement get unnamedConstructor {
1674 for (ConstructorElement element in constructors) { 1842 for (ConstructorElement element in constructors) {
1675 String name = element.displayName; 1843 String name = element.displayName;
1676 if (name == null || name.isEmpty) { 1844 if (name == null || name.isEmpty) {
1677 return element; 1845 return element;
1678 } 1846 }
1679 } 1847 }
1680 return null; 1848 return null;
1681 } 1849 }
1682 bool hasDefaultConstructor() {
1683 for (ConstructorElement constructor in constructors) {
1684 if (constructor.isDefaultConstructor) {
1685 return true;
1686 }
1687 }
1688 return false;
1689 }
1690 bool hasNonFinalField() { 1850 bool hasNonFinalField() {
1691 List<ClassElement> classesToVisit = new List<ClassElement>(); 1851 List<ClassElement> classesToVisit = new List<ClassElement>();
1692 Set<ClassElement> visitedClasses = new Set<ClassElement>(); 1852 Set<ClassElement> visitedClasses = new Set<ClassElement>();
1693 classesToVisit.add(this); 1853 classesToVisit.add(this);
1694 while (!classesToVisit.isEmpty) { 1854 while (!classesToVisit.isEmpty) {
1695 ClassElement currentElement = classesToVisit.removeAt(0); 1855 ClassElement currentElement = classesToVisit.removeAt(0);
1696 if (javaSetAdd(visitedClasses, currentElement)) { 1856 if (javaSetAdd(visitedClasses, currentElement)) {
1697 for (FieldElement field in currentElement.fields) { 1857 for (FieldElement field in currentElement.fields) {
1698 if (!field.isFinal && !field.isConst && !field.isStatic && !field.isSy nthetic) { 1858 if (!field.isFinal && !field.isConst && !field.isStatic && !field.isSy nthetic) {
1699 return true; 1859 return true;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 if (supertype == null) { 1952 if (supertype == null) {
1793 return null; 1953 return null;
1794 } 1954 }
1795 currentElement = supertype.element; 1955 currentElement = supertype.element;
1796 } 1956 }
1797 return null; 1957 return null;
1798 } 1958 }
1799 1959
1800 /** 1960 /**
1801 * Set whether this class is abstract to correspond to the given value. 1961 * Set whether this class is abstract to correspond to the given value.
1962 *
1802 * @param isAbstract `true` if the class is abstract 1963 * @param isAbstract `true` if the class is abstract
1803 */ 1964 */
1804 void set abstract(bool isAbstract) { 1965 void set abstract(bool isAbstract) {
1805 setModifier(Modifier.ABSTRACT, isAbstract); 1966 setModifier(Modifier.ABSTRACT, isAbstract);
1806 } 1967 }
1807 1968
1808 /** 1969 /**
1809 * Set the accessors contained in this class to the given accessors. 1970 * Set the accessors contained in this class to the given accessors.
1971 *
1810 * @param accessors the accessors contained in this class 1972 * @param accessors the accessors contained in this class
1811 */ 1973 */
1812 void set accessors(List<PropertyAccessorElement> accessors2) { 1974 void set accessors(List<PropertyAccessorElement> accessors2) {
1813 for (PropertyAccessorElement accessor in accessors2) { 1975 for (PropertyAccessorElement accessor in accessors2) {
1814 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; 1976 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this;
1815 } 1977 }
1816 this._accessors = accessors2; 1978 this._accessors = accessors2;
1817 } 1979 }
1818 1980
1819 /** 1981 /**
1820 * Set the constructors contained in this class to the given constructors. 1982 * Set the constructors contained in this class to the given constructors.
1983 *
1821 * @param constructors the constructors contained in this class 1984 * @param constructors the constructors contained in this class
1822 */ 1985 */
1823 void set constructors(List<ConstructorElement> constructors2) { 1986 void set constructors(List<ConstructorElement> constructors2) {
1824 for (ConstructorElement constructor in constructors2) { 1987 for (ConstructorElement constructor in constructors2) {
1825 ((constructor as ConstructorElementImpl)).enclosingElement = this; 1988 ((constructor as ConstructorElementImpl)).enclosingElement = this;
1826 } 1989 }
1827 this._constructors = constructors2; 1990 this._constructors = constructors2;
1828 } 1991 }
1829 1992
1830 /** 1993 /**
1831 * Set the fields contained in this class to the given fields. 1994 * Set the fields contained in this class to the given fields.
1995 *
1832 * @param fields the fields contained in this class 1996 * @param fields the fields contained in this class
1833 */ 1997 */
1834 void set fields(List<FieldElement> fields2) { 1998 void set fields(List<FieldElement> fields2) {
1835 for (FieldElement field in fields2) { 1999 for (FieldElement field in fields2) {
1836 ((field as FieldElementImpl)).enclosingElement = this; 2000 ((field as FieldElementImpl)).enclosingElement = this;
1837 } 2001 }
1838 this._fields = fields2; 2002 this._fields = fields2;
1839 } 2003 }
1840 2004
1841 /** 2005 /**
1842 * Set whether this class references 'super' to the given value. 2006 * Set whether this class references 'super' to the given value.
2007 *
1843 * @param isReferencedSuper `true` references 'super' 2008 * @param isReferencedSuper `true` references 'super'
1844 */ 2009 */
1845 void set hasReferenceToSuper2(bool isReferencedSuper) { 2010 void set hasReferenceToSuper2(bool isReferencedSuper) {
1846 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); 2011 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper);
1847 } 2012 }
1848 2013
1849 /** 2014 /**
1850 * Set the interfaces that are implemented by this class to the given types. 2015 * Set the interfaces that are implemented by this class to the given types.
2016 *
1851 * @param the interfaces that are implemented by this class 2017 * @param the interfaces that are implemented by this class
1852 */ 2018 */
1853 void set interfaces(List<InterfaceType> interfaces2) { 2019 void set interfaces(List<InterfaceType> interfaces2) {
1854 this._interfaces = interfaces2; 2020 this._interfaces = interfaces2;
1855 } 2021 }
1856 2022
1857 /** 2023 /**
1858 * Set the methods contained in this class to the given methods. 2024 * Set the methods contained in this class to the given methods.
2025 *
1859 * @param methods the methods contained in this class 2026 * @param methods the methods contained in this class
1860 */ 2027 */
1861 void set methods(List<MethodElement> methods2) { 2028 void set methods(List<MethodElement> methods2) {
1862 for (MethodElement method in methods2) { 2029 for (MethodElement method in methods2) {
1863 ((method as MethodElementImpl)).enclosingElement = this; 2030 ((method as MethodElementImpl)).enclosingElement = this;
1864 } 2031 }
1865 this._methods = methods2; 2032 this._methods = methods2;
1866 } 2033 }
1867 2034
1868 /** 2035 /**
1869 * Set the mixins that are applied to the class being extended in order to der ive the superclass 2036 * Set the mixins that are applied to the class being extended in order to der ive the superclass
1870 * of this class to the given types. 2037 * of this class to the given types.
2038 *
1871 * @param mixins the mixins that are applied to derive the superclass of this class 2039 * @param mixins the mixins that are applied to derive the superclass of this class
1872 */ 2040 */
1873 void set mixins(List<InterfaceType> mixins2) { 2041 void set mixins(List<InterfaceType> mixins2) {
1874 this._mixins = mixins2; 2042 this._mixins = mixins2;
1875 } 2043 }
1876 2044
1877 /** 2045 /**
1878 * Set the superclass of the class to the given type. 2046 * Set the superclass of the class to the given type.
2047 *
1879 * @param supertype the superclass of the class 2048 * @param supertype the superclass of the class
1880 */ 2049 */
1881 void set supertype(InterfaceType supertype2) { 2050 void set supertype(InterfaceType supertype2) {
1882 this._supertype = supertype2; 2051 this._supertype = supertype2;
1883 } 2052 }
1884 2053
1885 /** 2054 /**
1886 * Set the type defined by the class to the given type. 2055 * Set the type defined by the class to the given type.
2056 *
1887 * @param type the type defined by the class 2057 * @param type the type defined by the class
1888 */ 2058 */
1889 void set type(InterfaceType type2) { 2059 void set type(InterfaceType type2) {
1890 this._type = type2; 2060 this._type = type2;
1891 } 2061 }
1892 2062
1893 /** 2063 /**
1894 * Set whether this class is defined by a typedef construct to correspond to t he given value. 2064 * Set whether this class is defined by a typedef construct to correspond to t he given value.
2065 *
1895 * @param isTypedef `true` if the class is defined by a typedef construct 2066 * @param isTypedef `true` if the class is defined by a typedef construct
1896 */ 2067 */
1897 void set typedef(bool isTypedef) { 2068 void set typedef(bool isTypedef) {
1898 setModifier(Modifier.TYPEDEF, isTypedef); 2069 setModifier(Modifier.TYPEDEF, isTypedef);
1899 } 2070 }
1900 2071
1901 /** 2072 /**
1902 * Set the type variables defined for this class to the given type variables. 2073 * Set the type variables defined for this class to the given type variables.
2074 *
1903 * @param typeVariables the type variables defined for this class 2075 * @param typeVariables the type variables defined for this class
1904 */ 2076 */
1905 void set typeVariables(List<TypeVariableElement> typeVariables2) { 2077 void set typeVariables(List<TypeVariableElement> typeVariables2) {
1906 for (TypeVariableElement typeVariable in typeVariables2) { 2078 for (TypeVariableElement typeVariable in typeVariables2) {
1907 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this; 2079 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this;
1908 } 2080 }
1909 this._typeVariables = typeVariables2; 2081 this._typeVariables = typeVariables2;
1910 } 2082 }
1911 2083
1912 /** 2084 /**
1913 * Set whether this class is a valid mixin to correspond to the given value. 2085 * Set whether this class is a valid mixin to correspond to the given value.
2086 *
1914 * @param isValidMixin `true` if this class can be used as a mixin 2087 * @param isValidMixin `true` if this class can be used as a mixin
1915 */ 2088 */
1916 void set validMixin(bool isValidMixin) { 2089 void set validMixin(bool isValidMixin) {
1917 setModifier(Modifier.MIXIN, isValidMixin); 2090 setModifier(Modifier.MIXIN, isValidMixin);
1918 } 2091 }
1919 void visitChildren(ElementVisitor<Object> visitor) { 2092 void visitChildren(ElementVisitor<Object> visitor) {
1920 super.visitChildren(visitor); 2093 super.visitChildren(visitor);
1921 safelyVisitChildren(_accessors, visitor); 2094 safelyVisitChildren(_accessors, visitor);
1922 safelyVisitChildren(_constructors, visitor); 2095 safelyVisitChildren(_constructors, visitor);
1923 safelyVisitChildren(_fields, visitor); 2096 safelyVisitChildren(_fields, visitor);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 ClassElement element = type.element; 2139 ClassElement element = type.element;
1967 if (!visitedClasses.contains(element)) { 2140 if (!visitedClasses.contains(element)) {
1968 supertypes.add(type); 2141 supertypes.add(type);
1969 } 2142 }
1970 } 2143 }
1971 } 2144 }
1972 } 2145 }
1973 } 2146 }
1974 } 2147 }
1975 /** 2148 /**
1976 * Instances of the class `CompilationUnitElementImpl` implement a[CompilationUn itElement]. 2149 * Instances of the class `CompilationUnitElementImpl` implement a
2150 * [CompilationUnitElement].
2151 *
1977 * @coverage dart.engine.element 2152 * @coverage dart.engine.element
1978 */ 2153 */
1979 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE lement { 2154 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE lement {
1980 2155
1981 /** 2156 /**
1982 * An empty array of compilation unit elements. 2157 * An empty array of compilation unit elements.
1983 */ 2158 */
1984 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>(0); 2159 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>(0);
1985 2160
1986 /** 2161 /**
(...skipping 28 matching lines...) Expand all
2015 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; 2190 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY;
2016 2191
2017 /** 2192 /**
2018 * The URI that is specified by the "part" directive in the enclosing library, or `null` if 2193 * The URI that is specified by the "part" directive in the enclosing library, or `null` if
2019 * this is the defining compilation unit of a library. 2194 * this is the defining compilation unit of a library.
2020 */ 2195 */
2021 String _uri; 2196 String _uri;
2022 2197
2023 /** 2198 /**
2024 * Initialize a newly created compilation unit element to have the given name. 2199 * Initialize a newly created compilation unit element to have the given name.
2200 *
2025 * @param name the name of this element 2201 * @param name the name of this element
2026 */ 2202 */
2027 CompilationUnitElementImpl(String name) : super.con2(name, -1) { 2203 CompilationUnitElementImpl(String name) : super.con2(name, -1) {
2028 } 2204 }
2029 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); 2205 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this);
2030 bool operator ==(Object object) => object != null && runtimeType == object.run timeType && _source == ((object as CompilationUnitElementImpl)).source; 2206 bool operator ==(Object object) => object != null && runtimeType == object.run timeType && _source == ((object as CompilationUnitElementImpl)).source;
2031 List<PropertyAccessorElement> get accessors => _accessors; 2207 List<PropertyAccessorElement> get accessors => _accessors;
2032 ElementImpl getChild(String identifier2) { 2208 ElementImpl getChild(String identifier2) {
2033 for (PropertyAccessorElement accessor in _accessors) { 2209 for (PropertyAccessorElement accessor in _accessors) {
2034 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2) { 2210 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 } 2248 }
2073 return null; 2249 return null;
2074 } 2250 }
2075 List<ClassElement> get types => _types; 2251 List<ClassElement> get types => _types;
2076 String get uri => _uri; 2252 String get uri => _uri;
2077 int get hashCode => _source.hashCode; 2253 int get hashCode => _source.hashCode;
2078 2254
2079 /** 2255 /**
2080 * Set the top-level accessors (getters and setters) contained in this compila tion unit to the 2256 * Set the top-level accessors (getters and setters) contained in this compila tion unit to the
2081 * given accessors. 2257 * given accessors.
2258 *
2082 * @param the top-level accessors (getters and setters) contained in this comp ilation unit 2259 * @param the top-level accessors (getters and setters) contained in this comp ilation unit
2083 */ 2260 */
2084 void set accessors(List<PropertyAccessorElement> accessors2) { 2261 void set accessors(List<PropertyAccessorElement> accessors2) {
2085 for (PropertyAccessorElement accessor in accessors2) { 2262 for (PropertyAccessorElement accessor in accessors2) {
2086 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; 2263 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this;
2087 } 2264 }
2088 this._accessors = accessors2; 2265 this._accessors = accessors2;
2089 } 2266 }
2090 2267
2091 /** 2268 /**
2092 * Set the top-level functions contained in this compilation unit to the given functions. 2269 * Set the top-level functions contained in this compilation unit to the given functions.
2270 *
2093 * @param functions the top-level functions contained in this compilation unit 2271 * @param functions the top-level functions contained in this compilation unit
2094 */ 2272 */
2095 void set functions(List<FunctionElement> functions2) { 2273 void set functions(List<FunctionElement> functions2) {
2096 for (FunctionElement function in functions2) { 2274 for (FunctionElement function in functions2) {
2097 ((function as FunctionElementImpl)).enclosingElement = this; 2275 ((function as FunctionElementImpl)).enclosingElement = this;
2098 } 2276 }
2099 this._functions = functions2; 2277 this._functions = functions2;
2100 } 2278 }
2101 2279
2102 /** 2280 /**
2103 * Set the source that corresponds to this compilation unit to the given sourc e. 2281 * Set the source that corresponds to this compilation unit to the given sourc e.
2282 *
2104 * @param source the source that corresponds to this compilation unit 2283 * @param source the source that corresponds to this compilation unit
2105 */ 2284 */
2106 void set source(Source source2) { 2285 void set source(Source source2) {
2107 this._source = source2; 2286 this._source = source2;
2108 } 2287 }
2109 2288
2110 /** 2289 /**
2111 * Set the top-level variables contained in this compilation unit to the given variables. 2290 * Set the top-level variables contained in this compilation unit to the given variables.
2291 *
2112 * @param variables the top-level variables contained in this compilation unit 2292 * @param variables the top-level variables contained in this compilation unit
2113 */ 2293 */
2114 void set topLevelVariables(List<TopLevelVariableElement> variables2) { 2294 void set topLevelVariables(List<TopLevelVariableElement> variables2) {
2115 for (TopLevelVariableElement field in variables2) { 2295 for (TopLevelVariableElement field in variables2) {
2116 ((field as TopLevelVariableElementImpl)).enclosingElement = this; 2296 ((field as TopLevelVariableElementImpl)).enclosingElement = this;
2117 } 2297 }
2118 this._variables = variables2; 2298 this._variables = variables2;
2119 } 2299 }
2120 2300
2121 /** 2301 /**
2122 * Set the function type aliases contained in this compilation unit to the giv en type aliases. 2302 * Set the function type aliases contained in this compilation unit to the giv en type aliases.
2303 *
2123 * @param typeAliases the function type aliases contained in this compilation unit 2304 * @param typeAliases the function type aliases contained in this compilation unit
2124 */ 2305 */
2125 void set typeAliases(List<FunctionTypeAliasElement> typeAliases2) { 2306 void set typeAliases(List<FunctionTypeAliasElement> typeAliases2) {
2126 for (FunctionTypeAliasElement typeAlias in typeAliases2) { 2307 for (FunctionTypeAliasElement typeAlias in typeAliases2) {
2127 ((typeAlias as FunctionTypeAliasElementImpl)).enclosingElement = this; 2308 ((typeAlias as FunctionTypeAliasElementImpl)).enclosingElement = this;
2128 } 2309 }
2129 this._typeAliases = typeAliases2; 2310 this._typeAliases = typeAliases2;
2130 } 2311 }
2131 2312
2132 /** 2313 /**
2133 * Set the types contained in this compilation unit to the given types. 2314 * Set the types contained in this compilation unit to the given types.
2315 *
2134 * @param types types contained in this compilation unit 2316 * @param types types contained in this compilation unit
2135 */ 2317 */
2136 void set types(List<ClassElement> types2) { 2318 void set types(List<ClassElement> types2) {
2137 for (ClassElement type in types2) { 2319 for (ClassElement type in types2) {
2138 ((type as ClassElementImpl)).enclosingElement = this; 2320 ((type as ClassElementImpl)).enclosingElement = this;
2139 } 2321 }
2140 this._types = types2; 2322 this._types = types2;
2141 } 2323 }
2142 2324
2143 /** 2325 /**
2144 * Set the URI that is specified by the "part" directive in the enclosing libr ary. 2326 * Set the URI that is specified by the "part" directive in the enclosing libr ary.
2327 *
2145 * @param uri the URI that is specified by the "part" directive in the enclosi ng library. 2328 * @param uri the URI that is specified by the "part" directive in the enclosi ng library.
2146 */ 2329 */
2147 void set uri(String uri2) { 2330 void set uri(String uri2) {
2148 this._uri = uri2; 2331 this._uri = uri2;
2149 } 2332 }
2150 void visitChildren(ElementVisitor<Object> visitor) { 2333 void visitChildren(ElementVisitor<Object> visitor) {
2151 super.visitChildren(visitor); 2334 super.visitChildren(visitor);
2152 safelyVisitChildren(_accessors, visitor); 2335 safelyVisitChildren(_accessors, visitor);
2153 safelyVisitChildren(_functions, visitor); 2336 safelyVisitChildren(_functions, visitor);
2154 safelyVisitChildren(_typeAliases, visitor); 2337 safelyVisitChildren(_typeAliases, visitor);
(...skipping 14 matching lines...) Expand all
2169 */ 2352 */
2170 class ConstFieldElementImpl extends FieldElementImpl { 2353 class ConstFieldElementImpl extends FieldElementImpl {
2171 2354
2172 /** 2355 /**
2173 * The result of evaluating this variable's initializer. 2356 * The result of evaluating this variable's initializer.
2174 */ 2357 */
2175 EvaluationResultImpl _result; 2358 EvaluationResultImpl _result;
2176 2359
2177 /** 2360 /**
2178 * Initialize a newly created field element to have the given name. 2361 * Initialize a newly created field element to have the given name.
2362 *
2179 * @param name the name of this element 2363 * @param name the name of this element
2180 */ 2364 */
2181 ConstFieldElementImpl(Identifier name) : super.con1(name) { 2365 ConstFieldElementImpl(Identifier name) : super.con1(name) {
2182 } 2366 }
2183 EvaluationResultImpl get evaluationResult => _result; 2367 EvaluationResultImpl get evaluationResult => _result;
2184 void set evaluationResult(EvaluationResultImpl result2) { 2368 void set evaluationResult(EvaluationResultImpl result2) {
2185 this._result = result2; 2369 this._result = result2;
2186 } 2370 }
2187 } 2371 }
2188 /** 2372 /**
2189 * Instances of the class `ConstLocalVariableElementImpl` implement a`LocalVaria bleElement` for a local 'const' variable that has an initializer. 2373 * Instances of the class `ConstLocalVariableElementImpl` implement a
2374 * `LocalVariableElement` for a local 'const' variable that has an initializer.
2375 *
2190 * @coverage dart.engine.element 2376 * @coverage dart.engine.element
2191 */ 2377 */
2192 class ConstLocalVariableElementImpl extends LocalVariableElementImpl { 2378 class ConstLocalVariableElementImpl extends LocalVariableElementImpl {
2193 2379
2194 /** 2380 /**
2195 * The result of evaluating this variable's initializer. 2381 * The result of evaluating this variable's initializer.
2196 */ 2382 */
2197 EvaluationResultImpl _result; 2383 EvaluationResultImpl _result;
2198 2384
2199 /** 2385 /**
2200 * Initialize a newly created local variable element to have the given name. 2386 * Initialize a newly created local variable element to have the given name.
2387 *
2201 * @param name the name of this element 2388 * @param name the name of this element
2202 */ 2389 */
2203 ConstLocalVariableElementImpl(Identifier name) : super(name) { 2390 ConstLocalVariableElementImpl(Identifier name) : super(name) {
2204 } 2391 }
2205 EvaluationResultImpl get evaluationResult => _result; 2392 EvaluationResultImpl get evaluationResult => _result;
2206 void set evaluationResult(EvaluationResultImpl result2) { 2393 void set evaluationResult(EvaluationResultImpl result2) {
2207 this._result = result2; 2394 this._result = result2;
2208 } 2395 }
2209 } 2396 }
2210 /** 2397 /**
2211 * Instances of the class `ConstTopLevelVariableElementImpl` implement a`TopLeve lVariableElement` for a top-level 'const' variable that has an initializer. 2398 * Instances of the class `ConstTopLevelVariableElementImpl` implement a
2399 * `TopLevelVariableElement` for a top-level 'const' variable that has an initia lizer.
2212 */ 2400 */
2213 class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl { 2401 class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl {
2214 2402
2215 /** 2403 /**
2216 * The result of evaluating this variable's initializer. 2404 * The result of evaluating this variable's initializer.
2217 */ 2405 */
2218 EvaluationResultImpl _result; 2406 EvaluationResultImpl _result;
2219 2407
2220 /** 2408 /**
2221 * Initialize a newly created top-level variable element to have the given nam e. 2409 * Initialize a newly created top-level variable element to have the given nam e.
2410 *
2222 * @param name the name of this element 2411 * @param name the name of this element
2223 */ 2412 */
2224 ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name) { 2413 ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name) {
2225 } 2414 }
2226 EvaluationResultImpl get evaluationResult => _result; 2415 EvaluationResultImpl get evaluationResult => _result;
2227 void set evaluationResult(EvaluationResultImpl result2) { 2416 void set evaluationResult(EvaluationResultImpl result2) {
2228 this._result = result2; 2417 this._result = result2;
2229 } 2418 }
2230 } 2419 }
2231 /** 2420 /**
2232 * Instances of the class `ConstructorElementImpl` implement a `ConstructorEleme nt`. 2421 * Instances of the class `ConstructorElementImpl` implement a `ConstructorEleme nt`.
2422 *
2233 * @coverage dart.engine.element 2423 * @coverage dart.engine.element
2234 */ 2424 */
2235 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement { 2425 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement {
2236 2426
2237 /** 2427 /**
2238 * An empty array of constructor elements. 2428 * An empty array of constructor elements.
2239 */ 2429 */
2240 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); 2430 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0);
2241 2431
2242 /** 2432 /**
2243 * The constructor to which this constructor is redirecting. 2433 * The constructor to which this constructor is redirecting.
2244 */ 2434 */
2245 ConstructorElement _redirectedConstructor; 2435 ConstructorElement _redirectedConstructor;
2246 2436
2247 /** 2437 /**
2248 * Initialize a newly created constructor element to have the given name. 2438 * Initialize a newly created constructor element to have the given name.
2439 *
2249 * @param name the name of this element 2440 * @param name the name of this element
2250 */ 2441 */
2251 ConstructorElementImpl(Identifier name) : super.con1(name) { 2442 ConstructorElementImpl(Identifier name) : super.con1(name) {
2252 } 2443 }
2253 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); 2444 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
2254 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 2445 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
2255 ElementKind get kind => ElementKind.CONSTRUCTOR; 2446 ElementKind get kind => ElementKind.CONSTRUCTOR;
2256 ConstructorElement get redirectedConstructor => _redirectedConstructor; 2447 ConstructorElement get redirectedConstructor => _redirectedConstructor;
2257 bool get isConst => hasModifier(Modifier.CONST); 2448 bool get isConst => hasModifier(Modifier.CONST);
2258 bool get isDefaultConstructor { 2449 bool get isDefaultConstructor {
2259 String name = this.name; 2450 String name = this.name;
2260 if (name != null && name.length != 0) { 2451 if (name != null && name.length != 0) {
2261 return false; 2452 return false;
2262 } 2453 }
2263 for (ParameterElement parameter in parameters) { 2454 for (ParameterElement parameter in parameters) {
2264 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { 2455 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) {
2265 return false; 2456 return false;
2266 } 2457 }
2267 } 2458 }
2268 return true; 2459 return true;
2269 } 2460 }
2270 bool get isFactory => hasModifier(Modifier.FACTORY); 2461 bool get isFactory => hasModifier(Modifier.FACTORY);
2271 bool get isStatic => false; 2462 bool get isStatic => false;
2272 2463
2273 /** 2464 /**
2274 * Set whether this constructor represents a 'const' constructor to the given value. 2465 * Set whether this constructor represents a 'const' constructor to the given value.
2466 *
2275 * @param isConst `true` if this constructor represents a 'const' constructor 2467 * @param isConst `true` if this constructor represents a 'const' constructor
2276 */ 2468 */
2277 void set const2(bool isConst) { 2469 void set const2(bool isConst) {
2278 setModifier(Modifier.CONST, isConst); 2470 setModifier(Modifier.CONST, isConst);
2279 } 2471 }
2280 2472
2281 /** 2473 /**
2282 * Set whether this constructor represents a factory method to the given value . 2474 * Set whether this constructor represents a factory method to the given value .
2475 *
2283 * @param isFactory `true` if this constructor represents a factory method 2476 * @param isFactory `true` if this constructor represents a factory method
2284 */ 2477 */
2285 void set factory(bool isFactory) { 2478 void set factory(bool isFactory) {
2286 setModifier(Modifier.FACTORY, isFactory); 2479 setModifier(Modifier.FACTORY, isFactory);
2287 } 2480 }
2288 2481
2289 /** 2482 /**
2290 * Sets the constructor to which this constructor is redirecting. 2483 * Sets the constructor to which this constructor is redirecting.
2484 *
2291 * @param redirectedConstructor the constructor to which this constructor is r edirecting 2485 * @param redirectedConstructor the constructor to which this constructor is r edirecting
2292 */ 2486 */
2293 void set redirectedConstructor(ConstructorElement redirectedConstructor2) { 2487 void set redirectedConstructor(ConstructorElement redirectedConstructor2) {
2294 this._redirectedConstructor = redirectedConstructor2; 2488 this._redirectedConstructor = redirectedConstructor2;
2295 } 2489 }
2296 void appendTo(JavaStringBuilder builder) { 2490 void appendTo(JavaStringBuilder builder) {
2297 builder.append(enclosingElement.displayName); 2491 builder.append(enclosingElement.displayName);
2298 String name = displayName; 2492 String name = displayName;
2299 if (name != null && !name.isEmpty) { 2493 if (name != null && !name.isEmpty) {
2300 builder.append("."); 2494 builder.append(".");
2301 builder.append(name); 2495 builder.append(name);
2302 } 2496 }
2303 super.appendTo(builder); 2497 super.appendTo(builder);
2304 } 2498 }
2305 } 2499 }
2306 /** 2500 /**
2307 * Instances of the class `DefaultFieldFormalParameterElementImpl` implement a`F ieldFormalParameterElementImpl` for parameters that have an initializer. 2501 * Instances of the class `DefaultFieldFormalParameterElementImpl` implement a
2502 * `FieldFormalParameterElementImpl` for parameters that have an initializer.
2503 *
2308 * @coverage dart.engine.element 2504 * @coverage dart.engine.element
2309 */ 2505 */
2310 class DefaultFieldFormalParameterElementImpl extends FieldFormalParameterElement Impl { 2506 class DefaultFieldFormalParameterElementImpl extends FieldFormalParameterElement Impl {
2311 2507
2312 /** 2508 /**
2313 * The result of evaluating this variable's initializer. 2509 * The result of evaluating this variable's initializer.
2314 */ 2510 */
2315 EvaluationResultImpl _result; 2511 EvaluationResultImpl _result;
2316 2512
2317 /** 2513 /**
2318 * Initialize a newly created parameter element to have the given name. 2514 * Initialize a newly created parameter element to have the given name.
2515 *
2319 * @param name the name of this element 2516 * @param name the name of this element
2320 */ 2517 */
2321 DefaultFieldFormalParameterElementImpl(Identifier name) : super(name) { 2518 DefaultFieldFormalParameterElementImpl(Identifier name) : super(name) {
2322 } 2519 }
2323 EvaluationResultImpl get evaluationResult => _result; 2520 EvaluationResultImpl get evaluationResult => _result;
2324 void set evaluationResult(EvaluationResultImpl result2) { 2521 void set evaluationResult(EvaluationResultImpl result2) {
2325 this._result = result2; 2522 this._result = result2;
2326 } 2523 }
2327 } 2524 }
2328 /** 2525 /**
2329 * Instances of the class `DefaultParameterElementImpl` implement a `ParameterEl ement`for parameters that have an initializer. 2526 * Instances of the class `DefaultParameterElementImpl` implement a `ParameterEl ement`
2527 * for parameters that have an initializer.
2528 *
2330 * @coverage dart.engine.element 2529 * @coverage dart.engine.element
2331 */ 2530 */
2332 class DefaultParameterElementImpl extends ParameterElementImpl { 2531 class DefaultParameterElementImpl extends ParameterElementImpl {
2333 2532
2334 /** 2533 /**
2335 * The result of evaluating this variable's initializer. 2534 * The result of evaluating this variable's initializer.
2336 */ 2535 */
2337 EvaluationResultImpl _result; 2536 EvaluationResultImpl _result;
2338 2537
2339 /** 2538 /**
2340 * Initialize a newly created parameter element to have the given name. 2539 * Initialize a newly created parameter element to have the given name.
2540 *
2341 * @param name the name of this element 2541 * @param name the name of this element
2342 */ 2542 */
2343 DefaultParameterElementImpl(Identifier name) : super(name) { 2543 DefaultParameterElementImpl(Identifier name) : super(name) {
2344 } 2544 }
2345 EvaluationResultImpl get evaluationResult => _result; 2545 EvaluationResultImpl get evaluationResult => _result;
2346 void set evaluationResult(EvaluationResultImpl result2) { 2546 void set evaluationResult(EvaluationResultImpl result2) {
2347 this._result = result2; 2547 this._result = result2;
2348 } 2548 }
2349 } 2549 }
2350 /** 2550 /**
2351 * Instances of the class `DynamicElementImpl` represent the synthetic element r epresenting 2551 * Instances of the class `DynamicElementImpl` represent the synthetic element r epresenting
2352 * the declaration of the type `dynamic`. 2552 * the declaration of the type `dynamic`.
2553 *
2353 * @coverage dart.engine.element 2554 * @coverage dart.engine.element
2354 */ 2555 */
2355 class DynamicElementImpl extends ElementImpl { 2556 class DynamicElementImpl extends ElementImpl {
2356 2557
2357 /** 2558 /**
2358 * Return the unique instance of this class. 2559 * Return the unique instance of this class.
2560 *
2359 * @return the unique instance of this class 2561 * @return the unique instance of this class
2360 */ 2562 */
2361 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as DynamicElementImpl; 2563 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as DynamicElementImpl;
2362 2564
2363 /** 2565 /**
2364 * The type defined by this element. 2566 * The type defined by this element.
2365 */ 2567 */
2366 DynamicTypeImpl _type; 2568 DynamicTypeImpl _type;
2367 2569
2368 /** 2570 /**
2369 * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be 2571 * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be
2370 * created except as part of creating the type associated with this element. T he single instance 2572 * created except as part of creating the type associated with this element. T he single instance
2371 * of this class should be accessed through the method [getInstance]. 2573 * of this class should be accessed through the method [getInstance].
2372 */ 2574 */
2373 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { 2575 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) {
2374 setModifier(Modifier.SYNTHETIC, true); 2576 setModifier(Modifier.SYNTHETIC, true);
2375 } 2577 }
2376 accept(ElementVisitor visitor) => null; 2578 accept(ElementVisitor visitor) => null;
2377 ElementKind get kind => ElementKind.DYNAMIC; 2579 ElementKind get kind => ElementKind.DYNAMIC;
2378 2580
2379 /** 2581 /**
2380 * Return the type defined by this element. 2582 * Return the type defined by this element.
2583 *
2381 * @return the type defined by this element 2584 * @return the type defined by this element
2382 */ 2585 */
2383 DynamicTypeImpl get type => _type; 2586 DynamicTypeImpl get type => _type;
2384 2587
2385 /** 2588 /**
2386 * Set the type defined by this element to the given type. 2589 * Set the type defined by this element to the given type.
2590 *
2387 * @param type the type defined by this element 2591 * @param type the type defined by this element
2388 */ 2592 */
2389 void set type(DynamicTypeImpl type2) { 2593 void set type(DynamicTypeImpl type2) {
2390 this._type = type2; 2594 this._type = type2;
2391 } 2595 }
2392 } 2596 }
2393 /** 2597 /**
2394 * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotatio n]. 2598 * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotatio n].
2599 *
2395 * @coverage dart.engine.element 2600 * @coverage dart.engine.element
2396 */ 2601 */
2397 class ElementAnnotationImpl implements ElementAnnotation { 2602 class ElementAnnotationImpl implements ElementAnnotation {
2398 2603
2399 /** 2604 /**
2400 * The element representing the field, variable, or constructor being used as an annotation. 2605 * The element representing the field, variable, or constructor being used as an annotation.
2401 */ 2606 */
2402 Element _element; 2607 Element _element;
2403 2608
2404 /** 2609 /**
2405 * An empty array of annotations. 2610 * An empty array of annotations.
2406 */ 2611 */
2407 static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImp l>(0); 2612 static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImp l>(0);
2408 2613
2409 /** 2614 /**
2410 * Initialize a newly created annotation. 2615 * Initialize a newly created annotation.
2616 *
2411 * @param element the element representing the field, variable, or constructor being used as an 2617 * @param element the element representing the field, variable, or constructor being used as an
2412 * annotation 2618 * annotation
2413 */ 2619 */
2414 ElementAnnotationImpl(Element element) { 2620 ElementAnnotationImpl(Element element) {
2415 this._element = element; 2621 this._element = element;
2416 } 2622 }
2417 Element get element => _element; 2623 Element get element => _element;
2418 String toString() => "@${_element.toString()}"; 2624 String toString() => "@${_element.toString()}";
2419 } 2625 }
2420 /** 2626 /**
2421 * The abstract class `ElementImpl` implements the behavior common to objects th at implement 2627 * The abstract class `ElementImpl` implements the behavior common to objects th at implement
2422 * an [Element]. 2628 * an [Element].
2629 *
2423 * @coverage dart.engine.element 2630 * @coverage dart.engine.element
2424 */ 2631 */
2425 abstract class ElementImpl implements Element { 2632 abstract class ElementImpl implements Element {
2426 2633
2427 /** 2634 /**
2428 * The enclosing element of this element, or `null` if this element is at the root of the 2635 * The enclosing element of this element, or `null` if this element is at the root of the
2429 * element structure. 2636 * element structure.
2430 */ 2637 */
2431 ElementImpl _enclosingElement; 2638 ElementImpl _enclosingElement;
2432 2639
(...skipping 18 matching lines...) Expand all
2451 */ 2658 */
2452 List<ElementAnnotation> _metadata = ElementAnnotationImpl.EMPTY_ARRAY; 2659 List<ElementAnnotation> _metadata = ElementAnnotationImpl.EMPTY_ARRAY;
2453 2660
2454 /** 2661 /**
2455 * A cached copy of the calculated hashCode for this element. 2662 * A cached copy of the calculated hashCode for this element.
2456 */ 2663 */
2457 int _cachedHashCode = 0; 2664 int _cachedHashCode = 0;
2458 2665
2459 /** 2666 /**
2460 * Initialize a newly created element to have the given name. 2667 * Initialize a newly created element to have the given name.
2668 *
2461 * @param name the name of this element 2669 * @param name the name of this element
2462 */ 2670 */
2463 ElementImpl.con1(Identifier name2) { 2671 ElementImpl.con1(Identifier name2) {
2464 _jtd_constructor_195_impl(name2); 2672 _jtd_constructor_195_impl(name2);
2465 } 2673 }
2466 _jtd_constructor_195_impl(Identifier name2) { 2674 _jtd_constructor_195_impl(Identifier name2) {
2467 _jtd_constructor_196_impl(name2 == null ? "" : name2.name, name2 == null ? - 1 : name2.offset); 2675 _jtd_constructor_196_impl(name2 == null ? "" : name2.name, name2 == null ? - 1 : name2.offset);
2468 } 2676 }
2469 2677
2470 /** 2678 /**
2471 * Initialize a newly created element to have the given name. 2679 * Initialize a newly created element to have the given name.
2680 *
2472 * @param name the name of this element 2681 * @param name the name of this element
2473 * @param nameOffset the offset of the name of this element in the file that c ontains the 2682 * @param nameOffset the offset of the name of this element in the file that c ontains the
2474 * declaration of this element 2683 * declaration of this element
2475 */ 2684 */
2476 ElementImpl.con2(String name2, int nameOffset2) { 2685 ElementImpl.con2(String name2, int nameOffset2) {
2477 _jtd_constructor_196_impl(name2, nameOffset2); 2686 _jtd_constructor_196_impl(name2, nameOffset2);
2478 } 2687 }
2479 _jtd_constructor_196_impl(String name2, int nameOffset2) { 2688 _jtd_constructor_196_impl(String name2, int nameOffset2) {
2480 this._name = StringUtilities.intern(name2); 2689 this._name = StringUtilities.intern(name2);
2481 this._nameOffset = nameOffset2; 2690 this._nameOffset = nameOffset2;
2482 } 2691 }
2483 String computeDocumentationComment() { 2692 String computeDocumentationComment() {
2484 AnalysisContext context = this.context; 2693 AnalysisContext context = this.context;
2485 if (context == null) { 2694 if (context == null) {
2486 return null; 2695 return null;
2487 } 2696 }
2488 return context.computeDocumentationComment(this); 2697 return context.computeDocumentationComment(this);
2489 } 2698 }
2490 bool operator ==(Object object) => object != null && object.runtimeType == run timeType && ((object as Element)).location == location; 2699 bool operator ==(Object object) => object != null && object.runtimeType == run timeType && ((object as Element)).location == location;
2491 Element getAncestor(Type elementClass) { 2700 Element getAncestor(Type elementClass) {
2492 Element ancestor = _enclosingElement; 2701 Element ancestor = _enclosingElement;
2493 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { 2702 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) {
2494 ancestor = ancestor.enclosingElement; 2703 ancestor = ancestor.enclosingElement;
2495 } 2704 }
2496 return ancestor as Element; 2705 return ancestor as Element;
2497 } 2706 }
2498 2707
2499 /** 2708 /**
2500 * Return the child of this element that is uniquely identified by the given i dentifier, or`null` if there is no such child. 2709 * Return the child of this element that is uniquely identified by the given i dentifier, or
2710 * `null` if there is no such child.
2711 *
2501 * @param identifier the identifier used to select a child 2712 * @param identifier the identifier used to select a child
2502 * @return the child of this element with the given identifier 2713 * @return the child of this element with the given identifier
2503 */ 2714 */
2504 ElementImpl getChild(String identifier) => null; 2715 ElementImpl getChild(String identifier) => null;
2505 AnalysisContext get context { 2716 AnalysisContext get context {
2506 if (_enclosingElement == null) { 2717 if (_enclosingElement == null) {
2507 return null; 2718 return null;
2508 } 2719 }
2509 return _enclosingElement.context; 2720 return _enclosingElement.context;
2510 } 2721 }
(...skipping 19 matching lines...) Expand all
2530 bool isAccessibleIn(LibraryElement library2) { 2741 bool isAccessibleIn(LibraryElement library2) {
2531 if (Identifier.isPrivateName(_name)) { 2742 if (Identifier.isPrivateName(_name)) {
2532 return library2 == library; 2743 return library2 == library;
2533 } 2744 }
2534 return true; 2745 return true;
2535 } 2746 }
2536 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); 2747 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC);
2537 2748
2538 /** 2749 /**
2539 * Set the metadata associate with this element to the given array of annotati ons. 2750 * Set the metadata associate with this element to the given array of annotati ons.
2751 *
2540 * @param metadata the metadata to be associated with this element 2752 * @param metadata the metadata to be associated with this element
2541 */ 2753 */
2542 void set metadata(List<ElementAnnotation> metadata2) { 2754 void set metadata(List<ElementAnnotation> metadata2) {
2543 this._metadata = metadata2; 2755 this._metadata = metadata2;
2544 } 2756 }
2545 2757
2546 /** 2758 /**
2547 * Set the offset of the name of this element in the file that contains the de claration of this 2759 * Set the offset of the name of this element in the file that contains the de claration of this
2548 * element to the given value. This is normally done via the constructor, but this method is 2760 * element to the given value. This is normally done via the constructor, but this method is
2549 * provided to support unnamed constructors. 2761 * provided to support unnamed constructors.
2762 *
2550 * @param nameOffset the offset to the beginning of the name 2763 * @param nameOffset the offset to the beginning of the name
2551 */ 2764 */
2552 void set nameOffset(int nameOffset2) { 2765 void set nameOffset(int nameOffset2) {
2553 this._nameOffset = nameOffset2; 2766 this._nameOffset = nameOffset2;
2554 } 2767 }
2555 2768
2556 /** 2769 /**
2557 * Set whether this element is synthetic to correspond to the given value. 2770 * Set whether this element is synthetic to correspond to the given value.
2771 *
2558 * @param isSynthetic `true` if the element is synthetic 2772 * @param isSynthetic `true` if the element is synthetic
2559 */ 2773 */
2560 void set synthetic(bool isSynthetic) { 2774 void set synthetic(bool isSynthetic) {
2561 setModifier(Modifier.SYNTHETIC, isSynthetic); 2775 setModifier(Modifier.SYNTHETIC, isSynthetic);
2562 } 2776 }
2563 String toString() { 2777 String toString() {
2564 JavaStringBuilder builder = new JavaStringBuilder(); 2778 JavaStringBuilder builder = new JavaStringBuilder();
2565 appendTo(builder); 2779 appendTo(builder);
2566 return builder.toString(); 2780 return builder.toString();
2567 } 2781 }
2568 void visitChildren(ElementVisitor<Object> visitor) { 2782 void visitChildren(ElementVisitor<Object> visitor) {
2569 } 2783 }
2570 2784
2571 /** 2785 /**
2572 * Append a textual representation of this type to the given builder. 2786 * Append a textual representation of this type to the given builder.
2787 *
2573 * @param builder the builder to which the text is to be appended 2788 * @param builder the builder to which the text is to be appended
2574 */ 2789 */
2575 void appendTo(JavaStringBuilder builder) { 2790 void appendTo(JavaStringBuilder builder) {
2576 if (_name == null) { 2791 if (_name == null) {
2577 builder.append("<unnamed "); 2792 builder.append("<unnamed ");
2578 builder.append(runtimeType.toString()); 2793 builder.append(runtimeType.toString());
2579 builder.append(">"); 2794 builder.append(">");
2580 } else { 2795 } else {
2581 builder.append(_name); 2796 builder.append(_name);
2582 } 2797 }
2583 } 2798 }
2584 2799
2585 /** 2800 /**
2586 * Return an identifier that uniquely identifies this element among the childr en of this element's 2801 * Return an identifier that uniquely identifies this element among the childr en of this element's
2587 * parent. 2802 * parent.
2803 *
2588 * @return an identifier that uniquely identifies this element relative to its parent 2804 * @return an identifier that uniquely identifies this element relative to its parent
2589 */ 2805 */
2590 String get identifier => name; 2806 String get identifier => name;
2591 2807
2592 /** 2808 /**
2593 * Return `true` if this element has the given modifier associated with it. 2809 * Return `true` if this element has the given modifier associated with it.
2810 *
2594 * @param modifier the modifier being tested for 2811 * @param modifier the modifier being tested for
2595 * @return `true` if this element has the given modifier associated with it 2812 * @return `true` if this element has the given modifier associated with it
2596 */ 2813 */
2597 bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contai ns(modifier); 2814 bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contai ns(modifier);
2598 2815
2599 /** 2816 /**
2600 * If the given child is not `null`, use the given visitor to visit it. 2817 * If the given child is not `null`, use the given visitor to visit it.
2818 *
2601 * @param child the child to be visited 2819 * @param child the child to be visited
2602 * @param visitor the visitor to be used to visit the child 2820 * @param visitor the visitor to be used to visit the child
2603 */ 2821 */
2604 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { 2822 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) {
2605 if (child != null) { 2823 if (child != null) {
2606 child.accept(visitor); 2824 child.accept(visitor);
2607 } 2825 }
2608 } 2826 }
2609 2827
2610 /** 2828 /**
2611 * Use the given visitor to visit all of the children in the given array. 2829 * Use the given visitor to visit all of the children in the given array.
2830 *
2612 * @param children the children to be visited 2831 * @param children the children to be visited
2613 * @param visitor the visitor being used to visit the children 2832 * @param visitor the visitor being used to visit the children
2614 */ 2833 */
2615 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito r) { 2834 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito r) {
2616 if (children != null) { 2835 if (children != null) {
2617 for (Element child in children) { 2836 for (Element child in children) {
2618 child.accept(visitor); 2837 child.accept(visitor);
2619 } 2838 }
2620 } 2839 }
2621 } 2840 }
2622 2841
2623 /** 2842 /**
2624 * Set the enclosing element of this element to the given element. 2843 * Set the enclosing element of this element to the given element.
2844 *
2625 * @param element the enclosing element of this element 2845 * @param element the enclosing element of this element
2626 */ 2846 */
2627 void set enclosingElement(ElementImpl element) { 2847 void set enclosingElement(ElementImpl element) {
2628 _enclosingElement = element; 2848 _enclosingElement = element;
2629 } 2849 }
2630 2850
2631 /** 2851 /**
2632 * Set whether the given modifier is associated with this element to correspon d to the given 2852 * Set whether the given modifier is associated with this element to correspon d to the given
2633 * value. 2853 * value.
2854 *
2634 * @param modifier the modifier to be set 2855 * @param modifier the modifier to be set
2635 * @param value `true` if the modifier is to be associated with this element 2856 * @param value `true` if the modifier is to be associated with this element
2636 */ 2857 */
2637 void setModifier(Modifier modifier, bool value) { 2858 void setModifier(Modifier modifier, bool value) {
2638 if (value) { 2859 if (value) {
2639 if (_modifiers == null) { 2860 if (_modifiers == null) {
2640 _modifiers = new Set(); 2861 _modifiers = new Set();
2641 } 2862 }
2642 _modifiers.add(modifier); 2863 _modifiers.add(modifier);
2643 } else { 2864 } else {
2644 if (_modifiers != null) { 2865 if (_modifiers != null) {
2645 _modifiers.remove(modifier); 2866 _modifiers.remove(modifier);
2646 if (_modifiers.isEmpty) { 2867 if (_modifiers.isEmpty) {
2647 _modifiers = null; 2868 _modifiers = null;
2648 } 2869 }
2649 } 2870 }
2650 } 2871 }
2651 } 2872 }
2652 } 2873 }
2653 /** 2874 /**
2654 * Instances of the class `ElementLocationImpl` implement an [ElementLocation]. 2875 * Instances of the class `ElementLocationImpl` implement an [ElementLocation].
2876 *
2655 * @coverage dart.engine.element 2877 * @coverage dart.engine.element
2656 */ 2878 */
2657 class ElementLocationImpl implements ElementLocation { 2879 class ElementLocationImpl implements ElementLocation {
2658 2880
2659 /** 2881 /**
2660 * The path to the element whose location is represented by this object. 2882 * The path to the element whose location is represented by this object.
2661 */ 2883 */
2662 List<String> _components; 2884 List<String> _components;
2663 2885
2664 /** 2886 /**
2665 * The character used to separate components in the encoded form. 2887 * The character used to separate components in the encoded form.
2666 */ 2888 */
2667 static int _SEPARATOR_CHAR = 0x3B; 2889 static int _SEPARATOR_CHAR = 0x3B;
2668 2890
2669 /** 2891 /**
2670 * Initialize a newly created location to represent the given element. 2892 * Initialize a newly created location to represent the given element.
2893 *
2671 * @param element the element whose location is being represented 2894 * @param element the element whose location is being represented
2672 */ 2895 */
2673 ElementLocationImpl.con1(Element element) { 2896 ElementLocationImpl.con1(Element element) {
2674 _jtd_constructor_197_impl(element); 2897 _jtd_constructor_197_impl(element);
2675 } 2898 }
2676 _jtd_constructor_197_impl(Element element) { 2899 _jtd_constructor_197_impl(Element element) {
2677 List<String> components = new List<String>(); 2900 List<String> components = new List<String>();
2678 Element ancestor = element; 2901 Element ancestor = element;
2679 while (ancestor != null) { 2902 while (ancestor != null) {
2680 components.insert(0, ((ancestor as ElementImpl)).identifier); 2903 components.insert(0, ((ancestor as ElementImpl)).identifier);
2681 ancestor = ancestor.enclosingElement; 2904 ancestor = ancestor.enclosingElement;
2682 } 2905 }
2683 this._components = new List.from(components); 2906 this._components = new List.from(components);
2684 } 2907 }
2685 2908
2686 /** 2909 /**
2687 * Initialize a newly created location from the given encoded form. 2910 * Initialize a newly created location from the given encoded form.
2911 *
2688 * @param encoding the encoded form of a location 2912 * @param encoding the encoded form of a location
2689 */ 2913 */
2690 ElementLocationImpl.con2(String encoding) { 2914 ElementLocationImpl.con2(String encoding) {
2691 _jtd_constructor_198_impl(encoding); 2915 _jtd_constructor_198_impl(encoding);
2692 } 2916 }
2693 _jtd_constructor_198_impl(String encoding) { 2917 _jtd_constructor_198_impl(String encoding) {
2694 this._components = decode(encoding); 2918 this._components = decode(encoding);
2695 } 2919 }
2696 bool operator ==(Object object) { 2920 bool operator ==(Object object) {
2697 if (object is! ElementLocationImpl) { 2921 if (object is! ElementLocationImpl) {
(...skipping 14 matching lines...) Expand all
2712 for (int i = 2; i < length; i++) { 2936 for (int i = 2; i < length; i++) {
2713 if (_components[i] != otherComponents[i]) { 2937 if (_components[i] != otherComponents[i]) {
2714 return false; 2938 return false;
2715 } 2939 }
2716 } 2940 }
2717 return true; 2941 return true;
2718 } 2942 }
2719 2943
2720 /** 2944 /**
2721 * Return the path to the element whose location is represented by this object . 2945 * Return the path to the element whose location is represented by this object .
2946 *
2722 * @return the path to the element whose location is represented by this objec t 2947 * @return the path to the element whose location is represented by this objec t
2723 */ 2948 */
2724 List<String> get components => _components; 2949 List<String> get components => _components;
2725 String get encoding { 2950 String get encoding {
2726 JavaStringBuilder builder = new JavaStringBuilder(); 2951 JavaStringBuilder builder = new JavaStringBuilder();
2727 int length = _components.length; 2952 int length = _components.length;
2728 for (int i = 0; i < length; i++) { 2953 for (int i = 0; i < length; i++) {
2729 if (i > 0) { 2954 if (i > 0) {
2730 builder.appendChar(_SEPARATOR_CHAR); 2955 builder.appendChar(_SEPARATOR_CHAR);
2731 } 2956 }
2732 encode(builder, _components[i]); 2957 encode(builder, _components[i]);
2733 } 2958 }
2734 return builder.toString(); 2959 return builder.toString();
2735 } 2960 }
2736 int get hashCode => JavaArrays.makeHashCode(_components); 2961 int get hashCode => JavaArrays.makeHashCode(_components);
2737 String toString() => encoding; 2962 String toString() => encoding;
2738 2963
2739 /** 2964 /**
2740 * Decode the encoded form of a location into an array of components. 2965 * Decode the encoded form of a location into an array of components.
2966 *
2741 * @param encoding the encoded form of a location 2967 * @param encoding the encoded form of a location
2742 * @return the components that were encoded 2968 * @return the components that were encoded
2743 */ 2969 */
2744 List<String> decode(String encoding) { 2970 List<String> decode(String encoding) {
2745 List<String> components = new List<String>(); 2971 List<String> components = new List<String>();
2746 JavaStringBuilder builder = new JavaStringBuilder(); 2972 JavaStringBuilder builder = new JavaStringBuilder();
2747 int index = 0; 2973 int index = 0;
2748 int length = encoding.length; 2974 int length = encoding.length;
2749 while (index < length) { 2975 while (index < length) {
2750 int currentChar = encoding.codeUnitAt(index); 2976 int currentChar = encoding.codeUnitAt(index);
(...skipping 12 matching lines...) Expand all
2763 } 2989 }
2764 } 2990 }
2765 if (builder.length > 0) { 2991 if (builder.length > 0) {
2766 components.add(builder.toString()); 2992 components.add(builder.toString());
2767 } 2993 }
2768 return new List.from(components); 2994 return new List.from(components);
2769 } 2995 }
2770 2996
2771 /** 2997 /**
2772 * Append an encoded form of the given component to the given builder. 2998 * Append an encoded form of the given component to the given builder.
2999 *
2773 * @param builder the builder to which the encoded component is to be appended 3000 * @param builder the builder to which the encoded component is to be appended
2774 * @param component the component to be appended to the builder 3001 * @param component the component to be appended to the builder
2775 */ 3002 */
2776 void encode(JavaStringBuilder builder, String component) { 3003 void encode(JavaStringBuilder builder, String component) {
2777 int length = component.length; 3004 int length = component.length;
2778 for (int i = 0; i < length; i++) { 3005 for (int i = 0; i < length; i++) {
2779 int currentChar = component.codeUnitAt(i); 3006 int currentChar = component.codeUnitAt(i);
2780 if (currentChar == _SEPARATOR_CHAR) { 3007 if (currentChar == _SEPARATOR_CHAR) {
2781 builder.appendChar(_SEPARATOR_CHAR); 3008 builder.appendChar(_SEPARATOR_CHAR);
2782 } 3009 }
2783 builder.appendChar(currentChar); 3010 builder.appendChar(currentChar);
2784 } 3011 }
2785 } 3012 }
2786 3013
2787 /** 3014 /**
2788 * Return `true` if the given components, when interpreted to be encoded sourc es with a 3015 * Return `true` if the given components, when interpreted to be encoded sourc es with a
2789 * leading source type indicator, are equal when the source type's are ignored . 3016 * leading source type indicator, are equal when the source type's are ignored .
3017 *
2790 * @param left the left component being compared 3018 * @param left the left component being compared
2791 * @param right the right component being compared 3019 * @param right the right component being compared
2792 * @return `true` if the given components are equal when the source type's are ignored 3020 * @return `true` if the given components are equal when the source type's are ignored
2793 */ 3021 */
2794 bool equalSourceComponents(String left, String right) { 3022 bool equalSourceComponents(String left, String right) {
2795 if (left == null) { 3023 if (left == null) {
2796 return right == null; 3024 return right == null;
2797 } else if (right == null) { 3025 } else if (right == null) {
2798 return false; 3026 return false;
2799 } 3027 }
2800 if (left.length <= 1 || right.length <= 1) { 3028 if (left.length <= 1 || right.length <= 1) {
2801 return left == right; 3029 return left == right;
2802 } 3030 }
2803 return left.substring(1) == right.substring(1); 3031 return left.substring(1) == right.substring(1);
2804 } 3032 }
2805 } 3033 }
2806 /** 3034 /**
2807 * Instances of the class `EmbeddedHtmlScriptElementImpl` implement an[EmbeddedH tmlScriptElement]. 3035 * Instances of the class `EmbeddedHtmlScriptElementImpl` implement an
3036 * [EmbeddedHtmlScriptElement].
3037 *
2808 * @coverage dart.engine.element 3038 * @coverage dart.engine.element
2809 */ 3039 */
2810 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb eddedHtmlScriptElement { 3040 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb eddedHtmlScriptElement {
2811 3041
2812 /** 3042 /**
2813 * The library defined by the script tag's content. 3043 * The library defined by the script tag's content.
2814 */ 3044 */
2815 LibraryElement _scriptLibrary; 3045 LibraryElement _scriptLibrary;
2816 3046
2817 /** 3047 /**
2818 * Initialize a newly created script element to have the specified tag name an d offset. 3048 * Initialize a newly created script element to have the specified tag name an d offset.
3049 *
2819 * @param node the XML node from which this element is derived (not `null`) 3050 * @param node the XML node from which this element is derived (not `null`)
2820 */ 3051 */
2821 EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node) { 3052 EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node) {
2822 } 3053 }
2823 accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this) ; 3054 accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this) ;
2824 ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT; 3055 ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT;
2825 LibraryElement get scriptLibrary => _scriptLibrary; 3056 LibraryElement get scriptLibrary => _scriptLibrary;
2826 3057
2827 /** 3058 /**
2828 * Set the script library defined by the script tag's content. 3059 * Set the script library defined by the script tag's content.
3060 *
2829 * @param scriptLibrary the library or `null` if none 3061 * @param scriptLibrary the library or `null` if none
2830 */ 3062 */
2831 void set scriptLibrary(LibraryElementImpl scriptLibrary2) { 3063 void set scriptLibrary(LibraryElementImpl scriptLibrary2) {
2832 scriptLibrary2.enclosingElement = this; 3064 scriptLibrary2.enclosingElement = this;
2833 this._scriptLibrary = scriptLibrary2; 3065 this._scriptLibrary = scriptLibrary2;
2834 } 3066 }
2835 void visitChildren(ElementVisitor<Object> visitor) { 3067 void visitChildren(ElementVisitor<Object> visitor) {
2836 safelyVisitChild(_scriptLibrary, visitor); 3068 safelyVisitChild(_scriptLibrary, visitor);
2837 } 3069 }
2838 } 3070 }
2839 /** 3071 /**
2840 * The abstract class `ExecutableElementImpl` implements the behavior common to` ExecutableElement`s. 3072 * The abstract class `ExecutableElementImpl` implements the behavior common to
3073 * `ExecutableElement`s.
3074 *
2841 * @coverage dart.engine.element 3075 * @coverage dart.engine.element
2842 */ 3076 */
2843 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement { 3077 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement {
2844 3078
2845 /** 3079 /**
2846 * An array containing all of the functions defined within this executable ele ment. 3080 * An array containing all of the functions defined within this executable ele ment.
2847 */ 3081 */
2848 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; 3082 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
2849 3083
2850 /** 3084 /**
(...skipping 21 matching lines...) Expand all
2872 */ 3106 */
2873 FunctionType _type; 3107 FunctionType _type;
2874 3108
2875 /** 3109 /**
2876 * An empty array of executable elements. 3110 * An empty array of executable elements.
2877 */ 3111 */
2878 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); 3112 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0);
2879 3113
2880 /** 3114 /**
2881 * Initialize a newly created executable element to have the given name. 3115 * Initialize a newly created executable element to have the given name.
3116 *
2882 * @param name the name of this element 3117 * @param name the name of this element
2883 */ 3118 */
2884 ExecutableElementImpl.con1(Identifier name) : super.con1(name) { 3119 ExecutableElementImpl.con1(Identifier name) : super.con1(name) {
2885 _jtd_constructor_200_impl(name); 3120 _jtd_constructor_200_impl(name);
2886 } 3121 }
2887 _jtd_constructor_200_impl(Identifier name) { 3122 _jtd_constructor_200_impl(Identifier name) {
2888 } 3123 }
2889 3124
2890 /** 3125 /**
2891 * Initialize a newly created executable element to have the given name. 3126 * Initialize a newly created executable element to have the given name.
3127 *
2892 * @param name the name of this element 3128 * @param name the name of this element
2893 * @param nameOffset the offset of the name of this element in the file that c ontains the 3129 * @param nameOffset the offset of the name of this element in the file that c ontains the
2894 * declaration of this element 3130 * declaration of this element
2895 */ 3131 */
2896 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam eOffset) { 3132 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam eOffset) {
2897 _jtd_constructor_201_impl(name, nameOffset); 3133 _jtd_constructor_201_impl(name, nameOffset);
2898 } 3134 }
2899 _jtd_constructor_201_impl(String name, int nameOffset) { 3135 _jtd_constructor_201_impl(String name, int nameOffset) {
2900 } 3136 }
2901 ElementImpl getChild(String identifier2) { 3137 ElementImpl getChild(String identifier2) {
2902 for (ExecutableElement function in _functions) { 3138 for (ExecutableElement function in _functions) {
2903 if (((function as ExecutableElementImpl)).identifier == identifier2) { 3139 if (((function as ExecutableElementImpl)).identifier == identifier2) {
2904 return function as ExecutableElementImpl; 3140 return function as ExecutableElementImpl;
(...skipping 19 matching lines...) Expand all
2924 List<FunctionElement> get functions => _functions; 3160 List<FunctionElement> get functions => _functions;
2925 List<LabelElement> get labels => _labels; 3161 List<LabelElement> get labels => _labels;
2926 List<LocalVariableElement> get localVariables => _localVariables; 3162 List<LocalVariableElement> get localVariables => _localVariables;
2927 List<ParameterElement> get parameters => _parameters; 3163 List<ParameterElement> get parameters => _parameters;
2928 Type2 get returnType => _returnType; 3164 Type2 get returnType => _returnType;
2929 FunctionType get type => _type; 3165 FunctionType get type => _type;
2930 bool get isOperator => false; 3166 bool get isOperator => false;
2931 3167
2932 /** 3168 /**
2933 * Set the functions defined within this executable element to the given funct ions. 3169 * Set the functions defined within this executable element to the given funct ions.
3170 *
2934 * @param functions the functions defined within this executable element 3171 * @param functions the functions defined within this executable element
2935 */ 3172 */
2936 void set functions(List<FunctionElement> functions2) { 3173 void set functions(List<FunctionElement> functions2) {
2937 for (FunctionElement function in functions2) { 3174 for (FunctionElement function in functions2) {
2938 ((function as FunctionElementImpl)).enclosingElement = this; 3175 ((function as FunctionElementImpl)).enclosingElement = this;
2939 } 3176 }
2940 this._functions = functions2; 3177 this._functions = functions2;
2941 } 3178 }
2942 3179
2943 /** 3180 /**
2944 * Set the labels defined within this executable element to the given labels. 3181 * Set the labels defined within this executable element to the given labels.
3182 *
2945 * @param labels the labels defined within this executable element 3183 * @param labels the labels defined within this executable element
2946 */ 3184 */
2947 void set labels(List<LabelElement> labels2) { 3185 void set labels(List<LabelElement> labels2) {
2948 for (LabelElement label in labels2) { 3186 for (LabelElement label in labels2) {
2949 ((label as LabelElementImpl)).enclosingElement = this; 3187 ((label as LabelElementImpl)).enclosingElement = this;
2950 } 3188 }
2951 this._labels = labels2; 3189 this._labels = labels2;
2952 } 3190 }
2953 3191
2954 /** 3192 /**
2955 * Set the local variables defined within this executable element to the given variables. 3193 * Set the local variables defined within this executable element to the given variables.
3194 *
2956 * @param localVariables the local variables defined within this executable el ement 3195 * @param localVariables the local variables defined within this executable el ement
2957 */ 3196 */
2958 void set localVariables(List<LocalVariableElement> localVariables2) { 3197 void set localVariables(List<LocalVariableElement> localVariables2) {
2959 for (LocalVariableElement variable in localVariables2) { 3198 for (LocalVariableElement variable in localVariables2) {
2960 ((variable as LocalVariableElementImpl)).enclosingElement = this; 3199 ((variable as LocalVariableElementImpl)).enclosingElement = this;
2961 } 3200 }
2962 this._localVariables = localVariables2; 3201 this._localVariables = localVariables2;
2963 } 3202 }
2964 3203
2965 /** 3204 /**
2966 * Set the parameters defined by this executable element to the given paramete rs. 3205 * Set the parameters defined by this executable element to the given paramete rs.
3206 *
2967 * @param parameters the parameters defined by this executable element 3207 * @param parameters the parameters defined by this executable element
2968 */ 3208 */
2969 void set parameters(List<ParameterElement> parameters2) { 3209 void set parameters(List<ParameterElement> parameters2) {
2970 for (ParameterElement parameter in parameters2) { 3210 for (ParameterElement parameter in parameters2) {
2971 ((parameter as ParameterElementImpl)).enclosingElement = this; 3211 ((parameter as ParameterElementImpl)).enclosingElement = this;
2972 } 3212 }
2973 this._parameters = parameters2; 3213 this._parameters = parameters2;
2974 } 3214 }
2975 3215
2976 /** 3216 /**
2977 * Set the return type defined by this executable element. 3217 * Set the return type defined by this executable element.
3218 *
2978 * @param returnType the return type defined by this executable element 3219 * @param returnType the return type defined by this executable element
2979 */ 3220 */
2980 void set returnType(Type2 returnType2) { 3221 void set returnType(Type2 returnType2) {
2981 this._returnType = returnType2; 3222 this._returnType = returnType2;
2982 } 3223 }
2983 3224
2984 /** 3225 /**
2985 * Set the type of function defined by this executable element to the given ty pe. 3226 * Set the type of function defined by this executable element to the given ty pe.
3227 *
2986 * @param type the type of function defined by this executable element 3228 * @param type the type of function defined by this executable element
2987 */ 3229 */
2988 void set type(FunctionType type2) { 3230 void set type(FunctionType type2) {
2989 this._type = type2; 3231 this._type = type2;
2990 } 3232 }
2991 void visitChildren(ElementVisitor<Object> visitor) { 3233 void visitChildren(ElementVisitor<Object> visitor) {
2992 super.visitChildren(visitor); 3234 super.visitChildren(visitor);
2993 safelyVisitChildren(_functions, visitor); 3235 safelyVisitChildren(_functions, visitor);
2994 safelyVisitChildren(_labels, visitor); 3236 safelyVisitChildren(_labels, visitor);
2995 safelyVisitChildren(_localVariables, visitor); 3237 safelyVisitChildren(_localVariables, visitor);
(...skipping 10 matching lines...) Expand all
3006 } 3248 }
3007 builder.append(")"); 3249 builder.append(")");
3008 if (_type != null) { 3250 if (_type != null) {
3009 builder.append(" -> "); 3251 builder.append(" -> ");
3010 builder.append(_type.returnType); 3252 builder.append(_type.returnType);
3011 } 3253 }
3012 } 3254 }
3013 } 3255 }
3014 /** 3256 /**
3015 * Instances of the class `ExportElementImpl` implement an [ExportElement]. 3257 * Instances of the class `ExportElementImpl` implement an [ExportElement].
3258 *
3016 * @coverage dart.engine.element 3259 * @coverage dart.engine.element
3017 */ 3260 */
3018 class ExportElementImpl extends ElementImpl implements ExportElement { 3261 class ExportElementImpl extends ElementImpl implements ExportElement {
3019 3262
3020 /** 3263 /**
3021 * The URI that is specified by this directive. 3264 * The URI that is specified by this directive.
3022 */ 3265 */
3023 String _uri; 3266 String _uri;
3024 3267
3025 /** 3268 /**
(...skipping 14 matching lines...) Expand all
3040 } 3283 }
3041 accept(ElementVisitor visitor) => visitor.visitExportElement(this); 3284 accept(ElementVisitor visitor) => visitor.visitExportElement(this);
3042 List<NamespaceCombinator> get combinators => _combinators; 3285 List<NamespaceCombinator> get combinators => _combinators;
3043 LibraryElement get exportedLibrary => _exportedLibrary; 3286 LibraryElement get exportedLibrary => _exportedLibrary;
3044 ElementKind get kind => ElementKind.EXPORT; 3287 ElementKind get kind => ElementKind.EXPORT;
3045 String get uri => _uri; 3288 String get uri => _uri;
3046 3289
3047 /** 3290 /**
3048 * Set the combinators that were specified as part of the export directive to the given array of 3291 * Set the combinators that were specified as part of the export directive to the given array of
3049 * combinators. 3292 * combinators.
3293 *
3050 * @param combinators the combinators that were specified as part of the expor t directive 3294 * @param combinators the combinators that were specified as part of the expor t directive
3051 */ 3295 */
3052 void set combinators(List<NamespaceCombinator> combinators2) { 3296 void set combinators(List<NamespaceCombinator> combinators2) {
3053 this._combinators = combinators2; 3297 this._combinators = combinators2;
3054 } 3298 }
3055 3299
3056 /** 3300 /**
3057 * Set the library that is exported from this library by this import directive to the given 3301 * Set the library that is exported from this library by this import directive to the given
3058 * library. 3302 * library.
3303 *
3059 * @param exportedLibrary the library that is exported from this library 3304 * @param exportedLibrary the library that is exported from this library
3060 */ 3305 */
3061 void set exportedLibrary(LibraryElement exportedLibrary2) { 3306 void set exportedLibrary(LibraryElement exportedLibrary2) {
3062 this._exportedLibrary = exportedLibrary2; 3307 this._exportedLibrary = exportedLibrary2;
3063 } 3308 }
3064 3309
3065 /** 3310 /**
3066 * Set the URI that is specified by this directive. 3311 * Set the URI that is specified by this directive.
3312 *
3067 * @param uri the URI that is specified by this directive. 3313 * @param uri the URI that is specified by this directive.
3068 */ 3314 */
3069 void set uri(String uri2) { 3315 void set uri(String uri2) {
3070 this._uri = uri2; 3316 this._uri = uri2;
3071 } 3317 }
3072 void appendTo(JavaStringBuilder builder) { 3318 void appendTo(JavaStringBuilder builder) {
3073 builder.append("export "); 3319 builder.append("export ");
3074 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); 3320 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder);
3075 } 3321 }
3076 String get identifier => _exportedLibrary.name; 3322 String get identifier => _exportedLibrary.name;
3077 } 3323 }
3078 /** 3324 /**
3079 * Instances of the class `ExternalHtmlScriptElementImpl` implement an[ExternalH tmlScriptElement]. 3325 * Instances of the class `ExternalHtmlScriptElementImpl` implement an
3326 * [ExternalHtmlScriptElement].
3327 *
3080 * @coverage dart.engine.element 3328 * @coverage dart.engine.element
3081 */ 3329 */
3082 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext ernalHtmlScriptElement { 3330 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext ernalHtmlScriptElement {
3083 3331
3084 /** 3332 /**
3085 * The source specified in the `source` attribute or `null` if unspecified. 3333 * The source specified in the `source` attribute or `null` if unspecified.
3086 */ 3334 */
3087 Source _scriptSource; 3335 Source _scriptSource;
3088 3336
3089 /** 3337 /**
3090 * Initialize a newly created script element to have the specified tag name an d offset. 3338 * Initialize a newly created script element to have the specified tag name an d offset.
3339 *
3091 * @param node the XML node from which this element is derived (not `null`) 3340 * @param node the XML node from which this element is derived (not `null`)
3092 */ 3341 */
3093 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node) { 3342 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node) {
3094 } 3343 }
3095 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this) ; 3344 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this) ;
3096 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; 3345 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT;
3097 Source get scriptSource => _scriptSource; 3346 Source get scriptSource => _scriptSource;
3098 3347
3099 /** 3348 /**
3100 * Set the source specified in the `source` attribute. 3349 * Set the source specified in the `source` attribute.
3350 *
3101 * @param scriptSource the script source or `null` if unspecified 3351 * @param scriptSource the script source or `null` if unspecified
3102 */ 3352 */
3103 void set scriptSource(Source scriptSource2) { 3353 void set scriptSource(Source scriptSource2) {
3104 this._scriptSource = scriptSource2; 3354 this._scriptSource = scriptSource2;
3105 } 3355 }
3106 } 3356 }
3107 /** 3357 /**
3108 * Instances of the class `FieldElementImpl` implement a `FieldElement`. 3358 * Instances of the class `FieldElementImpl` implement a `FieldElement`.
3359 *
3109 * @coverage dart.engine.element 3360 * @coverage dart.engine.element
3110 */ 3361 */
3111 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme nt { 3362 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme nt {
3112 3363
3113 /** 3364 /**
3114 * An empty array of field elements. 3365 * An empty array of field elements.
3115 */ 3366 */
3116 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); 3367 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0);
3117 3368
3118 /** 3369 /**
3119 * Initialize a newly created field element to have the given name. 3370 * Initialize a newly created field element to have the given name.
3371 *
3120 * @param name the name of this element 3372 * @param name the name of this element
3121 */ 3373 */
3122 FieldElementImpl.con1(Identifier name) : super.con1(name) { 3374 FieldElementImpl.con1(Identifier name) : super.con1(name) {
3123 _jtd_constructor_204_impl(name); 3375 _jtd_constructor_204_impl(name);
3124 } 3376 }
3125 _jtd_constructor_204_impl(Identifier name) { 3377 _jtd_constructor_204_impl(Identifier name) {
3126 } 3378 }
3127 3379
3128 /** 3380 /**
3129 * Initialize a newly created synthetic field element to have the given name. 3381 * Initialize a newly created synthetic field element to have the given name.
3382 *
3130 * @param name the name of this element 3383 * @param name the name of this element
3131 */ 3384 */
3132 FieldElementImpl.con2(String name) : super.con2(name) { 3385 FieldElementImpl.con2(String name) : super.con2(name) {
3133 _jtd_constructor_205_impl(name); 3386 _jtd_constructor_205_impl(name);
3134 } 3387 }
3135 _jtd_constructor_205_impl(String name) { 3388 _jtd_constructor_205_impl(String name) {
3136 } 3389 }
3137 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); 3390 accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
3138 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 3391 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
3139 ElementKind get kind => ElementKind.FIELD; 3392 ElementKind get kind => ElementKind.FIELD;
3140 bool get isStatic => hasModifier(Modifier.STATIC); 3393 bool get isStatic => hasModifier(Modifier.STATIC);
3141 3394
3142 /** 3395 /**
3143 * Set whether this field is static to correspond to the given value. 3396 * Set whether this field is static to correspond to the given value.
3397 *
3144 * @param isStatic `true` if the field is static 3398 * @param isStatic `true` if the field is static
3145 */ 3399 */
3146 void set static(bool isStatic) { 3400 void set static(bool isStatic) {
3147 setModifier(Modifier.STATIC, isStatic); 3401 setModifier(Modifier.STATIC, isStatic);
3148 } 3402 }
3149 } 3403 }
3150 /** 3404 /**
3151 * Instances of the class `FieldFormalParameterElementImpl` extend[ParameterElem entImpl] to provide the additional information of the [FieldElement]associated w ith the parameter. 3405 * Instances of the class `FieldFormalParameterElementImpl` extend
3406 * [ParameterElementImpl] to provide the additional information of the [FieldEle ment]
3407 * associated with the parameter.
3408 *
3152 * @coverage dart.engine.element 3409 * @coverage dart.engine.element
3153 */ 3410 */
3154 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi eldFormalParameterElement { 3411 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi eldFormalParameterElement {
3155 3412
3156 /** 3413 /**
3157 * The field associated with this field formal parameter. 3414 * The field associated with this field formal parameter.
3158 */ 3415 */
3159 FieldElement _field; 3416 FieldElement _field;
3160 3417
3161 /** 3418 /**
3162 * Initialize a newly created parameter element to have the given name. 3419 * Initialize a newly created parameter element to have the given name.
3420 *
3163 * @param name the name of this element 3421 * @param name the name of this element
3164 */ 3422 */
3165 FieldFormalParameterElementImpl(Identifier name) : super(name) { 3423 FieldFormalParameterElementImpl(Identifier name) : super(name) {
3166 } 3424 }
3167 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi s); 3425 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi s);
3168 FieldElement get field => _field; 3426 FieldElement get field => _field;
3169 bool get isInitializingFormal => true; 3427 bool get isInitializingFormal => true;
3170 3428
3171 /** 3429 /**
3172 * Set the field element associated with this field formal parameter to the gi ven element. 3430 * Set the field element associated with this field formal parameter to the gi ven element.
3431 *
3173 * @param field the new field element 3432 * @param field the new field element
3174 */ 3433 */
3175 void set field(FieldElement field2) { 3434 void set field(FieldElement field2) {
3176 this._field = field2; 3435 this._field = field2;
3177 } 3436 }
3178 } 3437 }
3179 /** 3438 /**
3180 * Instances of the class `FunctionElementImpl` implement a `FunctionElement`. 3439 * Instances of the class `FunctionElementImpl` implement a `FunctionElement`.
3440 *
3181 * @coverage dart.engine.element 3441 * @coverage dart.engine.element
3182 */ 3442 */
3183 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme nt { 3443 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme nt {
3184 3444
3185 /** 3445 /**
3186 * The offset to the beginning of the visible range for this element. 3446 * The offset to the beginning of the visible range for this element.
3187 */ 3447 */
3188 int _visibleRangeOffset = 0; 3448 int _visibleRangeOffset = 0;
3189 3449
3190 /** 3450 /**
(...skipping 12 matching lines...) Expand all
3203 */ 3463 */
3204 FunctionElementImpl() : super.con2("", -1) { 3464 FunctionElementImpl() : super.con2("", -1) {
3205 _jtd_constructor_207_impl(); 3465 _jtd_constructor_207_impl();
3206 } 3466 }
3207 _jtd_constructor_207_impl() { 3467 _jtd_constructor_207_impl() {
3208 synthetic = true; 3468 synthetic = true;
3209 } 3469 }
3210 3470
3211 /** 3471 /**
3212 * Initialize a newly created function element to have the given name. 3472 * Initialize a newly created function element to have the given name.
3473 *
3213 * @param name the name of this element 3474 * @param name the name of this element
3214 */ 3475 */
3215 FunctionElementImpl.con1(Identifier name) : super.con1(name) { 3476 FunctionElementImpl.con1(Identifier name) : super.con1(name) {
3216 _jtd_constructor_208_impl(name); 3477 _jtd_constructor_208_impl(name);
3217 } 3478 }
3218 _jtd_constructor_208_impl(Identifier name) { 3479 _jtd_constructor_208_impl(Identifier name) {
3219 } 3480 }
3220 3481
3221 /** 3482 /**
3222 * Initialize a newly created function element to have no name and the given o ffset. This is used 3483 * Initialize a newly created function element to have no name and the given o ffset. This is used
3223 * for function expressions, which have no name. 3484 * for function expressions, which have no name.
3485 *
3224 * @param nameOffset the offset of the name of this element in the file that c ontains the 3486 * @param nameOffset the offset of the name of this element in the file that c ontains the
3225 * declaration of this element 3487 * declaration of this element
3226 */ 3488 */
3227 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) { 3489 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) {
3228 _jtd_constructor_209_impl(nameOffset); 3490 _jtd_constructor_209_impl(nameOffset);
3229 } 3491 }
3230 _jtd_constructor_209_impl(int nameOffset) { 3492 _jtd_constructor_209_impl(int nameOffset) {
3231 } 3493 }
3232 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); 3494 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
3233 String get identifier => "${name}@${nameOffset}"; 3495 String get identifier => "${name}@${nameOffset}";
3234 ElementKind get kind => ElementKind.FUNCTION; 3496 ElementKind get kind => ElementKind.FUNCTION;
3235 SourceRange get visibleRange { 3497 SourceRange get visibleRange {
3236 if (_visibleRangeLength < 0) { 3498 if (_visibleRangeLength < 0) {
3237 return null; 3499 return null;
3238 } 3500 }
3239 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 3501 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
3240 } 3502 }
3241 bool get isStatic => enclosingElement is CompilationUnitElement; 3503 bool get isStatic => enclosingElement is CompilationUnitElement;
3242 3504
3243 /** 3505 /**
3244 * Set the visible range for this element to the range starting at the given o ffset with the given 3506 * Set the visible range for this element to the range starting at the given o ffset with the given
3245 * length. 3507 * length.
3508 *
3246 * @param offset the offset to the beginning of the visible range for this ele ment 3509 * @param offset the offset to the beginning of the visible range for this ele ment
3247 * @param length the length of the visible range for this element, or `-1` if this element 3510 * @param length the length of the visible range for this element, or `-1` if this element
3248 * does not have a visible range 3511 * does not have a visible range
3249 */ 3512 */
3250 void setVisibleRange(int offset, int length) { 3513 void setVisibleRange(int offset, int length) {
3251 _visibleRangeOffset = offset; 3514 _visibleRangeOffset = offset;
3252 _visibleRangeLength = length; 3515 _visibleRangeLength = length;
3253 } 3516 }
3254 void appendTo(JavaStringBuilder builder) { 3517 void appendTo(JavaStringBuilder builder) {
3255 String name = displayName; 3518 String name = displayName;
3256 if (name != null) { 3519 if (name != null) {
3257 builder.append(name); 3520 builder.append(name);
3258 } 3521 }
3259 super.appendTo(builder); 3522 super.appendTo(builder);
3260 } 3523 }
3261 } 3524 }
3262 /** 3525 /**
3263 * Instances of the class `FunctionTypeAliasElementImpl` implement a`FunctionTyp eAliasElement`. 3526 * Instances of the class `FunctionTypeAliasElementImpl` implement a
3527 * `FunctionTypeAliasElement`.
3528 *
3264 * @coverage dart.engine.element 3529 * @coverage dart.engine.element
3265 */ 3530 */
3266 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl iasElement { 3531 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl iasElement {
3267 3532
3268 /** 3533 /**
3269 * An array containing all of the parameters defined by this type alias. 3534 * An array containing all of the parameters defined by this type alias.
3270 */ 3535 */
3271 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; 3536 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
3272 3537
3273 /** 3538 /**
(...skipping 11 matching lines...) Expand all
3285 */ 3550 */
3286 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ; 3551 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ;
3287 3552
3288 /** 3553 /**
3289 * An empty array of type alias elements. 3554 * An empty array of type alias elements.
3290 */ 3555 */
3291 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias Element>(0); 3556 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias Element>(0);
3292 3557
3293 /** 3558 /**
3294 * Initialize a newly created type alias element to have the given name. 3559 * Initialize a newly created type alias element to have the given name.
3560 *
3295 * @param name the name of this element 3561 * @param name the name of this element
3296 */ 3562 */
3297 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name) { 3563 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name) {
3298 } 3564 }
3299 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); 3565 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this);
3300 ElementImpl getChild(String identifier2) { 3566 ElementImpl getChild(String identifier2) {
3301 for (VariableElement parameter in _parameters) { 3567 for (VariableElement parameter in _parameters) {
3302 if (((parameter as VariableElementImpl)).identifier == identifier2) { 3568 if (((parameter as VariableElementImpl)).identifier == identifier2) {
3303 return parameter as VariableElementImpl; 3569 return parameter as VariableElementImpl;
3304 } 3570 }
3305 } 3571 }
3306 for (TypeVariableElement typeVariable in _typeVariables) { 3572 for (TypeVariableElement typeVariable in _typeVariables) {
3307 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2) { 3573 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2) {
3308 return typeVariable as TypeVariableElementImpl; 3574 return typeVariable as TypeVariableElementImpl;
3309 } 3575 }
3310 } 3576 }
3311 return null; 3577 return null;
3312 } 3578 }
3313 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi lationUnitElement; 3579 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi lationUnitElement;
3314 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; 3580 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
3315 List<ParameterElement> get parameters => _parameters; 3581 List<ParameterElement> get parameters => _parameters;
3316 Type2 get returnType => _returnType; 3582 Type2 get returnType => _returnType;
3317 FunctionType get type => _type; 3583 FunctionType get type => _type;
3318 List<TypeVariableElement> get typeVariables => _typeVariables; 3584 List<TypeVariableElement> get typeVariables => _typeVariables;
3319 3585
3320 /** 3586 /**
3321 * Set the parameters defined by this type alias to the given parameters. 3587 * Set the parameters defined by this type alias to the given parameters.
3588 *
3322 * @param parameters the parameters defined by this type alias 3589 * @param parameters the parameters defined by this type alias
3323 */ 3590 */
3324 void set parameters(List<ParameterElement> parameters2) { 3591 void set parameters(List<ParameterElement> parameters2) {
3325 if (parameters2 != null) { 3592 if (parameters2 != null) {
3326 for (ParameterElement parameter in parameters2) { 3593 for (ParameterElement parameter in parameters2) {
3327 ((parameter as ParameterElementImpl)).enclosingElement = this; 3594 ((parameter as ParameterElementImpl)).enclosingElement = this;
3328 } 3595 }
3329 } 3596 }
3330 this._parameters = parameters2; 3597 this._parameters = parameters2;
3331 } 3598 }
3332 3599
3333 /** 3600 /**
3334 * Set the return type defined by this type alias. 3601 * Set the return type defined by this type alias.
3602 *
3335 * @param returnType the return type defined by this type alias 3603 * @param returnType the return type defined by this type alias
3336 */ 3604 */
3337 void set returnType(Type2 returnType2) { 3605 void set returnType(Type2 returnType2) {
3338 this._returnType = returnType2; 3606 this._returnType = returnType2;
3339 } 3607 }
3340 3608
3341 /** 3609 /**
3342 * Set the type of function defined by this type alias to the given type. 3610 * Set the type of function defined by this type alias to the given type.
3611 *
3343 * @param type the type of function defined by this type alias 3612 * @param type the type of function defined by this type alias
3344 */ 3613 */
3345 void set type(FunctionType type2) { 3614 void set type(FunctionType type2) {
3346 this._type = type2; 3615 this._type = type2;
3347 } 3616 }
3348 3617
3349 /** 3618 /**
3350 * Set the type variables defined for this type to the given variables. 3619 * Set the type variables defined for this type to the given variables.
3620 *
3351 * @param typeVariables the type variables defined for this type 3621 * @param typeVariables the type variables defined for this type
3352 */ 3622 */
3353 void set typeVariables(List<TypeVariableElement> typeVariables2) { 3623 void set typeVariables(List<TypeVariableElement> typeVariables2) {
3354 for (TypeVariableElement variable in typeVariables2) { 3624 for (TypeVariableElement variable in typeVariables2) {
3355 ((variable as TypeVariableElementImpl)).enclosingElement = this; 3625 ((variable as TypeVariableElementImpl)).enclosingElement = this;
3356 } 3626 }
3357 this._typeVariables = typeVariables2; 3627 this._typeVariables = typeVariables2;
3358 } 3628 }
3359 void visitChildren(ElementVisitor<Object> visitor) { 3629 void visitChildren(ElementVisitor<Object> visitor) {
3360 super.visitChildren(visitor); 3630 super.visitChildren(visitor);
(...skipping 23 matching lines...) Expand all
3384 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); 3654 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
3385 } 3655 }
3386 builder.append(")"); 3656 builder.append(")");
3387 if (_type != null) { 3657 if (_type != null) {
3388 builder.append(" -> "); 3658 builder.append(" -> ");
3389 builder.append(_type.returnType); 3659 builder.append(_type.returnType);
3390 } 3660 }
3391 } 3661 }
3392 } 3662 }
3393 /** 3663 /**
3394 * Instances of the class `HideElementCombinatorImpl` implement a[HideElementCom binator]. 3664 * Instances of the class `HideElementCombinatorImpl` implement a
3665 * [HideElementCombinator].
3666 *
3395 * @coverage dart.engine.element 3667 * @coverage dart.engine.element
3396 */ 3668 */
3397 class HideElementCombinatorImpl implements HideElementCombinator { 3669 class HideElementCombinatorImpl implements HideElementCombinator {
3398 3670
3399 /** 3671 /**
3400 * The names that are not to be made visible in the importing library even if they are defined in 3672 * The names that are not to be made visible in the importing library even if they are defined in
3401 * the imported library. 3673 * the imported library.
3402 */ 3674 */
3403 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; 3675 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY;
3404 List<String> get hiddenNames => _hiddenNames; 3676 List<String> get hiddenNames => _hiddenNames;
3405 3677
3406 /** 3678 /**
3407 * Set the names that are not to be made visible in the importing library even if they are defined 3679 * Set the names that are not to be made visible in the importing library even if they are defined
3408 * in the imported library to the given names. 3680 * in the imported library to the given names.
3681 *
3409 * @param hiddenNames the names that are not to be made visible in the importi ng library 3682 * @param hiddenNames the names that are not to be made visible in the importi ng library
3410 */ 3683 */
3411 void set hiddenNames(List<String> hiddenNames2) { 3684 void set hiddenNames(List<String> hiddenNames2) {
3412 this._hiddenNames = hiddenNames2; 3685 this._hiddenNames = hiddenNames2;
3413 } 3686 }
3414 String toString() { 3687 String toString() {
3415 JavaStringBuilder builder = new JavaStringBuilder(); 3688 JavaStringBuilder builder = new JavaStringBuilder();
3416 builder.append("show "); 3689 builder.append("show ");
3417 int count = _hiddenNames.length; 3690 int count = _hiddenNames.length;
3418 for (int i = 0; i < count; i++) { 3691 for (int i = 0; i < count; i++) {
3419 if (i > 0) { 3692 if (i > 0) {
3420 builder.append(", "); 3693 builder.append(", ");
3421 } 3694 }
3422 builder.append(_hiddenNames[i]); 3695 builder.append(_hiddenNames[i]);
3423 } 3696 }
3424 return builder.toString(); 3697 return builder.toString();
3425 } 3698 }
3426 } 3699 }
3427 /** 3700 /**
3428 * Instances of the class `HtmlElementImpl` implement an [HtmlElement]. 3701 * Instances of the class `HtmlElementImpl` implement an [HtmlElement].
3702 *
3429 * @coverage dart.engine.element 3703 * @coverage dart.engine.element
3430 */ 3704 */
3431 class HtmlElementImpl extends ElementImpl implements HtmlElement { 3705 class HtmlElementImpl extends ElementImpl implements HtmlElement {
3432 3706
3433 /** 3707 /**
3434 * An empty array of HTML file elements. 3708 * An empty array of HTML file elements.
3435 */ 3709 */
3436 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); 3710 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0);
3437 3711
3438 /** 3712 /**
3439 * The analysis context in which this library is defined. 3713 * The analysis context in which this library is defined.
3440 */ 3714 */
3441 AnalysisContext _context; 3715 AnalysisContext _context;
3442 3716
3443 /** 3717 /**
3444 * The scripts contained in or referenced from script tags in the HTML file. 3718 * The scripts contained in or referenced from script tags in the HTML file.
3445 */ 3719 */
3446 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; 3720 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY;
3447 3721
3448 /** 3722 /**
3449 * The source that corresponds to this HTML file. 3723 * The source that corresponds to this HTML file.
3450 */ 3724 */
3451 Source _source; 3725 Source _source;
3452 3726
3453 /** 3727 /**
3454 * Initialize a newly created HTML element to have the given name. 3728 * Initialize a newly created HTML element to have the given name.
3729 *
3455 * @param context the analysis context in which the HTML file is defined 3730 * @param context the analysis context in which the HTML file is defined
3456 * @param name the name of this element 3731 * @param name the name of this element
3457 */ 3732 */
3458 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { 3733 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) {
3459 this._context = context; 3734 this._context = context;
3460 } 3735 }
3461 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); 3736 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this);
3462 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc e == ((object as CompilationUnitElementImpl)).source; 3737 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc e == ((object as CompilationUnitElementImpl)).source;
3463 AnalysisContext get context => _context; 3738 AnalysisContext get context => _context;
3464 ElementKind get kind => ElementKind.HTML; 3739 ElementKind get kind => ElementKind.HTML;
3465 List<HtmlScriptElement> get scripts => _scripts; 3740 List<HtmlScriptElement> get scripts => _scripts;
3466 Source get source => _source; 3741 Source get source => _source;
3467 int get hashCode => _source.hashCode; 3742 int get hashCode => _source.hashCode;
3468 3743
3469 /** 3744 /**
3470 * Set the scripts contained in the HTML file to the given scripts. 3745 * Set the scripts contained in the HTML file to the given scripts.
3746 *
3471 * @param scripts the scripts 3747 * @param scripts the scripts
3472 */ 3748 */
3473 void set scripts(List<HtmlScriptElement> scripts2) { 3749 void set scripts(List<HtmlScriptElement> scripts2) {
3474 if (scripts2.length == 0) { 3750 if (scripts2.length == 0) {
3475 scripts2 = HtmlScriptElementImpl.EMPTY_ARRAY; 3751 scripts2 = HtmlScriptElementImpl.EMPTY_ARRAY;
3476 } 3752 }
3477 for (HtmlScriptElement script in scripts2) { 3753 for (HtmlScriptElement script in scripts2) {
3478 ((script as HtmlScriptElementImpl)).enclosingElement = this; 3754 ((script as HtmlScriptElementImpl)).enclosingElement = this;
3479 } 3755 }
3480 this._scripts = scripts2; 3756 this._scripts = scripts2;
3481 } 3757 }
3482 3758
3483 /** 3759 /**
3484 * Set the source that corresponds to this HTML file to the given source. 3760 * Set the source that corresponds to this HTML file to the given source.
3761 *
3485 * @param source the source that corresponds to this HTML file 3762 * @param source the source that corresponds to this HTML file
3486 */ 3763 */
3487 void set source(Source source2) { 3764 void set source(Source source2) {
3488 this._source = source2; 3765 this._source = source2;
3489 } 3766 }
3490 void visitChildren(ElementVisitor<Object> visitor) { 3767 void visitChildren(ElementVisitor<Object> visitor) {
3491 super.visitChildren(visitor); 3768 super.visitChildren(visitor);
3492 safelyVisitChildren(_scripts, visitor); 3769 safelyVisitChildren(_scripts, visitor);
3493 } 3770 }
3494 void appendTo(JavaStringBuilder builder) { 3771 void appendTo(JavaStringBuilder builder) {
3495 if (_source == null) { 3772 if (_source == null) {
3496 builder.append("{HTML file}"); 3773 builder.append("{HTML file}");
3497 } else { 3774 } else {
3498 builder.append(_source.fullName); 3775 builder.append(_source.fullName);
3499 } 3776 }
3500 } 3777 }
3501 } 3778 }
3502 /** 3779 /**
3503 * Instances of the class `HtmlScriptElementImpl` implement an [HtmlScriptElemen t]. 3780 * Instances of the class `HtmlScriptElementImpl` implement an [HtmlScriptElemen t].
3781 *
3504 * @coverage dart.engine.element 3782 * @coverage dart.engine.element
3505 */ 3783 */
3506 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl ement { 3784 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl ement {
3507 3785
3508 /** 3786 /**
3509 * An empty array of HTML script elements. 3787 * An empty array of HTML script elements.
3510 */ 3788 */
3511 static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0); 3789 static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0);
3512 3790
3513 /** 3791 /**
3514 * Initialize a newly created script element to have the specified tag name an d offset. 3792 * Initialize a newly created script element to have the specified tag name an d offset.
3793 *
3515 * @param node the XML node from which this element is derived (not `null`) 3794 * @param node the XML node from which this element is derived (not `null`)
3516 */ 3795 */
3517 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag. offset) { 3796 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag. offset) {
3518 } 3797 }
3519 } 3798 }
3520 /** 3799 /**
3521 * Instances of the class `ImportElementImpl` implement an [ImportElement]. 3800 * Instances of the class `ImportElementImpl` implement an [ImportElement].
3801 *
3522 * @coverage dart.engine.element 3802 * @coverage dart.engine.element
3523 */ 3803 */
3524 class ImportElementImpl extends ElementImpl implements ImportElement { 3804 class ImportElementImpl extends ElementImpl implements ImportElement {
3525 3805
3526 /** 3806 /**
3527 * The URI that is specified by this directive. 3807 * The URI that is specified by this directive.
3528 */ 3808 */
3529 String _uri; 3809 String _uri;
3530 3810
3531 /** 3811 /**
(...skipping 21 matching lines...) Expand all
3553 accept(ElementVisitor visitor) => visitor.visitImportElement(this); 3833 accept(ElementVisitor visitor) => visitor.visitImportElement(this);
3554 List<NamespaceCombinator> get combinators => _combinators; 3834 List<NamespaceCombinator> get combinators => _combinators;
3555 LibraryElement get importedLibrary => _importedLibrary; 3835 LibraryElement get importedLibrary => _importedLibrary;
3556 ElementKind get kind => ElementKind.IMPORT; 3836 ElementKind get kind => ElementKind.IMPORT;
3557 PrefixElement get prefix => _prefix; 3837 PrefixElement get prefix => _prefix;
3558 String get uri => _uri; 3838 String get uri => _uri;
3559 3839
3560 /** 3840 /**
3561 * Set the combinators that were specified as part of the import directive to the given array of 3841 * Set the combinators that were specified as part of the import directive to the given array of
3562 * combinators. 3842 * combinators.
3843 *
3563 * @param combinators the combinators that were specified as part of the impor t directive 3844 * @param combinators the combinators that were specified as part of the impor t directive
3564 */ 3845 */
3565 void set combinators(List<NamespaceCombinator> combinators2) { 3846 void set combinators(List<NamespaceCombinator> combinators2) {
3566 this._combinators = combinators2; 3847 this._combinators = combinators2;
3567 } 3848 }
3568 3849
3569 /** 3850 /**
3570 * Set the library that is imported into this library by this import directive to the given 3851 * Set the library that is imported into this library by this import directive to the given
3571 * library. 3852 * library.
3853 *
3572 * @param importedLibrary the library that is imported into this library 3854 * @param importedLibrary the library that is imported into this library
3573 */ 3855 */
3574 void set importedLibrary(LibraryElement importedLibrary2) { 3856 void set importedLibrary(LibraryElement importedLibrary2) {
3575 this._importedLibrary = importedLibrary2; 3857 this._importedLibrary = importedLibrary2;
3576 } 3858 }
3577 3859
3578 /** 3860 /**
3579 * Set the prefix that was specified as part of the import directive to the gi ven prefix. 3861 * Set the prefix that was specified as part of the import directive to the gi ven prefix.
3862 *
3580 * @param prefix the prefix that was specified as part of the import directive 3863 * @param prefix the prefix that was specified as part of the import directive
3581 */ 3864 */
3582 void set prefix(PrefixElement prefix2) { 3865 void set prefix(PrefixElement prefix2) {
3583 this._prefix = prefix2; 3866 this._prefix = prefix2;
3584 } 3867 }
3585 3868
3586 /** 3869 /**
3587 * Set the URI that is specified by this directive. 3870 * Set the URI that is specified by this directive.
3871 *
3588 * @param uri the URI that is specified by this directive. 3872 * @param uri the URI that is specified by this directive.
3589 */ 3873 */
3590 void set uri(String uri2) { 3874 void set uri(String uri2) {
3591 this._uri = uri2; 3875 this._uri = uri2;
3592 } 3876 }
3593 void visitChildren(ElementVisitor<Object> visitor) { 3877 void visitChildren(ElementVisitor<Object> visitor) {
3594 super.visitChildren(visitor); 3878 super.visitChildren(visitor);
3595 safelyVisitChild(_prefix, visitor); 3879 safelyVisitChild(_prefix, visitor);
3596 } 3880 }
3597 void appendTo(JavaStringBuilder builder) { 3881 void appendTo(JavaStringBuilder builder) {
3598 builder.append("import "); 3882 builder.append("import ");
3599 ((_importedLibrary as LibraryElementImpl)).appendTo(builder); 3883 ((_importedLibrary as LibraryElementImpl)).appendTo(builder);
3600 } 3884 }
3601 String get identifier => ((_importedLibrary as LibraryElementImpl)).identifier ; 3885 String get identifier => ((_importedLibrary as LibraryElementImpl)).identifier ;
3602 } 3886 }
3603 /** 3887 /**
3604 * Instances of the class `LabelElementImpl` implement a `LabelElement`. 3888 * Instances of the class `LabelElementImpl` implement a `LabelElement`.
3889 *
3605 * @coverage dart.engine.element 3890 * @coverage dart.engine.element
3606 */ 3891 */
3607 class LabelElementImpl extends ElementImpl implements LabelElement { 3892 class LabelElementImpl extends ElementImpl implements LabelElement {
3608 3893
3609 /** 3894 /**
3610 * A flag indicating whether this label is associated with a `switch` statemen t. 3895 * A flag indicating whether this label is associated with a `switch` statemen t.
3611 */ 3896 */
3612 bool _onSwitchStatement = false; 3897 bool _onSwitchStatement = false;
3613 3898
3614 /** 3899 /**
3615 * A flag indicating whether this label is associated with a `switch` member ( `case`or `default`). 3900 * A flag indicating whether this label is associated with a `switch` member ( `case`
3901 * or `default`).
3616 */ 3902 */
3617 bool _onSwitchMember = false; 3903 bool _onSwitchMember = false;
3618 3904
3619 /** 3905 /**
3620 * An empty array of label elements. 3906 * An empty array of label elements.
3621 */ 3907 */
3622 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); 3908 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0);
3623 3909
3624 /** 3910 /**
3625 * Initialize a newly created label element to have the given name. 3911 * Initialize a newly created label element to have the given name.
3912 *
3626 * @param name the name of this element 3913 * @param name the name of this element
3627 * @param onSwitchStatement `true` if this label is associated with a `switch` statement 3914 * @param onSwitchStatement `true` if this label is associated with a `switch`
3915 * statement
3628 * @param onSwitchMember `true` if this label is associated with a `switch` me mber 3916 * @param onSwitchMember `true` if this label is associated with a `switch` me mber
3629 */ 3917 */
3630 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) { 3918 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) {
3631 this._onSwitchStatement = onSwitchStatement; 3919 this._onSwitchStatement = onSwitchStatement;
3632 this._onSwitchMember = onSwitchMember; 3920 this._onSwitchMember = onSwitchMember;
3633 } 3921 }
3634 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); 3922 accept(ElementVisitor visitor) => visitor.visitLabelElement(this);
3635 ExecutableElement get enclosingElement => super.enclosingElement as Executable Element; 3923 ExecutableElement get enclosingElement => super.enclosingElement as Executable Element;
3636 ElementKind get kind => ElementKind.LABEL; 3924 ElementKind get kind => ElementKind.LABEL;
3637 3925
3638 /** 3926 /**
3639 * Return `true` if this label is associated with a `switch` member (`case` or `default`). 3927 * Return `true` if this label is associated with a `switch` member (`case` or
3928 * `default`).
3929 *
3640 * @return `true` if this label is associated with a `switch` member 3930 * @return `true` if this label is associated with a `switch` member
3641 */ 3931 */
3642 bool get isOnSwitchMember => _onSwitchMember; 3932 bool get isOnSwitchMember => _onSwitchMember;
3643 3933
3644 /** 3934 /**
3645 * Return `true` if this label is associated with a `switch` statement. 3935 * Return `true` if this label is associated with a `switch` statement.
3936 *
3646 * @return `true` if this label is associated with a `switch` statement 3937 * @return `true` if this label is associated with a `switch` statement
3647 */ 3938 */
3648 bool get isOnSwitchStatement => _onSwitchStatement; 3939 bool get isOnSwitchStatement => _onSwitchStatement;
3649 } 3940 }
3650 /** 3941 /**
3651 * Instances of the class `LibraryElementImpl` implement a `LibraryElement`. 3942 * Instances of the class `LibraryElementImpl` implement a `LibraryElement`.
3943 *
3652 * @coverage dart.engine.element 3944 * @coverage dart.engine.element
3653 */ 3945 */
3654 class LibraryElementImpl extends ElementImpl implements LibraryElement { 3946 class LibraryElementImpl extends ElementImpl implements LibraryElement {
3655 3947
3656 /** 3948 /**
3657 * An empty array of library elements. 3949 * An empty array of library elements.
3658 */ 3950 */
3659 static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0); 3951 static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0);
3660 3952
3661 /** 3953 /**
3662 * Determine if the given library is up to date with respect to the given time stamp. 3954 * Determine if the given library is up to date with respect to the given time stamp.
3955 *
3663 * @param library the library to process 3956 * @param library the library to process
3664 * @param timeStamp the time stamp to check against 3957 * @param timeStamp the time stamp to check against
3665 * @param visitedLibraries the set of visited libraries 3958 * @param visitedLibraries the set of visited libraries
3666 */ 3959 */
3667 static bool isUpToDate(LibraryElement library, int timeStamp, Set<LibraryEleme nt> visitedLibraries) { 3960 static bool isUpToDate(LibraryElement library, int timeStamp, Set<LibraryEleme nt> visitedLibraries) {
3668 if (!visitedLibraries.contains(library)) { 3961 if (!visitedLibraries.contains(library)) {
3669 javaSetAdd(visitedLibraries, library); 3962 javaSetAdd(visitedLibraries, library);
3670 if (timeStamp < library.definingCompilationUnit.source.modificationStamp) { 3963 if (timeStamp < library.definingCompilationUnit.source.modificationStamp) {
3671 return false; 3964 return false;
3672 } 3965 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 * An array containing specifications of all of the imports defined in this li brary. 4001 * An array containing specifications of all of the imports defined in this li brary.
3709 */ 4002 */
3710 List<ImportElement> _imports = ImportElement.EMPTY_ARRAY; 4003 List<ImportElement> _imports = ImportElement.EMPTY_ARRAY;
3711 4004
3712 /** 4005 /**
3713 * An array containing specifications of all of the exports defined in this li brary. 4006 * An array containing specifications of all of the exports defined in this li brary.
3714 */ 4007 */
3715 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; 4008 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY;
3716 4009
3717 /** 4010 /**
3718 * An array containing all of the compilation units that are included in this library using a`part` directive. 4011 * An array containing all of the compilation units that are included in this library using a
4012 * `part` directive.
3719 */ 4013 */
3720 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; 4014 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY;
3721 4015
3722 /** 4016 /**
3723 * Initialize a newly created library element to have the given name. 4017 * Initialize a newly created library element to have the given name.
4018 *
3724 * @param context the analysis context in which the library is defined 4019 * @param context the analysis context in which the library is defined
3725 * @param name the name of this element 4020 * @param name the name of this element
3726 */ 4021 */
3727 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co n1(name) { 4022 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co n1(name) {
3728 this._context = context; 4023 this._context = context;
3729 } 4024 }
3730 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); 4025 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this);
3731 bool operator ==(Object object) => object != null && runtimeType == object.run timeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definin gCompilationUnit; 4026 bool operator ==(Object object) => object != null && runtimeType == object.run timeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definin gCompilationUnit;
3732 ElementImpl getChild(String identifier2) { 4027 ElementImpl getChild(String identifier2) {
3733 if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier2) { 4028 if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier2) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3811 int get hashCode => _definingCompilationUnit.hashCode; 4106 int get hashCode => _definingCompilationUnit.hashCode;
3812 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr ary; 4107 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr ary;
3813 bool get isDartCore => name == "dart.core"; 4108 bool get isDartCore => name == "dart.core";
3814 bool isUpToDate2(int timeStamp) { 4109 bool isUpToDate2(int timeStamp) {
3815 Set<LibraryElement> visitedLibraries = new Set(); 4110 Set<LibraryElement> visitedLibraries = new Set();
3816 return isUpToDate(this, timeStamp, visitedLibraries); 4111 return isUpToDate(this, timeStamp, visitedLibraries);
3817 } 4112 }
3818 4113
3819 /** 4114 /**
3820 * Set the compilation unit that defines this library to the given compilation unit. 4115 * Set the compilation unit that defines this library to the given compilation unit.
4116 *
3821 * @param definingCompilationUnit the compilation unit that defines this libra ry 4117 * @param definingCompilationUnit the compilation unit that defines this libra ry
3822 */ 4118 */
3823 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni t2) { 4119 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni t2) {
3824 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement = this; 4120 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement = this;
3825 this._definingCompilationUnit = definingCompilationUnit2; 4121 this._definingCompilationUnit = definingCompilationUnit2;
3826 } 4122 }
3827 4123
3828 /** 4124 /**
3829 * Set the entry point for this library to the given function. 4125 * Set the entry point for this library to the given function.
4126 *
3830 * @param entryPoint the entry point for this library 4127 * @param entryPoint the entry point for this library
3831 */ 4128 */
3832 void set entryPoint(FunctionElement entryPoint2) { 4129 void set entryPoint(FunctionElement entryPoint2) {
3833 this._entryPoint = entryPoint2; 4130 this._entryPoint = entryPoint2;
3834 } 4131 }
3835 4132
3836 /** 4133 /**
3837 * Set the specifications of all of the exports defined in this library to the given array. 4134 * Set the specifications of all of the exports defined in this library to the given array.
4135 *
3838 * @param exports the specifications of all of the exports defined in this lib rary 4136 * @param exports the specifications of all of the exports defined in this lib rary
3839 */ 4137 */
3840 void set exports(List<ExportElement> exports2) { 4138 void set exports(List<ExportElement> exports2) {
3841 for (ExportElement exportElement in exports2) { 4139 for (ExportElement exportElement in exports2) {
3842 ((exportElement as ExportElementImpl)).enclosingElement = this; 4140 ((exportElement as ExportElementImpl)).enclosingElement = this;
3843 } 4141 }
3844 this._exports = exports2; 4142 this._exports = exports2;
3845 } 4143 }
3846 4144
3847 /** 4145 /**
3848 * Set the specifications of all of the imports defined in this library to the given array. 4146 * Set the specifications of all of the imports defined in this library to the given array.
4147 *
3849 * @param imports the specifications of all of the imports defined in this lib rary 4148 * @param imports the specifications of all of the imports defined in this lib rary
3850 */ 4149 */
3851 void set imports(List<ImportElement> imports2) { 4150 void set imports(List<ImportElement> imports2) {
3852 for (ImportElement importElement in imports2) { 4151 for (ImportElement importElement in imports2) {
3853 ((importElement as ImportElementImpl)).enclosingElement = this; 4152 ((importElement as ImportElementImpl)).enclosingElement = this;
3854 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; 4153 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl;
3855 if (prefix != null) { 4154 if (prefix != null) {
3856 prefix.enclosingElement = this; 4155 prefix.enclosingElement = this;
3857 } 4156 }
3858 } 4157 }
3859 this._imports = imports2; 4158 this._imports = imports2;
3860 } 4159 }
3861 4160
3862 /** 4161 /**
3863 * Set the compilation units that are included in this library using a `part` directive. 4162 * Set the compilation units that are included in this library using a `part` directive.
3864 * @param parts the compilation units that are included in this library using a `part`directive 4163 *
4164 * @param parts the compilation units that are included in this library using a `part`
4165 * directive
3865 */ 4166 */
3866 void set parts(List<CompilationUnitElement> parts2) { 4167 void set parts(List<CompilationUnitElement> parts2) {
3867 for (CompilationUnitElement compilationUnit in parts2) { 4168 for (CompilationUnitElement compilationUnit in parts2) {
3868 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this; 4169 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this;
3869 } 4170 }
3870 this._parts = parts2; 4171 this._parts = parts2;
3871 } 4172 }
3872 void visitChildren(ElementVisitor<Object> visitor) { 4173 void visitChildren(ElementVisitor<Object> visitor) {
3873 super.visitChildren(visitor); 4174 super.visitChildren(visitor);
3874 safelyVisitChild(_definingCompilationUnit, visitor); 4175 safelyVisitChild(_definingCompilationUnit, visitor);
3875 safelyVisitChildren(_exports, visitor); 4176 safelyVisitChildren(_exports, visitor);
3876 safelyVisitChildren(_imports, visitor); 4177 safelyVisitChildren(_imports, visitor);
3877 safelyVisitChildren(_parts, visitor); 4178 safelyVisitChildren(_parts, visitor);
3878 } 4179 }
3879 4180
3880 /** 4181 /**
3881 * Answer `true` if the receiver directly or indirectly imports the dart:html libraries. 4182 * Answer `true` if the receiver directly or indirectly imports the dart:html libraries.
4183 *
3882 * @return `true` if the receiver directly or indirectly imports the dart:html libraries 4184 * @return `true` if the receiver directly or indirectly imports the dart:html libraries
3883 */ 4185 */
3884 bool get isOrImportsBrowserLibrary { 4186 bool get isOrImportsBrowserLibrary {
3885 List<LibraryElement> visited = new List<LibraryElement>(); 4187 List<LibraryElement> visited = new List<LibraryElement>();
3886 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); 4188 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML);
3887 visited.add(this); 4189 visited.add(this);
3888 for (int index = 0; index < visited.length; index++) { 4190 for (int index = 0; index < visited.length; index++) {
3889 LibraryElement library = visited[index]; 4191 LibraryElement library = visited[index];
3890 Source source = library.definingCompilationUnit.source; 4192 Source source = library.definingCompilationUnit.source;
3891 if (source == htmlLibSource) { 4193 if (source == htmlLibSource) {
3892 return true; 4194 return true;
3893 } 4195 }
3894 for (LibraryElement importedLibrary in library.importedLibraries) { 4196 for (LibraryElement importedLibrary in library.importedLibraries) {
3895 if (!visited.contains(importedLibrary)) { 4197 if (!visited.contains(importedLibrary)) {
3896 visited.add(importedLibrary); 4198 visited.add(importedLibrary);
3897 } 4199 }
3898 } 4200 }
3899 for (LibraryElement exportedLibrary in library.exportedLibraries) { 4201 for (LibraryElement exportedLibrary in library.exportedLibraries) {
3900 if (!visited.contains(exportedLibrary)) { 4202 if (!visited.contains(exportedLibrary)) {
3901 visited.add(exportedLibrary); 4203 visited.add(exportedLibrary);
3902 } 4204 }
3903 } 4205 }
3904 } 4206 }
3905 return false; 4207 return false;
3906 } 4208 }
3907 } 4209 }
3908 /** 4210 /**
3909 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE lement`. 4211 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE lement`.
4212 *
3910 * @coverage dart.engine.element 4213 * @coverage dart.engine.element
3911 */ 4214 */
3912 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria bleElement { 4215 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria bleElement {
3913 4216
3914 /** 4217 /**
3915 * The offset to the beginning of the visible range for this element. 4218 * The offset to the beginning of the visible range for this element.
3916 */ 4219 */
3917 int _visibleRangeOffset = 0; 4220 int _visibleRangeOffset = 0;
3918 4221
3919 /** 4222 /**
3920 * The length of the visible range for this element, or `-1` if this element d oes not have a 4223 * The length of the visible range for this element, or `-1` if this element d oes not have a
3921 * visible range. 4224 * visible range.
3922 */ 4225 */
3923 int _visibleRangeLength = -1; 4226 int _visibleRangeLength = -1;
3924 4227
3925 /** 4228 /**
3926 * An empty array of field elements. 4229 * An empty array of field elements.
3927 */ 4230 */
3928 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement> (0); 4231 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement> (0);
3929 4232
3930 /** 4233 /**
3931 * Initialize a newly created local variable element to have the given name. 4234 * Initialize a newly created local variable element to have the given name.
4235 *
3932 * @param name the name of this element 4236 * @param name the name of this element
3933 */ 4237 */
3934 LocalVariableElementImpl(Identifier name) : super.con1(name) { 4238 LocalVariableElementImpl(Identifier name) : super.con1(name) {
3935 } 4239 }
3936 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); 4240 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this);
3937 ElementKind get kind => ElementKind.LOCAL_VARIABLE; 4241 ElementKind get kind => ElementKind.LOCAL_VARIABLE;
3938 SourceRange get visibleRange { 4242 SourceRange get visibleRange {
3939 if (_visibleRangeLength < 0) { 4243 if (_visibleRangeLength < 0) {
3940 return null; 4244 return null;
3941 } 4245 }
3942 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 4246 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
3943 } 4247 }
3944 4248
3945 /** 4249 /**
3946 * Set the visible range for this element to the range starting at the given o ffset with the given 4250 * Set the visible range for this element to the range starting at the given o ffset with the given
3947 * length. 4251 * length.
4252 *
3948 * @param offset the offset to the beginning of the visible range for this ele ment 4253 * @param offset the offset to the beginning of the visible range for this ele ment
3949 * @param length the length of the visible range for this element, or `-1` if this element 4254 * @param length the length of the visible range for this element, or `-1` if this element
3950 * does not have a visible range 4255 * does not have a visible range
3951 */ 4256 */
3952 void setVisibleRange(int offset, int length) { 4257 void setVisibleRange(int offset, int length) {
3953 _visibleRangeOffset = offset; 4258 _visibleRangeOffset = offset;
3954 _visibleRangeLength = length; 4259 _visibleRangeLength = length;
3955 } 4260 }
3956 void appendTo(JavaStringBuilder builder) { 4261 void appendTo(JavaStringBuilder builder) {
3957 builder.append(type); 4262 builder.append(type);
3958 builder.append(" "); 4263 builder.append(" ");
3959 builder.append(displayName); 4264 builder.append(displayName);
3960 } 4265 }
3961 String get identifier => "${super.identifier}@${nameOffset}"; 4266 String get identifier => "${super.identifier}@${nameOffset}";
3962 } 4267 }
3963 /** 4268 /**
3964 * Instances of the class `MethodElementImpl` implement a `MethodElement`. 4269 * Instances of the class `MethodElementImpl` implement a `MethodElement`.
4270 *
3965 * @coverage dart.engine.element 4271 * @coverage dart.engine.element
3966 */ 4272 */
3967 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { 4273 class MethodElementImpl extends ExecutableElementImpl implements MethodElement {
3968 4274
3969 /** 4275 /**
3970 * An empty array of method elements. 4276 * An empty array of method elements.
3971 */ 4277 */
3972 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); 4278 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0);
3973 4279
3974 /** 4280 /**
3975 * Initialize a newly created method element to have the given name. 4281 * Initialize a newly created method element to have the given name.
4282 *
3976 * @param name the name of this element 4283 * @param name the name of this element
3977 */ 4284 */
3978 MethodElementImpl.con1(Identifier name) : super.con1(name) { 4285 MethodElementImpl.con1(Identifier name) : super.con1(name) {
3979 _jtd_constructor_218_impl(name); 4286 _jtd_constructor_218_impl(name);
3980 } 4287 }
3981 _jtd_constructor_218_impl(Identifier name) { 4288 _jtd_constructor_218_impl(Identifier name) {
3982 } 4289 }
3983 4290
3984 /** 4291 /**
3985 * Initialize a newly created method element to have the given name. 4292 * Initialize a newly created method element to have the given name.
4293 *
3986 * @param name the name of this element 4294 * @param name the name of this element
3987 * @param nameOffset the offset of the name of this element in the file that c ontains the 4295 * @param nameOffset the offset of the name of this element in the file that c ontains the
3988 * declaration of this element 4296 * declaration of this element
3989 */ 4297 */
3990 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set) { 4298 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set) {
3991 _jtd_constructor_219_impl(name, nameOffset); 4299 _jtd_constructor_219_impl(name, nameOffset);
3992 } 4300 }
3993 _jtd_constructor_219_impl(String name, int nameOffset) { 4301 _jtd_constructor_219_impl(String name, int nameOffset) {
3994 } 4302 }
3995 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); 4303 accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
3996 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 4304 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
3997 ElementKind get kind => ElementKind.METHOD; 4305 ElementKind get kind => ElementKind.METHOD;
3998 String get name { 4306 String get name {
(...skipping 11 matching lines...) Expand all
4010 if (name.isEmpty) { 4318 if (name.isEmpty) {
4011 return false; 4319 return false;
4012 } 4320 }
4013 int first = name.codeUnitAt(0); 4321 int first = name.codeUnitAt(0);
4014 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A ) || first == 0x5F || first == 0x24); 4322 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A ) || first == 0x5F || first == 0x24);
4015 } 4323 }
4016 bool get isStatic => hasModifier(Modifier.STATIC); 4324 bool get isStatic => hasModifier(Modifier.STATIC);
4017 4325
4018 /** 4326 /**
4019 * Set whether this method is abstract to correspond to the given value. 4327 * Set whether this method is abstract to correspond to the given value.
4328 *
4020 * @param isAbstract `true` if the method is abstract 4329 * @param isAbstract `true` if the method is abstract
4021 */ 4330 */
4022 void set abstract(bool isAbstract) { 4331 void set abstract(bool isAbstract) {
4023 setModifier(Modifier.ABSTRACT, isAbstract); 4332 setModifier(Modifier.ABSTRACT, isAbstract);
4024 } 4333 }
4025 4334
4026 /** 4335 /**
4027 * Set whether this method is static to correspond to the given value. 4336 * Set whether this method is static to correspond to the given value.
4337 *
4028 * @param isStatic `true` if the method is static 4338 * @param isStatic `true` if the method is static
4029 */ 4339 */
4030 void set static(bool isStatic) { 4340 void set static(bool isStatic) {
4031 setModifier(Modifier.STATIC, isStatic); 4341 setModifier(Modifier.STATIC, isStatic);
4032 } 4342 }
4033 void appendTo(JavaStringBuilder builder) { 4343 void appendTo(JavaStringBuilder builder) {
4034 builder.append(enclosingElement.displayName); 4344 builder.append(enclosingElement.displayName);
4035 builder.append("."); 4345 builder.append(".");
4036 builder.append(displayName); 4346 builder.append(displayName);
4037 super.appendTo(builder); 4347 super.appendTo(builder);
4038 } 4348 }
4039 } 4349 }
4040 /** 4350 /**
4041 * The enumeration `Modifier` defines constants for all of the modifiers defined by the Dart 4351 * The enumeration `Modifier` defines constants for all of the modifiers defined by the Dart
4042 * language and for a few additional flags that are useful. 4352 * language and for a few additional flags that are useful.
4353 *
4043 * @coverage dart.engine.element 4354 * @coverage dart.engine.element
4044 */ 4355 */
4045 class Modifier implements Comparable<Modifier> { 4356 class Modifier implements Comparable<Modifier> {
4046 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); 4357 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0);
4047 static final Modifier CONST = new Modifier('CONST', 1); 4358 static final Modifier CONST = new Modifier('CONST', 1);
4048 static final Modifier FACTORY = new Modifier('FACTORY', 2); 4359 static final Modifier FACTORY = new Modifier('FACTORY', 2);
4049 static final Modifier FINAL = new Modifier('FINAL', 3); 4360 static final Modifier FINAL = new Modifier('FINAL', 3);
4050 static final Modifier GETTER = new Modifier('GETTER', 4); 4361 static final Modifier GETTER = new Modifier('GETTER', 4);
4051 static final Modifier MIXIN = new Modifier('MIXIN', 5); 4362 static final Modifier MIXIN = new Modifier('MIXIN', 5);
4052 static final Modifier REFERENCES_SUPER = new Modifier('REFERENCES_SUPER', 6); 4363 static final Modifier REFERENCES_SUPER = new Modifier('REFERENCES_SUPER', 6);
(...skipping 10 matching lines...) Expand all
4063 final int ordinal; 4374 final int ordinal;
4064 Modifier(this.name, this.ordinal) { 4375 Modifier(this.name, this.ordinal) {
4065 } 4376 }
4066 int compareTo(Modifier other) => ordinal - other.ordinal; 4377 int compareTo(Modifier other) => ordinal - other.ordinal;
4067 int get hashCode => ordinal; 4378 int get hashCode => ordinal;
4068 String toString() => name; 4379 String toString() => name;
4069 } 4380 }
4070 /** 4381 /**
4071 * Instances of the class `MultiplyDefinedElementImpl` represent a collection of elements that 4382 * Instances of the class `MultiplyDefinedElementImpl` represent a collection of elements that
4072 * have the same name within the same scope. 4383 * have the same name within the same scope.
4384 *
4073 * @coverage dart.engine.element 4385 * @coverage dart.engine.element
4074 */ 4386 */
4075 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { 4387 class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
4076 4388
4077 /** 4389 /**
4078 * The analysis context in which the multiply defined elements are defined. 4390 * The analysis context in which the multiply defined elements are defined.
4079 */ 4391 */
4080 AnalysisContext _context; 4392 AnalysisContext _context;
4081 4393
4082 /** 4394 /**
4083 * The name of the conflicting elements. 4395 * The name of the conflicting elements.
4084 */ 4396 */
4085 String _name; 4397 String _name;
4086 4398
4087 /** 4399 /**
4088 * A list containing all of the elements that conflict. 4400 * A list containing all of the elements that conflict.
4089 */ 4401 */
4090 List<Element> _conflictingElements; 4402 List<Element> _conflictingElements;
4091 4403
4092 /** 4404 /**
4093 * Initialize a newly created element to represent a list of conflicting eleme nts. 4405 * Initialize a newly created element to represent a list of conflicting eleme nts.
4406 *
4094 * @param context the analysis context in which the multiply defined elements are defined 4407 * @param context the analysis context in which the multiply defined elements are defined
4095 * @param firstElement the first element that conflicts 4408 * @param firstElement the first element that conflicts
4096 * @param secondElement the second element that conflicts 4409 * @param secondElement the second element that conflicts
4097 */ 4410 */
4098 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem ent secondElement) { 4411 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem ent secondElement) {
4099 _name = firstElement.name; 4412 _name = firstElement.name;
4100 _conflictingElements = computeConflictingElements(firstElement, secondElemen t); 4413 _conflictingElements = computeConflictingElements(firstElement, secondElemen t);
4101 } 4414 }
4102 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); 4415 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this);
4103 String computeDocumentationComment() => null; 4416 String computeDocumentationComment() => null;
(...skipping 30 matching lines...) Expand all
4134 } 4447 }
4135 builder.append("]"); 4448 builder.append("]");
4136 return builder.toString(); 4449 return builder.toString();
4137 } 4450 }
4138 void visitChildren(ElementVisitor<Object> visitor) { 4451 void visitChildren(ElementVisitor<Object> visitor) {
4139 } 4452 }
4140 4453
4141 /** 4454 /**
4142 * Add the given element to the list of elements. If the element is a multiply -defined element, 4455 * Add the given element to the list of elements. If the element is a multiply -defined element,
4143 * add all of the conflicting elements that it represents. 4456 * add all of the conflicting elements that it represents.
4457 *
4144 * @param elements the list to which the element(s) are to be added 4458 * @param elements the list to which the element(s) are to be added
4145 * @param element the element(s) to be added 4459 * @param element the element(s) to be added
4146 */ 4460 */
4147 void add(List<Element> elements, Element element) { 4461 void add(List<Element> elements, Element element) {
4148 if (element is MultiplyDefinedElementImpl) { 4462 if (element is MultiplyDefinedElementImpl) {
4149 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl ))._conflictingElements) { 4463 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl ))._conflictingElements) {
4150 elements.add(conflictingElement); 4464 elements.add(conflictingElement);
4151 } 4465 }
4152 } else { 4466 } else {
4153 elements.add(element); 4467 elements.add(element);
4154 } 4468 }
4155 } 4469 }
4156 4470
4157 /** 4471 /**
4158 * Use the given elements to construct an array of conflicting elements. If ei ther of the given 4472 * Use the given elements to construct an array of conflicting elements. If ei ther of the given
4159 * elements are multiply-defined elements then the conflicting elements they r epresent will be 4473 * elements are multiply-defined elements then the conflicting elements they r epresent will be
4160 * included in the array. Otherwise, the element itself will be included. 4474 * included in the array. Otherwise, the element itself will be included.
4475 *
4161 * @param firstElement the first element to be included 4476 * @param firstElement the first element to be included
4162 * @param secondElement the second element to be included 4477 * @param secondElement the second element to be included
4163 * @return an array containing all of the conflicting elements 4478 * @return an array containing all of the conflicting elements
4164 */ 4479 */
4165 List<Element> computeConflictingElements(Element firstElement, Element secondE lement) { 4480 List<Element> computeConflictingElements(Element firstElement, Element secondE lement) {
4166 List<Element> elements = new List<Element>(); 4481 List<Element> elements = new List<Element>();
4167 add(elements, firstElement); 4482 add(elements, firstElement);
4168 add(elements, secondElement); 4483 add(elements, secondElement);
4169 return new List.from(elements); 4484 return new List.from(elements);
4170 } 4485 }
4171 } 4486 }
4172 /** 4487 /**
4173 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. 4488 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`.
4489 *
4174 * @coverage dart.engine.element 4490 * @coverage dart.engine.element
4175 */ 4491 */
4176 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme nt { 4492 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme nt {
4177 4493
4178 /** 4494 /**
4179 * An array containing all of the parameters defined by this parameter element . There will only be 4495 * An array containing all of the parameters defined by this parameter element . There will only be
4180 * parameters if this parameter is a function typed parameter. 4496 * parameters if this parameter is a function typed parameter.
4181 */ 4497 */
4182 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; 4498 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
4183 4499
(...skipping 24 matching lines...) Expand all
4208 */ 4524 */
4209 int _visibleRangeLength = -1; 4525 int _visibleRangeLength = -1;
4210 4526
4211 /** 4527 /**
4212 * An empty array of field elements. 4528 * An empty array of field elements.
4213 */ 4529 */
4214 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0); 4530 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0);
4215 4531
4216 /** 4532 /**
4217 * Initialize a newly created parameter element to have the given name. 4533 * Initialize a newly created parameter element to have the given name.
4534 *
4218 * @param name the name of this element 4535 * @param name the name of this element
4219 */ 4536 */
4220 ParameterElementImpl(Identifier name) : super.con1(name) { 4537 ParameterElementImpl(Identifier name) : super.con1(name) {
4221 } 4538 }
4222 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); 4539 accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
4223 SourceRange get defaultValueRange { 4540 SourceRange get defaultValueRange {
4224 if (_defaultValueRangeLength < 0) { 4541 if (_defaultValueRangeLength < 0) {
4225 return null; 4542 return null;
4226 } 4543 }
4227 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength); 4544 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength);
4228 } 4545 }
4229 ElementKind get kind => ElementKind.PARAMETER; 4546 ElementKind get kind => ElementKind.PARAMETER;
4230 ParameterKind get parameterKind => _parameterKind; 4547 ParameterKind get parameterKind => _parameterKind;
4231 List<ParameterElement> get parameters => _parameters; 4548 List<ParameterElement> get parameters => _parameters;
4232 SourceRange get visibleRange { 4549 SourceRange get visibleRange {
4233 if (_visibleRangeLength < 0) { 4550 if (_visibleRangeLength < 0) {
4234 return null; 4551 return null;
4235 } 4552 }
4236 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 4553 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
4237 } 4554 }
4238 bool get isInitializingFormal => false; 4555 bool get isInitializingFormal => false;
4239 4556
4240 /** 4557 /**
4241 * Set the range of the default value for this parameter to the range starting at the given offset 4558 * Set the range of the default value for this parameter to the range starting at the given offset
4242 * with the given length. 4559 * with the given length.
4560 *
4243 * @param offset the offset to the beginning of the default value range for th is element 4561 * @param offset the offset to the beginning of the default value range for th is element
4244 * @param length the length of the default value range for this element, or `- 1` if this 4562 * @param length the length of the default value range for this element, or `- 1` if this
4245 * element does not have a default value 4563 * element does not have a default value
4246 */ 4564 */
4247 void setDefaultValueRange(int offset, int length) { 4565 void setDefaultValueRange(int offset, int length) {
4248 _defaultValueRangeOffset = offset; 4566 _defaultValueRangeOffset = offset;
4249 _defaultValueRangeLength = length; 4567 _defaultValueRangeLength = length;
4250 } 4568 }
4251 4569
4252 /** 4570 /**
4253 * Set the kind of this parameter to the given kind. 4571 * Set the kind of this parameter to the given kind.
4572 *
4254 * @param parameterKind the new kind of this parameter 4573 * @param parameterKind the new kind of this parameter
4255 */ 4574 */
4256 void set parameterKind(ParameterKind parameterKind2) { 4575 void set parameterKind(ParameterKind parameterKind2) {
4257 this._parameterKind = parameterKind2; 4576 this._parameterKind = parameterKind2;
4258 } 4577 }
4259 4578
4260 /** 4579 /**
4261 * Set the parameters defined by this executable element to the given paramete rs. 4580 * Set the parameters defined by this executable element to the given paramete rs.
4581 *
4262 * @param parameters the parameters defined by this executable element 4582 * @param parameters the parameters defined by this executable element
4263 */ 4583 */
4264 void set parameters(List<ParameterElement> parameters2) { 4584 void set parameters(List<ParameterElement> parameters2) {
4265 for (ParameterElement parameter in parameters2) { 4585 for (ParameterElement parameter in parameters2) {
4266 ((parameter as ParameterElementImpl)).enclosingElement = this; 4586 ((parameter as ParameterElementImpl)).enclosingElement = this;
4267 } 4587 }
4268 this._parameters = parameters2; 4588 this._parameters = parameters2;
4269 } 4589 }
4270 4590
4271 /** 4591 /**
4272 * Set the visible range for this element to the range starting at the given o ffset with the given 4592 * Set the visible range for this element to the range starting at the given o ffset with the given
4273 * length. 4593 * length.
4594 *
4274 * @param offset the offset to the beginning of the visible range for this ele ment 4595 * @param offset the offset to the beginning of the visible range for this ele ment
4275 * @param length the length of the visible range for this element, or `-1` if this element 4596 * @param length the length of the visible range for this element, or `-1` if this element
4276 * does not have a visible range 4597 * does not have a visible range
4277 */ 4598 */
4278 void setVisibleRange(int offset, int length) { 4599 void setVisibleRange(int offset, int length) {
4279 _visibleRangeOffset = offset; 4600 _visibleRangeOffset = offset;
4280 _visibleRangeLength = length; 4601 _visibleRangeLength = length;
4281 } 4602 }
4282 void visitChildren(ElementVisitor<Object> visitor) { 4603 void visitChildren(ElementVisitor<Object> visitor) {
4283 super.visitChildren(visitor); 4604 super.visitChildren(visitor);
4284 safelyVisitChildren(_parameters, visitor); 4605 safelyVisitChildren(_parameters, visitor);
4285 } 4606 }
4286 void appendTo(JavaStringBuilder builder) { 4607 void appendTo(JavaStringBuilder builder) {
(...skipping 11 matching lines...) Expand all
4298 } 4619 }
4299 builder.append(left); 4620 builder.append(left);
4300 builder.append(type); 4621 builder.append(type);
4301 builder.append(" "); 4622 builder.append(" ");
4302 builder.append(displayName); 4623 builder.append(displayName);
4303 builder.append(right); 4624 builder.append(right);
4304 } 4625 }
4305 } 4626 }
4306 /** 4627 /**
4307 * Instances of the class `PrefixElementImpl` implement a `PrefixElement`. 4628 * Instances of the class `PrefixElementImpl` implement a `PrefixElement`.
4629 *
4308 * @coverage dart.engine.element 4630 * @coverage dart.engine.element
4309 */ 4631 */
4310 class PrefixElementImpl extends ElementImpl implements PrefixElement { 4632 class PrefixElementImpl extends ElementImpl implements PrefixElement {
4311 4633
4312 /** 4634 /**
4313 * An array containing all of the libraries that are imported using this prefi x. 4635 * An array containing all of the libraries that are imported using this prefi x.
4314 */ 4636 */
4315 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; 4637 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY;
4316 4638
4317 /** 4639 /**
4318 * An empty array of prefix elements. 4640 * An empty array of prefix elements.
4319 */ 4641 */
4320 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); 4642 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0);
4321 4643
4322 /** 4644 /**
4323 * Initialize a newly created prefix element to have the given name. 4645 * Initialize a newly created prefix element to have the given name.
4646 *
4324 * @param name the name of this element 4647 * @param name the name of this element
4325 */ 4648 */
4326 PrefixElementImpl(Identifier name) : super.con1(name) { 4649 PrefixElementImpl(Identifier name) : super.con1(name) {
4327 } 4650 }
4328 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); 4651 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this);
4329 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t; 4652 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t;
4330 List<LibraryElement> get importedLibraries => _importedLibraries; 4653 List<LibraryElement> get importedLibraries => _importedLibraries;
4331 ElementKind get kind => ElementKind.PREFIX; 4654 ElementKind get kind => ElementKind.PREFIX;
4332 4655
4333 /** 4656 /**
4334 * Set the libraries that are imported using this prefix to the given librarie s. 4657 * Set the libraries that are imported using this prefix to the given librarie s.
4658 *
4335 * @param importedLibraries the libraries that are imported using this prefix 4659 * @param importedLibraries the libraries that are imported using this prefix
4336 */ 4660 */
4337 void set importedLibraries(List<LibraryElement> importedLibraries2) { 4661 void set importedLibraries(List<LibraryElement> importedLibraries2) {
4338 for (LibraryElement library in importedLibraries2) { 4662 for (LibraryElement library in importedLibraries2) {
4339 ((library as LibraryElementImpl)).enclosingElement = this; 4663 ((library as LibraryElementImpl)).enclosingElement = this;
4340 } 4664 }
4341 this._importedLibraries = importedLibraries2; 4665 this._importedLibraries = importedLibraries2;
4342 } 4666 }
4343 void appendTo(JavaStringBuilder builder) { 4667 void appendTo(JavaStringBuilder builder) {
4344 builder.append("as "); 4668 builder.append("as ");
4345 super.appendTo(builder); 4669 super.appendTo(builder);
4346 } 4670 }
4347 } 4671 }
4348 /** 4672 /**
4349 * Instances of the class `PropertyAccessorElementImpl` implement a`PropertyAcce ssorElement`. 4673 * Instances of the class `PropertyAccessorElementImpl` implement a
4674 * `PropertyAccessorElement`.
4675 *
4350 * @coverage dart.engine.element 4676 * @coverage dart.engine.element
4351 */ 4677 */
4352 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement { 4678 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement {
4353 4679
4354 /** 4680 /**
4355 * The variable associated with this accessor. 4681 * The variable associated with this accessor.
4356 */ 4682 */
4357 PropertyInducingElement _variable; 4683 PropertyInducingElement _variable;
4358 4684
4359 /** 4685 /**
4360 * An empty array of property accessor elements. 4686 * An empty array of property accessor elements.
4361 */ 4687 */
4362 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl ement>(0); 4688 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl ement>(0);
4363 4689
4364 /** 4690 /**
4365 * Initialize a newly created property accessor element to have the given name . 4691 * Initialize a newly created property accessor element to have the given name .
4692 *
4366 * @param name the name of this element 4693 * @param name the name of this element
4367 */ 4694 */
4368 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) { 4695 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) {
4369 _jtd_constructor_224_impl(name); 4696 _jtd_constructor_224_impl(name);
4370 } 4697 }
4371 _jtd_constructor_224_impl(Identifier name) { 4698 _jtd_constructor_224_impl(Identifier name) {
4372 } 4699 }
4373 4700
4374 /** 4701 /**
4375 * Initialize a newly created synthetic property accessor element to be associ ated with the given 4702 * Initialize a newly created synthetic property accessor element to be associ ated with the given
4376 * variable. 4703 * variable.
4704 *
4377 * @param variable the variable with which this access is associated 4705 * @param variable the variable with which this access is associated
4378 */ 4706 */
4379 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : supe r.con2(variable2.name, variable2.nameOffset) { 4707 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : supe r.con2(variable2.name, variable2.nameOffset) {
4380 _jtd_constructor_225_impl(variable2); 4708 _jtd_constructor_225_impl(variable2);
4381 } 4709 }
4382 _jtd_constructor_225_impl(PropertyInducingElementImpl variable2) { 4710 _jtd_constructor_225_impl(PropertyInducingElementImpl variable2) {
4383 this._variable = variable2; 4711 this._variable = variable2;
4384 synthetic = true; 4712 synthetic = true;
4385 } 4713 }
4386 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); 4714 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this);
(...skipping 23 matching lines...) Expand all
4410 return super.name; 4738 return super.name;
4411 } 4739 }
4412 PropertyInducingElement get variable => _variable; 4740 PropertyInducingElement get variable => _variable;
4413 bool get isAbstract => hasModifier(Modifier.ABSTRACT); 4741 bool get isAbstract => hasModifier(Modifier.ABSTRACT);
4414 bool get isGetter => hasModifier(Modifier.GETTER); 4742 bool get isGetter => hasModifier(Modifier.GETTER);
4415 bool get isSetter => hasModifier(Modifier.SETTER); 4743 bool get isSetter => hasModifier(Modifier.SETTER);
4416 bool get isStatic => hasModifier(Modifier.STATIC); 4744 bool get isStatic => hasModifier(Modifier.STATIC);
4417 4745
4418 /** 4746 /**
4419 * Set whether this accessor is abstract to correspond to the given value. 4747 * Set whether this accessor is abstract to correspond to the given value.
4748 *
4420 * @param isAbstract `true` if the accessor is abstract 4749 * @param isAbstract `true` if the accessor is abstract
4421 */ 4750 */
4422 void set abstract(bool isAbstract) { 4751 void set abstract(bool isAbstract) {
4423 setModifier(Modifier.ABSTRACT, isAbstract); 4752 setModifier(Modifier.ABSTRACT, isAbstract);
4424 } 4753 }
4425 4754
4426 /** 4755 /**
4427 * Set whether this accessor is a getter to correspond to the given value. 4756 * Set whether this accessor is a getter to correspond to the given value.
4757 *
4428 * @param isGetter `true` if the accessor is a getter 4758 * @param isGetter `true` if the accessor is a getter
4429 */ 4759 */
4430 void set getter(bool isGetter) { 4760 void set getter(bool isGetter) {
4431 setModifier(Modifier.GETTER, isGetter); 4761 setModifier(Modifier.GETTER, isGetter);
4432 } 4762 }
4433 4763
4434 /** 4764 /**
4435 * Set whether this accessor is a setter to correspond to the given value. 4765 * Set whether this accessor is a setter to correspond to the given value.
4766 *
4436 * @param isSetter `true` if the accessor is a setter 4767 * @param isSetter `true` if the accessor is a setter
4437 */ 4768 */
4438 void set setter(bool isSetter) { 4769 void set setter(bool isSetter) {
4439 setModifier(Modifier.SETTER, isSetter); 4770 setModifier(Modifier.SETTER, isSetter);
4440 } 4771 }
4441 4772
4442 /** 4773 /**
4443 * Set whether this accessor is static to correspond to the given value. 4774 * Set whether this accessor is static to correspond to the given value.
4775 *
4444 * @param isStatic `true` if the accessor is static 4776 * @param isStatic `true` if the accessor is static
4445 */ 4777 */
4446 void set static(bool isStatic) { 4778 void set static(bool isStatic) {
4447 setModifier(Modifier.STATIC, isStatic); 4779 setModifier(Modifier.STATIC, isStatic);
4448 } 4780 }
4449 4781
4450 /** 4782 /**
4451 * Set the variable associated with this accessor to the given variable. 4783 * Set the variable associated with this accessor to the given variable.
4784 *
4452 * @param variable the variable associated with this accessor 4785 * @param variable the variable associated with this accessor
4453 */ 4786 */
4454 void set variable(PropertyInducingElement variable2) { 4787 void set variable(PropertyInducingElement variable2) {
4455 this._variable = variable2; 4788 this._variable = variable2;
4456 } 4789 }
4457 void appendTo(JavaStringBuilder builder) { 4790 void appendTo(JavaStringBuilder builder) {
4458 builder.append(isGetter ? "get " : "set "); 4791 builder.append(isGetter ? "get " : "set ");
4459 builder.append(variable.displayName); 4792 builder.append(variable.displayName);
4460 super.appendTo(builder); 4793 super.appendTo(builder);
4461 } 4794 }
4462 } 4795 }
4463 /** 4796 /**
4464 * Instances of the class `PropertyInducingElementImpl` implement a`PropertyIndu cingElement`. 4797 * Instances of the class `PropertyInducingElementImpl` implement a
4798 * `PropertyInducingElement`.
4799 *
4465 * @coverage dart.engine.element 4800 * @coverage dart.engine.element
4466 */ 4801 */
4467 abstract class PropertyInducingElementImpl extends VariableElementImpl implement s PropertyInducingElement { 4802 abstract class PropertyInducingElementImpl extends VariableElementImpl implement s PropertyInducingElement {
4468 4803
4469 /** 4804 /**
4470 * The getter associated with this element. 4805 * The getter associated with this element.
4471 */ 4806 */
4472 PropertyAccessorElement _getter; 4807 PropertyAccessorElement _getter;
4473 4808
4474 /** 4809 /**
4475 * The setter associated with this element, or `null` if the element is effect ively`final` and therefore does not have a setter associated with it. 4810 * The setter associated with this element, or `null` if the element is effect ively
4811 * `final` and therefore does not have a setter associated with it.
4476 */ 4812 */
4477 PropertyAccessorElement _setter; 4813 PropertyAccessorElement _setter;
4478 4814
4479 /** 4815 /**
4480 * An empty array of elements. 4816 * An empty array of elements.
4481 */ 4817 */
4482 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl ement>(0); 4818 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl ement>(0);
4483 4819
4484 /** 4820 /**
4485 * Initialize a newly created element to have the given name. 4821 * Initialize a newly created element to have the given name.
4822 *
4486 * @param name the name of this element 4823 * @param name the name of this element
4487 */ 4824 */
4488 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) { 4825 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) {
4489 _jtd_constructor_226_impl(name); 4826 _jtd_constructor_226_impl(name);
4490 } 4827 }
4491 _jtd_constructor_226_impl(Identifier name) { 4828 _jtd_constructor_226_impl(Identifier name) {
4492 } 4829 }
4493 4830
4494 /** 4831 /**
4495 * Initialize a newly created synthetic element to have the given name. 4832 * Initialize a newly created synthetic element to have the given name.
4833 *
4496 * @param name the name of this element 4834 * @param name the name of this element
4497 */ 4835 */
4498 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { 4836 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) {
4499 _jtd_constructor_227_impl(name); 4837 _jtd_constructor_227_impl(name);
4500 } 4838 }
4501 _jtd_constructor_227_impl(String name) { 4839 _jtd_constructor_227_impl(String name) {
4502 synthetic = true; 4840 synthetic = true;
4503 } 4841 }
4504 PropertyAccessorElement get getter => _getter; 4842 PropertyAccessorElement get getter => _getter;
4505 PropertyAccessorElement get setter => _setter; 4843 PropertyAccessorElement get setter => _setter;
4506 4844
4507 /** 4845 /**
4508 * Set the getter associated with this element to the given accessor. 4846 * Set the getter associated with this element to the given accessor.
4847 *
4509 * @param getter the getter associated with this element 4848 * @param getter the getter associated with this element
4510 */ 4849 */
4511 void set getter(PropertyAccessorElement getter2) { 4850 void set getter(PropertyAccessorElement getter2) {
4512 this._getter = getter2; 4851 this._getter = getter2;
4513 } 4852 }
4514 4853
4515 /** 4854 /**
4516 * Set the setter associated with this element to the given accessor. 4855 * Set the setter associated with this element to the given accessor.
4856 *
4517 * @param setter the setter associated with this element 4857 * @param setter the setter associated with this element
4518 */ 4858 */
4519 void set setter(PropertyAccessorElement setter2) { 4859 void set setter(PropertyAccessorElement setter2) {
4520 this._setter = setter2; 4860 this._setter = setter2;
4521 } 4861 }
4522 } 4862 }
4523 /** 4863 /**
4524 * Instances of the class `ShowElementCombinatorImpl` implement a[ShowElementCom binator]. 4864 * Instances of the class `ShowElementCombinatorImpl` implement a
4865 * [ShowElementCombinator].
4866 *
4525 * @coverage dart.engine.element 4867 * @coverage dart.engine.element
4526 */ 4868 */
4527 class ShowElementCombinatorImpl implements ShowElementCombinator { 4869 class ShowElementCombinatorImpl implements ShowElementCombinator {
4528 4870
4529 /** 4871 /**
4530 * The names that are to be made visible in the importing library if they are defined in the 4872 * The names that are to be made visible in the importing library if they are defined in the
4531 * imported library. 4873 * imported library.
4532 */ 4874 */
4533 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; 4875 List<String> _shownNames = StringUtilities.EMPTY_ARRAY;
4534 List<String> get shownNames => _shownNames; 4876 List<String> get shownNames => _shownNames;
4535 4877
4536 /** 4878 /**
4537 * Set the names that are to be made visible in the importing library if they are defined in the 4879 * Set the names that are to be made visible in the importing library if they are defined in the
4538 * imported library to the given names. 4880 * imported library to the given names.
4881 *
4539 * @param shownNames the names that are to be made visible in the importing li brary 4882 * @param shownNames the names that are to be made visible in the importing li brary
4540 */ 4883 */
4541 void set shownNames(List<String> shownNames2) { 4884 void set shownNames(List<String> shownNames2) {
4542 this._shownNames = shownNames2; 4885 this._shownNames = shownNames2;
4543 } 4886 }
4544 String toString() { 4887 String toString() {
4545 JavaStringBuilder builder = new JavaStringBuilder(); 4888 JavaStringBuilder builder = new JavaStringBuilder();
4546 builder.append("show "); 4889 builder.append("show ");
4547 int count = _shownNames.length; 4890 int count = _shownNames.length;
4548 for (int i = 0; i < count; i++) { 4891 for (int i = 0; i < count; i++) {
4549 if (i > 0) { 4892 if (i > 0) {
4550 builder.append(", "); 4893 builder.append(", ");
4551 } 4894 }
4552 builder.append(_shownNames[i]); 4895 builder.append(_shownNames[i]);
4553 } 4896 }
4554 return builder.toString(); 4897 return builder.toString();
4555 } 4898 }
4556 } 4899 }
4557 /** 4900 /**
4558 * Instances of the class `TopLevelVariableElementImpl` implement a`TopLevelVari ableElement`. 4901 * Instances of the class `TopLevelVariableElementImpl` implement a
4902 * `TopLevelVariableElement`.
4903 *
4559 * @coverage dart.engine.element 4904 * @coverage dart.engine.element
4560 */ 4905 */
4561 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement { 4906 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement {
4562 4907
4563 /** 4908 /**
4564 * An empty array of top-level variable elements. 4909 * An empty array of top-level variable elements.
4565 */ 4910 */
4566 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl ement>(0); 4911 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl ement>(0);
4567 4912
4568 /** 4913 /**
4569 * Initialize a newly created top-level variable element to have the given nam e. 4914 * Initialize a newly created top-level variable element to have the given nam e.
4915 *
4570 * @param name the name of this element 4916 * @param name the name of this element
4571 */ 4917 */
4572 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) { 4918 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) {
4573 _jtd_constructor_229_impl(name); 4919 _jtd_constructor_229_impl(name);
4574 } 4920 }
4575 _jtd_constructor_229_impl(Identifier name) { 4921 _jtd_constructor_229_impl(Identifier name) {
4576 } 4922 }
4577 4923
4578 /** 4924 /**
4579 * Initialize a newly created synthetic top-level variable element to have the given name. 4925 * Initialize a newly created synthetic top-level variable element to have the given name.
4926 *
4580 * @param name the name of this element 4927 * @param name the name of this element
4581 */ 4928 */
4582 TopLevelVariableElementImpl.con2(String name) : super.con2(name) { 4929 TopLevelVariableElementImpl.con2(String name) : super.con2(name) {
4583 _jtd_constructor_230_impl(name); 4930 _jtd_constructor_230_impl(name);
4584 } 4931 }
4585 _jtd_constructor_230_impl(String name) { 4932 _jtd_constructor_230_impl(String name) {
4586 } 4933 }
4587 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); 4934 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this);
4588 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; 4935 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
4589 bool get isStatic => true; 4936 bool get isStatic => true;
4590 } 4937 }
4591 /** 4938 /**
4592 * Instances of the class `TypeVariableElementImpl` implement a `TypeVariableEle ment`. 4939 * Instances of the class `TypeVariableElementImpl` implement a `TypeVariableEle ment`.
4940 *
4593 * @coverage dart.engine.element 4941 * @coverage dart.engine.element
4594 */ 4942 */
4595 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement { 4943 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement {
4596 4944
4597 /** 4945 /**
4598 * The type defined by this type variable. 4946 * The type defined by this type variable.
4599 */ 4947 */
4600 TypeVariableType _type; 4948 TypeVariableType _type;
4601 4949
4602 /** 4950 /**
4603 * The type representing the bound associated with this variable, or `null` if this variable 4951 * The type representing the bound associated with this variable, or `null` if this variable
4604 * does not have an explicit bound. 4952 * does not have an explicit bound.
4605 */ 4953 */
4606 Type2 _bound; 4954 Type2 _bound;
4607 4955
4608 /** 4956 /**
4609 * An empty array of type variable elements. 4957 * An empty array of type variable elements.
4610 */ 4958 */
4611 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0 ); 4959 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0 );
4612 4960
4613 /** 4961 /**
4614 * Initialize a newly created type variable element to have the given name. 4962 * Initialize a newly created type variable element to have the given name.
4963 *
4615 * @param name the name of this element 4964 * @param name the name of this element
4616 */ 4965 */
4617 TypeVariableElementImpl(Identifier name) : super.con1(name) { 4966 TypeVariableElementImpl(Identifier name) : super.con1(name) {
4618 } 4967 }
4619 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this); 4968 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this);
4620 Type2 get bound => _bound; 4969 Type2 get bound => _bound;
4621 ElementKind get kind => ElementKind.TYPE_VARIABLE; 4970 ElementKind get kind => ElementKind.TYPE_VARIABLE;
4622 TypeVariableType get type => _type; 4971 TypeVariableType get type => _type;
4623 4972
4624 /** 4973 /**
4625 * Set the type representing the bound associated with this variable to the gi ven type. 4974 * Set the type representing the bound associated with this variable to the gi ven type.
4975 *
4626 * @param bound the type representing the bound associated with this variable 4976 * @param bound the type representing the bound associated with this variable
4627 */ 4977 */
4628 void set bound(Type2 bound2) { 4978 void set bound(Type2 bound2) {
4629 this._bound = bound2; 4979 this._bound = bound2;
4630 } 4980 }
4631 4981
4632 /** 4982 /**
4633 * Set the type defined by this type variable to the given type 4983 * Set the type defined by this type variable to the given type
4984 *
4634 * @param type the type defined by this type variable 4985 * @param type the type defined by this type variable
4635 */ 4986 */
4636 void set type(TypeVariableType type2) { 4987 void set type(TypeVariableType type2) {
4637 this._type = type2; 4988 this._type = type2;
4638 } 4989 }
4639 void appendTo(JavaStringBuilder builder) { 4990 void appendTo(JavaStringBuilder builder) {
4640 builder.append(displayName); 4991 builder.append(displayName);
4641 if (_bound != null) { 4992 if (_bound != null) {
4642 builder.append(" extends "); 4993 builder.append(" extends ");
4643 builder.append(_bound); 4994 builder.append(_bound);
4644 } 4995 }
4645 } 4996 }
4646 } 4997 }
4647 /** 4998 /**
4648 * Instances of the class `VariableElementImpl` implement a `VariableElement`. 4999 * Instances of the class `VariableElementImpl` implement a `VariableElement`.
5000 *
4649 * @coverage dart.engine.element 5001 * @coverage dart.engine.element
4650 */ 5002 */
4651 abstract class VariableElementImpl extends ElementImpl implements VariableElemen t { 5003 abstract class VariableElementImpl extends ElementImpl implements VariableElemen t {
4652 5004
4653 /** 5005 /**
4654 * The declared type of this variable. 5006 * The declared type of this variable.
4655 */ 5007 */
4656 Type2 _type; 5008 Type2 _type;
4657 5009
4658 /** 5010 /**
4659 * A synthetic function representing this variable's initializer, or `null` if this variable 5011 * A synthetic function representing this variable's initializer, or `null` if this variable
4660 * does not have an initializer. 5012 * does not have an initializer.
4661 */ 5013 */
4662 FunctionElement _initializer; 5014 FunctionElement _initializer;
4663 5015
4664 /** 5016 /**
4665 * An empty array of variable elements. 5017 * An empty array of variable elements.
4666 */ 5018 */
4667 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0); 5019 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0);
4668 5020
4669 /** 5021 /**
4670 * Initialize a newly created variable element to have the given name. 5022 * Initialize a newly created variable element to have the given name.
5023 *
4671 * @param name the name of this element 5024 * @param name the name of this element
4672 */ 5025 */
4673 VariableElementImpl.con1(Identifier name) : super.con1(name) { 5026 VariableElementImpl.con1(Identifier name) : super.con1(name) {
4674 _jtd_constructor_232_impl(name); 5027 _jtd_constructor_232_impl(name);
4675 } 5028 }
4676 _jtd_constructor_232_impl(Identifier name) { 5029 _jtd_constructor_232_impl(Identifier name) {
4677 } 5030 }
4678 5031
4679 /** 5032 /**
4680 * Initialize a newly created variable element to have the given name. 5033 * Initialize a newly created variable element to have the given name.
5034 *
4681 * @param name the name of this element 5035 * @param name the name of this element
4682 * @param nameOffset the offset of the name of this element in the file that c ontains the 5036 * @param nameOffset the offset of the name of this element in the file that c ontains the
4683 * declaration of this element 5037 * declaration of this element
4684 */ 5038 */
4685 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO ffset) { 5039 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO ffset) {
4686 _jtd_constructor_233_impl(name, nameOffset); 5040 _jtd_constructor_233_impl(name, nameOffset);
4687 } 5041 }
4688 _jtd_constructor_233_impl(String name, int nameOffset) { 5042 _jtd_constructor_233_impl(String name, int nameOffset) {
4689 } 5043 }
4690 5044
4691 /** 5045 /**
4692 * Return the result of evaluating this variable's initializer as a compile-ti me constant 5046 * Return the result of evaluating this variable's initializer as a compile-ti me constant
4693 * expression, or `null` if this variable is not a 'const' variable or does no t have an 5047 * expression, or `null` if this variable is not a 'const' variable or does no t have an
4694 * initializer. 5048 * initializer.
5049 *
4695 * @return the result of evaluating this variable's initializer 5050 * @return the result of evaluating this variable's initializer
4696 */ 5051 */
4697 EvaluationResultImpl get evaluationResult => null; 5052 EvaluationResultImpl get evaluationResult => null;
4698 FunctionElement get initializer => _initializer; 5053 FunctionElement get initializer => _initializer;
4699 Type2 get type => _type; 5054 Type2 get type => _type;
4700 bool get isConst => hasModifier(Modifier.CONST); 5055 bool get isConst => hasModifier(Modifier.CONST);
4701 bool get isFinal => hasModifier(Modifier.FINAL); 5056 bool get isFinal => hasModifier(Modifier.FINAL);
4702 5057
4703 /** 5058 /**
4704 * Set whether this variable is const to correspond to the given value. 5059 * Set whether this variable is const to correspond to the given value.
5060 *
4705 * @param isConst `true` if the variable is const 5061 * @param isConst `true` if the variable is const
4706 */ 5062 */
4707 void set const3(bool isConst) { 5063 void set const3(bool isConst) {
4708 setModifier(Modifier.CONST, isConst); 5064 setModifier(Modifier.CONST, isConst);
4709 } 5065 }
4710 5066
4711 /** 5067 /**
4712 * Set the result of evaluating this variable's initializer as a compile-time constant expression 5068 * Set the result of evaluating this variable's initializer as a compile-time constant expression
4713 * to the given result. 5069 * to the given result.
5070 *
4714 * @param result the result of evaluating this variable's initializer 5071 * @param result the result of evaluating this variable's initializer
4715 */ 5072 */
4716 void set evaluationResult(EvaluationResultImpl result) { 5073 void set evaluationResult(EvaluationResultImpl result) {
4717 throw new IllegalStateException("Invalid attempt to set a compile-time const ant result"); 5074 throw new IllegalStateException("Invalid attempt to set a compile-time const ant result");
4718 } 5075 }
4719 5076
4720 /** 5077 /**
4721 * Set whether this variable is final to correspond to the given value. 5078 * Set whether this variable is final to correspond to the given value.
5079 *
4722 * @param isFinal `true` if the variable is final 5080 * @param isFinal `true` if the variable is final
4723 */ 5081 */
4724 void set final2(bool isFinal) { 5082 void set final2(bool isFinal) {
4725 setModifier(Modifier.FINAL, isFinal); 5083 setModifier(Modifier.FINAL, isFinal);
4726 } 5084 }
4727 5085
4728 /** 5086 /**
4729 * Set the function representing this variable's initializer to the given func tion. 5087 * Set the function representing this variable's initializer to the given func tion.
5088 *
4730 * @param initializer the function representing this variable's initializer 5089 * @param initializer the function representing this variable's initializer
4731 */ 5090 */
4732 void set initializer(FunctionElement initializer2) { 5091 void set initializer(FunctionElement initializer2) {
4733 if (initializer2 != null) { 5092 if (initializer2 != null) {
4734 ((initializer2 as FunctionElementImpl)).enclosingElement = this; 5093 ((initializer2 as FunctionElementImpl)).enclosingElement = this;
4735 } 5094 }
4736 this._initializer = initializer2; 5095 this._initializer = initializer2;
4737 } 5096 }
4738 5097
4739 /** 5098 /**
4740 * Set the declared type of this variable to the given type. 5099 * Set the declared type of this variable to the given type.
5100 *
4741 * @param type the declared type of this variable 5101 * @param type the declared type of this variable
4742 */ 5102 */
4743 void set type(Type2 type2) { 5103 void set type(Type2 type2) {
4744 this._type = type2; 5104 this._type = type2;
4745 } 5105 }
4746 void visitChildren(ElementVisitor<Object> visitor) { 5106 void visitChildren(ElementVisitor<Object> visitor) {
4747 super.visitChildren(visitor); 5107 super.visitChildren(visitor);
4748 safelyVisitChild(_initializer, visitor); 5108 safelyVisitChild(_initializer, visitor);
4749 } 5109 }
4750 void appendTo(JavaStringBuilder builder) { 5110 void appendTo(JavaStringBuilder builder) {
4751 builder.append(type); 5111 builder.append(type);
4752 builder.append(" "); 5112 builder.append(" ");
4753 builder.append(displayName); 5113 builder.append(displayName);
4754 } 5114 }
4755 } 5115 }
4756 /** 5116 /**
4757 * Instances of the class `ConstructorMember` represent a constructor element de fined in a 5117 * Instances of the class `ConstructorMember` represent a constructor element de fined in a
4758 * parameterized type where the values of the type parameters are known. 5118 * parameterized type where the values of the type parameters are known.
4759 */ 5119 */
4760 class ConstructorMember extends ExecutableMember implements ConstructorElement { 5120 class ConstructorMember extends ExecutableMember implements ConstructorElement {
4761 5121
4762 /** 5122 /**
4763 * If the given constructor's type is different when any type parameters from the defining type's 5123 * If the given constructor's type is different when any type parameters from the defining type's
4764 * declaration are replaced with the actual type arguments from the defining t ype, create a 5124 * declaration are replaced with the actual type arguments from the defining t ype, create a
4765 * constructor member representing the given constructor. Return the member th at was created, or 5125 * constructor member representing the given constructor. Return the member th at was created, or
4766 * the base constructor if no member was created. 5126 * the base constructor if no member was created.
5127 *
4767 * @param baseConstructor the base constructor for which a member might be cre ated 5128 * @param baseConstructor the base constructor for which a member might be cre ated
4768 * @param definingType the type defining the parameters and arguments to be us ed in the 5129 * @param definingType the type defining the parameters and arguments to be us ed in the
4769 * substitution 5130 * substitution
4770 * @return the constructor element that will return the correctly substituted types 5131 * @return the constructor element that will return the correctly substituted types
4771 */ 5132 */
4772 static ConstructorElement from(ConstructorElement baseConstructor, InterfaceTy pe definingType) { 5133 static ConstructorElement from(ConstructorElement baseConstructor, InterfaceTy pe definingType) {
4773 if (baseConstructor == null || definingType.typeArguments.length == 0) { 5134 if (baseConstructor == null || definingType.typeArguments.length == 0) {
4774 return baseConstructor; 5135 return baseConstructor;
4775 } 5136 }
4776 FunctionType baseType = baseConstructor.type; 5137 FunctionType baseType = baseConstructor.type;
4777 List<Type2> argumentTypes = definingType.typeArguments; 5138 List<Type2> argumentTypes = definingType.typeArguments;
4778 List<Type2> parameterTypes = definingType.element.type.typeArguments; 5139 List<Type2> parameterTypes = definingType.element.type.typeArguments;
4779 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter Types); 5140 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter Types);
4780 if (baseType == substitutedType) { 5141 if (baseType == substitutedType) {
4781 return baseConstructor; 5142 return baseConstructor;
4782 } 5143 }
4783 return new ConstructorMember(baseConstructor, definingType); 5144 return new ConstructorMember(baseConstructor, definingType);
4784 } 5145 }
4785 5146
4786 /** 5147 /**
4787 * Initialize a newly created element to represent a constructor of the given parameterized type. 5148 * Initialize a newly created element to represent a constructor of the given parameterized type.
5149 *
4788 * @param baseElement the element on which the parameterized element was creat ed 5150 * @param baseElement the element on which the parameterized element was creat ed
4789 * @param definingType the type in which the element is defined 5151 * @param definingType the type in which the element is defined
4790 */ 5152 */
4791 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType) : super(baseElement, definingType) { 5153 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
4792 } 5154 }
4793 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); 5155 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
4794 ConstructorElement get baseElement => super.baseElement as ConstructorElement; 5156 ConstructorElement get baseElement => super.baseElement as ConstructorElement;
4795 ClassElement get enclosingElement => baseElement.enclosingElement; 5157 ClassElement get enclosingElement => baseElement.enclosingElement;
4796 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon structor, definingType); 5158 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon structor, definingType);
4797 bool get isConst => baseElement.isConst; 5159 bool get isConst => baseElement.isConst;
(...skipping 30 matching lines...) Expand all
4828 /** 5190 /**
4829 * The abstract class `ExecutableMember` defines the behavior common to members that represent 5191 * The abstract class `ExecutableMember` defines the behavior common to members that represent
4830 * an executable element defined in a parameterized type where the values of the type parameters are 5192 * an executable element defined in a parameterized type where the values of the type parameters are
4831 * known. 5193 * known.
4832 */ 5194 */
4833 abstract class ExecutableMember extends Member implements ExecutableElement { 5195 abstract class ExecutableMember extends Member implements ExecutableElement {
4834 5196
4835 /** 5197 /**
4836 * Initialize a newly created element to represent an executable element of th e given 5198 * Initialize a newly created element to represent an executable element of th e given
4837 * parameterized type. 5199 * parameterized type.
5200 *
4838 * @param baseElement the element on which the parameterized element was creat ed 5201 * @param baseElement the element on which the parameterized element was creat ed
4839 * @param definingType the type in which the element is defined 5202 * @param definingType the type in which the element is defined
4840 */ 5203 */
4841 ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) : super(baseElement, definingType) { 5204 ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
4842 } 5205 }
4843 ExecutableElement get baseElement => super.baseElement as ExecutableElement; 5206 ExecutableElement get baseElement => super.baseElement as ExecutableElement;
4844 List<FunctionElement> get functions { 5207 List<FunctionElement> get functions {
4845 throw new UnsupportedOperationException(); 5208 throw new UnsupportedOperationException();
4846 } 5209 }
4847 List<LabelElement> get labels => baseElement.labels; 5210 List<LabelElement> get labels => baseElement.labels;
(...skipping 28 matching lines...) Expand all
4876 * Instances of the class `FieldMember` represent a field element defined in a p arameterized 5239 * Instances of the class `FieldMember` represent a field element defined in a p arameterized
4877 * type where the values of the type parameters are known. 5240 * type where the values of the type parameters are known.
4878 */ 5241 */
4879 class FieldMember extends VariableMember implements FieldElement { 5242 class FieldMember extends VariableMember implements FieldElement {
4880 5243
4881 /** 5244 /**
4882 * If the given field's type is different when any type parameters from the de fining type's 5245 * If the given field's type is different when any type parameters from the de fining type's
4883 * declaration are replaced with the actual type arguments from the defining t ype, create a field 5246 * declaration are replaced with the actual type arguments from the defining t ype, create a field
4884 * member representing the given field. Return the member that was created, or the base field if 5247 * member representing the given field. Return the member that was created, or the base field if
4885 * no member was created. 5248 * no member was created.
5249 *
4886 * @param baseField the base field for which a member might be created 5250 * @param baseField the base field for which a member might be created
4887 * @param definingType the type defining the parameters and arguments to be us ed in the 5251 * @param definingType the type defining the parameters and arguments to be us ed in the
4888 * substitution 5252 * substitution
4889 * @return the field element that will return the correctly substituted types 5253 * @return the field element that will return the correctly substituted types
4890 */ 5254 */
4891 static FieldElement from(FieldElement baseField, InterfaceType definingType) { 5255 static FieldElement from(FieldElement baseField, InterfaceType definingType) {
4892 if (baseField == null || definingType.typeArguments.length == 0) { 5256 if (baseField == null || definingType.typeArguments.length == 0) {
4893 return baseField; 5257 return baseField;
4894 } 5258 }
4895 Type2 baseType = baseField.type; 5259 Type2 baseType = baseField.type;
4896 if (baseType == null) { 5260 if (baseType == null) {
4897 return baseField; 5261 return baseField;
4898 } 5262 }
4899 List<Type2> argumentTypes = definingType.typeArguments; 5263 List<Type2> argumentTypes = definingType.typeArguments;
4900 List<Type2> parameterTypes = definingType.element.type.typeArguments; 5264 List<Type2> parameterTypes = definingType.element.type.typeArguments;
4901 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); 5265 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
4902 if (baseType == substitutedType) { 5266 if (baseType == substitutedType) {
4903 return baseField; 5267 return baseField;
4904 } 5268 }
4905 return new FieldMember(baseField, definingType); 5269 return new FieldMember(baseField, definingType);
4906 } 5270 }
4907 5271
4908 /** 5272 /**
4909 * Initialize a newly created element to represent a field of the given parame terized type. 5273 * Initialize a newly created element to represent a field of the given parame terized type.
5274 *
4910 * @param baseElement the element on which the parameterized element was creat ed 5275 * @param baseElement the element on which the parameterized element was creat ed
4911 * @param definingType the type in which the element is defined 5276 * @param definingType the type in which the element is defined
4912 */ 5277 */
4913 FieldMember(FieldElement baseElement, InterfaceType definingType) : super(base Element, definingType) { 5278 FieldMember(FieldElement baseElement, InterfaceType definingType) : super(base Element, definingType) {
4914 } 5279 }
4915 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); 5280 accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
4916 FieldElement get baseElement => super.baseElement as FieldElement; 5281 FieldElement get baseElement => super.baseElement as FieldElement;
4917 ClassElement get enclosingElement => baseElement.enclosingElement; 5282 ClassElement get enclosingElement => baseElement.enclosingElement;
4918 PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement. getter, definingType); 5283 PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement. getter, definingType);
4919 PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement. setter, definingType); 5284 PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement. setter, definingType);
(...skipping 11 matching lines...) Expand all
4931 */ 5296 */
4932 Element _baseElement; 5297 Element _baseElement;
4933 5298
4934 /** 5299 /**
4935 * The type in which the element is defined. 5300 * The type in which the element is defined.
4936 */ 5301 */
4937 ParameterizedType _definingType; 5302 ParameterizedType _definingType;
4938 5303
4939 /** 5304 /**
4940 * Initialize a newly created element to represent the member of the given par ameterized type. 5305 * Initialize a newly created element to represent the member of the given par ameterized type.
5306 *
4941 * @param baseElement the element on which the parameterized element was creat ed 5307 * @param baseElement the element on which the parameterized element was creat ed
4942 * @param definingType the type in which the element is defined 5308 * @param definingType the type in which the element is defined
4943 */ 5309 */
4944 Member(Element baseElement, ParameterizedType definingType) { 5310 Member(Element baseElement, ParameterizedType definingType) {
4945 this._baseElement = baseElement; 5311 this._baseElement = baseElement;
4946 this._definingType = definingType; 5312 this._definingType = definingType;
4947 } 5313 }
4948 String computeDocumentationComment() => _baseElement.computeDocumentationComme nt(); 5314 String computeDocumentationComment() => _baseElement.computeDocumentationComme nt();
4949 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass ); 5315 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass );
4950 5316
4951 /** 5317 /**
4952 * Return the element on which the parameterized element was created. 5318 * Return the element on which the parameterized element was created.
5319 *
4953 * @return the element on which the parameterized element was created 5320 * @return the element on which the parameterized element was created
4954 */ 5321 */
4955 Element get baseElement => _baseElement; 5322 Element get baseElement => _baseElement;
4956 AnalysisContext get context => _baseElement.context; 5323 AnalysisContext get context => _baseElement.context;
4957 String get displayName => _baseElement.displayName; 5324 String get displayName => _baseElement.displayName;
4958 ElementKind get kind => _baseElement.kind; 5325 ElementKind get kind => _baseElement.kind;
4959 LibraryElement get library => _baseElement.library; 5326 LibraryElement get library => _baseElement.library;
4960 ElementLocation get location => _baseElement.location; 5327 ElementLocation get location => _baseElement.location;
4961 List<ElementAnnotation> get metadata => _baseElement.metadata; 5328 List<ElementAnnotation> get metadata => _baseElement.metadata;
4962 String get name => _baseElement.name; 5329 String get name => _baseElement.name;
4963 int get nameOffset => _baseElement.nameOffset; 5330 int get nameOffset => _baseElement.nameOffset;
4964 Source get source => _baseElement.source; 5331 Source get source => _baseElement.source;
4965 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib rary); 5332 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib rary);
4966 bool get isSynthetic => _baseElement.isSynthetic; 5333 bool get isSynthetic => _baseElement.isSynthetic;
4967 void visitChildren(ElementVisitor<Object> visitor) { 5334 void visitChildren(ElementVisitor<Object> visitor) {
4968 } 5335 }
4969 5336
4970 /** 5337 /**
4971 * Return the type in which the element is defined. 5338 * Return the type in which the element is defined.
5339 *
4972 * @return the type in which the element is defined 5340 * @return the type in which the element is defined
4973 */ 5341 */
4974 ParameterizedType get definingType => _definingType; 5342 ParameterizedType get definingType => _definingType;
4975 5343
4976 /** 5344 /**
4977 * If the given child is not `null`, use the given visitor to visit it. 5345 * If the given child is not `null`, use the given visitor to visit it.
5346 *
4978 * @param child the child to be visited 5347 * @param child the child to be visited
4979 * @param visitor the visitor to be used to visit the child 5348 * @param visitor the visitor to be used to visit the child
4980 */ 5349 */
4981 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) { 5350 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) {
4982 if (child != null) { 5351 if (child != null) {
4983 child.accept(visitor); 5352 child.accept(visitor);
4984 } 5353 }
4985 } 5354 }
4986 5355
4987 /** 5356 /**
4988 * Use the given visitor to visit all of the children in the given array. 5357 * Use the given visitor to visit all of the children in the given array.
5358 *
4989 * @param children the children to be visited 5359 * @param children the children to be visited
4990 * @param visitor the visitor being used to visit the children 5360 * @param visitor the visitor being used to visit the children
4991 */ 5361 */
4992 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito r) { 5362 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito r) {
4993 if (children != null) { 5363 if (children != null) {
4994 for (Element child in children) { 5364 for (Element child in children) {
4995 child.accept(visitor); 5365 child.accept(visitor);
4996 } 5366 }
4997 } 5367 }
4998 } 5368 }
4999 5369
5000 /** 5370 /**
5001 * Return the type that results from replacing the type parameters in the give n type with the type 5371 * Return the type that results from replacing the type parameters in the give n type with the type
5002 * arguments. 5372 * arguments.
5373 *
5003 * @param type the type to be transformed 5374 * @param type the type to be transformed
5004 * @return the result of transforming the type 5375 * @return the result of transforming the type
5005 */ 5376 */
5006 Type2 substituteFor(Type2 type) { 5377 Type2 substituteFor(Type2 type) {
5007 List<Type2> argumentTypes = _definingType.typeArguments; 5378 List<Type2> argumentTypes = _definingType.typeArguments;
5008 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.typ eVariables); 5379 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.typ eVariables);
5009 return type.substitute2(argumentTypes, parameterTypes) as Type2; 5380 return type.substitute2(argumentTypes, parameterTypes) as Type2;
5010 } 5381 }
5011 5382
5012 /** 5383 /**
5013 * Return the array of types that results from replacing the type parameters i n the given types 5384 * Return the array of types that results from replacing the type parameters i n the given types
5014 * with the type arguments. 5385 * with the type arguments.
5386 *
5015 * @param types the types to be transformed 5387 * @param types the types to be transformed
5016 * @return the result of transforming the types 5388 * @return the result of transforming the types
5017 */ 5389 */
5018 List<InterfaceType> substituteFor2(List<InterfaceType> types) { 5390 List<InterfaceType> substituteFor2(List<InterfaceType> types) {
5019 int count = types.length; 5391 int count = types.length;
5020 List<InterfaceType> substitutedTypes = new List<InterfaceType>(count); 5392 List<InterfaceType> substitutedTypes = new List<InterfaceType>(count);
5021 for (int i = 0; i < count; i++) { 5393 for (int i = 0; i < count; i++) {
5022 substitutedTypes[i] = substituteFor(types[i]); 5394 substitutedTypes[i] = substituteFor(types[i]);
5023 } 5395 }
5024 return substitutedTypes; 5396 return substitutedTypes;
5025 } 5397 }
5026 } 5398 }
5027 /** 5399 /**
5028 * Instances of the class `MethodMember` represent a method element defined in a parameterized 5400 * Instances of the class `MethodMember` represent a method element defined in a parameterized
5029 * type where the values of the type parameters are known. 5401 * type where the values of the type parameters are known.
5030 */ 5402 */
5031 class MethodMember extends ExecutableMember implements MethodElement { 5403 class MethodMember extends ExecutableMember implements MethodElement {
5032 5404
5033 /** 5405 /**
5034 * If the given method's type is different when any type parameters from the d efining type's 5406 * If the given method's type is different when any type parameters from the d efining type's
5035 * declaration are replaced with the actual type arguments from the defining t ype, create a method 5407 * declaration are replaced with the actual type arguments from the defining t ype, create a method
5036 * member representing the given method. Return the member that was created, o r the base method if 5408 * member representing the given method. Return the member that was created, o r the base method if
5037 * no member was created. 5409 * no member was created.
5410 *
5038 * @param baseMethod the base method for which a member might be created 5411 * @param baseMethod the base method for which a member might be created
5039 * @param definingType the type defining the parameters and arguments to be us ed in the 5412 * @param definingType the type defining the parameters and arguments to be us ed in the
5040 * substitution 5413 * substitution
5041 * @return the method element that will return the correctly substituted types 5414 * @return the method element that will return the correctly substituted types
5042 */ 5415 */
5043 static MethodElement from(MethodElement baseMethod, InterfaceType definingType ) { 5416 static MethodElement from(MethodElement baseMethod, InterfaceType definingType ) {
5044 if (baseMethod == null || definingType.typeArguments.length == 0) { 5417 if (baseMethod == null || definingType.typeArguments.length == 0) {
5045 return baseMethod; 5418 return baseMethod;
5046 } 5419 }
5047 FunctionType baseType = baseMethod.type; 5420 FunctionType baseType = baseMethod.type;
5048 List<Type2> argumentTypes = definingType.typeArguments; 5421 List<Type2> argumentTypes = definingType.typeArguments;
5049 List<Type2> parameterTypes = definingType.element.type.typeArguments; 5422 List<Type2> parameterTypes = definingType.element.type.typeArguments;
5050 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter Types); 5423 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter Types);
5051 if (baseType == substitutedType) { 5424 if (baseType == substitutedType) {
5052 return baseMethod; 5425 return baseMethod;
5053 } 5426 }
5054 return new MethodMember(baseMethod, definingType); 5427 return new MethodMember(baseMethod, definingType);
5055 } 5428 }
5056 5429
5057 /** 5430 /**
5058 * Initialize a newly created element to represent a method of the given param eterized type. 5431 * Initialize a newly created element to represent a method of the given param eterized type.
5432 *
5059 * @param baseElement the element on which the parameterized element was creat ed 5433 * @param baseElement the element on which the parameterized element was creat ed
5060 * @param definingType the type in which the element is defined 5434 * @param definingType the type in which the element is defined
5061 */ 5435 */
5062 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba seElement, definingType) { 5436 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba seElement, definingType) {
5063 } 5437 }
5064 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); 5438 accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
5065 MethodElement get baseElement => super.baseElement as MethodElement; 5439 MethodElement get baseElement => super.baseElement as MethodElement;
5066 ClassElement get enclosingElement => baseElement.enclosingElement; 5440 ClassElement get enclosingElement => baseElement.enclosingElement;
5067 bool get isAbstract => baseElement.isAbstract; 5441 bool get isAbstract => baseElement.isAbstract;
5068 String toString() { 5442 String toString() {
(...skipping 24 matching lines...) Expand all
5093 * Instances of the class `ParameterMember` represent a parameter element define d in a 5467 * Instances of the class `ParameterMember` represent a parameter element define d in a
5094 * parameterized type where the values of the type parameters are known. 5468 * parameterized type where the values of the type parameters are known.
5095 */ 5469 */
5096 class ParameterMember extends VariableMember implements ParameterElement { 5470 class ParameterMember extends VariableMember implements ParameterElement {
5097 5471
5098 /** 5472 /**
5099 * If the given parameter's type is different when any type parameters from th e defining type's 5473 * If the given parameter's type is different when any type parameters from th e defining type's
5100 * declaration are replaced with the actual type arguments from the defining t ype, create a 5474 * declaration are replaced with the actual type arguments from the defining t ype, create a
5101 * parameter member representing the given parameter. Return the member that w as created, or the 5475 * parameter member representing the given parameter. Return the member that w as created, or the
5102 * base parameter if no member was created. 5476 * base parameter if no member was created.
5477 *
5103 * @param baseParameter the base parameter for which a member might be created 5478 * @param baseParameter the base parameter for which a member might be created
5104 * @param definingType the type defining the parameters and arguments to be us ed in the 5479 * @param definingType the type defining the parameters and arguments to be us ed in the
5105 * substitution 5480 * substitution
5106 * @return the parameter element that will return the correctly substituted ty pes 5481 * @return the parameter element that will return the correctly substituted ty pes
5107 */ 5482 */
5108 static ParameterElement from(ParameterElement baseParameter, ParameterizedType definingType) { 5483 static ParameterElement from(ParameterElement baseParameter, ParameterizedType definingType) {
5109 if (baseParameter == null || definingType.typeArguments.length == 0) { 5484 if (baseParameter == null || definingType.typeArguments.length == 0) {
5110 return baseParameter; 5485 return baseParameter;
5111 } 5486 }
5112 Type2 baseType = baseParameter.type; 5487 Type2 baseType = baseParameter.type;
5113 List<Type2> argumentTypes = definingType.typeArguments; 5488 List<Type2> argumentTypes = definingType.typeArguments;
5114 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.type Variables); 5489 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.type Variables);
5115 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); 5490 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
5116 if (baseType == substitutedType) { 5491 if (baseType == substitutedType) {
5117 return baseParameter; 5492 return baseParameter;
5118 } 5493 }
5119 return new ParameterMember(baseParameter, definingType); 5494 return new ParameterMember(baseParameter, definingType);
5120 } 5495 }
5121 5496
5122 /** 5497 /**
5123 * Initialize a newly created element to represent a parameter of the given pa rameterized type. 5498 * Initialize a newly created element to represent a parameter of the given pa rameterized type.
5499 *
5124 * @param baseElement the element on which the parameterized element was creat ed 5500 * @param baseElement the element on which the parameterized element was creat ed
5125 * @param definingType the type in which the element is defined 5501 * @param definingType the type in which the element is defined
5126 */ 5502 */
5127 ParameterMember(ParameterElement baseElement, ParameterizedType definingType) : super(baseElement, definingType) { 5503 ParameterMember(ParameterElement baseElement, ParameterizedType definingType) : super(baseElement, definingType) {
5128 } 5504 }
5129 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); 5505 accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
5130 Element getAncestor(Type elementClass) { 5506 Element getAncestor(Type elementClass) {
5131 Element element = baseElement.getAncestor(elementClass); 5507 Element element = baseElement.getAncestor(elementClass);
5132 ParameterizedType definingType = this.definingType; 5508 ParameterizedType definingType = this.definingType;
5133 if (definingType is InterfaceType) { 5509 if (definingType is InterfaceType) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 * Instances of the class `PropertyAccessorMember` represent a property accessor element 5567 * Instances of the class `PropertyAccessorMember` represent a property accessor element
5192 * defined in a parameterized type where the values of the type parameters are k nown. 5568 * defined in a parameterized type where the values of the type parameters are k nown.
5193 */ 5569 */
5194 class PropertyAccessorMember extends ExecutableMember implements PropertyAccesso rElement { 5570 class PropertyAccessorMember extends ExecutableMember implements PropertyAccesso rElement {
5195 5571
5196 /** 5572 /**
5197 * If the given property accessor's type is different when any type parameters from the defining 5573 * If the given property accessor's type is different when any type parameters from the defining
5198 * type's declaration are replaced with the actual type arguments from the def ining type, create a 5574 * type's declaration are replaced with the actual type arguments from the def ining type, create a
5199 * property accessor member representing the given property accessor. Return t he member that was 5575 * property accessor member representing the given property accessor. Return t he member that was
5200 * created, or the base accessor if no member was created. 5576 * created, or the base accessor if no member was created.
5577 *
5201 * @param baseAccessor the base property accessor for which a member might be created 5578 * @param baseAccessor the base property accessor for which a member might be created
5202 * @param definingType the type defining the parameters and arguments to be us ed in the 5579 * @param definingType the type defining the parameters and arguments to be us ed in the
5203 * substitution 5580 * substitution
5204 * @return the property accessor element that will return the correctly substi tuted types 5581 * @return the property accessor element that will return the correctly substi tuted types
5205 */ 5582 */
5206 static PropertyAccessorElement from(PropertyAccessorElement baseAccessor, Inte rfaceType definingType) { 5583 static PropertyAccessorElement from(PropertyAccessorElement baseAccessor, Inte rfaceType definingType) {
5207 if (baseAccessor == null || definingType.typeArguments.length == 0) { 5584 if (baseAccessor == null || definingType.typeArguments.length == 0) {
5208 return baseAccessor; 5585 return baseAccessor;
5209 } 5586 }
5210 FunctionType baseType = baseAccessor.type; 5587 FunctionType baseType = baseAccessor.type;
5211 List<Type2> argumentTypes = definingType.typeArguments; 5588 List<Type2> argumentTypes = definingType.typeArguments;
5212 List<Type2> parameterTypes = definingType.element.type.typeArguments; 5589 List<Type2> parameterTypes = definingType.element.type.typeArguments;
5213 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter Types); 5590 FunctionType substitutedType = baseType.substitute2(argumentTypes, parameter Types);
5214 if (baseType == substitutedType) { 5591 if (baseType == substitutedType) {
5215 return baseAccessor; 5592 return baseAccessor;
5216 } 5593 }
5217 return new PropertyAccessorMember(baseAccessor, definingType); 5594 return new PropertyAccessorMember(baseAccessor, definingType);
5218 } 5595 }
5219 5596
5220 /** 5597 /**
5221 * Initialize a newly created element to represent a property accessor of the given parameterized 5598 * Initialize a newly created element to represent a property accessor of the given parameterized
5222 * type. 5599 * type.
5600 *
5223 * @param baseElement the element on which the parameterized element was creat ed 5601 * @param baseElement the element on which the parameterized element was creat ed
5224 * @param definingType the type in which the element is defined 5602 * @param definingType the type in which the element is defined
5225 */ 5603 */
5226 PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType defi ningType) : super(baseElement, definingType) { 5604 PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType defi ningType) : super(baseElement, definingType) {
5227 } 5605 }
5228 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); 5606 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this);
5229 PropertyAccessorElement get baseElement => super.baseElement as PropertyAccess orElement; 5607 PropertyAccessorElement get baseElement => super.baseElement as PropertyAccess orElement;
5230 PropertyAccessorElement get correspondingGetter => from(baseElement.correspond ingGetter, definingType); 5608 PropertyAccessorElement get correspondingGetter => from(baseElement.correspond ingGetter, definingType);
5231 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond ingSetter, definingType); 5609 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond ingSetter, definingType);
5232 Element get enclosingElement => baseElement.enclosingElement; 5610 Element get enclosingElement => baseElement.enclosingElement;
(...skipping 12 matching lines...) Expand all
5245 /** 5623 /**
5246 * The abstract class `VariableMember` defines the behavior common to members th at represent a 5624 * The abstract class `VariableMember` defines the behavior common to members th at represent a
5247 * variable element defined in a parameterized type where the values of the type parameters are 5625 * variable element defined in a parameterized type where the values of the type parameters are
5248 * known. 5626 * known.
5249 */ 5627 */
5250 abstract class VariableMember extends Member implements VariableElement { 5628 abstract class VariableMember extends Member implements VariableElement {
5251 5629
5252 /** 5630 /**
5253 * Initialize a newly created element to represent an executable element of th e given 5631 * Initialize a newly created element to represent an executable element of th e given
5254 * parameterized type. 5632 * parameterized type.
5633 *
5255 * @param baseElement the element on which the parameterized element was creat ed 5634 * @param baseElement the element on which the parameterized element was creat ed
5256 * @param definingType the type in which the element is defined 5635 * @param definingType the type in which the element is defined
5257 */ 5636 */
5258 VariableMember(VariableElement baseElement, ParameterizedType definingType) : super(baseElement, definingType) { 5637 VariableMember(VariableElement baseElement, ParameterizedType definingType) : super(baseElement, definingType) {
5259 } 5638 }
5260 VariableElement get baseElement => super.baseElement as VariableElement; 5639 VariableElement get baseElement => super.baseElement as VariableElement;
5261 FunctionElement get initializer { 5640 FunctionElement get initializer {
5262 throw new UnsupportedOperationException(); 5641 throw new UnsupportedOperationException();
5263 } 5642 }
5264 Type2 get type => substituteFor(baseElement.type); 5643 Type2 get type => substituteFor(baseElement.type);
5265 bool get isConst => baseElement.isConst; 5644 bool get isConst => baseElement.isConst;
5266 bool get isFinal => baseElement.isFinal; 5645 bool get isFinal => baseElement.isFinal;
5267 void visitChildren(ElementVisitor<Object> visitor) { 5646 void visitChildren(ElementVisitor<Object> visitor) {
5268 super.visitChildren(visitor); 5647 super.visitChildren(visitor);
5269 safelyVisitChild(baseElement.initializer, visitor); 5648 safelyVisitChild(baseElement.initializer, visitor);
5270 } 5649 }
5271 } 5650 }
5272 /** 5651 /**
5273 * The unique instance of the class `BottomTypeImpl` implements the type `bottom `. 5652 * The unique instance of the class `BottomTypeImpl` implements the type `bottom `.
5653 *
5274 * @coverage dart.engine.type 5654 * @coverage dart.engine.type
5275 */ 5655 */
5276 class BottomTypeImpl extends TypeImpl { 5656 class BottomTypeImpl extends TypeImpl {
5277 5657
5278 /** 5658 /**
5279 * The unique instance of this class. 5659 * The unique instance of this class.
5280 */ 5660 */
5281 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); 5661 static BottomTypeImpl _INSTANCE = new BottomTypeImpl();
5282 5662
5283 /** 5663 /**
5284 * Return the unique instance of this class. 5664 * Return the unique instance of this class.
5665 *
5285 * @return the unique instance of this class 5666 * @return the unique instance of this class
5286 */ 5667 */
5287 static BottomTypeImpl get instance => _INSTANCE; 5668 static BottomTypeImpl get instance => _INSTANCE;
5288 5669
5289 /** 5670 /**
5290 * Prevent the creation of instances of this class. 5671 * Prevent the creation of instances of this class.
5291 */ 5672 */
5292 BottomTypeImpl() : super(null, "<bottom>") { 5673 BottomTypeImpl() : super(null, "<bottom>") {
5293 } 5674 }
5294 bool operator ==(Object object) => identical(object, this); 5675 bool operator ==(Object object) => identical(object, this);
5295 bool isMoreSpecificThan(Type2 type) => true; 5676 bool isMoreSpecificThan(Type2 type) => true;
5296 bool isSubtypeOf(Type2 type) => true; 5677 bool isSubtypeOf(Type2 type) => true;
5297 bool isSupertypeOf(Type2 type) => false; 5678 bool isSupertypeOf(Type2 type) => false;
5298 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp es) => this; 5679 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp es) => this;
5299 } 5680 }
5300 /** 5681 /**
5301 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam ic`. 5682 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam ic`.
5683 *
5302 * @coverage dart.engine.type 5684 * @coverage dart.engine.type
5303 */ 5685 */
5304 class DynamicTypeImpl extends TypeImpl { 5686 class DynamicTypeImpl extends TypeImpl {
5305 5687
5306 /** 5688 /**
5307 * The unique instance of this class. 5689 * The unique instance of this class.
5308 */ 5690 */
5309 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); 5691 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl();
5310 5692
5311 /** 5693 /**
5312 * Return the unique instance of this class. 5694 * Return the unique instance of this class.
5695 *
5313 * @return the unique instance of this class 5696 * @return the unique instance of this class
5314 */ 5697 */
5315 static DynamicTypeImpl get instance => _INSTANCE; 5698 static DynamicTypeImpl get instance => _INSTANCE;
5316 5699
5317 /** 5700 /**
5318 * Prevent the creation of instances of this class. 5701 * Prevent the creation of instances of this class.
5319 */ 5702 */
5320 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { 5703 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) {
5321 ((element as DynamicElementImpl)).type = this; 5704 ((element as DynamicElementImpl)).type = this;
5322 } 5705 }
5323 bool operator ==(Object object) => object is DynamicTypeImpl; 5706 bool operator ==(Object object) => object is DynamicTypeImpl;
5324 bool get isDynamic => true; 5707 bool get isDynamic => true;
5325 bool isMoreSpecificThan(Type2 type) => false; 5708 bool isMoreSpecificThan(Type2 type) => false;
5326 bool isSubtypeOf(Type2 type) => identical(this, type); 5709 bool isSubtypeOf(Type2 type) => identical(this, type);
5327 bool isSupertypeOf(Type2 type) => true; 5710 bool isSupertypeOf(Type2 type) => true;
5328 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy pes) => this; 5711 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
5712 int length = parameterTypes.length;
5713 for (int i = 0; i < length; i++) {
5714 if (parameterTypes[i] == this) {
5715 return argumentTypes[i];
5716 }
5717 }
5718 return this;
5719 }
5329 } 5720 }
5330 /** 5721 /**
5331 * Instances of the class `FunctionTypeImpl` defines the behavior common to obje cts 5722 * Instances of the class `FunctionTypeImpl` defines the behavior common to obje cts
5332 * representing the type of a function, method, constructor, getter, or setter. 5723 * representing the type of a function, method, constructor, getter, or setter.
5724 *
5333 * @coverage dart.engine.type 5725 * @coverage dart.engine.type
5334 */ 5726 */
5335 class FunctionTypeImpl extends TypeImpl implements FunctionType { 5727 class FunctionTypeImpl extends TypeImpl implements FunctionType {
5336 5728
5337 /** 5729 /**
5338 * Return `true` if all of the name/type pairs in the first map are equal to t he 5730 * Return `true` if all of the name/type pairs in the first map are equal to t he
5339 * corresponding name/type pairs in the second map. The maps are expected to i terate over their 5731 * corresponding name/type pairs in the second map. The maps are expected to i terate over their
5340 * entries in the same order in which those entries were added to the map. 5732 * entries in the same order in which those entries were added to the map.
5733 *
5341 * @param firstTypes the first map of name/type pairs being compared 5734 * @param firstTypes the first map of name/type pairs being compared
5342 * @param secondTypes the second map of name/type pairs being compared 5735 * @param secondTypes the second map of name/type pairs being compared
5343 * @return `true` if all of the name/type pairs in the first map are equal to the 5736 * @return `true` if all of the name/type pairs in the first map are equal to the
5344 * corresponding name/type pairs in the second map 5737 * corresponding name/type pairs in the second map
5345 */ 5738 */
5346 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy pes) { 5739 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy pes) {
5347 if (secondTypes.length != firstTypes.length) { 5740 if (secondTypes.length != firstTypes.length) {
5348 return false; 5741 return false;
5349 } 5742 }
5350 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes)); 5743 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes));
5351 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(secondTypes)); 5744 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(secondTypes));
5352 while (firstIterator.hasNext) { 5745 while (firstIterator.hasNext) {
5353 MapEntry<String, Type2> firstEntry = firstIterator.next(); 5746 MapEntry<String, Type2> firstEntry = firstIterator.next();
5354 MapEntry<String, Type2> secondEntry = secondIterator.next(); 5747 MapEntry<String, Type2> secondEntry = secondIterator.next();
5355 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) { 5748 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) {
5356 return false; 5749 return false;
5357 } 5750 }
5358 } 5751 }
5359 return true; 5752 return true;
5360 } 5753 }
5361 5754
5362 /** 5755 /**
5363 * Return a map containing the results of using the given argument types and p arameter types to 5756 * Return a map containing the results of using the given argument types and p arameter types to
5364 * perform a substitution on all of the values in the given map. The order of the entries will be 5757 * perform a substitution on all of the values in the given map. The order of the entries will be
5365 * preserved. 5758 * preserved.
5759 *
5366 * @param types the types on which a substitution is to be performed 5760 * @param types the types on which a substitution is to be performed
5367 * @param argumentTypes the argument types for the substitution 5761 * @param argumentTypes the argument types for the substitution
5368 * @param parameterTypes the parameter types for the substitution 5762 * @param parameterTypes the parameter types for the substitution
5369 * @return the result of performing the substitution on each of the types 5763 * @return the result of performing the substitution on each of the types
5370 */ 5764 */
5371 static Map<String, Type2> substitute3(Map<String, Type2> types, List<Type2> ar gumentTypes, List<Type2> parameterTypes) { 5765 static Map<String, Type2> substitute3(Map<String, Type2> types, List<Type2> ar gumentTypes, List<Type2> parameterTypes) {
5372 if (types.isEmpty) { 5766 if (types.isEmpty) {
5373 return types; 5767 return types;
5374 } 5768 }
5375 LinkedHashMap<String, Type2> newTypes = new LinkedHashMap<String, Type2>(); 5769 LinkedHashMap<String, Type2> newTypes = new LinkedHashMap<String, Type2>();
5376 for (MapEntry<String, Type2> entry in getMapEntrySet(types)) { 5770 for (MapEntry<String, Type2> entry in getMapEntrySet(types)) {
5377 newTypes[entry.getKey()] = entry.getValue().substitute2(argumentTypes, par ameterTypes); 5771 newTypes[entry.getKey()] = entry.getValue().substitute2(argumentTypes, par ameterTypes);
5378 } 5772 }
5379 return newTypes; 5773 return newTypes;
5380 } 5774 }
5381 5775
5382 /** 5776 /**
5383 * An array containing the actual types of the type arguments. 5777 * An array containing the actual types of the type arguments.
5384 */ 5778 */
5385 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; 5779 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY;
5386 5780
5387 /** 5781 /**
5388 * An array containing the types of the normal parameters of this type of func tion. The parameter 5782 * An array containing the types of the normal parameters of this type of func tion. The parameter
5389 * types are in the same order as they appear in the declaration of the functi on. 5783 * types are in the same order as they appear in the declaration of the functi on.
5784 *
5390 * @return the types of the normal parameters of this type of function 5785 * @return the types of the normal parameters of this type of function
5391 */ 5786 */
5392 List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY; 5787 List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY;
5393 5788
5394 /** 5789 /**
5395 * A table mapping the names of optional (positional) parameters to the types of the optional 5790 * A table mapping the names of optional (positional) parameters to the types of the optional
5396 * parameters of this type of function. 5791 * parameters of this type of function.
5397 */ 5792 */
5398 List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY; 5793 List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY;
5399 5794
5400 /** 5795 /**
5401 * A table mapping the names of named parameters to the types of the named par ameters of this type 5796 * A table mapping the names of named parameters to the types of the named par ameters of this type
5402 * of function. 5797 * of function.
5403 */ 5798 */
5404 Map<String, Type2> _namedParameterTypes = new Map(); 5799 Map<String, Type2> _namedParameterTypes = new Map();
5405 5800
5406 /** 5801 /**
5407 * Initialize a newly created function type to be declared by the given elemen t and to have the 5802 * Initialize a newly created function type to be declared by the given elemen t and to have the
5408 * given name. 5803 * given name.
5804 *
5409 * @param element the element representing the declaration of the function typ e 5805 * @param element the element representing the declaration of the function typ e
5410 */ 5806 */
5411 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name) { 5807 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name) {
5412 _jtd_constructor_299_impl(element); 5808 _jtd_constructor_299_impl(element);
5413 } 5809 }
5414 _jtd_constructor_299_impl(ExecutableElement element) { 5810 _jtd_constructor_299_impl(ExecutableElement element) {
5415 } 5811 }
5416 5812
5417 /** 5813 /**
5418 * Initialize a newly created function type to be declared by the given elemen t and to have the 5814 * Initialize a newly created function type to be declared by the given elemen t and to have the
5419 * given name. 5815 * given name.
5816 *
5420 * @param element the element representing the declaration of the function typ e 5817 * @param element the element representing the declaration of the function typ e
5421 */ 5818 */
5422 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme nt == null ? null : element.name) { 5819 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme nt == null ? null : element.name) {
5423 _jtd_constructor_300_impl(element); 5820 _jtd_constructor_300_impl(element);
5424 } 5821 }
5425 _jtd_constructor_300_impl(FunctionTypeAliasElement element) { 5822 _jtd_constructor_300_impl(FunctionTypeAliasElement element) {
5426 } 5823 }
5427 bool operator ==(Object object) { 5824 bool operator ==(Object object) {
5428 if (object is! FunctionTypeImpl) { 5825 if (object is! FunctionTypeImpl) {
5429 return false; 5826 return false;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
5578 } 5975 }
5579 } 5976 }
5580 } else if (s.namedParameterTypes.length > 0) { 5977 } else if (s.namedParameterTypes.length > 0) {
5581 return false; 5978 return false;
5582 } else { 5979 } else {
5583 int tArgLength = tTypes.length + tOpTypes.length; 5980 int tArgLength = tTypes.length + tOpTypes.length;
5584 int sArgLength = sTypes.length + sOpTypes.length; 5981 int sArgLength = sTypes.length + sOpTypes.length;
5585 if (tArgLength < sArgLength || sTypes.length < tTypes.length) { 5982 if (tArgLength < sArgLength || sTypes.length < tTypes.length) {
5586 return false; 5983 return false;
5587 } 5984 }
5588 List<Type2> tAllTypes = new List<Type2>(sArgLength); 5985 if (tOpTypes.length == 0 && sOpTypes.length == 0) {
5589 for (int i = 0; i < tTypes.length; i++) { 5986 for (int i = 0; i < sTypes.length; i++) {
5590 tAllTypes[i] = tTypes[i]; 5987 if (!sTypes[i].isAssignableTo(tTypes[i])) {
5591 } 5988 return false;
5592 for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) { 5989 }
5593 tAllTypes[i] = tOpTypes[j]; 5990 }
5594 } 5991 } else {
5595 List<Type2> sAllTypes = new List<Type2>(sArgLength); 5992 List<Type2> tAllTypes = new List<Type2>(sArgLength);
5596 for (int i = 0; i < sTypes.length; i++) { 5993 for (int i = 0; i < tTypes.length; i++) {
5597 sAllTypes[i] = sTypes[i]; 5994 tAllTypes[i] = tTypes[i];
5598 } 5995 }
5599 for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) { 5996 for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) {
5600 sAllTypes[i] = sOpTypes[j]; 5997 tAllTypes[i] = tOpTypes[j];
5601 } 5998 }
5602 for (int i = 0; i < sAllTypes.length; i++) { 5999 List<Type2> sAllTypes = new List<Type2>(sArgLength);
5603 if (!sAllTypes[i].isAssignableTo(tAllTypes[i])) { 6000 for (int i = 0; i < sTypes.length; i++) {
5604 return false; 6001 sAllTypes[i] = sTypes[i];
6002 }
6003 for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) {
6004 sAllTypes[i] = sOpTypes[j];
6005 }
6006 for (int i = 0; i < sAllTypes.length; i++) {
6007 if (!sAllTypes[i].isAssignableTo(tAllTypes[i])) {
6008 return false;
6009 }
5605 } 6010 }
5606 } 6011 }
5607 } 6012 }
5608 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo( s.returnType); 6013 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo( s.returnType);
5609 } 6014 }
5610 6015
5611 /** 6016 /**
5612 * Set the mapping of the names of named parameters to the types of the named parameters of this 6017 * Set the mapping of the names of named parameters to the types of the named parameters of this
5613 * type of function to the given mapping. 6018 * type of function to the given mapping.
6019 *
5614 * @param namedParameterTypes the mapping of the names of named parameters to the types of the 6020 * @param namedParameterTypes the mapping of the names of named parameters to the types of the
5615 * named parameters of this type of function 6021 * named parameters of this type of function
5616 */ 6022 */
5617 void set namedParameterTypes(LinkedHashMap<String, Type2> namedParameterTypes2 ) { 6023 void set namedParameterTypes(LinkedHashMap<String, Type2> namedParameterTypes2 ) {
5618 this._namedParameterTypes = namedParameterTypes2; 6024 this._namedParameterTypes = namedParameterTypes2;
5619 } 6025 }
5620 6026
5621 /** 6027 /**
5622 * Set the types of the normal parameters of this type of function to the type s in the given 6028 * Set the types of the normal parameters of this type of function to the type s in the given
5623 * array. 6029 * array.
6030 *
5624 * @param normalParameterTypes the types of the normal parameters of this type of function 6031 * @param normalParameterTypes the types of the normal parameters of this type of function
5625 */ 6032 */
5626 void set normalParameterTypes(List<Type2> normalParameterTypes2) { 6033 void set normalParameterTypes(List<Type2> normalParameterTypes2) {
5627 this._normalParameterTypes = normalParameterTypes2; 6034 this._normalParameterTypes = normalParameterTypes2;
5628 } 6035 }
5629 6036
5630 /** 6037 /**
5631 * Set the types of the optional parameters of this type of function to the ty pes in the given 6038 * Set the types of the optional parameters of this type of function to the ty pes in the given
5632 * array. 6039 * array.
6040 *
5633 * @param optionalParameterTypes the types of the optional parameters of this type of function 6041 * @param optionalParameterTypes the types of the optional parameters of this type of function
5634 */ 6042 */
5635 void set optionalParameterTypes(List<Type2> optionalParameterTypes2) { 6043 void set optionalParameterTypes(List<Type2> optionalParameterTypes2) {
5636 this._optionalParameterTypes = optionalParameterTypes2; 6044 this._optionalParameterTypes = optionalParameterTypes2;
5637 } 6045 }
5638 6046
5639 /** 6047 /**
5640 * Set the actual types of the type arguments to the given types. 6048 * Set the actual types of the type arguments to the given types.
6049 *
5641 * @param typeArguments the actual types of the type arguments 6050 * @param typeArguments the actual types of the type arguments
5642 */ 6051 */
5643 void set typeArguments(List<Type2> typeArguments2) { 6052 void set typeArguments(List<Type2> typeArguments2) {
5644 this._typeArguments = typeArguments2; 6053 this._typeArguments = typeArguments2;
5645 } 6054 }
5646 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen tTypes, typeArguments); 6055 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen tTypes, typeArguments);
5647 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT ypes) { 6056 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT ypes) {
5648 if (argumentTypes.length != parameterTypes.length) { 6057 if (argumentTypes.length != parameterTypes.length) {
5649 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 6058 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
5650 } 6059 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
5724 Element element = this.element; 6133 Element element = this.element;
5725 if (element is ExecutableElement) { 6134 if (element is ExecutableElement) {
5726 return ((element as ExecutableElement)).parameters; 6135 return ((element as ExecutableElement)).parameters;
5727 } else { 6136 } else {
5728 return ((element as FunctionTypeAliasElement)).parameters; 6137 return ((element as FunctionTypeAliasElement)).parameters;
5729 } 6138 }
5730 } 6139 }
5731 6140
5732 /** 6141 /**
5733 * Return the return type defined by this function's element. 6142 * Return the return type defined by this function's element.
6143 *
5734 * @return the return type defined by this function's element 6144 * @return the return type defined by this function's element
5735 */ 6145 */
5736 Type2 get baseReturnType { 6146 Type2 get baseReturnType {
5737 Element element = this.element; 6147 Element element = this.element;
5738 if (element is ExecutableElement) { 6148 if (element is ExecutableElement) {
5739 return ((element as ExecutableElement)).returnType; 6149 return ((element as ExecutableElement)).returnType;
5740 } else { 6150 } else {
5741 return ((element as FunctionTypeAliasElement)).returnType; 6151 return ((element as FunctionTypeAliasElement)).returnType;
5742 } 6152 }
5743 } 6153 }
5744 } 6154 }
5745 /** 6155 /**
5746 * Instances of the class `InterfaceTypeImpl` defines the behavior common to obj ects 6156 * Instances of the class `InterfaceTypeImpl` defines the behavior common to obj ects
5747 * representing the type introduced by either a class or an interface, or a refe rence to such a 6157 * representing the type introduced by either a class or an interface, or a refe rence to such a
5748 * type. 6158 * type.
6159 *
5749 * @coverage dart.engine.type 6160 * @coverage dart.engine.type
5750 */ 6161 */
5751 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { 6162 class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
5752 6163
5753 /** 6164 /**
5754 * An empty array of types. 6165 * An empty array of types.
5755 */ 6166 */
5756 static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0); 6167 static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0);
5757 6168
5758 /** 6169 /**
5759 * This method computes the longest inheritance path from some passed [Type] t o Object. 6170 * This method computes the longest inheritance path from some passed [Type] t o Object.
5760 * @param type the [Type] to compute the longest inheritance path of from the passed[Type] to Object 6171 *
6172 * @param type the [Type] to compute the longest inheritance path of from the passed
6173 * [Type] to Object
5761 * @return the computed longest inheritance path to Object 6174 * @return the computed longest inheritance path to Object
5762 * @see InterfaceType#getLeastUpperBound(Type) 6175 * @see InterfaceType#getLeastUpperBound(Type)
5763 */ 6176 */
5764 static int computeLongestInheritancePathToObject(InterfaceType type) => comput eLongestInheritancePathToObject2(type, 0, new Set<ClassElement>()); 6177 static int computeLongestInheritancePathToObject(InterfaceType type) => comput eLongestInheritancePathToObject2(type, 0, new Set<ClassElement>());
5765 6178
5766 /** 6179 /**
5767 * Returns the set of all superinterfaces of the passed [Type]. 6180 * Returns the set of all superinterfaces of the passed [Type].
6181 *
5768 * @param type the [Type] to compute the set of superinterfaces of 6182 * @param type the [Type] to compute the set of superinterfaces of
5769 * @return the [Set] of superinterfaces of the passed [Type] 6183 * @return the [Set] of superinterfaces of the passed [Type]
5770 * @see #getLeastUpperBound(Type) 6184 * @see #getLeastUpperBound(Type)
5771 */ 6185 */
5772 static Set<InterfaceType> computeSuperinterfaceSet(InterfaceType type) => comp uteSuperinterfaceSet2(type, new Set<InterfaceType>()); 6186 static Set<InterfaceType> computeSuperinterfaceSet(InterfaceType type) => comp uteSuperinterfaceSet2(type, new Set<InterfaceType>());
5773 6187
5774 /** 6188 /**
5775 * This method computes the longest inheritance path from some passed [Type] t o Object. This 6189 * This method computes the longest inheritance path from some passed [Type] t o Object. This
5776 * method calls itself recursively, callers should use the public method[compu teLongestInheritancePathToObject]. 6190 * method calls itself recursively, callers should use the public method
5777 * @param type the [Type] to compute the longest inheritance path of from the passed[Type] to Object 6191 * [computeLongestInheritancePathToObject].
6192 *
6193 * @param type the [Type] to compute the longest inheritance path of from the passed
6194 * [Type] to Object
5778 * @param depth a field used recursively 6195 * @param depth a field used recursively
5779 * @param visitedClasses the classes that have already been visited 6196 * @param visitedClasses the classes that have already been visited
5780 * @return the computed longest inheritance path to Object 6197 * @return the computed longest inheritance path to Object
5781 * @see #computeLongestInheritancePathToObject(Type) 6198 * @see #computeLongestInheritancePathToObject(Type)
5782 * @see #getLeastUpperBound(Type) 6199 * @see #getLeastUpperBound(Type)
5783 */ 6200 */
5784 static int computeLongestInheritancePathToObject2(InterfaceType type, int dept h, Set<ClassElement> visitedClasses) { 6201 static int computeLongestInheritancePathToObject2(InterfaceType type, int dept h, Set<ClassElement> visitedClasses) {
5785 ClassElement classElement = type.element; 6202 ClassElement classElement = type.element;
5786 if (classElement.supertype == null || visitedClasses.contains(classElement)) { 6203 if (classElement.supertype == null || visitedClasses.contains(classElement)) {
5787 return depth; 6204 return depth;
(...skipping 18 matching lines...) Expand all
5806 } 6223 }
5807 } finally { 6224 } finally {
5808 visitedClasses.remove(classElement); 6225 visitedClasses.remove(classElement);
5809 } 6226 }
5810 return longestPath; 6227 return longestPath;
5811 } 6228 }
5812 6229
5813 /** 6230 /**
5814 * Returns the set of all superinterfaces of the passed [Type]. This is a recu rsive method, 6231 * Returns the set of all superinterfaces of the passed [Type]. This is a recu rsive method,
5815 * callers should call the public [computeSuperinterfaceSet]. 6232 * callers should call the public [computeSuperinterfaceSet].
6233 *
5816 * @param type the [Type] to compute the set of superinterfaces of 6234 * @param type the [Type] to compute the set of superinterfaces of
5817 * @param set a [HashSet] used recursively by this method 6235 * @param set a [HashSet] used recursively by this method
5818 * @return the [Set] of superinterfaces of the passed [Type] 6236 * @return the [Set] of superinterfaces of the passed [Type]
5819 * @see #computeSuperinterfaceSet(Type) 6237 * @see #computeSuperinterfaceSet(Type)
5820 * @see #getLeastUpperBound(Type) 6238 * @see #getLeastUpperBound(Type)
5821 */ 6239 */
5822 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In terfaceType> set) { 6240 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In terfaceType> set) {
5823 Element element = type.element; 6241 Element element = type.element;
5824 if (element != null && element is ClassElement) { 6242 if (element != null && element is ClassElement) {
5825 ClassElement classElement = element as ClassElement; 6243 ClassElement classElement = element as ClassElement;
(...skipping 12 matching lines...) Expand all
5838 } 6256 }
5839 return set; 6257 return set;
5840 } 6258 }
5841 6259
5842 /** 6260 /**
5843 * Return the intersection of the given sets of types, where intersection is b ased on the equality 6261 * Return the intersection of the given sets of types, where intersection is b ased on the equality
5844 * of the elements of the types rather than on the equality of the types thems elves. In cases 6262 * of the elements of the types rather than on the equality of the types thems elves. In cases
5845 * where two non-equal types have equal elements, which only happens when the class is 6263 * where two non-equal types have equal elements, which only happens when the class is
5846 * parameterized, the type that is added to the intersection is the base type with type arguments 6264 * parameterized, the type that is added to the intersection is the base type with type arguments
5847 * that are the least upper bound of the type arguments of the two types. 6265 * that are the least upper bound of the type arguments of the two types.
6266 *
5848 * @param first the first set of types to be intersected 6267 * @param first the first set of types to be intersected
5849 * @param second the second set of types to be intersected 6268 * @param second the second set of types to be intersected
5850 * @return the intersection of the given sets of types 6269 * @return the intersection of the given sets of types
5851 */ 6270 */
5852 static List<InterfaceType> intersection(Set<InterfaceType> first, Set<Interfac eType> second) { 6271 static List<InterfaceType> intersection(Set<InterfaceType> first, Set<Interfac eType> second) {
5853 Map<ClassElement, InterfaceType> firstMap = new Map<ClassElement, InterfaceT ype>(); 6272 Map<ClassElement, InterfaceType> firstMap = new Map<ClassElement, InterfaceT ype>();
5854 for (InterfaceType firstType in first) { 6273 for (InterfaceType firstType in first) {
5855 firstMap[firstType.element] = firstType; 6274 firstMap[firstType.element] = firstType;
5856 } 6275 }
5857 Set<InterfaceType> result = new Set<InterfaceType>(); 6276 Set<InterfaceType> result = new Set<InterfaceType>();
5858 for (InterfaceType secondType in second) { 6277 for (InterfaceType secondType in second) {
5859 InterfaceType firstType = firstMap[secondType.element]; 6278 InterfaceType firstType = firstMap[secondType.element];
5860 if (firstType != null) { 6279 if (firstType != null) {
5861 javaSetAdd(result, leastUpperBound(firstType, secondType)); 6280 javaSetAdd(result, leastUpperBound(firstType, secondType));
5862 } 6281 }
5863 } 6282 }
5864 return new List.from(result); 6283 return new List.from(result);
5865 } 6284 }
5866 6285
5867 /** 6286 /**
5868 * Return the "least upper bound" of the given types under the assumption that the types have the 6287 * Return the "least upper bound" of the given types under the assumption that the types have the
5869 * same element and differ only in terms of the type arguments. The resulting type is composed by 6288 * same element and differ only in terms of the type arguments. The resulting type is composed by
5870 * comparing the corresponding type arguments, keeping those that are the same , and using 6289 * comparing the corresponding type arguments, keeping those that are the same , and using
5871 * 'dynamic' for those that are different. 6290 * 'dynamic' for those that are different.
6291 *
5872 * @param firstType the first type 6292 * @param firstType the first type
5873 * @param secondType the second type 6293 * @param secondType the second type
5874 * @return the "least upper bound" of the given types 6294 * @return the "least upper bound" of the given types
5875 */ 6295 */
5876 static InterfaceType leastUpperBound(InterfaceType firstType, InterfaceType se condType) { 6296 static InterfaceType leastUpperBound(InterfaceType firstType, InterfaceType se condType) {
5877 if (firstType == secondType) { 6297 if (firstType == secondType) {
5878 return firstType; 6298 return firstType;
5879 } 6299 }
5880 List<Type2> firstArguments = firstType.typeArguments; 6300 List<Type2> firstArguments = firstType.typeArguments;
5881 List<Type2> secondArguments = secondType.typeArguments; 6301 List<Type2> secondArguments = secondType.typeArguments;
(...skipping 15 matching lines...) Expand all
5897 return lub; 6317 return lub;
5898 } 6318 }
5899 6319
5900 /** 6320 /**
5901 * An array containing the actual types of the type arguments. 6321 * An array containing the actual types of the type arguments.
5902 */ 6322 */
5903 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; 6323 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY;
5904 6324
5905 /** 6325 /**
5906 * Initialize a newly created type to be declared by the given element. 6326 * Initialize a newly created type to be declared by the given element.
6327 *
5907 * @param element the element representing the declaration of the type 6328 * @param element the element representing the declaration of the type
5908 */ 6329 */
5909 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN ame) { 6330 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN ame) {
5910 _jtd_constructor_301_impl(element); 6331 _jtd_constructor_301_impl(element);
5911 } 6332 }
5912 _jtd_constructor_301_impl(ClassElement element) { 6333 _jtd_constructor_301_impl(ClassElement element) {
5913 } 6334 }
5914 6335
5915 /** 6336 /**
5916 * Initialize a newly created type to have the given name. This constructor sh ould only be used in 6337 * Initialize a newly created type to have the given name. This constructor sh ould only be used in
5917 * cases where there is no declaration of the type. 6338 * cases where there is no declaration of the type.
6339 *
5918 * @param name the name of the type 6340 * @param name the name of the type
5919 */ 6341 */
5920 InterfaceTypeImpl.con2(String name) : super(null, name) { 6342 InterfaceTypeImpl.con2(String name) : super(null, name) {
5921 _jtd_constructor_302_impl(name); 6343 _jtd_constructor_302_impl(name);
5922 } 6344 }
5923 _jtd_constructor_302_impl(String name) { 6345 _jtd_constructor_302_impl(String name) {
5924 } 6346 }
5925 bool operator ==(Object object) { 6347 bool operator ==(Object object) {
5926 if (object is! InterfaceTypeImpl) { 6348 if (object is! InterfaceTypeImpl) {
5927 return false; 6349 return false;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
6086 MethodElement callMethod = element.lookUpMethod("call", element.library); 6508 MethodElement callMethod = element.lookUpMethod("call", element.library);
6087 if (callMethod != null) { 6509 if (callMethod != null) {
6088 return callMethod.type.isSubtypeOf(type2); 6510 return callMethod.type.isSubtypeOf(type2);
6089 } 6511 }
6090 return false; 6512 return false;
6091 } else if (type2 is! InterfaceType) { 6513 } else if (type2 is! InterfaceType) {
6092 return false; 6514 return false;
6093 } else if (this == type2) { 6515 } else if (this == type2) {
6094 return true; 6516 return true;
6095 } 6517 }
6096 return isSubtypeOf2((type2 as InterfaceType), new Set<ClassElement>()); 6518 InterfaceTypeImpl thisType = substitute2(<Type2> [BottomTypeImpl.instance], <Type2> [DynamicTypeImpl.instance]);
6519 return thisType.isSubtypeOf2((type2 as InterfaceType), new Set<ClassElement> ());
6097 } 6520 }
6098 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li brary) { 6521 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li brary) {
6099 ConstructorElement constructorElement; 6522 ConstructorElement constructorElement;
6100 if (constructorName == null) { 6523 if (constructorName == null) {
6101 constructorElement = element.unnamedConstructor; 6524 constructorElement = element.unnamedConstructor;
6102 } else { 6525 } else {
6103 constructorElement = element.getNamedConstructor(constructorName); 6526 constructorElement = element.getNamedConstructor(constructorName);
6104 } 6527 }
6105 if (constructorElement == null || !constructorElement.isAccessibleIn(library )) { 6528 if (constructorElement == null || !constructorElement.isAccessibleIn(library )) {
6106 return null; 6529 return null;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
6205 } 6628 }
6206 } 6629 }
6207 supertype = supertype.superclass; 6630 supertype = supertype.superclass;
6208 supertypeElement = supertype == null ? null : supertype.element; 6631 supertypeElement = supertype == null ? null : supertype.element;
6209 } 6632 }
6210 return null; 6633 return null;
6211 } 6634 }
6212 6635
6213 /** 6636 /**
6214 * Set the actual types of the type arguments to those in the given array. 6637 * Set the actual types of the type arguments to those in the given array.
6638 *
6215 * @param typeArguments the actual types of the type arguments 6639 * @param typeArguments the actual types of the type arguments
6216 */ 6640 */
6217 void set typeArguments(List<Type2> typeArguments2) { 6641 void set typeArguments(List<Type2> typeArguments2) {
6218 this._typeArguments = typeArguments2; 6642 this._typeArguments = typeArguments2;
6219 } 6643 }
6220 InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argume ntTypes, typeArguments); 6644 InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argume ntTypes, typeArguments);
6221 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter Types) { 6645 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter Types) {
6222 if (argumentTypes.length != parameterTypes.length) { 6646 if (argumentTypes.length != parameterTypes.length) {
6223 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 6647 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
6224 } 6648 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
6327 if (((mixinType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses) ) { 6751 if (((mixinType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses) ) {
6328 return true; 6752 return true;
6329 } 6753 }
6330 } 6754 }
6331 return false; 6755 return false;
6332 } 6756 }
6333 } 6757 }
6334 /** 6758 /**
6335 * The abstract class `TypeImpl` implements the behavior common to objects repre senting the 6759 * The abstract class `TypeImpl` implements the behavior common to objects repre senting the
6336 * declared type of elements in the element model. 6760 * declared type of elements in the element model.
6761 *
6337 * @coverage dart.engine.type 6762 * @coverage dart.engine.type
6338 */ 6763 */
6339 abstract class TypeImpl implements Type2 { 6764 abstract class TypeImpl implements Type2 {
6340 6765
6341 /** 6766 /**
6342 * Return an array containing the results of using the given argument types an d parameter types to 6767 * Return an array containing the results of using the given argument types an d parameter types to
6343 * perform a substitution on all of the given types. 6768 * perform a substitution on all of the given types.
6769 *
6344 * @param types the types on which a substitution is to be performed 6770 * @param types the types on which a substitution is to be performed
6345 * @param argumentTypes the argument types for the substitution 6771 * @param argumentTypes the argument types for the substitution
6346 * @param parameterTypes the parameter types for the substitution 6772 * @param parameterTypes the parameter types for the substitution
6347 * @return the result of performing the substitution on each of the types 6773 * @return the result of performing the substitution on each of the types
6348 */ 6774 */
6349 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li st<Type2> parameterTypes) { 6775 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li st<Type2> parameterTypes) {
6350 int length = types.length; 6776 int length = types.length;
6351 if (length == 0) { 6777 if (length == 0) {
6352 return types; 6778 return types;
6353 } 6779 }
(...skipping 15 matching lines...) Expand all
6369 */ 6795 */
6370 String _name; 6796 String _name;
6371 6797
6372 /** 6798 /**
6373 * An empty array of types. 6799 * An empty array of types.
6374 */ 6800 */
6375 static List<Type2> EMPTY_ARRAY = new List<Type2>(0); 6801 static List<Type2> EMPTY_ARRAY = new List<Type2>(0);
6376 6802
6377 /** 6803 /**
6378 * Initialize a newly created type to be declared by the given element and to have the given name. 6804 * Initialize a newly created type to be declared by the given element and to have the given name.
6805 *
6379 * @param element the element representing the declaration of the type 6806 * @param element the element representing the declaration of the type
6380 * @param name the name of the type 6807 * @param name the name of the type
6381 */ 6808 */
6382 TypeImpl(Element element, String name) { 6809 TypeImpl(Element element, String name) {
6383 this._element = element; 6810 this._element = element;
6384 this._name = name; 6811 this._name = name;
6385 } 6812 }
6386 String get displayName => name; 6813 String get displayName => name;
6387 Element get element => _element; 6814 Element get element => _element;
6388 Type2 getLeastUpperBound(Type2 type) => null; 6815 Type2 getLeastUpperBound(Type2 type) => null;
6389 String get name => _name; 6816 String get name => _name;
6390 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this); 6817 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this);
6391 bool get isDartCoreFunction => false; 6818 bool get isDartCoreFunction => false;
6392 bool get isDynamic => false; 6819 bool get isDynamic => false;
6393 bool isMoreSpecificThan(Type2 type) => false; 6820 bool isMoreSpecificThan(Type2 type) => false;
6394 bool get isObject => false; 6821 bool get isObject => false;
6395 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); 6822 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this);
6396 bool get isVoid => false; 6823 bool get isVoid => false;
6397 String toString() { 6824 String toString() {
6398 JavaStringBuilder builder = new JavaStringBuilder(); 6825 JavaStringBuilder builder = new JavaStringBuilder();
6399 appendTo(builder); 6826 appendTo(builder);
6400 return builder.toString(); 6827 return builder.toString();
6401 } 6828 }
6402 6829
6403 /** 6830 /**
6404 * Append a textual representation of this type to the given builder. 6831 * Append a textual representation of this type to the given builder.
6832 *
6405 * @param builder the builder to which the text is to be appended 6833 * @param builder the builder to which the text is to be appended
6406 */ 6834 */
6407 void appendTo(JavaStringBuilder builder) { 6835 void appendTo(JavaStringBuilder builder) {
6408 if (_name == null) { 6836 if (_name == null) {
6409 builder.append("<unnamed type>"); 6837 builder.append("<unnamed type>");
6410 } else { 6838 } else {
6411 builder.append(_name); 6839 builder.append(_name);
6412 } 6840 }
6413 } 6841 }
6414 } 6842 }
6415 /** 6843 /**
6416 * Instances of the class `TypeVariableTypeImpl` defines the behavior of objects representing 6844 * Instances of the class `TypeVariableTypeImpl` defines the behavior of objects representing
6417 * the type introduced by a type variable. 6845 * the type introduced by a type variable.
6846 *
6418 * @coverage dart.engine.type 6847 * @coverage dart.engine.type
6419 */ 6848 */
6420 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { 6849 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType {
6421 6850
6422 /** 6851 /**
6423 * An empty array of type variable types. 6852 * An empty array of type variable types.
6424 */ 6853 */
6425 static List<TypeVariableType> EMPTY_ARRAY = new List<TypeVariableType>(0); 6854 static List<TypeVariableType> EMPTY_ARRAY = new List<TypeVariableType>(0);
6426 6855
6427 /** 6856 /**
6428 * Return an array containing the type variable types defined by the given arr ay of type variable 6857 * Return an array containing the type variable types defined by the given arr ay of type variable
6429 * elements. 6858 * elements.
6859 *
6430 * @param typeVariables the type variable elements defining the type variable types to be returned 6860 * @param typeVariables the type variable elements defining the type variable types to be returned
6431 * @return the type variable types defined by the type variable elements 6861 * @return the type variable types defined by the type variable elements
6432 */ 6862 */
6433 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables ) { 6863 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables ) {
6434 int count = typeVariables.length; 6864 int count = typeVariables.length;
6435 if (count == 0) { 6865 if (count == 0) {
6436 return EMPTY_ARRAY; 6866 return EMPTY_ARRAY;
6437 } 6867 }
6438 List<TypeVariableType> types = new List<TypeVariableType>(count); 6868 List<TypeVariableType> types = new List<TypeVariableType>(count);
6439 for (int i = 0; i < count; i++) { 6869 for (int i = 0; i < count; i++) {
6440 types[i] = typeVariables[i].type; 6870 types[i] = typeVariables[i].type;
6441 } 6871 }
6442 return types; 6872 return types;
6443 } 6873 }
6444 6874
6445 /** 6875 /**
6446 * Initialize a newly created type variable to be declared by the given elemen t and to have the 6876 * Initialize a newly created type variable to be declared by the given elemen t and to have the
6447 * given name. 6877 * given name.
6878 *
6448 * @param element the element representing the declaration of the type variabl e 6879 * @param element the element representing the declaration of the type variabl e
6449 */ 6880 */
6450 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam e) { 6881 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam e) {
6451 } 6882 }
6452 bool operator ==(Object object) => object is TypeVariableTypeImpl && element = = ((object as TypeVariableTypeImpl)).element; 6883 bool operator ==(Object object) => object is TypeVariableTypeImpl && element = = ((object as TypeVariableTypeImpl)).element;
6453 TypeVariableElement get element => super.element as TypeVariableElement; 6884 TypeVariableElement get element => super.element as TypeVariableElement;
6454 int get hashCode => element.hashCode; 6885 int get hashCode => element.hashCode;
6455 bool isMoreSpecificThan(Type2 type) { 6886 bool isMoreSpecificThan(Type2 type) {
6456 Type2 upperBound = element.bound; 6887 Type2 upperBound = element.bound;
6457 return type == upperBound; 6888 return type == upperBound;
6458 } 6889 }
6459 bool isSubtypeOf(Type2 type) => true; 6890 bool isSubtypeOf(Type2 type) => true;
6460 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { 6891 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
6461 int length = parameterTypes.length; 6892 int length = parameterTypes.length;
6462 for (int i = 0; i < length; i++) { 6893 for (int i = 0; i < length; i++) {
6463 if (parameterTypes[i] == this) { 6894 if (parameterTypes[i] == this) {
6464 return argumentTypes[i]; 6895 return argumentTypes[i];
6465 } 6896 }
6466 } 6897 }
6467 return this; 6898 return this;
6468 } 6899 }
6469 } 6900 }
6470 /** 6901 /**
6471 * The unique instance of the class `VoidTypeImpl` implements the type `void`. 6902 * The unique instance of the class `VoidTypeImpl` implements the type `void`.
6903 *
6472 * @coverage dart.engine.type 6904 * @coverage dart.engine.type
6473 */ 6905 */
6474 class VoidTypeImpl extends TypeImpl implements VoidType { 6906 class VoidTypeImpl extends TypeImpl implements VoidType {
6475 6907
6476 /** 6908 /**
6477 * The unique instance of this class. 6909 * The unique instance of this class.
6478 */ 6910 */
6479 static VoidTypeImpl _INSTANCE = new VoidTypeImpl(); 6911 static VoidTypeImpl _INSTANCE = new VoidTypeImpl();
6480 6912
6481 /** 6913 /**
6482 * Return the unique instance of this class. 6914 * Return the unique instance of this class.
6915 *
6483 * @return the unique instance of this class 6916 * @return the unique instance of this class
6484 */ 6917 */
6485 static VoidTypeImpl get instance => _INSTANCE; 6918 static VoidTypeImpl get instance => _INSTANCE;
6486 6919
6487 /** 6920 /**
6488 * Prevent the creation of instances of this class. 6921 * Prevent the creation of instances of this class.
6489 */ 6922 */
6490 VoidTypeImpl() : super(null, Keyword.VOID.syntax) { 6923 VoidTypeImpl() : super(null, Keyword.VOID.syntax) {
6491 } 6924 }
6492 bool operator ==(Object object) => identical(object, this); 6925 bool operator ==(Object object) => identical(object, this);
6493 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam icTypeImpl.instance); 6926 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam icTypeImpl.instance);
6494 bool get isVoid => true; 6927 bool get isVoid => true;
6495 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this; 6928 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this;
6496 } 6929 }
6497 /** 6930 /**
6498 * The interface `FunctionType` defines the behavior common to objects represent ing the type 6931 * The interface `FunctionType` defines the behavior common to objects represent ing the type
6499 * of a function, method, constructor, getter, or setter. Function types come in three variations: 6932 * of a function, method, constructor, getter, or setter. Function types come in three variations:
6500 * <ol> 6933 * <ol>
6501 * * The types of functions that only have required parameters. These have the g eneral form 6934 * * The types of functions that only have required parameters. These have the g eneral form
6502 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i>. 6935 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i>.
6503 * * The types of functions with optional positional parameters. These have the general form 6936 * * The types of functions with optional positional parameters. These have the general form
6504 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, \[T<sub>n+1</sub>, &hellip;, T<su b>n+k</sub>\]) &rarr; 6937 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, [T<sub>n+1</sub>, &hellip;, T<sub >n+k</sub>]) &rarr;
6505 * T</i>. 6938 * T</i>.
6506 * * The types of functions with named parameters. These have the general form < i>(T<sub>1</sub>, 6939 * * The types of functions with named parameters. These have the general form < i>(T<sub>1</sub>,
6507 * &hellip;, T<sub>n</sub>, {T<sub>x1</sub> x1, &hellip;, T<sub>xk</sub> xk}) &r arr; T</i>. 6940 * &hellip;, T<sub>n</sub>, {T<sub>x1</sub> x1, &hellip;, T<sub>xk</sub> xk}) &r arr; T</i>.
6508 * </ol> 6941 * </ol>
6942 *
6509 * @coverage dart.engine.type 6943 * @coverage dart.engine.type
6510 */ 6944 */
6511 abstract class FunctionType implements ParameterizedType { 6945 abstract class FunctionType implements ParameterizedType {
6512 6946
6513 /** 6947 /**
6514 * Return a map from the names of named parameters to the types of the named p arameters of this 6948 * Return a map from the names of named parameters to the types of the named p arameters of this
6515 * type of function. The entries in the map will be iterated in the same order as the order in 6949 * type of function. The entries in the map will be iterated in the same order as the order in
6516 * which the named parameters were defined. If there were no named parameters declared then the 6950 * which the named parameters were defined. If there were no named parameters declared then the
6517 * map will be empty. 6951 * map will be empty.
6952 *
6518 * @return a map from the name to the types of the named parameters of this ty pe of function 6953 * @return a map from the name to the types of the named parameters of this ty pe of function
6519 */ 6954 */
6520 Map<String, Type2> get namedParameterTypes; 6955 Map<String, Type2> get namedParameterTypes;
6521 6956
6522 /** 6957 /**
6523 * Return an array containing the types of the normal parameters of this type of function. The 6958 * Return an array containing the types of the normal parameters of this type of function. The
6524 * parameter types are in the same order as they appear in the declaration of the function. 6959 * parameter types are in the same order as they appear in the declaration of the function.
6960 *
6525 * @return the types of the normal parameters of this type of function 6961 * @return the types of the normal parameters of this type of function
6526 */ 6962 */
6527 List<Type2> get normalParameterTypes; 6963 List<Type2> get normalParameterTypes;
6528 6964
6529 /** 6965 /**
6530 * Return a map from the names of optional (positional) parameters to the type s of the optional 6966 * Return a map from the names of optional (positional) parameters to the type s of the optional
6531 * parameters of this type of function. The entries in the map will be iterate d in the same order 6967 * parameters of this type of function. The entries in the map will be iterate d in the same order
6532 * as the order in which the optional parameters were defined. If there were n o optional 6968 * as the order in which the optional parameters were defined. If there were n o optional
6533 * parameters declared then the map will be empty. 6969 * parameters declared then the map will be empty.
6970 *
6534 * @return a map from the name to the types of the optional parameters of this type of function 6971 * @return a map from the name to the types of the optional parameters of this type of function
6535 */ 6972 */
6536 List<Type2> get optionalParameterTypes; 6973 List<Type2> get optionalParameterTypes;
6537 6974
6538 /** 6975 /**
6539 * Return an array containing the parameters elements of this type of function . The parameter 6976 * Return an array containing the parameters elements of this type of function . The parameter
6540 * types are in the same order as they appear in the declaration of the functi on. 6977 * types are in the same order as they appear in the declaration of the functi on.
6978 *
6541 * @return the parameters elements of this type of function 6979 * @return the parameters elements of this type of function
6542 */ 6980 */
6543 List<ParameterElement> get parameters; 6981 List<ParameterElement> get parameters;
6544 6982
6545 /** 6983 /**
6546 * Return the type of object returned by this type of function. 6984 * Return the type of object returned by this type of function.
6985 *
6547 * @return the type of object returned by this type of function 6986 * @return the type of object returned by this type of function
6548 */ 6987 */
6549 Type2 get returnType; 6988 Type2 get returnType;
6550 6989
6551 /** 6990 /**
6552 * Return `true` if this type is a subtype of the given type. 6991 * Return `true` if this type is a subtype of the given type.
6553 * 6992 *
6554 * A function type <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i> is a subtype of the 6993 * A function type <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i> is a subtype of the
6555 * function type <i>(S<sub>1</sub>, &hellip;, S<sub>n</sub>) &rarr; S</i>, if all of the following 6994 * function type <i>(S<sub>1</sub>, &hellip;, S<sub>n</sub>) &rarr; S</i>, if all of the following
6556 * conditions are met: 6995 * conditions are met:
6557 * 6996 *
6558 * * Either 6997 * * Either
6559 * 6998 *
6560 * * <i>S</i> is void, or 6999 * * <i>S</i> is void, or
6561 * * <i>T &hArr; S</i>. 7000 * * <i>T &hArr; S</i>.
6562 * 7001 *
6563 * 7002 *
6564 * * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> &hArr; S<su b>i</sub></i>. 7003 * * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> &hArr; S<su b>i</sub></i>.
6565 * 7004 *
6566 * A function type <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, \[T<sub>n+1</su b>, &hellip;, 7005 * A function type <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, [T<sub>n+1</sub >, &hellip;,
6567 * T<sub>n+k</sub>\]) &rarr; T</i> is a subtype of the function type <i>(S<sub >1</sub>, &hellip;, 7006 * T<sub>n+k</sub>]) &rarr; T</i> is a subtype of the function type <i>(S<sub> 1</sub>, &hellip;,
6568 * S<sub>n</sub>, \[S<sub>n+1</sub>, &hellip;, S<sub>n+m</sub>\]) &rarr; S</i> , if all of the 7007 * S<sub>n</sub>, [S<sub>n+1</sub>, &hellip;, S<sub>n+m</sub>]) &rarr; S</i>, if all of the
6569 * following conditions are met: 7008 * following conditions are met:
6570 * 7009 *
6571 * * Either 7010 * * Either
6572 * 7011 *
6573 * * <i>S</i> is void, or 7012 * * <i>S</i> is void, or
6574 * * <i>T &hArr; S</i>. 7013 * * <i>T &hArr; S</i>.
6575 * 7014 *
6576 * 7015 *
6577 * * <i>k</i> >= <i>m</i> and for all <i>i</i>, 1 <= <i>i</i> <= <i>n+m</i>, < i>T<sub>i</sub> 7016 * * <i>k</i> >= <i>m</i> and for all <i>i</i>, 1 <= <i>i</i> <= <i>n+m</i>, < i>T<sub>i</sub>
6578 * &hArr; S<sub>i</sub></i>. 7017 * &hArr; S<sub>i</sub></i>.
(...skipping 10 matching lines...) Expand all
6589 * 7028 *
6590 * 7029 *
6591 * * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> &hArr; S<su b>i</sub></i>. 7030 * * For all <i>i</i>, 1 <= <i>i</i> <= <i>n</i>, <i>T<sub>i</sub> &hArr; S<su b>i</sub></i>.
6592 * * <i>k</i> >= <i>m</i> and <i>y<sub>i</sub></i> in <i>{x<sub>1</sub>, &hell ip;, 7031 * * <i>k</i> >= <i>m</i> and <i>y<sub>i</sub></i> in <i>{x<sub>1</sub>, &hell ip;,
6593 * x<sub>k</sub>}</i>, 1 <= <i>i</i> <= <i>m</i>. 7032 * x<sub>k</sub>}</i>, 1 <= <i>i</i> <= <i>m</i>.
6594 * * For all <i>y<sub>i</sub></i> in <i>{y<sub>1</sub>, &hellip;, y<sub>m</sub >}</i>, 7033 * * For all <i>y<sub>i</sub></i> in <i>{y<sub>1</sub>, &hellip;, y<sub>m</sub >}</i>,
6595 * <i>y<sub>i</sub> = x<sub>j</sub> => Tj &hArr; Si</i>. 7034 * <i>y<sub>i</sub> = x<sub>j</sub> => Tj &hArr; Si</i>.
6596 * 7035 *
6597 * In addition, the following subtype rules apply: 7036 * In addition, the following subtype rules apply:
6598 * 7037 *
6599 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, \[\]) &rarr; T <: (T<sub>1</sub >, &hellip;, 7038 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, []) &rarr; T <: (T<sub>1</sub>, &hellip;,
6600 * T<sub>n</sub>) &rarr; T.</i><br> 7039 * T<sub>n</sub>) &rarr; T.</i><br>
6601 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T <: (T<sub>1</sub>, &he llip;, 7040 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T <: (T<sub>1</sub>, &he llip;,
6602 * T<sub>n</sub>, {}) &rarr; T.</i><br> 7041 * T<sub>n</sub>, {}) &rarr; T.</i><br>
6603 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, {}) &rarr; T <: (T<sub>1</sub>, &hellip;, 7042 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, {}) &rarr; T <: (T<sub>1</sub>, &hellip;,
6604 * T<sub>n</sub>) &rarr; T.</i><br> 7043 * T<sub>n</sub>) &rarr; T.</i><br>
6605 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T <: (T<sub>1</sub>, &he llip;, 7044 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T <: (T<sub>1</sub>, &he llip;,
6606 * T<sub>n</sub>, \[\]) &rarr; T.</i> 7045 * T<sub>n</sub>, []) &rarr; T.</i>
6607 * 7046 *
6608 * All functions implement the class `Function`. However not all function type s are a 7047 * All functions implement the class `Function`. However not all function type s are a
6609 * subtype of `Function`. If an interface type <i>I</i> includes a method name d`call()`, and the type of `call()` is the function type <i>F</i>, then <i>I</i> is 7048 * subtype of `Function`. If an interface type <i>I</i> includes a method name d
7049 * `call()`, and the type of `call()` is the function type <i>F</i>, then <i>I </i> is
6610 * considered to be a subtype of <i>F</i>. 7050 * considered to be a subtype of <i>F</i>.
7051 *
6611 * @param type the type being compared with this type 7052 * @param type the type being compared with this type
6612 * @return `true` if this type is a subtype of the given type 7053 * @return `true` if this type is a subtype of the given type
6613 */ 7054 */
6614 bool isSubtypeOf(Type2 type); 7055 bool isSubtypeOf(Type2 type);
6615 7056
6616 /** 7057 /**
6617 * Return the type resulting from substituting the given arguments for this ty pe's parameters. 7058 * Return the type resulting from substituting the given arguments for this ty pe's parameters.
6618 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())` . 7059 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())` .
7060 *
6619 * @param argumentTypes the actual type arguments being substituted for the ty pe parameters 7061 * @param argumentTypes the actual type arguments being substituted for the ty pe parameters
6620 * @return the result of performing the substitution 7062 * @return the result of performing the substitution
6621 */ 7063 */
6622 FunctionType substitute4(List<Type2> argumentTypes); 7064 FunctionType substitute4(List<Type2> argumentTypes);
6623 FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ); 7065 FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes );
6624 } 7066 }
6625 /** 7067 /**
6626 * The interface `InterfaceType` defines the behavior common to objects represen ting the type 7068 * The interface `InterfaceType` defines the behavior common to objects represen ting the type
6627 * introduced by either a class or an interface, or a reference to such a type. 7069 * introduced by either a class or an interface, or a reference to such a type.
7070 *
6628 * @coverage dart.engine.type 7071 * @coverage dart.engine.type
6629 */ 7072 */
6630 abstract class InterfaceType implements ParameterizedType { 7073 abstract class InterfaceType implements ParameterizedType {
6631 7074
6632 /** 7075 /**
6633 * Return an array containing all of the accessors (getters and setters) decla red in this type. 7076 * Return an array containing all of the accessors (getters and setters) decla red in this type.
7077 *
6634 * @return the accessors declared in this type 7078 * @return the accessors declared in this type
6635 */ 7079 */
6636 List<PropertyAccessorElement> get accessors; 7080 List<PropertyAccessorElement> get accessors;
6637 ClassElement get element; 7081 ClassElement get element;
6638 7082
6639 /** 7083 /**
6640 * Return the element representing the getter with the given name that is decl ared in this class, 7084 * Return the element representing the getter with the given name that is decl ared in this class,
6641 * or `null` if this class does not declare a getter with the given name. 7085 * or `null` if this class does not declare a getter with the given name.
7086 *
6642 * @param getterName the name of the getter to be returned 7087 * @param getterName the name of the getter to be returned
6643 * @return the getter declared in this class with the given name 7088 * @return the getter declared in this class with the given name
6644 */ 7089 */
6645 PropertyAccessorElement getGetter(String getterName); 7090 PropertyAccessorElement getGetter(String getterName);
6646 7091
6647 /** 7092 /**
6648 * Return an array containing all of the interfaces that are implemented by th is interface. Note 7093 * Return an array containing all of the interfaces that are implemented by th is interface. Note
6649 * that this is <b>not</b>, in general, equivalent to getting the interfaces f rom this type's 7094 * that this is <b>not</b>, in general, equivalent to getting the interfaces f rom this type's
6650 * element because the types returned by this method will have had their type parameters replaced. 7095 * element because the types returned by this method will have had their type parameters replaced.
7096 *
6651 * @return the interfaces that are implemented by this type 7097 * @return the interfaces that are implemented by this type
6652 */ 7098 */
6653 List<InterfaceType> get interfaces; 7099 List<InterfaceType> get interfaces;
6654 7100
6655 /** 7101 /**
6656 * Return the least upper bound of this type and the given type, or `null` if there is no 7102 * Return the least upper bound of this type and the given type, or `null` if there is no
6657 * least upper bound. 7103 * least upper bound.
6658 * 7104 *
6659 * Given two interfaces <i>I</i> and <i>J</i>, let <i>S<sub>I</sub></i> be the set of 7105 * Given two interfaces <i>I</i> and <i>J</i>, let <i>S<sub>I</sub></i> be the set of
6660 * superinterfaces of <i>I<i>, let <i>S<sub>J</sub></i> be the set of superint erfaces of <i>J</i> 7106 * superinterfaces of <i>I<i>, let <i>S<sub>J</sub></i> be the set of superint erfaces of <i>J</i>
6661 * and let <i>S = (I &cup; S<sub>I</sub>) &cap; (J &cup; S<sub>J</sub>)</i>. F urthermore, we 7107 * and let <i>S = (I &cup; S<sub>I</sub>) &cap; (J &cup; S<sub>J</sub>)</i>. F urthermore, we
6662 * define <i>S<sub>n</sub> = {T | T &isin; S &and; depth(T) = n}</i> for any f inite <i>n</i>, 7108 * define <i>S<sub>n</sub> = {T | T &isin; S &and; depth(T) = n}</i> for any f inite <i>n</i>,
6663 * where <i>depth(T)</i> is the number of steps in the longest inheritance pat h from <i>T</i> to 7109 * where <i>depth(T)</i> is the number of steps in the longest inheritance pat h from <i>T</i> to
6664 * <i>Object</i>. Let <i>q</i> be the largest number such that <i>S<sub>q</sub ></i> has 7110 * <i>Object</i>. Let <i>q</i> be the largest number such that <i>S<sub>q</sub ></i> has
6665 * cardinality one. The least upper bound of <i>I</i> and <i>J</i> is the sole element of 7111 * cardinality one. The least upper bound of <i>I</i> and <i>J</i> is the sole element of
6666 * <i>S<sub>q</sub></i>. 7112 * <i>S<sub>q</sub></i>.
7113 *
6667 * @param type the other type used to compute the least upper bound 7114 * @param type the other type used to compute the least upper bound
6668 * @return the least upper bound of this type and the given type 7115 * @return the least upper bound of this type and the given type
6669 */ 7116 */
6670 Type2 getLeastUpperBound(Type2 type); 7117 Type2 getLeastUpperBound(Type2 type);
6671 7118
6672 /** 7119 /**
6673 * Return the element representing the method with the given name that is decl ared in this class, 7120 * Return the element representing the method with the given name that is decl ared in this class,
6674 * or `null` if this class does not declare a method with the given name. 7121 * or `null` if this class does not declare a method with the given name.
7122 *
6675 * @param methodName the name of the method to be returned 7123 * @param methodName the name of the method to be returned
6676 * @return the method declared in this class with the given name 7124 * @return the method declared in this class with the given name
6677 */ 7125 */
6678 MethodElement getMethod(String methodName); 7126 MethodElement getMethod(String methodName);
6679 7127
6680 /** 7128 /**
6681 * Return an array containing all of the methods declared in this type. 7129 * Return an array containing all of the methods declared in this type.
7130 *
6682 * @return the methods declared in this type 7131 * @return the methods declared in this type
6683 */ 7132 */
6684 List<MethodElement> get methods; 7133 List<MethodElement> get methods;
6685 7134
6686 /** 7135 /**
6687 * Return an array containing all of the mixins that are applied to the class being extended in 7136 * Return an array containing all of the mixins that are applied to the class being extended in
6688 * order to derive the superclass of this class. Note that this is <b>not</b>, in general, 7137 * order to derive the superclass of this class. Note that this is <b>not</b>, in general,
6689 * equivalent to getting the mixins from this type's element because the types returned by this 7138 * equivalent to getting the mixins from this type's element because the types returned by this
6690 * method will have had their type parameters replaced. 7139 * method will have had their type parameters replaced.
7140 *
6691 * @return the mixins that are applied to derive the superclass of this class 7141 * @return the mixins that are applied to derive the superclass of this class
6692 */ 7142 */
6693 List<InterfaceType> get mixins; 7143 List<InterfaceType> get mixins;
6694 7144
6695 /** 7145 /**
6696 * Return the element representing the setter with the given name that is decl ared in this class, 7146 * Return the element representing the setter with the given name that is decl ared in this class,
6697 * or `null` if this class does not declare a setter with the given name. 7147 * or `null` if this class does not declare a setter with the given name.
7148 *
6698 * @param setterName the name of the setter to be returned 7149 * @param setterName the name of the setter to be returned
6699 * @return the setter declared in this class with the given name 7150 * @return the setter declared in this class with the given name
6700 */ 7151 */
6701 PropertyAccessorElement getSetter(String setterName); 7152 PropertyAccessorElement getSetter(String setterName);
6702 7153
6703 /** 7154 /**
6704 * Return the type representing the superclass of this type, or null if this t ype represents the 7155 * Return the type representing the superclass of this type, or null if this t ype represents the
6705 * class 'Object'. Note that this is <b>not</b>, in general, equivalent to get ting the superclass 7156 * class 'Object'. Note that this is <b>not</b>, in general, equivalent to get ting the superclass
6706 * from this type's element because the type returned by this method will have had it's type 7157 * from this type's element because the type returned by this method will have had it's type
6707 * parameters replaced. 7158 * parameters replaced.
7159 *
6708 * @return the superclass of this type 7160 * @return the superclass of this type
6709 */ 7161 */
6710 InterfaceType get superclass; 7162 InterfaceType get superclass;
6711 7163
6712 /** 7164 /**
6713 * Return `true` if this type is a direct supertype of the given type. The imp licit 7165 * Return `true` if this type is a direct supertype of the given type. The imp licit
6714 * interface of class <i>I</i> is a direct supertype of the implicit interface of class <i>J</i> 7166 * interface of class <i>I</i> is a direct supertype of the implicit interface of class <i>J</i>
6715 * iff: 7167 * iff:
6716 * 7168 *
6717 * * <i>I</i> is Object, and <i>J</i> has no extends clause. 7169 * * <i>I</i> is Object, and <i>J</i> has no extends clause.
6718 * * <i>I</i> is listed in the extends clause of <i>J</i>. 7170 * * <i>I</i> is listed in the extends clause of <i>J</i>.
6719 * * <i>I</i> is listed in the implements clause of <i>J</i>. 7171 * * <i>I</i> is listed in the implements clause of <i>J</i>.
6720 * * <i>I</i> is listed in the with clause of <i>J</i>. 7172 * * <i>I</i> is listed in the with clause of <i>J</i>.
6721 * * <i>J</i> is a mixin application of the mixin of <i>I</i>. 7173 * * <i>J</i> is a mixin application of the mixin of <i>I</i>.
6722 * 7174 *
7175 *
6723 * @param type the type being compared with this type 7176 * @param type the type being compared with this type
6724 * @return `true` if this type is a direct supertype of the given type 7177 * @return `true` if this type is a direct supertype of the given type
6725 */ 7178 */
6726 bool isDirectSupertypeOf(InterfaceType type); 7179 bool isDirectSupertypeOf(InterfaceType type);
6727 7180
6728 /** 7181 /**
6729 * Return `true` if this type is more specific than the given type. An interfa ce type 7182 * Return `true` if this type is more specific than the given type. An interfa ce type
6730 * <i>T</i> is more specific than an interface type <i>S</i>, written <i>T &la quo; S</i>, if one 7183 * <i>T</i> is more specific than an interface type <i>S</i>, written <i>T &la quo; S</i>, if one
6731 * of the following conditions is met: 7184 * of the following conditions is met:
6732 * 7185 *
6733 * * Reflexivity: <i>T</i> is <i>S</i>. 7186 * * Reflexivity: <i>T</i> is <i>S</i>.
6734 * * <i>T</i> is bottom. 7187 * * <i>T</i> is bottom.
6735 * * <i>S</i> is dynamic. 7188 * * <i>S</i> is dynamic.
6736 * * Direct supertype: <i>S</i> is a direct supertype of <i>T</i>. 7189 * * Direct supertype: <i>S</i> is a direct supertype of <i>T</i>.
6737 * * <i>T</i> is a type variable and <i>S</i> is the upper bound of <i>T</i>. 7190 * * <i>T</i> is a type variable and <i>S</i> is the upper bound of <i>T</i>.
6738 * * Covariance: <i>T</i> is of the form <i>I&lt;T<sub>1</sub>, &hellip;, T<su b>n</sub>&gt;</i> 7191 * * Covariance: <i>T</i> is of the form <i>I&lt;T<sub>1</sub>, &hellip;, T<su b>n</sub>&gt;</i>
6739 * and S</i> is of the form <i>I&lt;S<sub>1</sub>, &hellip;, S<sub>n</sub>&gt; </i> and 7192 * and S</i> is of the form <i>I&lt;S<sub>1</sub>, &hellip;, S<sub>n</sub>&gt; </i> and
6740 * <i>T<sub>i</sub> &laquo; S<sub>i</sub></i>, <i>1 <= i <= n</i>. 7193 * <i>T<sub>i</sub> &laquo; S<sub>i</sub></i>, <i>1 <= i <= n</i>.
6741 * * Transitivity: <i>T &laquo; U</i> and <i>U &laquo; S</i>. 7194 * * Transitivity: <i>T &laquo; U</i> and <i>U &laquo; S</i>.
6742 * 7195 *
7196 *
6743 * @param type the type being compared with this type 7197 * @param type the type being compared with this type
6744 * @return `true` if this type is more specific than the given type 7198 * @return `true` if this type is more specific than the given type
6745 */ 7199 */
6746 bool isMoreSpecificThan(Type2 type); 7200 bool isMoreSpecificThan(Type2 type);
6747 7201
6748 /** 7202 /**
6749 * Return `true` if this type is a subtype of the given type. An interface typ e <i>T</i> is 7203 * Return `true` if this type is a subtype of the given type. An interface typ e <i>T</i> is
6750 * a subtype of an interface type <i>S</i>, written <i>T</i> <: <i>S</i>, iff 7204 * a subtype of an interface type <i>S</i>, written <i>T</i> <: <i>S</i>, iff
6751 * <i>\[bottom/dynamic\]T</i> &laquo; <i>S</i> (<i>T</i> is more specific than <i>S</i>). If an 7205 * <i>[bottom/dynamic]T</i> &laquo; <i>S</i> (<i>T</i> is more specific than < i>S</i>). If an
6752 * interface type <i>I</i> includes a method named <i>call()</i>, and the type of <i>call()</i> is 7206 * interface type <i>I</i> includes a method named <i>call()</i>, and the type of <i>call()</i> is
6753 * the function type <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>. 7207 * the function type <i>F</i>, then <i>I</i> is considered to be a subtype of <i>F</i>.
7208 *
6754 * @param type the type being compared with this type 7209 * @param type the type being compared with this type
6755 * @return `true` if this type is a subtype of the given type 7210 * @return `true` if this type is a subtype of the given type
6756 */ 7211 */
6757 bool isSubtypeOf(Type2 type); 7212 bool isSubtypeOf(Type2 type);
6758 7213
6759 /** 7214 /**
6760 * Return the element representing the constructor that results from looking u p the given 7215 * Return the element representing the constructor that results from looking u p the given
6761 * constructor in this class with respect to the given library, or `null` if t he look up 7216 * constructor in this class with respect to the given library, or `null` if t he look up
6762 * fails. The behavior of this method is defined by the Dart Language Specific ation in section 7217 * fails. The behavior of this method is defined by the Dart Language Specific ation in section
6763 * 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 7218 * 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
6764 * the constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor <i>T< i>. Otherwise, if 7219 * the constructor <i>T.id</i>, otherwise let <i>q<i> be the constructor <i>T< i>. Otherwise, if
6765 * <i>q</i> is not defined or not accessible, a NoSuchMethodException is throw n. </blockquote> 7220 * <i>q</i> is not defined or not accessible, a NoSuchMethodException is throw n. </blockquote>
7221 *
6766 * @param constructorName the name of the constructor being looked up 7222 * @param constructorName the name of the constructor being looked up
6767 * @param library the library with respect to which the lookup is being perfor med 7223 * @param library the library with respect to which the lookup is being perfor med
6768 * @return the result of looking up the given constructor in this class with r espect to the given 7224 * @return the result of looking up the given constructor in this class with r espect to the given
6769 * library 7225 * library
6770 */ 7226 */
6771 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li brary); 7227 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li brary);
6772 7228
6773 /** 7229 /**
6774 * Return the element representing the getter that results from looking up the given getter in 7230 * Return the element representing the getter that results from looking up the given getter in
6775 * this class with respect to the given library, or `null` if the look up fail s. The 7231 * this class with respect to the given library, or `null` if the look up fail s. The
6776 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1: 7232 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1:
6777 * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> 7233 * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
6778 * with respect to library <i>L</i> is: 7234 * with respect to library <i>L</i> is:
6779 * 7235 *
6780 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is 7236 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is
6781 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 7237 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
6782 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 7238 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
6783 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 7239 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
6784 * Otherwise, we say that the lookup has failed. 7240 * Otherwise, we say that the lookup has failed.
6785 * 7241 *
6786 * </blockquote> 7242 * </blockquote>
7243 *
6787 * @param getterName the name of the getter being looked up 7244 * @param getterName the name of the getter being looked up
6788 * @param library the library with respect to which the lookup is being perfor med 7245 * @param library the library with respect to which the lookup is being perfor med
6789 * @return the result of looking up the given getter in this class with respec t to the given 7246 * @return the result of looking up the given getter in this class with respec t to the given
6790 * library 7247 * library
6791 */ 7248 */
6792 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library ); 7249 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library );
6793 7250
6794 /** 7251 /**
6795 * Return the element representing the getter that results from looking up the given getter in the 7252 * Return the element representing the getter that results from looking up the given getter in the
6796 * superclass of this class with respect to the given library, or `null` if th e look up 7253 * superclass of this class with respect to the given library, or `null` if th e look up
6797 * fails. The behavior of this method is defined by the Dart Language Specific ation in section 7254 * fails. The behavior of this method is defined by the Dart Language Specific ation in section
6798 * 12.15.1: <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class 7255 * 12.15.1: <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class
6799 * <i>C</i> with respect to library <i>L</i> is: 7256 * <i>C</i> with respect to library <i>L</i> is:
6800 * 7257 *
6801 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is 7258 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is
6802 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 7259 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
6803 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 7260 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
6804 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 7261 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
6805 * Otherwise, we say that the lookup has failed. 7262 * Otherwise, we say that the lookup has failed.
6806 * 7263 *
6807 * </blockquote> 7264 * </blockquote>
7265 *
6808 * @param getterName the name of the getter being looked up 7266 * @param getterName the name of the getter being looked up
6809 * @param library the library with respect to which the lookup is being perfor med 7267 * @param library the library with respect to which the lookup is being perfor med
6810 * @return the result of looking up the given getter in this class with respec t to the given 7268 * @return the result of looking up the given getter in this class with respec t to the given
6811 * library 7269 * library
6812 */ 7270 */
6813 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryEle ment library); 7271 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryEle ment library);
6814 7272
6815 /** 7273 /**
6816 * Return the element representing the method that results from looking up the given method in 7274 * Return the element representing the method that results from looking up the given method in
6817 * this class with respect to the given library, or `null` if the look up fail s. The 7275 * this class with respect to the given library, or `null` if the look up fail s. The
6818 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1: 7276 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1:
6819 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit h respect to library 7277 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit h respect to library
6820 * <i>L</i> is: 7278 * <i>L</i> is:
6821 * 7279 *
6822 * * If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then 7280 * * If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then
6823 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then 7281 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then
6824 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect 7282 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect
6825 * to <i>L</i>. Otherwise, we say that the lookup has failed. 7283 * to <i>L</i>. Otherwise, we say that the lookup has failed.
6826 * 7284 *
6827 * </blockquote> 7285 * </blockquote>
7286 *
6828 * @param methodName the name of the method being looked up 7287 * @param methodName the name of the method being looked up
6829 * @param library the library with respect to which the lookup is being perfor med 7288 * @param library the library with respect to which the lookup is being perfor med
6830 * @return the result of looking up the given method in this class with respec t to the given 7289 * @return the result of looking up the given method in this class with respec t to the given
6831 * library 7290 * library
6832 */ 7291 */
6833 MethodElement lookUpMethod(String methodName, LibraryElement library); 7292 MethodElement lookUpMethod(String methodName, LibraryElement library);
6834 7293
6835 /** 7294 /**
6836 * Return the element representing the method that results from looking up the given method in the 7295 * Return the element representing the method that results from looking up the given method in the
6837 * superclass of this class with respect to the given library, or `null` if th e look up 7296 * superclass of this class with respect to the given library, or `null` if th e look up
6838 * fails. The behavior of this method is defined by the Dart Language Specific ation in section 7297 * fails. The behavior of this method is defined by the Dart Language Specific ation in section
6839 * 12.15.1: <blockquote> The result of looking up method <i>m</i> in class <i> C</i> with respect 7298 * 12.15.1: <blockquote> The result of looking up method <i>m</i> in class <i> C</i> with respect
6840 * to library <i>L</i> is: 7299 * to library <i>L</i> is:
6841 * 7300 *
6842 * * If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then 7301 * * If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then
6843 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then 7302 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then
6844 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect 7303 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect
6845 * to <i>L</i>. Otherwise, we say that the lookup has failed. 7304 * to <i>L</i>. Otherwise, we say that the lookup has failed.
6846 * 7305 *
6847 * </blockquote> 7306 * </blockquote>
7307 *
6848 * @param methodName the name of the method being looked up 7308 * @param methodName the name of the method being looked up
6849 * @param library the library with respect to which the lookup is being perfor med 7309 * @param library the library with respect to which the lookup is being perfor med
6850 * @return the result of looking up the given method in this class with respec t to the given 7310 * @return the result of looking up the given method in this class with respec t to the given
6851 * library 7311 * library
6852 */ 7312 */
6853 MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement libra ry); 7313 MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement libra ry);
6854 7314
6855 /** 7315 /**
6856 * Return the element representing the setter that results from looking up the given setter in 7316 * Return the element representing the setter that results from looking up the given setter in
6857 * this class with respect to the given library, or `null` if the look up fail s. The 7317 * this class with respect to the given library, or `null` if the look up fail s. The
6858 * behavior of this method is defined by the Dart Language Specification in se ction 12.16: 7318 * behavior of this method is defined by the Dart Language Specification in se ction 12.16:
6859 * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> 7319 * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
6860 * with respect to library <i>L</i> is: 7320 * with respect to library <i>L</i> is:
6861 * 7321 *
6862 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is 7322 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is
6863 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 7323 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
6864 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 7324 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
6865 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 7325 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
6866 * Otherwise, we say that the lookup has failed. 7326 * Otherwise, we say that the lookup has failed.
6867 * 7327 *
6868 * </blockquote> 7328 * </blockquote>
7329 *
6869 * @param setterName the name of the setter being looked up 7330 * @param setterName the name of the setter being looked up
6870 * @param library the library with respect to which the lookup is being perfor med 7331 * @param library the library with respect to which the lookup is being perfor med
6871 * @return the result of looking up the given setter in this class with respec t to the given 7332 * @return the result of looking up the given setter in this class with respec t to the given
6872 * library 7333 * library
6873 */ 7334 */
6874 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library ); 7335 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library );
6875 7336
6876 /** 7337 /**
6877 * Return the element representing the setter that results from looking up the given setter in the 7338 * Return the element representing the setter that results from looking up the given setter in the
6878 * superclass of this class with respect to the given library, or `null` if th e look up 7339 * superclass of this class with respect to the given library, or `null` if th e look up
6879 * fails. The behavior of this method is defined by the Dart Language Specific ation in section 7340 * fails. The behavior of this method is defined by the Dart Language Specific ation in section
6880 * 12.16: <blockquote> The result of looking up getter (respectively setter) < i>m</i> in class 7341 * 12.16: <blockquote> The result of looking up getter (respectively setter) < i>m</i> in class
6881 * <i>C</i> with respect to library <i>L</i> is: 7342 * <i>C</i> with respect to library <i>L</i> is:
6882 * 7343 *
6883 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is 7344 * * If <i>C</i> declares an instance getter (respectively setter) named <i>m< /i> that is
6884 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 7345 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
6885 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 7346 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
6886 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 7347 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
6887 * Otherwise, we say that the lookup has failed. 7348 * Otherwise, we say that the lookup has failed.
6888 * 7349 *
6889 * </blockquote> 7350 * </blockquote>
7351 *
6890 * @param setterName the name of the setter being looked up 7352 * @param setterName the name of the setter being looked up
6891 * @param library the library with respect to which the lookup is being perfor med 7353 * @param library the library with respect to which the lookup is being perfor med
6892 * @return the result of looking up the given setter in this class with respec t to the given 7354 * @return the result of looking up the given setter in this class with respec t to the given
6893 * library 7355 * library
6894 */ 7356 */
6895 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle ment library); 7357 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle ment library);
6896 7358
6897 /** 7359 /**
6898 * Return the type resulting from substituting the given arguments for this ty pe's parameters. 7360 * Return the type resulting from substituting the given arguments for this ty pe's parameters.
6899 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())` . 7361 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())` .
7362 *
6900 * @param argumentTypes the actual type arguments being substituted for the ty pe parameters 7363 * @param argumentTypes the actual type arguments being substituted for the ty pe parameters
6901 * @return the result of performing the substitution 7364 * @return the result of performing the substitution
6902 */ 7365 */
6903 InterfaceType substitute5(List<Type2> argumentTypes); 7366 InterfaceType substitute5(List<Type2> argumentTypes);
6904 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType s); 7367 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType s);
6905 } 7368 }
6906 /** 7369 /**
6907 * The interface `ParameterizedType` defines the behavior common to objects repr esenting the 7370 * The interface `ParameterizedType` defines the behavior common to objects repr esenting the
6908 * type with type parameters, such as class and function type alias. 7371 * type with type parameters, such as class and function type alias.
7372 *
6909 * @coverage dart.engine.type 7373 * @coverage dart.engine.type
6910 */ 7374 */
6911 abstract class ParameterizedType implements Type2 { 7375 abstract class ParameterizedType implements Type2 {
6912 7376
6913 /** 7377 /**
6914 * Return an array containing the actual types of the type arguments. If this type's element does 7378 * Return an array containing the actual types of the type arguments. If this type's element does
6915 * not have type parameters, then the array should be empty (although it is po ssible for type 7379 * not have type parameters, then the array should be empty (although it is po ssible for type
6916 * arguments to be erroneously declared). If the element has type parameters a nd the actual type 7380 * arguments to be erroneously declared). If the element has type parameters a nd the actual type
6917 * does not explicitly include argument values, then the type "dynamic" will b e automatically 7381 * does not explicitly include argument values, then the type "dynamic" will b e automatically
6918 * provided. 7382 * provided.
7383 *
6919 * @return the actual types of the type arguments 7384 * @return the actual types of the type arguments
6920 */ 7385 */
6921 List<Type2> get typeArguments; 7386 List<Type2> get typeArguments;
6922 7387
6923 /** 7388 /**
6924 * Return an array containing all of the type variables declared for this type . 7389 * Return an array containing all of the type variables declared for this type .
7390 *
6925 * @return the type variables declared for this type 7391 * @return the type variables declared for this type
6926 */ 7392 */
6927 List<TypeVariableElement> get typeVariables; 7393 List<TypeVariableElement> get typeVariables;
6928 } 7394 }
6929 /** 7395 /**
6930 * The interface `Type` defines the behavior of objects representing the declare d type of 7396 * The interface `Type` defines the behavior of objects representing the declare d type of
6931 * elements in the element model. 7397 * elements in the element model.
7398 *
6932 * @coverage dart.engine.type 7399 * @coverage dart.engine.type
6933 */ 7400 */
6934 abstract class Type2 { 7401 abstract class Type2 {
6935 7402
6936 /** 7403 /**
6937 * Return the name of this type as it should appear when presented to users in contexts such as 7404 * Return the name of this type as it should appear when presented to users in contexts such as
6938 * error messages. 7405 * error messages.
7406 *
6939 * @return the name of this type 7407 * @return the name of this type
6940 */ 7408 */
6941 String get displayName; 7409 String get displayName;
6942 7410
6943 /** 7411 /**
6944 * Return the element representing the declaration of this type, or `null` if the type has 7412 * Return the element representing the declaration of this type, or `null` if the type has
6945 * not, or cannot, be associated with an element. The former case will occur i f the element model 7413 * not, or cannot, be associated with an element. The former case will occur i f the element model
6946 * is not yet complete; the latter case will occur if this object represents a n undefined type. 7414 * is not yet complete; the latter case will occur if this object represents a n undefined type.
7415 *
6947 * @return the element representing the declaration of this type 7416 * @return the element representing the declaration of this type
6948 */ 7417 */
6949 Element get element; 7418 Element get element;
6950 7419
6951 /** 7420 /**
6952 * Return the least upper bound of this type and the given type, or `null` if there is no 7421 * Return the least upper bound of this type and the given type, or `null` if there is no
6953 * least upper bound. 7422 * least upper bound.
7423 *
6954 * @param type the other type used to compute the least upper bound 7424 * @param type the other type used to compute the least upper bound
6955 * @return the least upper bound of this type and the given type 7425 * @return the least upper bound of this type and the given type
6956 */ 7426 */
6957 Type2 getLeastUpperBound(Type2 type); 7427 Type2 getLeastUpperBound(Type2 type);
6958 7428
6959 /** 7429 /**
6960 * Return the name of this type, or `null` if the type does not have a name, s uch as when 7430 * Return the name of this type, or `null` if the type does not have a name, s uch as when
6961 * the type represents the type of an unnamed function. 7431 * the type represents the type of an unnamed function.
7432 *
6962 * @return the name of this type 7433 * @return the name of this type
6963 */ 7434 */
6964 String get name; 7435 String get name;
6965 7436
6966 /** 7437 /**
6967 * Return `true` if this type is assignable to the given type. A type <i>T</i> may be 7438 * Return `true` if this type is assignable to the given type. A type <i>T</i> may be
6968 * assigned to a type <i>S</i>, written <i>T</i> &hArr; <i>S</i>, iff either < i>T</i> <: <i>S</i> 7439 * assigned to a type <i>S</i>, written <i>T</i> &hArr; <i>S</i>, iff either < i>T</i> <: <i>S</i>
6969 * or <i>S</i> <: <i>T</i>. 7440 * or <i>S</i> <: <i>T</i>.
7441 *
6970 * @param type the type being compared with this type 7442 * @param type the type being compared with this type
6971 * @return `true` if this type is assignable to the given type 7443 * @return `true` if this type is assignable to the given type
6972 */ 7444 */
6973 bool isAssignableTo(Type2 type); 7445 bool isAssignableTo(Type2 type);
6974 7446
6975 /** 7447 /**
6976 * Return `true` if this type represents the type 'Function' defined in the da rt:core 7448 * Return `true` if this type represents the type 'Function' defined in the da rt:core
6977 * library. 7449 * library.
7450 *
6978 * @return `true` if this type represents the type 'Function' defined in the d art:core 7451 * @return `true` if this type represents the type 'Function' defined in the d art:core
6979 * library 7452 * library
6980 */ 7453 */
6981 bool get isDartCoreFunction; 7454 bool get isDartCoreFunction;
6982 7455
6983 /** 7456 /**
6984 * Return `true` if this type represents the type 'dynamic'. 7457 * Return `true` if this type represents the type 'dynamic'.
7458 *
6985 * @return `true` if this type represents the type 'dynamic' 7459 * @return `true` if this type represents the type 'dynamic'
6986 */ 7460 */
6987 bool get isDynamic; 7461 bool get isDynamic;
6988 7462
6989 /** 7463 /**
6990 * Return `true` if this type is more specific than the given type. 7464 * Return `true` if this type is more specific than the given type.
7465 *
6991 * @param type the type being compared with this type 7466 * @param type the type being compared with this type
6992 * @return `true` if this type is more specific than the given type 7467 * @return `true` if this type is more specific than the given type
6993 */ 7468 */
6994 bool isMoreSpecificThan(Type2 type); 7469 bool isMoreSpecificThan(Type2 type);
6995 7470
6996 /** 7471 /**
6997 * Return `true` if this type represents the type 'Object'. 7472 * Return `true` if this type represents the type 'Object'.
7473 *
6998 * @return `true` if this type represents the type 'Object' 7474 * @return `true` if this type represents the type 'Object'
6999 */ 7475 */
7000 bool get isObject; 7476 bool get isObject;
7001 7477
7002 /** 7478 /**
7003 * Return `true` if this type is a subtype of the given type. 7479 * Return `true` if this type is a subtype of the given type.
7480 *
7004 * @param type the type being compared with this type 7481 * @param type the type being compared with this type
7005 * @return `true` if this type is a subtype of the given type 7482 * @return `true` if this type is a subtype of the given type
7006 */ 7483 */
7007 bool isSubtypeOf(Type2 type); 7484 bool isSubtypeOf(Type2 type);
7008 7485
7009 /** 7486 /**
7010 * Return `true` if this type is a supertype of the given type. A type <i>S</i > is a 7487 * Return `true` if this type is a supertype of the given type. A type <i>S</i > is a
7011 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt ype of <i>S</i>. 7488 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt ype of <i>S</i>.
7489 *
7012 * @param type the type being compared with this type 7490 * @param type the type being compared with this type
7013 * @return `true` if this type is a supertype of the given type 7491 * @return `true` if this type is a supertype of the given type
7014 */ 7492 */
7015 bool isSupertypeOf(Type2 type); 7493 bool isSupertypeOf(Type2 type);
7016 7494
7017 /** 7495 /**
7018 * Return `true` if this type represents the type 'void'. 7496 * Return `true` if this type represents the type 'void'.
7497 *
7019 * @return `true` if this type represents the type 'void' 7498 * @return `true` if this type represents the type 'void'
7020 */ 7499 */
7021 bool get isVoid; 7500 bool get isVoid;
7022 7501
7023 /** 7502 /**
7024 * Return the type resulting from substituting the given arguments for the giv en parameters in 7503 * Return the type resulting from substituting the given arguments for the giv en parameters in
7025 * this type. The specification defines this operation in section 2: <blockquo te> The notation 7504 * this type. The specification defines this operation in section 2: <blockquo te> The notation
7026 * <i>\[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>\]E </i> denotes a copy of 7505 * <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>]E</ i> denotes a copy of
7027 * <i>E</i> in which all occurrences of <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with 7506 * <i>E</i> in which all occurrences of <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with
7028 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification , this method will 7507 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification , this method will
7029 * not create a copy of this type if no substitutions were required, but will return this type 7508 * not create a copy of this type if no substitutions were required, but will return this type
7030 * directly. 7509 * directly.
7510 *
7031 * @param argumentTypes the actual type arguments being substituted for the pa rameters 7511 * @param argumentTypes the actual type arguments being substituted for the pa rameters
7032 * @param parameterTypes the parameters to be replaced 7512 * @param parameterTypes the parameters to be replaced
7033 * @return the result of performing the substitution 7513 * @return the result of performing the substitution
7034 */ 7514 */
7035 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 7515 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
7036 } 7516 }
7037 /** 7517 /**
7038 * The interface `TypeVariableType` defines the behavior of objects representing the type 7518 * The interface `TypeVariableType` defines the behavior of objects representing the type
7039 * introduced by a type variable. 7519 * introduced by a type variable.
7520 *
7040 * @coverage dart.engine.type 7521 * @coverage dart.engine.type
7041 */ 7522 */
7042 abstract class TypeVariableType implements Type2 { 7523 abstract class TypeVariableType implements Type2 {
7043 TypeVariableElement get element; 7524 TypeVariableElement get element;
7044 } 7525 }
7045 /** 7526 /**
7046 * The interface `VoidType` defines the behavior of the unique object representi ng the type`void`. 7527 * The interface `VoidType` defines the behavior of the unique object representi ng the type
7528 * `void`.
7529 *
7047 * @coverage dart.engine.type 7530 * @coverage dart.engine.type
7048 */ 7531 */
7049 abstract class VoidType implements Type2 { 7532 abstract class VoidType implements Type2 {
7050 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 7533 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
7051 } 7534 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/constant.dart ('k') | pkg/analyzer_experimental/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698