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

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

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