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

Side by Side Diff: pkg/analyzer-experimental/lib/src/generated/element.dart

Issue 12502002: Update analyzer-experimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 3
4 library engine.element; 4 library engine.element;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart'; 8 import 'java_engine.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'scanner.dart' show Keyword; 10 import 'scanner.dart' show Keyword;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 * @return the unnamed constructor defined in this class 96 * @return the unnamed constructor defined in this class
97 */ 97 */
98 ConstructorElement get unnamedConstructor; 98 ConstructorElement get unnamedConstructor;
99 /** 99 /**
100 * 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 100 * 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
101 * <i>has unimplemented members</i>. 101 * <i>has unimplemented members</i>.
102 * @return {@code true} if this class is abstract 102 * @return {@code true} if this class is abstract
103 */ 103 */
104 bool isAbstract(); 104 bool isAbstract();
105 /** 105 /**
106 * Return {@code true} if this class is defined by a typedef construct.
107 * @return {@code true} if this class is defined by a typedef construct
108 */
109 bool isTypedef();
110 /**
111 * Return {@code true} if this class can validly be used as a mixin when defin ing another class.
112 * The behavior of this method is defined by the Dart Language Specification i n section 9:
113 * <blockquote>It is a compile-time error if a declared or derived mixin refer s to super. It is a
114 * compile-time error if a declared or derived mixin explicitly declares a con structor. It is a
115 * compile-time error if a mixin is derived from a class whose superclass is n ot
116 * Object.</blockquote>
117 * @return {@code true} if this class can validly be used as a mixin
118 */
119 bool isValidMixin();
120 /**
106 * Return the element representing the getter that results from looking up the given getter in 121 * Return the element representing the getter that results from looking up the given getter in
107 * this class with respect to the given library, or {@code null} if the look u p fails. The 122 * this class with respect to the given library, or {@code null} if the look u p fails. The
108 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1: 123 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1:
109 * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i> 124 * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
110 * with respect to library <i>L</i> is: 125 * with respect to library <i>L</i> is:
111 * <ul> 126 * <ul>
112 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i> m</i> that is 127 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i> m</i> that is
113 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup. 128 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
114 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result 129 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
115 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>. 130 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
116 * Otherwise, we say that the lookup has failed.</li> 131 * Otherwise, we say that the lookup has failed.</li>
117 * </ul> 132 * </ul>
118 * </blockquote> 133 * </blockquote>
119 * @param getterName the name of the getter being looked up 134 * @param getterName the name of the getter being looked up
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 * Return an array containing all of the type aliases contained in this compil ation unit. 202 * Return an array containing all of the type aliases contained in this compil ation unit.
188 * @return the type aliases contained in this compilation unit 203 * @return the type aliases contained in this compilation unit
189 */ 204 */
190 List<TypeAliasElement> get typeAliases; 205 List<TypeAliasElement> get typeAliases;
191 /** 206 /**
192 * Return an array containing all of the classes contained in this compilation unit. 207 * Return an array containing all of the classes contained in this compilation unit.
193 * @return the classes contained in this compilation unit 208 * @return the classes contained in this compilation unit
194 */ 209 */
195 List<ClassElement> get types; 210 List<ClassElement> get types;
196 /** 211 /**
197 * Return an array containing all of the variables contained in this compilati on unit. 212 * Return an array containing all of the top-level variables contained in this compilation unit.
198 * @return the variables contained in this compilation unit 213 * @return the top-level variables contained in this compilation unit
199 */ 214 */
200 List<VariableElement> get variables; 215 List<TopLevelVariableElement> get topLevelVariables;
201 } 216 }
202 /** 217 /**
203 * The interface {@code ConstructorElement} defines the behavior of elements rep resenting a 218 * The interface {@code ConstructorElement} defines the behavior of elements rep resenting a
204 * constructor or a factory method defined within a type. 219 * constructor or a factory method defined within a type.
205 */ 220 */
206 abstract class ConstructorElement implements ExecutableElement { 221 abstract class ConstructorElement implements ExecutableElement {
207 /** 222 /**
208 * Return the type in which this constructor is defined. 223 * Return the type in which this constructor is defined.
209 * @return the type in which this constructor is defined 224 * @return the type in which this constructor is defined
210 */ 225 */
(...skipping 24 matching lines...) Expand all
235 * <li>fields that are induced by explicit declarations of getters and setters, and 250 * <li>fields that are induced by explicit declarations of getters and setters, and
236 * <li>functions representing the initialization expression for a variable. 251 * <li>functions representing the initialization expression for a variable.
237 * </ul> 252 * </ul>
238 * <p> 253 * <p>
239 * Second, there are elements in the element model that do not have a name. Thes e correspond to 254 * Second, there are elements in the element model that do not have a name. Thes e correspond to
240 * unnamed functions and exist in order to more accurately represent the semanti c structure of the 255 * unnamed functions and exist in order to more accurately represent the semanti c structure of the
241 * program. 256 * program.
242 */ 257 */
243 abstract class Element { 258 abstract class Element {
244 /** 259 /**
260 * A comparator that can be used to sort elements by their name offset. Elemen ts with a smaller
261 * offset will be sorted to be before elements with a larger name offset.
262 */
263 static Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Element sec ondElement) => firstElement.nameOffset - secondElement.nameOffset;
264 /**
265 * Use the given visitor to visit this element.
266 * @param visitor the visitor that will visit this element
267 * @return the value returned by the visitor as a result of visiting this elem ent
268 */
269 accept(ElementVisitor visitor);
270 /**
245 * 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. 271 * 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.
246 * @param elementClass the class of the element to be returned 272 * @param elementClass the class of the element to be returned
247 * @return the element that encloses this element 273 * @return the element that encloses this element
248 */ 274 */
249 Element getAncestor(Type elementClass); 275 Element getAncestor(Type elementClass);
250 /** 276 /**
251 * Return the analysis context in which this element is defined. 277 * Return the analysis context in which this element is defined.
252 * @return the analysis context in which this element is defined 278 * @return the analysis context in which this element is defined
253 */ 279 */
254 AnalysisContext get context; 280 AnalysisContext get context;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 * @return {@code true} if this element is accessible to code in the given lib rary 333 * @return {@code true} if this element is accessible to code in the given lib rary
308 */ 334 */
309 bool isAccessibleIn(LibraryElement library); 335 bool isAccessibleIn(LibraryElement library);
310 /** 336 /**
311 * Return {@code true} if this element is synthetic. A synthetic element is an element that is not 337 * Return {@code true} if this element is synthetic. A synthetic element is an element that is not
312 * represented in the source code explicitly, but is implied by the source cod e, such as the 338 * represented in the source code explicitly, but is implied by the source cod e, such as the
313 * default constructor for a class that does not explicitly define any constru ctors. 339 * default constructor for a class that does not explicitly define any constru ctors.
314 * @return {@code true} if this element is synthetic 340 * @return {@code true} if this element is synthetic
315 */ 341 */
316 bool isSynthetic(); 342 bool isSynthetic();
343 /**
344 * Use the given visitor to visit all of the children of this element. There i s no guarantee of
345 * the order in which the children will be visited.
346 * @param visitor the visitor that will be used to visit the children of this element
347 */
348 void visitChildren(ElementVisitor<Object> visitor);
317 } 349 }
318 /** 350 /**
319 * The enumeration {@code ElementKind} defines the various kinds of elements in the element model. 351 * The enumeration {@code ElementKind} defines the various kinds of elements in the element model.
320 */ 352 */
321 class ElementKind { 353 class ElementKind {
322 static final ElementKind CLASS = new ElementKind('CLASS', 0); 354 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class");
323 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT' , 1); 355 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT' , 1, "compilation unit");
324 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2); 356 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons tructor");
325 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3); 357 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>");
326 static final ElementKind ERROR = new ElementKind('ERROR', 4); 358 static final ElementKind ERROR = new ElementKind('ERROR', 4, "<error>");
327 static final ElementKind EXPORT = new ElementKind('EXPORT', 5); 359 static final ElementKind EXPORT = new ElementKind('EXPORT', 5, "export directi ve");
328 static final ElementKind FIELD = new ElementKind('FIELD', 6); 360 static final ElementKind FIELD = new ElementKind('FIELD', 6, "field");
329 static final ElementKind FUNCTION = new ElementKind('FUNCTION', 7); 361 static final ElementKind FUNCTION = new ElementKind('FUNCTION', 7, "function") ;
330 static final ElementKind GETTER = new ElementKind('GETTER', 8); 362 static final ElementKind GETTER = new ElementKind('GETTER', 8, "getter");
331 static final ElementKind HTML = new ElementKind('HTML', 9); 363 static final ElementKind HTML = new ElementKind('HTML', 9, "html");
332 static final ElementKind IMPORT = new ElementKind('IMPORT', 10); 364 static final ElementKind IMPORT = new ElementKind('IMPORT', 10, "import direct ive");
333 static final ElementKind LABEL = new ElementKind('LABEL', 11); 365 static final ElementKind LABEL = new ElementKind('LABEL', 11, "label");
334 static final ElementKind LIBRARY = new ElementKind('LIBRARY', 12); 366 static final ElementKind LIBRARY = new ElementKind('LIBRARY', 12, "library");
335 static final ElementKind METHOD = new ElementKind('METHOD', 13); 367 static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 13 , "local variable");
336 static final ElementKind NAME = new ElementKind('NAME', 14); 368 static final ElementKind METHOD = new ElementKind('METHOD', 14, "method");
337 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 15); 369 static final ElementKind NAME = new ElementKind('NAME', 15, "<name>");
338 static final ElementKind PREFIX = new ElementKind('PREFIX', 16); 370 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 16, "paramet er");
339 static final ElementKind SETTER = new ElementKind('SETTER', 17); 371 static final ElementKind PREFIX = new ElementKind('PREFIX', 17, "import prefix ");
340 static final ElementKind TYPE_ALIAS = new ElementKind('TYPE_ALIAS', 18); 372 static final ElementKind SETTER = new ElementKind('SETTER', 18, "setter");
341 static final ElementKind TYPE_VARIABLE = new ElementKind('TYPE_VARIABLE', 19); 373 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA BLE', 19, "top level variable");
342 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 20); 374 static final ElementKind TYPE_ALIAS = new ElementKind('TYPE_ALIAS', 20, "funct ion type alias");
343 static final ElementKind VARIABLE = new ElementKind('VARIABLE', 21); 375 static final ElementKind TYPE_VARIABLE = new ElementKind('TYPE_VARIABLE', 21, "type variable");
344 static final List<ElementKind> values = [CLASS, COMPILATION_UNIT, CONSTRUCTOR, DYNAMIC, ERROR, EXPORT, FIELD, FUNCTION, GETTER, HTML, IMPORT, LABEL, LIBRARY, METHOD, NAME, PARAMETER, PREFIX, SETTER, TYPE_ALIAS, TYPE_VARIABLE, UNIVERSE, VA RIABLE]; 376 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 22, "<universe >");
377 static final List<ElementKind> values = [CLASS, COMPILATION_UNIT, CONSTRUCTOR, DYNAMIC, ERROR, EXPORT, FIELD, FUNCTION, GETTER, HTML, IMPORT, LABEL, LIBRARY, LOCAL_VARIABLE, METHOD, NAME, PARAMETER, PREFIX, SETTER, TOP_LEVEL_VARIABLE, TYP E_ALIAS, TYPE_VARIABLE, UNIVERSE];
345 final String __name; 378 final String __name;
346 final int __ordinal; 379 final int __ordinal;
347 ElementKind(this.__name, this.__ordinal) { 380 String _displayName;
381 ElementKind(this.__name, this.__ordinal, String displayName) {
382 this._displayName = displayName;
348 } 383 }
384 /**
385 * @return the name of this {@link ElementKind} to display in UI.
386 */
387 String get displayName => _displayName;
349 String toString() => __name; 388 String toString() => __name;
350 } 389 }
351 /** 390 /**
352 * The interface {@code ElementLocation} defines the behavior of objects that re present the location 391 * The interface {@code ElementLocation} defines the behavior of objects that re present the location
353 * of an element within the element model. 392 * of an element within the element model.
354 */ 393 */
355 abstract class ElementLocation { 394 abstract class ElementLocation {
356 /** 395 /**
357 * Return an encoded representation of this location that can be used to creat e a location that is 396 * Return an encoded representation of this location that can be used to creat e a location that is
358 * equal to this location. 397 * equal to this location.
359 * @return an encoded representation of this location 398 * @return an encoded representation of this location
360 */ 399 */
361 String get encoding; 400 String get encoding;
362 } 401 }
363 /** 402 /**
403 * The interface {@code ElementVisitor} defines the behavior of objects that can be used to visit an
404 * element structure.
405 */
406 abstract class ElementVisitor<R> {
407 R visitClassElement(ClassElement element);
408 R visitCompilationUnitElement(CompilationUnitElement element);
409 R visitConstructorElement(ConstructorElement element);
410 R visitExportElement(ExportElement element);
411 R visitFieldElement(FieldElement element);
412 R visitFunctionElement(FunctionElement element);
413 R visitHtmlElement(HtmlElement element);
414 R visitImportElement(ImportElement element);
415 R visitLabelElement(LabelElement element);
416 R visitLibraryElement(LibraryElement element);
417 R visitLocalVariableElement(LocalVariableElement element);
418 R visitMethodElement(MethodElement element);
419 R visitMultiplyDefinedElement(MultiplyDefinedElement element);
420 R visitParameterElement(ParameterElement element);
421 R visitPrefixElement(PrefixElement element);
422 R visitPropertyAccessorElement(PropertyAccessorElement element);
423 R visitTopLevelVariableElement(TopLevelVariableElement element);
424 R visitTypeAliasElement(TypeAliasElement element);
425 R visitTypeVariableElement(TypeVariableElement element);
426 }
427 /**
364 * The interface {@code ExecutableElement} defines the behavior of elements repr esenting an 428 * The interface {@code ExecutableElement} defines the behavior of elements repr esenting an
365 * executable object, including functions, methods, constructors, getters, and s etters. 429 * executable object, including functions, methods, constructors, getters, and s etters.
366 */ 430 */
367 abstract class ExecutableElement implements Element { 431 abstract class ExecutableElement implements Element {
368 /** 432 /**
369 * Return an array containing all of the functions defined within this executa ble element. 433 * Return an array containing all of the functions defined within this executa ble element.
370 * @return the functions defined within this executable element 434 * @return the functions defined within this executable element
371 */ 435 */
372 List<ExecutableElement> get functions; 436 List<FunctionElement> get functions;
373 /** 437 /**
374 * Return an array containing all of the labels defined within this executable element. 438 * Return an array containing all of the labels defined within this executable element.
375 * @return the labels defined within this executable element 439 * @return the labels defined within this executable element
376 */ 440 */
377 List<LabelElement> get labels; 441 List<LabelElement> get labels;
378 /** 442 /**
379 * Return an array containing all of the local variables defined within this e xecutable element. 443 * Return an array containing all of the local variables defined within this e xecutable element.
380 * @return the local variables defined within this executable element 444 * @return the local variables defined within this executable element
381 */ 445 */
382 List<VariableElement> get localVariables; 446 List<LocalVariableElement> get localVariables;
383 /** 447 /**
384 * Return an array containing all of the parameters defined by this executable element. 448 * Return an array containing all of the parameters defined by this executable element.
385 * @return the parameters defined by this executable element 449 * @return the parameters defined by this executable element
386 */ 450 */
387 List<ParameterElement> get parameters; 451 List<ParameterElement> get parameters;
388 /** 452 /**
389 * Return the type of function defined by this executable element. 453 * Return the type of function defined by this executable element.
390 * @return the type of function defined by this executable element 454 * @return the type of function defined by this executable element
391 */ 455 */
392 FunctionType get type; 456 FunctionType get type;
457 /**
458 * Return {@code true} if this element is a static element. A static element i s an element that is
459 * not associated with a particular instance, but rather with an entire librar y or class.
460 * @return {@code true} if this executable element is a static element
461 */
462 bool isStatic();
393 } 463 }
394 /** 464 /**
395 * The interface {@code ExportElement} defines the behavior of objects represent ing information 465 * The interface {@code ExportElement} defines the behavior of objects represent ing information
396 * about a single export directive within a library. 466 * about a single export directive within a library.
397 */ 467 */
398 abstract class ExportElement implements Element { 468 abstract class ExportElement implements Element {
399 /** 469 /**
400 * An empty array of export elements. 470 * An empty array of export elements.
401 */ 471 */
402 static List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); 472 static List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0);
403 /** 473 /**
404 * Return an array containing the combinators that were specified as part of t he export directive 474 * Return an array containing the combinators that were specified as part of t he export directive
405 * in the order in which they were specified. 475 * in the order in which they were specified.
406 * @return the combinators specified in the export directive 476 * @return the combinators specified in the export directive
407 */ 477 */
408 List<NamespaceCombinator> get combinators; 478 List<NamespaceCombinator> get combinators;
409 /** 479 /**
410 * Return the library that is exported from this library by this export direct ive. 480 * Return the library that is exported from this library by this export direct ive.
411 * @return the library that is exported from this library 481 * @return the library that is exported from this library
412 */ 482 */
413 LibraryElement get exportedLibrary; 483 LibraryElement get exportedLibrary;
414 } 484 }
415 /** 485 /**
416 * The interface {@code FieldElement} defines the behavior of elements represent ing a field defined 486 * The interface {@code FieldElement} defines the behavior of elements represent ing a field defined
417 * within a type. Note that explicitly defined fields implicitly define a synthe tic getter and that 487 * within a type.
418 * non-{@code final} explicitly defined fields implicitly define a synthetic set ter. Symmetrically,
419 * synthetic fields are implicitly created for explicitly defined getters and se tters. The following
420 * rules apply:
421 * <ul>
422 * <li>Every explicit field is represented by a non-synthetic {@link FieldElemen t}.
423 * <li>Every explicit field induces a getter and possibly a setter, both of whic h are represented by
424 * synthetic {@link PropertyAccessorElement}s.
425 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P ropertyAccessorElement}.
426 * <li>Every explicit getter or setter (or pair thereof if they have the same na me) induces a field
427 * that is represented by a synthetic {@link FieldElement}.
428 * </ul>
429 */ 488 */
430 abstract class FieldElement implements VariableElement { 489 abstract class FieldElement implements PropertyInducingElement {
431 /** 490 /**
432 * Return the getter associated with this field. If this field was explicitly defined (is not 491 * Return the type in which this field is defined.
433 * synthetic) then the getter associated with it will be synthetic. 492 * @return the type in which this field is defined
434 * @return the getter associated with this field
435 */ 493 */
436 PropertyAccessorElement get getter; 494 ClassElement get enclosingElement;
437 /**
438 * Return the setter associated with this field, or {@code null} if the field is effectively{@code final} and therefore does not have a setter associated with it. (This can happen either
439 * because the field is explicitly defined as being {@code final} or because t he field is induced
440 * by an explicit getter that does not have a corresponding setter.) If this f ield was explicitly
441 * defined (is not synthetic) then the setter associated with it will be synth etic.
442 * @return the setter associated with this field
443 */
444 PropertyAccessorElement get setter;
445 /**
446 * Return {@code true} if this field is a static field.
447 * @return {@code true} if this field is a static field
448 */
449 bool isStatic();
450 } 495 }
451 /** 496 /**
452 * The interface {@code FunctionElement} defines the behavior of elements repres enting a function. 497 * The interface {@code FunctionElement} defines the behavior of elements repres enting a function.
453 */ 498 */
454 abstract class FunctionElement implements ExecutableElement { 499 abstract class FunctionElement implements ExecutableElement, LocalElement {
455 /**
456 * Return a source range that covers the approximate portion of the source in which the name of
457 * this function is visible, or {@code null} if there is no single range of ch aracters within
458 * which the variable's name is visible.
459 * <ul>
460 * <li>For a local function, this includes everything from the beginning of th e function's body to
461 * the end of the block that encloses the function declaration.</li>
462 * <li>For top-level functions, {@code null} will be returned because they are potentially visible
463 * in multiple sources.</li>
464 * </ul>
465 * @return the range of characters in which the name of this function is visib le
466 */
467 SourceRange get visibleRange;
468 } 500 }
469 /** 501 /**
470 * The interface {@code HideCombinator} defines the behavior of combinators that cause some of the 502 * The interface {@code HideCombinator} defines the behavior of combinators that cause some of the
471 * names in a namespace to be hidden when being imported. 503 * names in a namespace to be hidden when being imported.
472 */ 504 */
473 abstract class HideCombinator implements NamespaceCombinator { 505 abstract class HideCombinator implements NamespaceCombinator {
474 /** 506 /**
475 * Return an array containing the names that are not to be made visible in the importing library 507 * Return an array containing the names that are not to be made visible in the importing library
476 * even if they are defined in the imported library. 508 * even if they are defined in the imported library.
477 * @return the names from the imported library that are hidden from the import ing library 509 * @return the names from the imported library that are hidden from the import ing library
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 * Return an array containing elements for each of the prefixes used to {@code import} libraries 607 * Return an array containing elements for each of the prefixes used to {@code import} libraries
576 * into this library. Each prefix can be used in more than one {@code import} directive. 608 * into this library. Each prefix can be used in more than one {@code import} directive.
577 * @return the prefixes used to {@code import} libraries into this library 609 * @return the prefixes used to {@code import} libraries into this library
578 */ 610 */
579 List<PrefixElement> get prefixes; 611 List<PrefixElement> get prefixes;
580 /** 612 /**
581 * Answer {@code true} if this library is an application that can be run in th e browser. 613 * Answer {@code true} if this library is an application that can be run in th e browser.
582 * @return {@code true} if this library is an application that can be run in t he browser 614 * @return {@code true} if this library is an application that can be run in t he browser
583 */ 615 */
584 bool isBrowserApplication(); 616 bool isBrowserApplication();
617 /**
618 * Return {@code true} if this library is the dart:core library.
619 * @return {@code true} if this library is the dart:core library
620 */
621 bool isDartCore();
622 }
623 /**
624 * The interface {@code LocalElement} defines the behavior of elements that can be (but are not
625 * required to be) defined within a method or function (an {@link ExecutableElem ent}).
626 */
627 abstract class LocalElement implements Element {
628 /**
629 * Return a source range that covers the approximate portion of the source in which the name of
630 * this element is visible, or {@code null} if there is no single range of cha racters within which
631 * the element name is visible.
632 * <ul>
633 * <li>For a local variable, this includes everything from the end of the vari able's initializer
634 * to the end of the block that encloses the variable declaration.</li>
635 * <li>For a parameter, this includes the body of the method or function that declares the
636 * parameter.</li>
637 * <li>For a local function, this includes everything from the beginning of th e function's body to
638 * the end of the block that encloses the function declaration.</li>
639 * <li>For top-level functions, {@code null} will be returned because they are potentially visible
640 * in multiple sources.</li>
641 * </ul>
642 * @return the range of characters in which the name of this element is visibl e
643 */
644 SourceRange get visibleRange;
645 }
646 /**
647 * The interface {@code LocalVariableElement} defines the behavior common to ele ments that represent
648 * a local variable.
649 */
650 abstract class LocalVariableElement implements LocalElement, VariableElement {
585 } 651 }
586 /** 652 /**
587 * The interface {@code MethodElement} defines the behavior of elements that rep resent a method 653 * The interface {@code MethodElement} defines the behavior of elements that rep resent a method
588 * defined within a type. 654 * defined within a type.
589 */ 655 */
590 abstract class MethodElement implements ExecutableElement { 656 abstract class MethodElement implements ExecutableElement {
591 /** 657 /**
592 * Return the type in which this method is defined. 658 * Return the type in which this method is defined.
593 * @return the type in which this method is defined 659 * @return the type in which this method is defined
594 */ 660 */
595 ClassElement get enclosingElement; 661 ClassElement get enclosingElement;
596 /** 662 /**
597 * Return {@code true} if this method is abstract. Methods are abstract if the y are not external 663 * Return {@code true} if this method is abstract. Methods are abstract if the y are not external
598 * and have no body. 664 * and have no body.
599 * @return {@code true} if this method is abstract 665 * @return {@code true} if this method is abstract
600 */ 666 */
601 bool isAbstract(); 667 bool isAbstract();
602 /**
603 * Return {@code true} if this method is static. Methods are static if they ha ve been marked as
604 * being static using the {@code static} modifier.
605 * @return {@code true} if this method is static
606 */
607 bool isStatic();
608 } 668 }
609 /** 669 /**
610 * The interface {@code MultiplyDefinedElement} defines the behavior of pseudo-e lements that 670 * The interface {@code MultiplyDefinedElement} defines the behavior of pseudo-e lements that
611 * represent multiple elements defined within a single scope that have the same name. This situation 671 * represent multiple elements defined within a single scope that have the same name. This situation
612 * is not allowed by the language, so objects implementing this interface always represent an error. 672 * is not allowed by the language, so objects implementing this interface always represent an error.
613 * As a result, most of the normal operations on elements do not make sense and will return useless 673 * As a result, most of the normal operations on elements do not make sense and will return useless
614 * results. 674 * results.
615 */ 675 */
616 abstract class MultiplyDefinedElement implements Element { 676 abstract class MultiplyDefinedElement implements Element {
617 /** 677 /**
(...skipping 10 matching lines...) Expand all
628 abstract class NamespaceCombinator { 688 abstract class NamespaceCombinator {
629 /** 689 /**
630 * An empty array of namespace combinators. 690 * An empty array of namespace combinators.
631 */ 691 */
632 static List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombinator>(0 ); 692 static List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombinator>(0 );
633 } 693 }
634 /** 694 /**
635 * The interface {@code ParameterElement} defines the behavior of elements repre senting a parameter 695 * The interface {@code ParameterElement} defines the behavior of elements repre senting a parameter
636 * defined within an executable element. 696 * defined within an executable element.
637 */ 697 */
638 abstract class ParameterElement implements VariableElement { 698 abstract class ParameterElement implements LocalElement, VariableElement {
639 /** 699 /**
640 * Return the kind of this parameter. 700 * Return the kind of this parameter.
641 * @return the kind of this parameter 701 * @return the kind of this parameter
642 */ 702 */
643 ParameterKind get parameterKind; 703 ParameterKind get parameterKind;
644 /** 704 /**
645 * Return {@code true} if this parameter is an initializing formal parameter. 705 * Return {@code true} if this parameter is an initializing formal parameter.
646 * @return {@code true} if this parameter is an initializing formal parameter 706 * @return {@code true} if this parameter is an initializing formal parameter
647 */ 707 */
648 bool isInitializingFormal(); 708 bool isInitializingFormal();
(...skipping 23 matching lines...) Expand all
672 * <li>Every explicit field is represented by a non-synthetic {@link FieldElemen t}. 732 * <li>Every explicit field is represented by a non-synthetic {@link FieldElemen t}.
673 * <li>Every explicit field induces a getter and possibly a setter, both of whic h are represented by 733 * <li>Every explicit field induces a getter and possibly a setter, both of whic h are represented by
674 * synthetic {@link PropertyAccessorElement}s. 734 * synthetic {@link PropertyAccessorElement}s.
675 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P ropertyAccessorElement}. 735 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P ropertyAccessorElement}.
676 * <li>Every explicit getter or setter (or pair thereof if they have the same na me) induces a field 736 * <li>Every explicit getter or setter (or pair thereof if they have the same na me) induces a field
677 * that is represented by a synthetic {@link FieldElement}. 737 * that is represented by a synthetic {@link FieldElement}.
678 * </ul> 738 * </ul>
679 */ 739 */
680 abstract class PropertyAccessorElement implements ExecutableElement { 740 abstract class PropertyAccessorElement implements ExecutableElement {
681 /** 741 /**
682 * Return the field associated with this accessor. If this accessor was explic itly defined (is not 742 * Return the field or top-level variable associated with this accessor. If th is accessor was
683 * synthetic) then the field associated with it will be synthetic. 743 * explicitly defined (is not synthetic) then the variable associated with it will be synthetic.
684 * @return the field associated with this accessor 744 * @return the variable associated with this accessor
685 */ 745 */
686 FieldElement get field; 746 PropertyInducingElement get variable;
687 /** 747 /**
688 * Return {@code true} if this accessor represents a getter. 748 * Return {@code true} if this accessor represents a getter.
689 * @return {@code true} if this accessor represents a getter 749 * @return {@code true} if this accessor represents a getter
690 */ 750 */
691 bool isGetter(); 751 bool isGetter();
692 /** 752 /**
693 * Return {@code true} if this accessor represents a setter. 753 * Return {@code true} if this accessor represents a setter.
694 * @return {@code true} if this accessor represents a setter 754 * @return {@code true} if this accessor represents a setter
695 */ 755 */
696 bool isSetter(); 756 bool isSetter();
697 } 757 }
698 /** 758 /**
759 * The interface {@code PropertyInducingElement} defines the behavior of element s representing a
760 * variable that has an associated getter and possibly a setter. Note that expli citly defined
761 * variables implicitly define a synthetic getter and that non-{@code final} exp licitly defined
762 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel ds are implicitly
763 * created for explicitly defined getters and setters. The following rules apply :
764 * <ul>
765 * <li>Every explicit variable is represented by a non-synthetic {@link Property InducingElement}.
766 * <li>Every explicit variable induces a getter and possibly a setter, both of w hich are represented
767 * by synthetic {@link PropertyAccessorElement}s.
768 * <li>Every explicit getter or setter is represented by a non-synthetic{@link P ropertyAccessorElement}.
769 * <li>Every explicit getter or setter (or pair thereof if they have the same na me) induces a
770 * variable that is represented by a synthetic {@link PropertyInducingElement}.
771 * </ul>
772 */
773 abstract class PropertyInducingElement implements VariableElement {
774 /**
775 * Return the getter associated with this variable. If this variable was expli citly defined (is
776 * not synthetic) then the getter associated with it will be synthetic.
777 * @return the getter associated with this variable
778 */
779 PropertyAccessorElement get getter;
780 /**
781 * 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
782 * because the variable is explicitly defined as being {@code final} or becaus e the variable is
783 * induced by an explicit getter that does not have a corresponding setter.) I f this variable was
784 * explicitly defined (is not synthetic) then the setter associated with it wi ll be synthetic.
785 * @return the setter associated with this variable
786 */
787 PropertyAccessorElement get setter;
788 /**
789 * Return {@code true} if this element is a static element. A static element i s an element that is
790 * not associated with a particular instance, but rather with an entire librar y or class.
791 * @return {@code true} if this executable element is a static element
792 */
793 bool isStatic();
794 }
795 /**
699 * The interface {@code ShowCombinator} defines the behavior of combinators that cause some of the 796 * The interface {@code ShowCombinator} defines the behavior of combinators that cause some of the
700 * names in a namespace to be visible (and the rest hidden) when being imported. 797 * names in a namespace to be visible (and the rest hidden) when being imported.
701 */ 798 */
702 abstract class ShowCombinator implements NamespaceCombinator { 799 abstract class ShowCombinator implements NamespaceCombinator {
703 /** 800 /**
704 * Return an array containing the names that are to be made visible in the imp orting library if 801 * Return an array containing the names that are to be made visible in the imp orting library if
705 * they are defined in the imported library. 802 * they are defined in the imported library.
706 * @return the names from the imported library that are visible in the importi ng library 803 * @return the names from the imported library that are visible in the importi ng library
707 */ 804 */
708 List<String> get shownNames; 805 List<String> get shownNames;
709 } 806 }
710 /** 807 /**
808 * The interface {@code TopLevelVariableElement} defines the behavior of element s representing a
809 * top-level variable.
810 */
811 abstract class TopLevelVariableElement implements PropertyInducingElement {
812 }
813 /**
711 * The interface {@code TypeAliasElement} defines the behavior of elements repre senting a type alias 814 * The interface {@code TypeAliasElement} defines the behavior of elements repre senting a type alias
712 * ({@code typedef}). 815 * ({@code typedef}).
713 */ 816 */
714 abstract class TypeAliasElement implements Element { 817 abstract class TypeAliasElement implements Element {
715 /** 818 /**
716 * Return the compilation unit in which this type alias is defined. 819 * Return the compilation unit in which this type alias is defined.
717 * @return the compilation unit in which this type alias is defined 820 * @return the compilation unit in which this type alias is defined
718 */ 821 */
719 CompilationUnitElement get enclosingElement; 822 CompilationUnitElement get enclosingElement;
720 /** 823 /**
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 * @return a synthetic function representing this variable's initializer 873 * @return a synthetic function representing this variable's initializer
771 */ 874 */
772 FunctionElement get initializer; 875 FunctionElement get initializer;
773 /** 876 /**
774 * Return the declared type of this variable, or {@code null} if the variable did not have a 877 * Return the declared type of this variable, or {@code null} if the variable did not have a
775 * declared type (such as if it was declared using the keyword 'var'). 878 * declared type (such as if it was declared using the keyword 'var').
776 * @return the declared type of this variable 879 * @return the declared type of this variable
777 */ 880 */
778 Type2 get type; 881 Type2 get type;
779 /** 882 /**
780 * Return a source range that covers the approximate portion of the source in which the name of
781 * this variable is visible, or {@code null} if there is no single range of ch aracters within
782 * which the variable's name is visible.
783 * <ul>
784 * <li>For a local variable, this includes everything from the end of the vari able's initializer
785 * to the end of the block that encloses the variable declaration.</li>
786 * <li>For a parameter, this includes the body of the method or function that declares the
787 * parameter.</li>
788 * <li>For fields and top-level variables, {@code null} will be returned becau se they are
789 * potentially visible in multiple sources.</li>
790 * </ul>
791 * @return the range of characters in which the name of this variable is visib le
792 */
793 SourceRange get visibleRange;
794 /**
795 * Return {@code true} if this variable is a const variable. Variables are con st if they have been 883 * Return {@code true} if this variable is a const variable. Variables are con st if they have been
796 * marked as being const using the {@code const} modifier. 884 * marked as being const using the {@code const} modifier.
797 * @return {@code true} if this variable is a const variable 885 * @return {@code true} if this variable is a const variable
798 */ 886 */
799 bool isConst(); 887 bool isConst();
800 /** 888 /**
801 * Return {@code true} if this variable is a final variable. Variables are fin al if they have been 889 * Return {@code true} if this variable is a final variable. Variables are fin al if they have been
802 * marked as being final using either the {@code final} or {@code const} modif iers. 890 * marked as being final using either the {@code final} or {@code const} modif iers.
803 * @return {@code true} if this variable is a final variable 891 * @return {@code true} if this variable is a final variable
804 */ 892 */
805 bool isFinal(); 893 bool isFinal();
806 } 894 }
807 /** 895 /**
896 * Instances of the class {@code GeneralizingElementVisitor} implement an elemen t visitor that will
897 * 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
898 * only will the visit method for that specific type of element be invoked, but additional methods
899 * for the supertypes of that element will also be invoked. For example, using a n instance of this
900 * 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
901 * subsequently invoked. This allows visitors to be written that visit all execu table elements
902 * without needing to override the visit method for each of the specific subclas ses of{@link ExecutableElement}.
903 * <p>
904 * Note, however, that unlike many visitors, element visitors visit objects base d on the interfaces
905 * implemented by those elements. Because interfaces form a graph structure rath er than a tree
906 * structure the way classes do, and because it is generally undesirable for an object to be visited
907 * more than once, this class flattens the interface graph into a pseudo-tree. I n particular, this
908 * class treats elements as if the element types were structured in the followin g way:
909 * <p>
910 * <pre>
911 * Element
912 * ClassElement
913 * CompilationUnitElement
914 * ExecutableElement
915 * ConstructorElement
916 * LocalElement
917 * FunctionElement
918 * MethodElement
919 * PropertyAccessorElement
920 * ExportElement
921 * HtmlElement
922 * ImportElement
923 * LabelElement
924 * LibraryElement
925 * MultiplyDefinedElement
926 * PrefixElement
927 * TypeAliasElement
928 * TypeVariableElement
929 * UndefinedElement
930 * VariableElement
931 * PropertyInducingElement
932 * FieldElement
933 * TopLevelVariableElement
934 * LocalElement
935 * LocalVariableElement
936 * ParameterElement
937 * </pre>
938 * <p>
939 * Subclasses that override a visit method must either invoke the overridden vis it method or
940 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods
941 * for superclasses of the element to not be invoked and will cause the children of the visited node
942 * to not be visited.
943 */
944 class GeneralizingElementVisitor<R> implements ElementVisitor<R> {
945 R visitClassElement(ClassElement element) => visitElement(element);
946 R visitCompilationUnitElement(CompilationUnitElement element) => visitElement( element);
947 R visitConstructorElement(ConstructorElement element) => visitExecutableElemen t(element);
948 R visitElement(Element element) {
949 element.visitChildren(this);
950 return null;
951 }
952 R visitExecutableElement(ExecutableElement element) => visitElement(element);
953 R visitExportElement(ExportElement element) => visitElement(element);
954 R visitFieldElement(FieldElement element) => visitPropertyInducingElement(elem ent);
955 R visitFunctionElement(FunctionElement element) => visitLocalElement(element);
956 R visitHtmlElement(HtmlElement element) => visitElement(element);
957 R visitImportElement(ImportElement element) => visitElement(element);
958 R visitLabelElement(LabelElement element) => visitElement(element);
959 R visitLibraryElement(LibraryElement element) => visitElement(element);
960 R visitLocalElement(LocalElement element) {
961 if (element is LocalVariableElement) {
962 return visitVariableElement((element as LocalVariableElement));
963 } else if (element is ParameterElement) {
964 return visitVariableElement((element as ParameterElement));
965 } else if (element is FunctionElement) {
966 return visitExecutableElement((element as FunctionElement));
967 }
968 return null;
969 }
970 R visitLocalVariableElement(LocalVariableElement element) => visitLocalElement (element);
971 R visitMethodElement(MethodElement element) => visitExecutableElement(element) ;
972 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement( element);
973 R visitParameterElement(ParameterElement element) => visitLocalElement(element );
974 R visitPrefixElement(PrefixElement element) => visitElement(element);
975 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut ableElement(element);
976 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab leElement(element);
977 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper tyInducingElement(element);
978 R visitTypeAliasElement(TypeAliasElement element) => visitElement(element);
979 R visitTypeVariableElement(TypeVariableElement element) => visitElement(elemen t);
980 R visitVariableElement(VariableElement element) => visitElement(element);
981 }
982 /**
983 * Instances of the class {@code RecursiveElementVisitor} implement an element v isitor that will
984 * recursively visit all of the element in an element model. For example, using an instance of this
985 * class to visit a {@link CompilationUnitElement} will also cause all of the ty pes in the
986 * compilation unit to be visited.
987 * <p>
988 * Subclasses that override a visit method must either invoke the overridden vis it method or must
989 * explicitly ask the visited element to visit its children. Failure to do so wi ll cause the
990 * children of the visited element to not be visited.
991 */
992 class RecursiveElementVisitor<R> implements ElementVisitor<R> {
993 R visitClassElement(ClassElement element) {
994 element.visitChildren(this);
995 return null;
996 }
997 R visitCompilationUnitElement(CompilationUnitElement element) {
998 element.visitChildren(this);
999 return null;
1000 }
1001 R visitConstructorElement(ConstructorElement element) {
1002 element.visitChildren(this);
1003 return null;
1004 }
1005 R visitExportElement(ExportElement element) {
1006 element.visitChildren(this);
1007 return null;
1008 }
1009 R visitFieldElement(FieldElement element) {
1010 element.visitChildren(this);
1011 return null;
1012 }
1013 R visitFunctionElement(FunctionElement element) {
1014 element.visitChildren(this);
1015 return null;
1016 }
1017 R visitHtmlElement(HtmlElement element) {
1018 element.visitChildren(this);
1019 return null;
1020 }
1021 R visitImportElement(ImportElement element) {
1022 element.visitChildren(this);
1023 return null;
1024 }
1025 R visitLabelElement(LabelElement element) {
1026 element.visitChildren(this);
1027 return null;
1028 }
1029 R visitLibraryElement(LibraryElement element) {
1030 element.visitChildren(this);
1031 return null;
1032 }
1033 R visitLocalVariableElement(LocalVariableElement element) {
1034 element.visitChildren(this);
1035 return null;
1036 }
1037 R visitMethodElement(MethodElement element) {
1038 element.visitChildren(this);
1039 return null;
1040 }
1041 R visitMultiplyDefinedElement(MultiplyDefinedElement element) {
1042 element.visitChildren(this);
1043 return null;
1044 }
1045 R visitParameterElement(ParameterElement element) {
1046 element.visitChildren(this);
1047 return null;
1048 }
1049 R visitPrefixElement(PrefixElement element) {
1050 element.visitChildren(this);
1051 return null;
1052 }
1053 R visitPropertyAccessorElement(PropertyAccessorElement element) {
1054 element.visitChildren(this);
1055 return null;
1056 }
1057 R visitTopLevelVariableElement(TopLevelVariableElement element) {
1058 element.visitChildren(this);
1059 return null;
1060 }
1061 R visitTypeAliasElement(TypeAliasElement element) {
1062 element.visitChildren(this);
1063 return null;
1064 }
1065 R visitTypeVariableElement(TypeVariableElement element) {
1066 element.visitChildren(this);
1067 return null;
1068 }
1069 }
1070 /**
1071 * Instances of the class {@code SimpleElementVisitor} implement an element visi tor that will do
1072 * nothing when visiting an element. It is intended to be a superclass for class es that use the
1073 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re cursively visit a
1074 * whole structure) and that only need to visit a small number of element types.
1075 */
1076 class SimpleElementVisitor<R> implements ElementVisitor<R> {
1077 R visitClassElement(ClassElement element) => null;
1078 R visitCompilationUnitElement(CompilationUnitElement element) => null;
1079 R visitConstructorElement(ConstructorElement element) => null;
1080 R visitExportElement(ExportElement element) => null;
1081 R visitFieldElement(FieldElement element) => null;
1082 R visitFunctionElement(FunctionElement element) => null;
1083 R visitHtmlElement(HtmlElement element) => null;
1084 R visitImportElement(ImportElement element) => null;
1085 R visitLabelElement(LabelElement element) => null;
1086 R visitLibraryElement(LibraryElement element) => null;
1087 R visitLocalVariableElement(LocalVariableElement element) => null;
1088 R visitMethodElement(MethodElement element) => null;
1089 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null;
1090 R visitParameterElement(ParameterElement element) => null;
1091 R visitPrefixElement(PrefixElement element) => null;
1092 R visitPropertyAccessorElement(PropertyAccessorElement element) => null;
1093 R visitTopLevelVariableElement(TopLevelVariableElement element) => null;
1094 R visitTypeAliasElement(TypeAliasElement element) => null;
1095 R visitTypeVariableElement(TypeVariableElement element) => null;
1096 }
1097 /**
808 * Instances of the class {@code AnnotationImpl} implement an {@link Annotation} . 1098 * Instances of the class {@code AnnotationImpl} implement an {@link Annotation} .
809 */ 1099 */
810 class AnnotationImpl implements Annotation { 1100 class AnnotationImpl implements Annotation {
811 /** 1101 /**
812 * The element representing the field, variable, or constructor being used as an annotation. 1102 * The element representing the field, variable, or constructor being used as an annotation.
813 */ 1103 */
814 Element _element; 1104 Element _element;
815 /** 1105 /**
816 * An empty array of annotations. 1106 * An empty array of annotations.
817 */ 1107 */
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 /** 1161 /**
872 * An empty array of type elements. 1162 * An empty array of type elements.
873 */ 1163 */
874 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); 1164 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0);
875 /** 1165 /**
876 * Initialize a newly created class element to have the given name. 1166 * Initialize a newly created class element to have the given name.
877 * @param name the name of this element 1167 * @param name the name of this element
878 */ 1168 */
879 ClassElementImpl(Identifier name) : super.con1(name) { 1169 ClassElementImpl(Identifier name) : super.con1(name) {
880 } 1170 }
1171 accept(ElementVisitor visitor) => visitor.visitClassElement(this);
881 List<PropertyAccessorElement> get accessors => _accessors; 1172 List<PropertyAccessorElement> get accessors => _accessors;
882 List<InterfaceType> get allSupertypes { 1173 List<InterfaceType> get allSupertypes {
883 Collection<InterfaceType> list = new Set<InterfaceType>(); 1174 Collection<InterfaceType> list = new Set<InterfaceType>();
884 collectAllSupertypes(list); 1175 collectAllSupertypes(list);
885 return new List.from(list); 1176 return new List.from(list);
886 } 1177 }
887 ElementImpl getChild(String identifier19) { 1178 ElementImpl getChild(String identifier24) {
888 for (PropertyAccessorElement accessor in _accessors) { 1179 for (PropertyAccessorElement accessor in _accessors) {
889 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier19 ) { 1180 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier24 ) {
890 return (accessor as PropertyAccessorElementImpl); 1181 return accessor as PropertyAccessorElementImpl;
891 } 1182 }
892 } 1183 }
893 for (ConstructorElement constructor in _constructors) { 1184 for (ConstructorElement constructor in _constructors) {
894 if (((constructor as ConstructorElementImpl)).identifier == identifier19) { 1185 if (((constructor as ConstructorElementImpl)).identifier == identifier24) {
895 return (constructor as ConstructorElementImpl); 1186 return constructor as ConstructorElementImpl;
896 } 1187 }
897 } 1188 }
898 for (FieldElement field in _fields) { 1189 for (FieldElement field in _fields) {
899 if (((field as FieldElementImpl)).identifier == identifier19) { 1190 if (((field as FieldElementImpl)).identifier == identifier24) {
900 return (field as FieldElementImpl); 1191 return field as FieldElementImpl;
901 } 1192 }
902 } 1193 }
903 for (MethodElement method in _methods) { 1194 for (MethodElement method in _methods) {
904 if (((method as MethodElementImpl)).identifier == identifier19) { 1195 if (((method as MethodElementImpl)).identifier == identifier24) {
905 return (method as MethodElementImpl); 1196 return method as MethodElementImpl;
906 } 1197 }
907 } 1198 }
908 for (TypeVariableElement typeVariable in _typeVariables) { 1199 for (TypeVariableElement typeVariable in _typeVariables) {
909 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier19 ) { 1200 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier24 ) {
910 return (typeVariable as TypeVariableElementImpl); 1201 return typeVariable as TypeVariableElementImpl;
911 } 1202 }
912 } 1203 }
913 return null; 1204 return null;
914 } 1205 }
915 List<ConstructorElement> get constructors => _constructors; 1206 List<ConstructorElement> get constructors => _constructors;
916 List<FieldElement> get fields => _fields; 1207 List<FieldElement> get fields => _fields;
917 List<InterfaceType> get interfaces => _interfaces; 1208 List<InterfaceType> get interfaces => _interfaces;
918 ElementKind get kind => ElementKind.CLASS; 1209 ElementKind get kind => ElementKind.CLASS;
919 List<MethodElement> get methods => _methods; 1210 List<MethodElement> get methods => _methods;
920 List<InterfaceType> get mixins => _mixins; 1211 List<InterfaceType> get mixins => _mixins;
921 ConstructorElement getNamedConstructor(String name21) { 1212 ConstructorElement getNamedConstructor(String name22) {
922 for (ConstructorElement element in constructors) { 1213 for (ConstructorElement element in constructors) {
923 String elementName = element.name; 1214 String elementName = element.name;
924 if (elementName != null && elementName == name21) { 1215 if (elementName != null && elementName == name22) {
925 return element; 1216 return element;
926 } 1217 }
927 } 1218 }
928 return null; 1219 return null;
929 } 1220 }
930 InterfaceType get supertype => _supertype; 1221 InterfaceType get supertype => _supertype;
931 InterfaceType get type => _type; 1222 InterfaceType get type => _type;
932 List<TypeVariableElement> get typeVariables => _typeVariables; 1223 List<TypeVariableElement> get typeVariables => _typeVariables;
933 ConstructorElement get unnamedConstructor { 1224 ConstructorElement get unnamedConstructor {
934 for (ConstructorElement element in constructors) { 1225 for (ConstructorElement element in constructors) {
935 String name10 = element.name; 1226 String name10 = element.name;
936 if (name10 == null || name10.isEmpty) { 1227 if (name10 == null || name10.isEmpty) {
937 return element; 1228 return element;
938 } 1229 }
939 } 1230 }
940 return null; 1231 return null;
941 } 1232 }
942 bool isAbstract() => hasModifier(Modifier.ABSTRACT); 1233 bool isAbstract() => hasModifier(Modifier.ABSTRACT);
1234 bool isTypedef() => hasModifier(Modifier.TYPEDEF);
1235 bool isValidMixin() => hasModifier(Modifier.MIXIN);
943 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library ) { 1236 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library ) {
944 PropertyAccessorElement element = getGetter(getterName); 1237 PropertyAccessorElement element = getGetter(getterName);
945 if (element != null && element.isAccessibleIn(library)) { 1238 if (element != null && element.isAccessibleIn(library)) {
946 return element; 1239 return element;
947 } 1240 }
948 for (InterfaceType mixin in _mixins) { 1241 for (InterfaceType mixin in _mixins) {
949 ClassElement mixinElement = mixin.element; 1242 ClassElement mixinElement = mixin.element;
950 if (mixinElement != null) { 1243 if (mixinElement != null) {
951 element = ((mixinElement as ClassElementImpl)).getGetter(getterName); 1244 element = ((mixinElement as ClassElementImpl)).getGetter(getterName);
952 if (element != null && element.isAccessibleIn(library)) { 1245 if (element != null && element.isAccessibleIn(library)) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 * Set the superclass of the class to the given type. 1374 * Set the superclass of the class to the given type.
1082 * @param supertype the superclass of the class 1375 * @param supertype the superclass of the class
1083 */ 1376 */
1084 void set supertype(InterfaceType supertype2) { 1377 void set supertype(InterfaceType supertype2) {
1085 this._supertype = supertype2; 1378 this._supertype = supertype2;
1086 } 1379 }
1087 /** 1380 /**
1088 * Set the type defined by the class to the given type. 1381 * Set the type defined by the class to the given type.
1089 * @param type the type defined by the class 1382 * @param type the type defined by the class
1090 */ 1383 */
1091 void set type(InterfaceType type4) { 1384 void set type(InterfaceType type5) {
1092 this._type = type4; 1385 this._type = type5;
1386 }
1387 /**
1388 * Set whether this class is defined by a typedef construct to correspond to t he given value.
1389 * @param isTypedef {@code true} if the class is defined by a typedef construc t
1390 */
1391 void set typedef(bool isTypedef) {
1392 setModifier(Modifier.TYPEDEF, isTypedef);
1093 } 1393 }
1094 /** 1394 /**
1095 * Set the type variables defined for this class to the given type variables. 1395 * Set the type variables defined for this class to the given type variables.
1096 * @param typeVariables the type variables defined for this class 1396 * @param typeVariables the type variables defined for this class
1097 */ 1397 */
1098 void set typeVariables(List<TypeVariableElement> typeVariables2) { 1398 void set typeVariables(List<TypeVariableElement> typeVariables2) {
1099 for (TypeVariableElement typeVariable in typeVariables2) { 1399 for (TypeVariableElement typeVariable in typeVariables2) {
1100 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this; 1400 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this;
1101 } 1401 }
1102 this._typeVariables = typeVariables2; 1402 this._typeVariables = typeVariables2;
1103 } 1403 }
1404 /**
1405 * Set whether this class is a valid mixin to correspond to the given value.
1406 * @param isValidMixin {@code true} if this class can be used as a mixin
1407 */
1408 void set validMixin(bool isValidMixin) {
1409 setModifier(Modifier.MIXIN, isValidMixin);
1410 }
1411 void visitChildren(ElementVisitor<Object> visitor) {
1412 super.visitChildren(visitor);
1413 safelyVisitChildren(_accessors, visitor);
1414 safelyVisitChildren(_constructors, visitor);
1415 safelyVisitChildren(_fields, visitor);
1416 safelyVisitChildren(_methods, visitor);
1417 safelyVisitChildren(_typeVariables, visitor);
1418 }
1104 void appendTo(StringBuffer builder) { 1419 void appendTo(StringBuffer builder) {
1105 String name11 = name; 1420 String name11 = name;
1106 if (name11 == null) { 1421 if (name11 == null) {
1107 builder.add("{unnamed class}"); 1422 builder.write("{unnamed class}");
1108 } else { 1423 } else {
1109 builder.add(name11); 1424 builder.write(name11);
1110 } 1425 }
1111 int variableCount = _typeVariables.length; 1426 int variableCount = _typeVariables.length;
1112 if (variableCount > 0) { 1427 if (variableCount > 0) {
1113 builder.add("<"); 1428 builder.write("<");
1114 for (int i = 0; i < variableCount; i++) { 1429 for (int i = 0; i < variableCount; i++) {
1115 if (i > 0) { 1430 if (i > 0) {
1116 builder.add(", "); 1431 builder.write(", ");
1117 } 1432 }
1118 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); 1433 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
1119 } 1434 }
1120 builder.add(">"); 1435 builder.write(">");
1121 } 1436 }
1122 } 1437 }
1123 void collectAllSupertypes(Collection<InterfaceType> list) { 1438 void collectAllSupertypes(Collection<InterfaceType> list) {
1124 if (_supertype == null || list.contains(_supertype)) { 1439 if (_supertype == null || list.contains(_supertype)) {
1125 return; 1440 return;
1126 } 1441 }
1127 list.add(_supertype); 1442 list.add(_supertype);
1128 ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list); 1443 ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list);
1129 for (InterfaceType type in interfaces) { 1444 for (InterfaceType type in interfaces) {
1130 if (!list.contains(type)) { 1445 if (!list.contains(type)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 * compilation unit. 1505 * compilation unit.
1191 */ 1506 */
1192 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY; 1507 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY;
1193 /** 1508 /**
1194 * An array containing all of the top-level functions contained in this compil ation unit. 1509 * An array containing all of the top-level functions contained in this compil ation unit.
1195 */ 1510 */
1196 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; 1511 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
1197 /** 1512 /**
1198 * An array containing all of the variables contained in this compilation unit . 1513 * An array containing all of the variables contained in this compilation unit .
1199 */ 1514 */
1200 List<VariableElement> _variables = VariableElementImpl.EMPTY_ARRAY; 1515 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A RRAY;
1201 /** 1516 /**
1202 * The source that corresponds to this compilation unit. 1517 * The source that corresponds to this compilation unit.
1203 */ 1518 */
1204 Source _source; 1519 Source _source;
1205 /** 1520 /**
1206 * An array containing all of the type aliases contained in this compilation u nit. 1521 * An array containing all of the type aliases contained in this compilation u nit.
1207 */ 1522 */
1208 List<TypeAliasElement> _typeAliases = TypeAliasElementImpl.EMPTY_ARRAY; 1523 List<TypeAliasElement> _typeAliases = TypeAliasElementImpl.EMPTY_ARRAY;
1209 /** 1524 /**
1210 * An array containing all of the types contained in this compilation unit. 1525 * An array containing all of the types contained in this compilation unit.
1211 */ 1526 */
1212 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; 1527 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY;
1213 /** 1528 /**
1214 * An empty array of compilation unit elements. 1529 * An empty array of compilation unit elements.
1215 */ 1530 */
1216 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>(0); 1531 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>(0);
1217 /** 1532 /**
1218 * Initialize a newly created compilation unit element to have the given name. 1533 * Initialize a newly created compilation unit element to have the given name.
1219 * @param name the name of this element 1534 * @param name the name of this element
1220 */ 1535 */
1221 CompilationUnitElementImpl(String name) : super.con2(name, -1) { 1536 CompilationUnitElementImpl(String name) : super.con2(name, -1) {
1222 } 1537 }
1223 bool operator ==(Object object) => identical(this.runtimeType, object.runtimeT ype) && _source == ((object as CompilationUnitElementImpl)).source; 1538 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this);
1539 bool operator ==(Object object) => identical(runtimeType, object.runtimeType) && _source == ((object as CompilationUnitElementImpl)).source;
1224 List<PropertyAccessorElement> get accessors => _accessors; 1540 List<PropertyAccessorElement> get accessors => _accessors;
1225 ElementImpl getChild(String identifier20) { 1541 ElementImpl getChild(String identifier25) {
1226 for (PropertyAccessorElement accessor in _accessors) { 1542 for (PropertyAccessorElement accessor in _accessors) {
1227 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier20 ) { 1543 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier25 ) {
1228 return (accessor as PropertyAccessorElementImpl); 1544 return accessor as PropertyAccessorElementImpl;
1229 } 1545 }
1230 } 1546 }
1231 for (VariableElement variable in _variables) { 1547 for (VariableElement variable in _variables) {
1232 if (((variable as VariableElementImpl)).identifier == identifier20) { 1548 if (((variable as VariableElementImpl)).identifier == identifier25) {
1233 return (variable as VariableElementImpl); 1549 return variable as VariableElementImpl;
1234 } 1550 }
1235 } 1551 }
1236 for (ExecutableElement function in _functions) { 1552 for (ExecutableElement function in _functions) {
1237 if (((function as ExecutableElementImpl)).identifier == identifier20) { 1553 if (((function as ExecutableElementImpl)).identifier == identifier25) {
1238 return (function as ExecutableElementImpl); 1554 return function as ExecutableElementImpl;
1239 } 1555 }
1240 } 1556 }
1241 for (TypeAliasElement typeAlias in _typeAliases) { 1557 for (TypeAliasElement typeAlias in _typeAliases) {
1242 if (((typeAlias as TypeAliasElementImpl)).identifier == identifier20) { 1558 if (((typeAlias as TypeAliasElementImpl)).identifier == identifier25) {
1243 return (typeAlias as TypeAliasElementImpl); 1559 return typeAlias as TypeAliasElementImpl;
1244 } 1560 }
1245 } 1561 }
1246 for (ClassElement type in _types) { 1562 for (ClassElement type in _types) {
1247 if (((type as ClassElementImpl)).identifier == identifier20) { 1563 if (((type as ClassElementImpl)).identifier == identifier25) {
1248 return (type as ClassElementImpl); 1564 return type as ClassElementImpl;
1249 } 1565 }
1250 } 1566 }
1251 return null; 1567 return null;
1252 } 1568 }
1253 LibraryElement get enclosingElement => (super.enclosingElement as LibraryEleme nt); 1569 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t;
1254 List<FunctionElement> get functions => _functions; 1570 List<FunctionElement> get functions => _functions;
1255 String get identifier => source.fullName; 1571 String get identifier => source.fullName;
1256 ElementKind get kind => ElementKind.COMPILATION_UNIT; 1572 ElementKind get kind => ElementKind.COMPILATION_UNIT;
1257 Source get source => _source; 1573 Source get source => _source;
1574 List<TopLevelVariableElement> get topLevelVariables => _variables;
1258 List<TypeAliasElement> get typeAliases => _typeAliases; 1575 List<TypeAliasElement> get typeAliases => _typeAliases;
1259 List<ClassElement> get types => _types; 1576 List<ClassElement> get types => _types;
1260 List<VariableElement> get variables => _variables;
1261 int get hashCode => _source.hashCode; 1577 int get hashCode => _source.hashCode;
1262 /** 1578 /**
1263 * Set the top-level accessors (getters and setters) contained in this compila tion unit to the 1579 * Set the top-level accessors (getters and setters) contained in this compila tion unit to the
1264 * given accessors. 1580 * given accessors.
1265 * @param the top-level accessors (getters and setters) contained in this comp ilation unit 1581 * @param the top-level accessors (getters and setters) contained in this comp ilation unit
1266 */ 1582 */
1267 void set accessors(List<PropertyAccessorElement> accessors3) { 1583 void set accessors(List<PropertyAccessorElement> accessors3) {
1268 for (PropertyAccessorElement accessor in accessors3) { 1584 for (PropertyAccessorElement accessor in accessors3) {
1269 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; 1585 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this;
1270 } 1586 }
(...skipping 10 matching lines...) Expand all
1281 this._functions = functions2; 1597 this._functions = functions2;
1282 } 1598 }
1283 /** 1599 /**
1284 * Set the source that corresponds to this compilation unit to the given sourc e. 1600 * Set the source that corresponds to this compilation unit to the given sourc e.
1285 * @param source the source that corresponds to this compilation unit 1601 * @param source the source that corresponds to this compilation unit
1286 */ 1602 */
1287 void set source(Source source5) { 1603 void set source(Source source5) {
1288 this._source = source5; 1604 this._source = source5;
1289 } 1605 }
1290 /** 1606 /**
1607 * Set the top-level variables contained in this compilation unit to the given variables.
1608 * @param variables the top-level variables contained in this compilation unit
1609 */
1610 void set topLevelVariables(List<TopLevelVariableElement> variables2) {
1611 for (TopLevelVariableElement field in variables2) {
1612 ((field as TopLevelVariableElementImpl)).enclosingElement = this;
1613 }
1614 this._variables = variables2;
1615 }
1616 /**
1291 * Set the type aliases contained in this compilation unit to the given type a liases. 1617 * Set the type aliases contained in this compilation unit to the given type a liases.
1292 * @param typeAliases the type aliases contained in this compilation unit 1618 * @param typeAliases the type aliases contained in this compilation unit
1293 */ 1619 */
1294 void set typeAliases(List<TypeAliasElement> typeAliases2) { 1620 void set typeAliases(List<TypeAliasElement> typeAliases2) {
1295 for (TypeAliasElement typeAlias in typeAliases2) { 1621 for (TypeAliasElement typeAlias in typeAliases2) {
1296 ((typeAlias as TypeAliasElementImpl)).enclosingElement = this; 1622 ((typeAlias as TypeAliasElementImpl)).enclosingElement = this;
1297 } 1623 }
1298 this._typeAliases = typeAliases2; 1624 this._typeAliases = typeAliases2;
1299 } 1625 }
1300 /** 1626 /**
1301 * Set the types contained in this compilation unit to the given types. 1627 * Set the types contained in this compilation unit to the given types.
1302 * @param types types contained in this compilation unit 1628 * @param types types contained in this compilation unit
1303 */ 1629 */
1304 void set types(List<ClassElement> types2) { 1630 void set types(List<ClassElement> types2) {
1305 for (ClassElement type in types2) { 1631 for (ClassElement type in types2) {
1306 ((type as ClassElementImpl)).enclosingElement = this; 1632 ((type as ClassElementImpl)).enclosingElement = this;
1307 } 1633 }
1308 this._types = types2; 1634 this._types = types2;
1309 } 1635 }
1310 /** 1636 void visitChildren(ElementVisitor<Object> visitor) {
1311 * Set the variables contained in this compilation unit to the given variables . 1637 super.visitChildren(visitor);
1312 * @param variables the variables contained in this compilation unit 1638 safelyVisitChildren(_accessors, visitor);
1313 */ 1639 safelyVisitChildren(_functions, visitor);
1314 void set variables(List<VariableElement> variables2) { 1640 safelyVisitChildren(_typeAliases, visitor);
1315 for (VariableElement field in variables2) { 1641 safelyVisitChildren(_types, visitor);
1316 ((field as VariableElementImpl)).enclosingElement = this; 1642 safelyVisitChildren(_variables, visitor);
1317 }
1318 this._variables = variables2;
1319 } 1643 }
1320 void appendTo(StringBuffer builder) { 1644 void appendTo(StringBuffer builder) {
1321 if (_source == null) { 1645 if (_source == null) {
1322 builder.add("{compilation unit}"); 1646 builder.write("{compilation unit}");
1323 } else { 1647 } else {
1324 builder.add(_source.fullName); 1648 builder.write(_source.fullName);
1325 } 1649 }
1326 } 1650 }
1327 } 1651 }
1328 /** 1652 /**
1329 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons tructorElement}. 1653 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons tructorElement}.
1330 */ 1654 */
1331 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement { 1655 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement {
1332 /** 1656 /**
1333 * An empty array of constructor elements. 1657 * An empty array of constructor elements.
1334 */ 1658 */
1335 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); 1659 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0);
1336 /** 1660 /**
1337 * Initialize a newly created constructor element to have the given name. 1661 * Initialize a newly created constructor element to have the given name.
1338 * @param name the name of this element 1662 * @param name the name of this element
1339 */ 1663 */
1340 ConstructorElementImpl(Identifier name) : super.con1(name) { 1664 ConstructorElementImpl(Identifier name) : super.con1(name) {
1341 } 1665 }
1342 ClassElement get enclosingElement => (super.enclosingElement as ClassElement); 1666 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
1667 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
1343 ElementKind get kind => ElementKind.CONSTRUCTOR; 1668 ElementKind get kind => ElementKind.CONSTRUCTOR;
1344 bool isConst() => hasModifier(Modifier.CONST); 1669 bool isConst() => hasModifier(Modifier.CONST);
1345 bool isFactory() => hasModifier(Modifier.FACTORY); 1670 bool isFactory() => hasModifier(Modifier.FACTORY);
1671 bool isStatic() => false;
1346 /** 1672 /**
1347 * Set whether this constructor represents a factory method to the given value . 1673 * Set whether this constructor represents a factory method to the given value .
1348 * @param isFactory {@code true} if this constructor represents a factory meth od 1674 * @param isFactory {@code true} if this constructor represents a factory meth od
1349 */ 1675 */
1350 void set factory(bool isFactory) { 1676 void set factory(bool isFactory) {
1351 setModifier(Modifier.FACTORY, isFactory); 1677 setModifier(Modifier.FACTORY, isFactory);
1352 } 1678 }
1353 void appendTo(StringBuffer builder) { 1679 void appendTo(StringBuffer builder) {
1354 builder.add(enclosingElement.name); 1680 builder.write(enclosingElement.name);
1355 String name12 = name; 1681 String name12 = name;
1356 if (name12 != null && !name12.isEmpty) { 1682 if (name12 != null && !name12.isEmpty) {
1357 builder.add("."); 1683 builder.write(".");
1358 builder.add(name12); 1684 builder.write(name12);
1359 } 1685 }
1360 super.appendTo(builder); 1686 super.appendTo(builder);
1361 } 1687 }
1362 } 1688 }
1363 /** 1689 /**
1364 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele ment representing 1690 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele ment representing
1365 * the declaration of the type {@code dynamic}. 1691 * the declaration of the type {@code dynamic}.
1366 */ 1692 */
1367 class DynamicElementImpl extends ElementImpl { 1693 class DynamicElementImpl extends ElementImpl {
1368 /** 1694 /**
1369 * Return the unique instance of this class. 1695 * Return the unique instance of this class.
1370 * @return the unique instance of this class 1696 * @return the unique instance of this class
1371 */ 1697 */
1372 static DynamicElementImpl get instance => (DynamicTypeImpl.instance.element as DynamicElementImpl); 1698 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as DynamicElementImpl;
1373 /** 1699 /**
1374 * The type defined by this element. 1700 * The type defined by this element.
1375 */ 1701 */
1376 DynamicTypeImpl _type; 1702 DynamicTypeImpl _type;
1377 /** 1703 /**
1378 * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be 1704 * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be
1379 * created except as part of creating the type associated with this element. T he single instance 1705 * created except as part of creating the type associated with this element. T he single instance
1380 * of this class should be accessed through the method {@link #getInstance()}. 1706 * of this class should be accessed through the method {@link #getInstance()}.
1381 */ 1707 */
1382 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { 1708 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) {
1383 setModifier(Modifier.SYNTHETIC, true); 1709 setModifier(Modifier.SYNTHETIC, true);
1384 } 1710 }
1711 accept(ElementVisitor visitor) => null;
1385 ElementKind get kind => ElementKind.DYNAMIC; 1712 ElementKind get kind => ElementKind.DYNAMIC;
1386 /** 1713 /**
1387 * Return the type defined by this element. 1714 * Return the type defined by this element.
1388 * @return the type defined by this element 1715 * @return the type defined by this element
1389 */ 1716 */
1390 DynamicTypeImpl get type => _type; 1717 DynamicTypeImpl get type => _type;
1391 /** 1718 /**
1392 * Set the type defined by this element to the given type. 1719 * Set the type defined by this element to the given type.
1393 * @param type the type defined by this element 1720 * @param type the type defined by this element
1394 */ 1721 */
1395 void set type(DynamicTypeImpl type5) { 1722 void set type(DynamicTypeImpl type6) {
1396 this._type = type5; 1723 this._type = type6;
1397 } 1724 }
1398 } 1725 }
1399 /** 1726 /**
1400 * The abstract class {@code ElementImpl} implements the behavior common to obje cts that implement 1727 * The abstract class {@code ElementImpl} implements the behavior common to obje cts that implement
1401 * an {@link Element}. 1728 * an {@link Element}.
1402 */ 1729 */
1403 abstract class ElementImpl implements Element { 1730 abstract class ElementImpl implements Element {
1404 /** 1731 /**
1405 * The enclosing element of this element, or {@code null} if this element is a t the root of the 1732 * The enclosing element of this element, or {@code null} if this element is a t the root of the
1406 * element structure. 1733 * element structure.
(...skipping 13 matching lines...) Expand all
1420 */ 1747 */
1421 Set<Modifier> _modifiers; 1748 Set<Modifier> _modifiers;
1422 /** 1749 /**
1423 * An array containing all of the metadata associated with this element. 1750 * An array containing all of the metadata associated with this element.
1424 */ 1751 */
1425 List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY; 1752 List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY;
1426 /** 1753 /**
1427 * Initialize a newly created element to have the given name. 1754 * Initialize a newly created element to have the given name.
1428 * @param name the name of this element 1755 * @param name the name of this element
1429 */ 1756 */
1430 ElementImpl.con1(Identifier name22) { 1757 ElementImpl.con1(Identifier name23) {
1431 _jtd_constructor_135_impl(name22); 1758 _jtd_constructor_158_impl(name23);
1432 } 1759 }
1433 _jtd_constructor_135_impl(Identifier name22) { 1760 _jtd_constructor_158_impl(Identifier name23) {
1434 _jtd_constructor_136_impl(name22 == null ? "" : name22.name, name22 == null ? -1 : name22.offset); 1761 _jtd_constructor_159_impl(name23 == null ? "" : name23.name, name23 == null ? -1 : name23.offset);
1435 } 1762 }
1436 /** 1763 /**
1437 * Initialize a newly created element to have the given name. 1764 * Initialize a newly created element to have the given name.
1438 * @param name the name of this element 1765 * @param name the name of this element
1439 * @param nameOffset the offset of the name of this element in the file that c ontains the 1766 * @param nameOffset the offset of the name of this element in the file that c ontains the
1440 * declaration of this element 1767 * declaration of this element
1441 */ 1768 */
1442 ElementImpl.con2(String name8, int nameOffset2) { 1769 ElementImpl.con2(String name8, int nameOffset2) {
1443 _jtd_constructor_136_impl(name8, nameOffset2); 1770 _jtd_constructor_159_impl(name8, nameOffset2);
1444 } 1771 }
1445 _jtd_constructor_136_impl(String name8, int nameOffset2) { 1772 _jtd_constructor_159_impl(String name8, int nameOffset2) {
1446 this._name = name8; 1773 this._name = name8;
1447 this._nameOffset = nameOffset2; 1774 this._nameOffset = nameOffset2;
1448 this._modifiers = new Set(); 1775 this._modifiers = new Set();
1449 } 1776 }
1450 bool operator ==(Object object) => object is Element && ((object as Element)). location == location; 1777 bool operator ==(Object object) => object != null && identical(object.runtimeT ype, runtimeType) && ((object as Element)).location == location;
1451 Element getAncestor(Type elementClass) { 1778 Element getAncestor(Type elementClass) {
1452 Element ancestor = _enclosingElement; 1779 Element ancestor = _enclosingElement;
1453 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { 1780 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) {
1454 ancestor = ancestor.enclosingElement; 1781 ancestor = ancestor.enclosingElement;
1455 } 1782 }
1456 return (ancestor as Element); 1783 return ancestor as Element;
1457 } 1784 }
1458 /** 1785 /**
1459 * Return the child of this element that is uniquely identified by the given i dentifier, or{@code null} if there is no such child. 1786 * Return the child of this element that is uniquely identified by the given i dentifier, or{@code null} if there is no such child.
1460 * @param identifier the identifier used to select a child 1787 * @param identifier the identifier used to select a child
1461 * @return the child of this element with the given identifier 1788 * @return the child of this element with the given identifier
1462 */ 1789 */
1463 ElementImpl getChild(String identifier) => null; 1790 ElementImpl getChild(String identifier) => null;
1464 AnalysisContext get context { 1791 AnalysisContext get context {
1465 if (_enclosingElement == null) { 1792 if (_enclosingElement == null) {
1466 return null; 1793 return null;
1467 } 1794 }
1468 return _enclosingElement.context; 1795 return _enclosingElement.context;
1469 } 1796 }
1470 Element get enclosingElement => _enclosingElement; 1797 Element get enclosingElement => _enclosingElement;
1471 LibraryElement get library => getAncestor(LibraryElement); 1798 LibraryElement get library => getAncestor(LibraryElement);
1472 ElementLocation get location => new ElementLocationImpl.con1(this); 1799 ElementLocation get location => new ElementLocationImpl.con1(this);
1473 List<Annotation> get metadata => _metadata; 1800 List<Annotation> get metadata => _metadata;
1474 String get name => _name; 1801 String get name => _name;
1475 int get nameOffset => _nameOffset; 1802 int get nameOffset => _nameOffset;
1476 Source get source { 1803 Source get source {
1477 if (_enclosingElement == null) { 1804 if (_enclosingElement == null) {
1478 return null; 1805 return null;
1479 } 1806 }
1480 return _enclosingElement.source; 1807 return _enclosingElement.source;
1481 } 1808 }
1482 int get hashCode => location.hashCode; 1809 int get hashCode => location.hashCode;
1483 bool isAccessibleIn(LibraryElement library18) { 1810 bool isAccessibleIn(LibraryElement library19) {
1484 if (Identifier.isPrivateName(_name)) { 1811 if (Identifier.isPrivateName(_name)) {
1485 return library18 == library; 1812 return library19 == library;
1486 } 1813 }
1487 return true; 1814 return true;
1488 } 1815 }
1489 bool isSynthetic() => hasModifier(Modifier.SYNTHETIC); 1816 bool isSynthetic() => hasModifier(Modifier.SYNTHETIC);
1490 /** 1817 /**
1491 * Set the metadata associate with this element to the given array of annotati ons. 1818 * Set the metadata associate with this element to the given array of annotati ons.
1492 * @param metadata the metadata to be associated with this element 1819 * @param metadata the metadata to be associated with this element
1493 */ 1820 */
1494 void set metadata(List<Annotation> metadata2) { 1821 void set metadata(List<Annotation> metadata2) {
1495 this._metadata = metadata2; 1822 this._metadata = metadata2;
1496 } 1823 }
1497 /** 1824 /**
1498 * Set whether this element is synthetic to correspond to the given value. 1825 * Set whether this element is synthetic to correspond to the given value.
1499 * @param isSynthetic {@code true} if the element is synthetic 1826 * @param isSynthetic {@code true} if the element is synthetic
1500 */ 1827 */
1501 void set synthetic(bool isSynthetic) { 1828 void set synthetic(bool isSynthetic) {
1502 setModifier(Modifier.SYNTHETIC, isSynthetic); 1829 setModifier(Modifier.SYNTHETIC, isSynthetic);
1503 } 1830 }
1504 String toString() { 1831 String toString() {
1505 StringBuffer builder = new StringBuffer(); 1832 StringBuffer builder = new StringBuffer();
1506 appendTo(builder); 1833 appendTo(builder);
1507 return builder.toString(); 1834 return builder.toString();
1508 } 1835 }
1836 void visitChildren(ElementVisitor<Object> visitor) {
1837 }
1509 /** 1838 /**
1510 * Append a textual representation of this type to the given builder. 1839 * Append a textual representation of this type to the given builder.
1511 * @param builder the builder to which the text is to be appended 1840 * @param builder the builder to which the text is to be appended
1512 */ 1841 */
1513 void appendTo(StringBuffer builder) { 1842 void appendTo(StringBuffer builder) {
1514 if (_name == null) { 1843 if (_name == null) {
1515 builder.add("<unnamed "); 1844 builder.write("<unnamed ");
1516 builder.add(runtimeType.toString()); 1845 builder.write(runtimeType.toString());
1517 builder.add(">"); 1846 builder.write(">");
1518 } else { 1847 } else {
1519 builder.add(_name); 1848 builder.write(_name);
1520 } 1849 }
1521 } 1850 }
1522 /** 1851 /**
1523 * Return an identifier that uniquely identifies this element among the childr en of this element's 1852 * Return an identifier that uniquely identifies this element among the childr en of this element's
1524 * parent. 1853 * parent.
1525 * @return an identifier that uniquely identifies this element relative to its parent 1854 * @return an identifier that uniquely identifies this element relative to its parent
1526 */ 1855 */
1527 String get identifier => name; 1856 String get identifier => name;
1528 /** 1857 /**
1529 * Return {@code true} if this element has the given modifier associated with it. 1858 * Return {@code true} if this element has the given modifier associated with it.
1530 * @param modifier the modifier being tested for 1859 * @param modifier the modifier being tested for
1531 * @return {@code true} if this element has the given modifier associated with it 1860 * @return {@code true} if this element has the given modifier associated with it
1532 */ 1861 */
1533 bool hasModifier(Modifier modifier) => _modifiers.contains(modifier); 1862 bool hasModifier(Modifier modifier) => _modifiers.contains(modifier);
1534 /** 1863 /**
1864 * If the given child is not {@code null}, use the given visitor to visit it.
1865 * @param child the child to be visited
1866 * @param visitor the visitor to be used to visit the child
1867 */
1868 void safelyVisitChild(Element child, ElementVisitor<Object> visitor) {
1869 if (child != null) {
1870 child.accept(visitor);
1871 }
1872 }
1873 /**
1874 * Use the given visitor to visit all of the children in the given array.
1875 * @param children the children to be visited
1876 * @param visitor the visitor being used to visit the children
1877 */
1878 void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visito r) {
1879 if (children != null) {
1880 for (Element child in children) {
1881 child.accept(visitor);
1882 }
1883 }
1884 }
1885 /**
1535 * Set the enclosing element of this element to the given element. 1886 * Set the enclosing element of this element to the given element.
1536 * @param element the enclosing element of this element 1887 * @param element the enclosing element of this element
1537 */ 1888 */
1538 void set enclosingElement(ElementImpl element) { 1889 void set enclosingElement(ElementImpl element) {
1539 _enclosingElement = element; 1890 _enclosingElement = element;
1540 } 1891 }
1541 /** 1892 /**
1542 * Set whether the given modifier is associated with this element to correspon d to the given 1893 * Set whether the given modifier is associated with this element to correspon d to the given
1543 * value. 1894 * value.
1544 * @param modifier the modifier to be set 1895 * @param modifier the modifier to be set
(...skipping 17 matching lines...) Expand all
1562 List<String> _components; 1913 List<String> _components;
1563 /** 1914 /**
1564 * The character used to separate components in the encoded form. 1915 * The character used to separate components in the encoded form.
1565 */ 1916 */
1566 static int _SEPARATOR_CHAR = 0x3B; 1917 static int _SEPARATOR_CHAR = 0x3B;
1567 /** 1918 /**
1568 * Initialize a newly created location to represent the given element. 1919 * Initialize a newly created location to represent the given element.
1569 * @param element the element whose location is being represented 1920 * @param element the element whose location is being represented
1570 */ 1921 */
1571 ElementLocationImpl.con1(Element element) { 1922 ElementLocationImpl.con1(Element element) {
1572 _jtd_constructor_137_impl(element); 1923 _jtd_constructor_160_impl(element);
1573 } 1924 }
1574 _jtd_constructor_137_impl(Element element) { 1925 _jtd_constructor_160_impl(Element element) {
1575 List<String> components = new List<String>(); 1926 List<String> components = new List<String>();
1576 Element ancestor = element; 1927 Element ancestor = element;
1577 while (ancestor != null) { 1928 while (ancestor != null) {
1578 components.insertRange(0, 1, ((ancestor as ElementImpl)).identifier); 1929 components.insertRange(0, 1, ((ancestor as ElementImpl)).identifier);
1579 ancestor = ancestor.enclosingElement; 1930 ancestor = ancestor.enclosingElement;
1580 } 1931 }
1581 this._components = new List.from(components); 1932 this._components = new List.from(components);
1582 } 1933 }
1583 /** 1934 /**
1584 * Initialize a newly created location from the given encoded form. 1935 * Initialize a newly created location from the given encoded form.
1585 * @param encoding the encoded form of a location 1936 * @param encoding the encoded form of a location
1586 */ 1937 */
1587 ElementLocationImpl.con2(String encoding) { 1938 ElementLocationImpl.con2(String encoding) {
1588 _jtd_constructor_138_impl(encoding); 1939 _jtd_constructor_161_impl(encoding);
1589 } 1940 }
1590 _jtd_constructor_138_impl(String encoding) { 1941 _jtd_constructor_161_impl(String encoding) {
1591 this._components = decode(encoding); 1942 this._components = decode(encoding);
1592 } 1943 }
1593 bool operator ==(Object object) { 1944 bool operator ==(Object object) {
1594 if (object is! ElementLocationImpl) { 1945 if (object is! ElementLocationImpl) {
1595 return false; 1946 return false;
1596 } 1947 }
1597 ElementLocationImpl location = (object as ElementLocationImpl); 1948 ElementLocationImpl location = object as ElementLocationImpl;
1598 return JavaArrays.equals(_components, location._components); 1949 return JavaArrays.equals(_components, location._components);
1599 } 1950 }
1600 /** 1951 /**
1601 * Return the path to the element whose location is represented by this object . 1952 * Return the path to the element whose location is represented by this object .
1602 * @return the path to the element whose location is represented by this objec t 1953 * @return the path to the element whose location is represented by this objec t
1603 */ 1954 */
1604 List<String> get components => _components; 1955 List<String> get components => _components;
1605 String get encoding { 1956 String get encoding {
1606 StringBuffer builder = new StringBuffer(); 1957 StringBuffer builder = new StringBuffer();
1607 int length2 = _components.length; 1958 int length2 = _components.length;
1608 for (int i = 0; i < length2; i++) { 1959 for (int i = 0; i < length2; i++) {
1609 if (i > 0) { 1960 if (i > 0) {
1610 builder.addCharCode(_SEPARATOR_CHAR); 1961 builder.writeCharCode(_SEPARATOR_CHAR);
1611 } 1962 }
1612 encode(builder, _components[i]); 1963 encode(builder, _components[i]);
1613 } 1964 }
1614 return builder.toString(); 1965 return builder.toString();
1615 } 1966 }
1616 int get hashCode => JavaArrays.makeHashCode(_components); 1967 int get hashCode => JavaArrays.makeHashCode(_components);
1617 String toString() => encoding; 1968 String toString() => encoding;
1618 /** 1969 /**
1619 * Decode the encoded form of a location into an array of components. 1970 * Decode the encoded form of a location into an array of components.
1620 * @param encoding the encoded form of a location 1971 * @param encoding the encoded form of a location
1621 * @return the components that were encoded 1972 * @return the components that were encoded
1622 */ 1973 */
1623 List<String> decode(String encoding) { 1974 List<String> decode(String encoding) {
1624 List<String> components = new List<String>(); 1975 List<String> components = new List<String>();
1625 StringBuffer builder = new StringBuffer(); 1976 StringBuffer builder = new StringBuffer();
1626 int index = 0; 1977 int index = 0;
1627 int length3 = encoding.length; 1978 int length3 = encoding.length;
1628 while (index < length3) { 1979 while (index < length3) {
1629 int currentChar = encoding.codeUnitAt(index); 1980 int currentChar = encoding.codeUnitAt(index);
1630 if (currentChar == _SEPARATOR_CHAR) { 1981 if (currentChar == _SEPARATOR_CHAR) {
1631 if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_ CHAR) { 1982 if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_ CHAR) {
1632 builder.addCharCode(_SEPARATOR_CHAR); 1983 builder.writeCharCode(_SEPARATOR_CHAR);
1633 index += 2; 1984 index += 2;
1634 } else { 1985 } else {
1635 components.add(builder.toString()); 1986 components.add(builder.toString());
1636 builder.clear(); 1987 builder.clear();
1637 index++; 1988 index++;
1638 } 1989 }
1639 } else { 1990 } else {
1640 builder.addCharCode(currentChar); 1991 builder.writeCharCode(currentChar);
1641 index++; 1992 index++;
1642 } 1993 }
1643 } 1994 }
1644 if (builder.length > 0) { 1995 if (builder.length > 0) {
1645 components.add(builder.toString()); 1996 components.add(builder.toString());
1646 } 1997 }
1647 return new List.from(components); 1998 return new List.from(components);
1648 } 1999 }
1649 /** 2000 /**
1650 * Append an encoded form of the given component to the given builder. 2001 * Append an encoded form of the given component to the given builder.
1651 * @param builder the builder to which the encoded component is to be appended 2002 * @param builder the builder to which the encoded component is to be appended
1652 * @param component the component to be appended to the builder 2003 * @param component the component to be appended to the builder
1653 */ 2004 */
1654 void encode(StringBuffer builder, String component) { 2005 void encode(StringBuffer builder, String component) {
1655 int length4 = component.length; 2006 int length4 = component.length;
1656 for (int i = 0; i < length4; i++) { 2007 for (int i = 0; i < length4; i++) {
1657 int currentChar = component.codeUnitAt(i); 2008 int currentChar = component.codeUnitAt(i);
1658 if (currentChar == _SEPARATOR_CHAR) { 2009 if (currentChar == _SEPARATOR_CHAR) {
1659 builder.addCharCode(_SEPARATOR_CHAR); 2010 builder.writeCharCode(_SEPARATOR_CHAR);
1660 } 2011 }
1661 builder.addCharCode(currentChar); 2012 builder.writeCharCode(currentChar);
1662 } 2013 }
1663 } 2014 }
1664 } 2015 }
1665 /** 2016 /**
1666 * The abstract class {@code ExecutableElementImpl} implements the behavior comm on to{@code ExecutableElement}s. 2017 * The abstract class {@code ExecutableElementImpl} implements the behavior comm on to{@code ExecutableElement}s.
1667 */ 2018 */
1668 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement { 2019 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement {
1669 /** 2020 /**
1670 * An array containing all of the functions defined within this executable ele ment. 2021 * An array containing all of the functions defined within this executable ele ment.
1671 */ 2022 */
1672 List<ExecutableElement> _functions = EMPTY_ARRAY; 2023 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
1673 /** 2024 /**
1674 * An array containing all of the labels defined within this executable elemen t. 2025 * An array containing all of the labels defined within this executable elemen t.
1675 */ 2026 */
1676 List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY; 2027 List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY;
1677 /** 2028 /**
1678 * An array containing all of the local variables defined within this executab le element. 2029 * An array containing all of the local variables defined within this executab le element.
1679 */ 2030 */
1680 List<VariableElement> _localVariables = VariableElementImpl.EMPTY_ARRAY; 2031 List<LocalVariableElement> _localVariables = LocalVariableElementImpl.EMPTY_AR RAY;
1681 /** 2032 /**
1682 * An array containing all of the parameters defined by this executable elemen t. 2033 * An array containing all of the parameters defined by this executable elemen t.
1683 */ 2034 */
1684 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; 2035 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
1685 /** 2036 /**
1686 * The type of function defined by this executable element. 2037 * The type of function defined by this executable element.
1687 */ 2038 */
1688 FunctionType _type; 2039 FunctionType _type;
1689 /** 2040 /**
1690 * An empty array of executable elements. 2041 * An empty array of executable elements.
1691 */ 2042 */
1692 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0); 2043 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>(0);
1693 /** 2044 /**
1694 * Initialize a newly created executable element to have the given name. 2045 * Initialize a newly created executable element to have the given name.
1695 * @param name the name of this element 2046 * @param name the name of this element
1696 */ 2047 */
1697 ExecutableElementImpl.con1(Identifier name) : super.con1(name) { 2048 ExecutableElementImpl.con1(Identifier name) : super.con1(name) {
1698 _jtd_constructor_139_impl(name); 2049 _jtd_constructor_162_impl(name);
1699 } 2050 }
1700 _jtd_constructor_139_impl(Identifier name) { 2051 _jtd_constructor_162_impl(Identifier name) {
1701 } 2052 }
1702 /** 2053 /**
1703 * Initialize a newly created executable element to have the given name. 2054 * Initialize a newly created executable element to have the given name.
1704 * @param name the name of this element 2055 * @param name the name of this element
1705 * @param nameOffset the offset of the name of this element in the file that c ontains the 2056 * @param nameOffset the offset of the name of this element in the file that c ontains the
1706 * declaration of this element 2057 * declaration of this element
1707 */ 2058 */
1708 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam eOffset) { 2059 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam eOffset) {
1709 _jtd_constructor_140_impl(name, nameOffset); 2060 _jtd_constructor_163_impl(name, nameOffset);
1710 } 2061 }
1711 _jtd_constructor_140_impl(String name, int nameOffset) { 2062 _jtd_constructor_163_impl(String name, int nameOffset) {
1712 } 2063 }
1713 ElementImpl getChild(String identifier21) { 2064 ElementImpl getChild(String identifier26) {
1714 for (ExecutableElement function in _functions) { 2065 for (ExecutableElement function in _functions) {
1715 if (((function as ExecutableElementImpl)).identifier == identifier21) { 2066 if (((function as ExecutableElementImpl)).identifier == identifier26) {
1716 return (function as ExecutableElementImpl); 2067 return function as ExecutableElementImpl;
1717 } 2068 }
1718 } 2069 }
1719 for (LabelElement label in _labels) { 2070 for (LabelElement label in _labels) {
1720 if (((label as LabelElementImpl)).identifier == identifier21) { 2071 if (((label as LabelElementImpl)).identifier == identifier26) {
1721 return (label as LabelElementImpl); 2072 return label as LabelElementImpl;
1722 } 2073 }
1723 } 2074 }
1724 for (VariableElement variable in _localVariables) { 2075 for (VariableElement variable in _localVariables) {
1725 if (((variable as VariableElementImpl)).identifier == identifier21) { 2076 if (((variable as VariableElementImpl)).identifier == identifier26) {
1726 return (variable as VariableElementImpl); 2077 return variable as VariableElementImpl;
1727 } 2078 }
1728 } 2079 }
1729 for (ParameterElement parameter in _parameters) { 2080 for (ParameterElement parameter in _parameters) {
1730 if (((parameter as ParameterElementImpl)).identifier == identifier21) { 2081 if (((parameter as ParameterElementImpl)).identifier == identifier26) {
1731 return (parameter as ParameterElementImpl); 2082 return parameter as ParameterElementImpl;
1732 } 2083 }
1733 } 2084 }
1734 return null; 2085 return null;
1735 } 2086 }
1736 List<ExecutableElement> get functions => _functions; 2087 List<FunctionElement> get functions => _functions;
1737 List<LabelElement> get labels => _labels; 2088 List<LabelElement> get labels => _labels;
1738 List<VariableElement> get localVariables => _localVariables; 2089 List<LocalVariableElement> get localVariables => _localVariables;
1739 List<ParameterElement> get parameters => _parameters; 2090 List<ParameterElement> get parameters => _parameters;
1740 FunctionType get type => _type; 2091 FunctionType get type => _type;
1741 /** 2092 /**
1742 * Set the functions defined within this executable element to the given funct ions. 2093 * Set the functions defined within this executable element to the given funct ions.
1743 * @param functions the functions defined within this executable element 2094 * @param functions the functions defined within this executable element
1744 */ 2095 */
1745 void set functions(List<ExecutableElement> functions3) { 2096 void set functions(List<FunctionElement> functions3) {
1746 for (ExecutableElement function in functions3) { 2097 for (FunctionElement function in functions3) {
1747 ((function as ExecutableElementImpl)).enclosingElement = this; 2098 ((function as FunctionElementImpl)).enclosingElement = this;
1748 } 2099 }
1749 this._functions = functions3; 2100 this._functions = functions3;
1750 } 2101 }
1751 /** 2102 /**
1752 * Set the labels defined within this executable element to the given labels. 2103 * Set the labels defined within this executable element to the given labels.
1753 * @param labels the labels defined within this executable element 2104 * @param labels the labels defined within this executable element
1754 */ 2105 */
1755 void set labels(List<LabelElement> labels2) { 2106 void set labels(List<LabelElement> labels2) {
1756 for (LabelElement label in labels2) { 2107 for (LabelElement label in labels2) {
1757 ((label as LabelElementImpl)).enclosingElement = this; 2108 ((label as LabelElementImpl)).enclosingElement = this;
1758 } 2109 }
1759 this._labels = labels2; 2110 this._labels = labels2;
1760 } 2111 }
1761 /** 2112 /**
1762 * Set the local variables defined within this executable element to the given variables. 2113 * Set the local variables defined within this executable element to the given variables.
1763 * @param localVariables the local variables defined within this executable el ement 2114 * @param localVariables the local variables defined within this executable el ement
1764 */ 2115 */
1765 void set localVariables(List<VariableElement> localVariables2) { 2116 void set localVariables(List<LocalVariableElement> localVariables2) {
1766 for (VariableElement variable in localVariables2) { 2117 for (LocalVariableElement variable in localVariables2) {
1767 ((variable as VariableElementImpl)).enclosingElement = this; 2118 ((variable as LocalVariableElementImpl)).enclosingElement = this;
1768 } 2119 }
1769 this._localVariables = localVariables2; 2120 this._localVariables = localVariables2;
1770 } 2121 }
1771 /** 2122 /**
1772 * Set the parameters defined by this executable element to the given paramete rs. 2123 * Set the parameters defined by this executable element to the given paramete rs.
1773 * @param parameters the parameters defined by this executable element 2124 * @param parameters the parameters defined by this executable element
1774 */ 2125 */
1775 void set parameters(List<ParameterElement> parameters7) { 2126 void set parameters(List<ParameterElement> parameters7) {
1776 for (ParameterElement parameter in parameters7) { 2127 for (ParameterElement parameter in parameters7) {
1777 ((parameter as ParameterElementImpl)).enclosingElement = this; 2128 ((parameter as ParameterElementImpl)).enclosingElement = this;
1778 } 2129 }
1779 this._parameters = parameters7; 2130 this._parameters = parameters7;
1780 } 2131 }
1781 /** 2132 /**
1782 * Set the type of function defined by this executable element to the given ty pe. 2133 * Set the type of function defined by this executable element to the given ty pe.
1783 * @param type the type of function defined by this executable element 2134 * @param type the type of function defined by this executable element
1784 */ 2135 */
1785 void set type(FunctionType type6) { 2136 void set type(FunctionType type7) {
1786 this._type = type6; 2137 this._type = type7;
2138 }
2139 void visitChildren(ElementVisitor<Object> visitor) {
2140 super.visitChildren(visitor);
2141 safelyVisitChildren(_functions, visitor);
2142 safelyVisitChildren(_labels, visitor);
2143 safelyVisitChildren(_localVariables, visitor);
2144 safelyVisitChildren(_parameters, visitor);
1787 } 2145 }
1788 void appendTo(StringBuffer builder) { 2146 void appendTo(StringBuffer builder) {
1789 builder.add("("); 2147 builder.write("(");
1790 int parameterCount = _parameters.length; 2148 int parameterCount = _parameters.length;
1791 for (int i = 0; i < parameterCount; i++) { 2149 for (int i = 0; i < parameterCount; i++) {
1792 if (i > 0) { 2150 if (i > 0) {
1793 builder.add(", "); 2151 builder.write(", ");
1794 } 2152 }
1795 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); 2153 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
1796 } 2154 }
1797 builder.add(")"); 2155 builder.write(")");
1798 if (_type != null) { 2156 if (_type != null) {
1799 builder.add(" -> "); 2157 builder.write(" -> ");
1800 builder.add(_type.returnType); 2158 builder.write(_type.returnType);
1801 } 2159 }
1802 } 2160 }
1803 } 2161 }
1804 /** 2162 /**
1805 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl ement}. 2163 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl ement}.
1806 */ 2164 */
1807 class ExportElementImpl extends ElementImpl implements ExportElement { 2165 class ExportElementImpl extends ElementImpl implements ExportElement {
1808 /** 2166 /**
1809 * The library that is exported from this library by this export directive. 2167 * The library that is exported from this library by this export directive.
1810 */ 2168 */
1811 LibraryElement _exportedLibrary; 2169 LibraryElement _exportedLibrary;
1812 /** 2170 /**
1813 * The combinators that were specified as part of the export directive in the order in which they 2171 * The combinators that were specified as part of the export directive in the order in which they
1814 * were specified. 2172 * were specified.
1815 */ 2173 */
1816 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; 2174 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY;
1817 /** 2175 /**
1818 * Initialize a newly created export element. 2176 * Initialize a newly created export element.
1819 */ 2177 */
1820 ExportElementImpl() : super.con1(null) { 2178 ExportElementImpl() : super.con1(null) {
1821 } 2179 }
2180 accept(ElementVisitor visitor) => visitor.visitExportElement(this);
1822 List<NamespaceCombinator> get combinators => _combinators; 2181 List<NamespaceCombinator> get combinators => _combinators;
1823 LibraryElement get exportedLibrary => _exportedLibrary; 2182 LibraryElement get exportedLibrary => _exportedLibrary;
1824 ElementKind get kind => ElementKind.EXPORT; 2183 ElementKind get kind => ElementKind.EXPORT;
1825 /** 2184 /**
1826 * Set the combinators that were specified as part of the export directive to the given array of 2185 * Set the combinators that were specified as part of the export directive to the given array of
1827 * combinators. 2186 * combinators.
1828 * @param combinators the combinators that were specified as part of the expor t directive 2187 * @param combinators the combinators that were specified as part of the expor t directive
1829 */ 2188 */
1830 void set combinators(List<NamespaceCombinator> combinators2) { 2189 void set combinators(List<NamespaceCombinator> combinators2) {
1831 this._combinators = combinators2; 2190 this._combinators = combinators2;
1832 } 2191 }
1833 /** 2192 /**
1834 * Set the library that is exported from this library by this import directive to the given 2193 * Set the library that is exported from this library by this import directive to the given
1835 * library. 2194 * library.
1836 * @param exportedLibrary the library that is exported from this library 2195 * @param exportedLibrary the library that is exported from this library
1837 */ 2196 */
1838 void set exportedLibrary(LibraryElement exportedLibrary2) { 2197 void set exportedLibrary(LibraryElement exportedLibrary2) {
1839 this._exportedLibrary = exportedLibrary2; 2198 this._exportedLibrary = exportedLibrary2;
1840 } 2199 }
1841 void appendTo(StringBuffer builder) { 2200 void appendTo(StringBuffer builder) {
1842 builder.add("export "); 2201 builder.write("export ");
1843 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); 2202 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder);
1844 } 2203 }
1845 } 2204 }
1846 /** 2205 /**
1847 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme nt}. 2206 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme nt}.
1848 */ 2207 */
1849 class FieldElementImpl extends VariableElementImpl implements FieldElement { 2208 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme nt {
1850 /**
1851 * The getter associated with this field.
1852 */
1853 PropertyAccessorElement _getter;
1854 /**
1855 * The setter associated with this field, or {@code null} if the field is effe ctively{@code final} and therefore does not have a setter associated with it.
1856 */
1857 PropertyAccessorElement _setter;
1858 /** 2209 /**
1859 * An empty array of field elements. 2210 * An empty array of field elements.
1860 */ 2211 */
1861 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); 2212 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0);
1862 /** 2213 /**
1863 * Initialize a newly created field element to have the given name. 2214 * Initialize a newly created field element to have the given name.
1864 * @param name the name of this element 2215 * @param name the name of this element
1865 */ 2216 */
1866 FieldElementImpl.con1(Identifier name) : super.con1(name) { 2217 FieldElementImpl.con1(Identifier name) : super.con1(name) {
1867 _jtd_constructor_142_impl(name); 2218 _jtd_constructor_165_impl(name);
1868 } 2219 }
1869 _jtd_constructor_142_impl(Identifier name) { 2220 _jtd_constructor_165_impl(Identifier name) {
1870 } 2221 }
1871 /** 2222 /**
1872 * Initialize a newly created synthetic field element to have the given name. 2223 * Initialize a newly created synthetic field element to have the given name.
1873 * @param name the name of this element 2224 * @param name the name of this element
1874 */ 2225 */
1875 FieldElementImpl.con2(String name) : super.con2(name, -1) { 2226 FieldElementImpl.con2(String name) : super.con2(name) {
1876 _jtd_constructor_143_impl(name); 2227 _jtd_constructor_166_impl(name);
1877 } 2228 }
1878 _jtd_constructor_143_impl(String name) { 2229 _jtd_constructor_166_impl(String name) {
1879 synthetic = true;
1880 } 2230 }
1881 PropertyAccessorElement get getter => _getter; 2231 accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
2232 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
1882 ElementKind get kind => ElementKind.FIELD; 2233 ElementKind get kind => ElementKind.FIELD;
1883 PropertyAccessorElement get setter => _setter;
1884 bool isStatic() => hasModifier(Modifier.STATIC); 2234 bool isStatic() => hasModifier(Modifier.STATIC);
1885 /** 2235 /**
1886 * Set the getter associated with this field to the given accessor.
1887 * @param getter the getter associated with this field
1888 */
1889 void set getter(PropertyAccessorElement getter2) {
1890 this._getter = getter2;
1891 }
1892 /**
1893 * Set the setter associated with this field to the given accessor.
1894 * @param setter the setter associated with this field
1895 */
1896 void set setter(PropertyAccessorElement setter2) {
1897 this._setter = setter2;
1898 }
1899 /**
1900 * Set whether this field is static to correspond to the given value. 2236 * Set whether this field is static to correspond to the given value.
1901 * @param isStatic {@code true} if the field is static 2237 * @param isStatic {@code true} if the field is static
1902 */ 2238 */
1903 void set static(bool isStatic) { 2239 void set static(bool isStatic) {
1904 setModifier(Modifier.STATIC, isStatic); 2240 setModifier(Modifier.STATIC, isStatic);
1905 } 2241 }
1906 } 2242 }
1907 /** 2243 /**
1908 * Instances of the class {@code FunctionElementImpl} implement a {@code Functio nElement}. 2244 * Instances of the class {@code FunctionElementImpl} implement a {@code Functio nElement}.
1909 */ 2245 */
1910 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme nt { 2246 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme nt {
1911 /** 2247 /**
1912 * The offset to the beginning of the visible range for this element. 2248 * The offset to the beginning of the visible range for this element.
1913 */ 2249 */
1914 int _visibleRangeOffset = 0; 2250 int _visibleRangeOffset = 0;
1915 /** 2251 /**
1916 * The length of the visible range for this element, or {@code -1} if this ele ment does not have a 2252 * The length of the visible range for this element, or {@code -1} if this ele ment does not have a
1917 * visible range. 2253 * visible range.
1918 */ 2254 */
1919 int _visibleRangeLength = -1; 2255 int _visibleRangeLength = -1;
1920 /** 2256 /**
1921 * An empty array of function elements. 2257 * An empty array of function elements.
1922 */ 2258 */
1923 static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>(0); 2259 static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>(0);
1924 /** 2260 /**
1925 * Initialize a newly created synthetic function element. 2261 * Initialize a newly created synthetic function element.
1926 */ 2262 */
1927 FunctionElementImpl() : super.con2("", -1) { 2263 FunctionElementImpl() : super.con2("", -1) {
1928 _jtd_constructor_144_impl(); 2264 _jtd_constructor_167_impl();
1929 } 2265 }
1930 _jtd_constructor_144_impl() { 2266 _jtd_constructor_167_impl() {
1931 synthetic = true; 2267 synthetic = true;
1932 } 2268 }
1933 /** 2269 /**
1934 * Initialize a newly created function element to have the given name. 2270 * Initialize a newly created function element to have the given name.
1935 * @param name the name of this element 2271 * @param name the name of this element
1936 */ 2272 */
1937 FunctionElementImpl.con1(Identifier name) : super.con1(name) { 2273 FunctionElementImpl.con1(Identifier name) : super.con1(name) {
1938 _jtd_constructor_145_impl(name); 2274 _jtd_constructor_168_impl(name);
1939 } 2275 }
1940 _jtd_constructor_145_impl(Identifier name) { 2276 _jtd_constructor_168_impl(Identifier name) {
1941 } 2277 }
2278 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
1942 String get identifier => name; 2279 String get identifier => name;
1943 ElementKind get kind => ElementKind.FUNCTION; 2280 ElementKind get kind => ElementKind.FUNCTION;
1944 SourceRange get visibleRange { 2281 SourceRange get visibleRange {
1945 if (_visibleRangeLength < 0) { 2282 if (_visibleRangeLength < 0) {
1946 return null; 2283 return null;
1947 } 2284 }
1948 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 2285 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
1949 } 2286 }
2287 bool isStatic() => enclosingElement is CompilationUnitElement;
1950 /** 2288 /**
1951 * Set the visible range for this element to the range starting at the given o ffset with the given 2289 * Set the visible range for this element to the range starting at the given o ffset with the given
1952 * length. 2290 * length.
1953 * @param offset the offset to the beginning of the visible range for this ele ment 2291 * @param offset the offset to the beginning of the visible range for this ele ment
1954 * @param length the length of the visible range for this element, or {@code - 1} if this element 2292 * @param length the length of the visible range for this element, or {@code - 1} if this element
1955 * does not have a visible range 2293 * does not have a visible range
1956 */ 2294 */
1957 void setVisibleRange(int offset, int length) { 2295 void setVisibleRange(int offset, int length) {
1958 _visibleRangeOffset = offset; 2296 _visibleRangeOffset = offset;
1959 _visibleRangeLength = length; 2297 _visibleRangeLength = length;
1960 } 2298 }
1961 void appendTo(StringBuffer builder) { 2299 void appendTo(StringBuffer builder) {
1962 String name13 = name; 2300 String name13 = name;
1963 if (name13 != null) { 2301 if (name13 != null) {
1964 builder.add(name13); 2302 builder.write(name13);
1965 } 2303 }
1966 super.appendTo(builder); 2304 super.appendTo(builder);
1967 } 2305 }
1968 } 2306 }
1969 /** 2307 /**
1970 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}. 2308 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}.
1971 */ 2309 */
1972 class HideCombinatorImpl implements HideCombinator { 2310 class HideCombinatorImpl implements HideCombinator {
1973 /** 2311 /**
1974 * The names that are not to be made visible in the importing library even if they are defined in 2312 * The names that are not to be made visible in the importing library even if they are defined in
1975 * the imported library. 2313 * the imported library.
1976 */ 2314 */
1977 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; 2315 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY;
1978 /** 2316 /**
1979 * Initialize a newly created combinator. 2317 * Initialize a newly created combinator.
1980 */ 2318 */
1981 HideCombinatorImpl() : super() { 2319 HideCombinatorImpl() : super() {
1982 } 2320 }
1983 List<String> get hiddenNames => _hiddenNames; 2321 List<String> get hiddenNames => _hiddenNames;
1984 /** 2322 /**
1985 * Set the names that are not to be made visible in the importing library even if they are defined 2323 * Set the names that are not to be made visible in the importing library even if they are defined
1986 * in the imported library to the given names. 2324 * in the imported library to the given names.
1987 * @param hiddenNames the names that are not to be made visible in the importi ng library 2325 * @param hiddenNames the names that are not to be made visible in the importi ng library
1988 */ 2326 */
1989 void set hiddenNames(List<String> hiddenNames2) { 2327 void set hiddenNames(List<String> hiddenNames2) {
1990 this._hiddenNames = hiddenNames2; 2328 this._hiddenNames = hiddenNames2;
1991 } 2329 }
1992 String toString() { 2330 String toString() {
1993 StringBuffer builder = new StringBuffer(); 2331 StringBuffer builder = new StringBuffer();
1994 builder.add("show "); 2332 builder.write("show ");
1995 int count = _hiddenNames.length; 2333 int count = _hiddenNames.length;
1996 for (int i = 0; i < count; i++) { 2334 for (int i = 0; i < count; i++) {
1997 if (i > 0) { 2335 if (i > 0) {
1998 builder.add(", "); 2336 builder.write(", ");
1999 } 2337 }
2000 builder.add(_hiddenNames[i]); 2338 builder.write(_hiddenNames[i]);
2001 } 2339 }
2002 return builder.toString(); 2340 return builder.toString();
2003 } 2341 }
2004 } 2342 }
2005 /** 2343 /**
2006 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen t}. 2344 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen t}.
2007 */ 2345 */
2008 class HtmlElementImpl extends ElementImpl implements HtmlElement { 2346 class HtmlElementImpl extends ElementImpl implements HtmlElement {
2009 /** 2347 /**
2010 * An empty array of HTML file elements. 2348 * An empty array of HTML file elements.
(...skipping 12 matching lines...) Expand all
2023 */ 2361 */
2024 Source _source; 2362 Source _source;
2025 /** 2363 /**
2026 * Initialize a newly created HTML element to have the given name. 2364 * Initialize a newly created HTML element to have the given name.
2027 * @param context the analysis context in which the HTML file is defined 2365 * @param context the analysis context in which the HTML file is defined
2028 * @param name the name of this element 2366 * @param name the name of this element
2029 */ 2367 */
2030 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { 2368 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) {
2031 this._context = context; 2369 this._context = context;
2032 } 2370 }
2033 bool operator ==(Object object) => identical(this.runtimeType, object.runtimeT ype) && _source == ((object as CompilationUnitElementImpl)).source; 2371 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this);
2372 bool operator ==(Object object) => identical(runtimeType, object.runtimeType) && _source == ((object as CompilationUnitElementImpl)).source;
2034 AnalysisContext get context => _context; 2373 AnalysisContext get context => _context;
2035 ElementKind get kind => ElementKind.HTML; 2374 ElementKind get kind => ElementKind.HTML;
2036 List<LibraryElement> get libraries => _libraries; 2375 List<LibraryElement> get libraries => _libraries;
2037 Source get source => _source; 2376 Source get source => _source;
2038 int get hashCode => _source.hashCode; 2377 int get hashCode => _source.hashCode;
2039 /** 2378 /**
2040 * Set the libraries contained in or referenced from script tags in the HTML f ile to the given 2379 * Set the libraries contained in or referenced from script tags in the HTML f ile to the given
2041 * libraries. 2380 * libraries.
2042 * @param libraries the libraries contained in or referenced from script tags in the HTML file 2381 * @param libraries the libraries contained in or referenced from script tags in the HTML file
2043 */ 2382 */
2044 void set libraries(List<LibraryElement> libraries2) { 2383 void set libraries(List<LibraryElement> libraries2) {
2045 this._libraries = libraries2; 2384 this._libraries = libraries2;
2046 } 2385 }
2047 /** 2386 /**
2048 * Set the source that corresponds to this HTML file to the given source. 2387 * Set the source that corresponds to this HTML file to the given source.
2049 * @param source the source that corresponds to this HTML file 2388 * @param source the source that corresponds to this HTML file
2050 */ 2389 */
2051 void set source(Source source6) { 2390 void set source(Source source6) {
2052 this._source = source6; 2391 this._source = source6;
2053 } 2392 }
2393 void visitChildren(ElementVisitor<Object> visitor) {
2394 super.visitChildren(visitor);
2395 safelyVisitChildren(_libraries, visitor);
2396 }
2054 void appendTo(StringBuffer builder) { 2397 void appendTo(StringBuffer builder) {
2055 if (_source == null) { 2398 if (_source == null) {
2056 builder.add("{HTML file}"); 2399 builder.write("{HTML file}");
2057 } else { 2400 } else {
2058 builder.add(_source.fullName); 2401 builder.write(_source.fullName);
2059 } 2402 }
2060 } 2403 }
2061 } 2404 }
2062 /** 2405 /**
2063 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl ement}. 2406 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl ement}.
2064 */ 2407 */
2065 class ImportElementImpl extends ElementImpl implements ImportElement { 2408 class ImportElementImpl extends ElementImpl implements ImportElement {
2066 /** 2409 /**
2067 * The library that is imported into this library by this import directive. 2410 * The library that is imported into this library by this import directive.
2068 */ 2411 */
2069 LibraryElement _importedLibrary; 2412 LibraryElement _importedLibrary;
2070 /** 2413 /**
2071 * The combinators that were specified as part of the import directive in the order in which they 2414 * The combinators that were specified as part of the import directive in the order in which they
2072 * were specified. 2415 * were specified.
2073 */ 2416 */
2074 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; 2417 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY;
2075 /** 2418 /**
2076 * The prefix that was specified as part of the import directive, or {@code nu ll} if there was no 2419 * The prefix that was specified as part of the import directive, or {@code nu ll} if there was no
2077 * prefix specified. 2420 * prefix specified.
2078 */ 2421 */
2079 PrefixElement _prefix; 2422 PrefixElement _prefix;
2080 /** 2423 /**
2081 * Initialize a newly created import element. 2424 * Initialize a newly created import element.
2082 */ 2425 */
2083 ImportElementImpl() : super.con1(null) { 2426 ImportElementImpl() : super.con1(null) {
2084 } 2427 }
2428 accept(ElementVisitor visitor) => visitor.visitImportElement(this);
2085 List<NamespaceCombinator> get combinators => _combinators; 2429 List<NamespaceCombinator> get combinators => _combinators;
2086 LibraryElement get importedLibrary => _importedLibrary; 2430 LibraryElement get importedLibrary => _importedLibrary;
2087 ElementKind get kind => ElementKind.IMPORT; 2431 ElementKind get kind => ElementKind.IMPORT;
2088 PrefixElement get prefix => _prefix; 2432 PrefixElement get prefix => _prefix;
2089 /** 2433 /**
2090 * Set the combinators that were specified as part of the import directive to the given array of 2434 * Set the combinators that were specified as part of the import directive to the given array of
2091 * combinators. 2435 * combinators.
2092 * @param combinators the combinators that were specified as part of the impor t directive 2436 * @param combinators the combinators that were specified as part of the impor t directive
2093 */ 2437 */
2094 void set combinators(List<NamespaceCombinator> combinators3) { 2438 void set combinators(List<NamespaceCombinator> combinators3) {
2095 this._combinators = combinators3; 2439 this._combinators = combinators3;
2096 } 2440 }
2097 /** 2441 /**
2098 * Set the library that is imported into this library by this import directive to the given 2442 * Set the library that is imported into this library by this import directive to the given
2099 * library. 2443 * library.
2100 * @param importedLibrary the library that is imported into this library 2444 * @param importedLibrary the library that is imported into this library
2101 */ 2445 */
2102 void set importedLibrary(LibraryElement importedLibrary3) { 2446 void set importedLibrary(LibraryElement importedLibrary3) {
2103 this._importedLibrary = importedLibrary3; 2447 this._importedLibrary = importedLibrary3;
2104 } 2448 }
2105 /** 2449 /**
2106 * Set the prefix that was specified as part of the import directive to the gi ven prefix. 2450 * Set the prefix that was specified as part of the import directive to the gi ven prefix.
2107 * @param prefix the prefix that was specified as part of the import directive 2451 * @param prefix the prefix that was specified as part of the import directive
2108 */ 2452 */
2109 void set prefix(PrefixElement prefix3) { 2453 void set prefix(PrefixElement prefix3) {
2110 this._prefix = prefix3; 2454 this._prefix = prefix3;
2111 } 2455 }
2456 void visitChildren(ElementVisitor<Object> visitor) {
2457 super.visitChildren(visitor);
2458 safelyVisitChild(_prefix, visitor);
2459 }
2112 void appendTo(StringBuffer builder) { 2460 void appendTo(StringBuffer builder) {
2113 builder.add("import "); 2461 builder.write("import ");
2114 ((_importedLibrary as LibraryElementImpl)).appendTo(builder); 2462 ((_importedLibrary as LibraryElementImpl)).appendTo(builder);
2115 } 2463 }
2116 } 2464 }
2117 /** 2465 /**
2118 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme nt}. 2466 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme nt}.
2119 */ 2467 */
2120 class LabelElementImpl extends ElementImpl implements LabelElement { 2468 class LabelElementImpl extends ElementImpl implements LabelElement {
2121 /** 2469 /**
2122 * A flag indicating whether this label is associated with a {@code switch} st atement. 2470 * A flag indicating whether this label is associated with a {@code switch} st atement.
2123 */ 2471 */
2124 bool _onSwitchStatement = false; 2472 bool _onSwitchStatement = false;
2125 /** 2473 /**
2126 * A flag indicating whether this label is associated with a {@code switch} me mber ({@code case}or {@code default}). 2474 * A flag indicating whether this label is associated with a {@code switch} me mber ({@code case}or {@code default}).
2127 */ 2475 */
2128 bool _onSwitchMember = false; 2476 bool _onSwitchMember = false;
2129 /** 2477 /**
2130 * An empty array of label elements. 2478 * An empty array of label elements.
2131 */ 2479 */
2132 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); 2480 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0);
2133 /** 2481 /**
2134 * Initialize a newly created label element to have the given name. 2482 * Initialize a newly created label element to have the given name.
2135 * @param name the name of this element 2483 * @param name the name of this element
2136 * @param onSwitchStatement {@code true} if this label is associated with a {@ code switch}statement 2484 * @param onSwitchStatement {@code true} if this label is associated with a {@ code switch}statement
2137 * @param onSwitchMember {@code true} if this label is associated with a {@cod e switch} member 2485 * @param onSwitchMember {@code true} if this label is associated with a {@cod e switch} member
2138 */ 2486 */
2139 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) { 2487 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) {
2140 this._onSwitchStatement = onSwitchStatement; 2488 this._onSwitchStatement = onSwitchStatement;
2141 this._onSwitchMember = onSwitchMember; 2489 this._onSwitchMember = onSwitchMember;
2142 } 2490 }
2143 ExecutableElement get enclosingElement => (super.enclosingElement as Executabl eElement); 2491 accept(ElementVisitor visitor) => visitor.visitLabelElement(this);
2492 ExecutableElement get enclosingElement => super.enclosingElement as Executable Element;
2144 ElementKind get kind => ElementKind.LABEL; 2493 ElementKind get kind => ElementKind.LABEL;
2145 /** 2494 /**
2146 * Return {@code true} if this label is associated with a {@code switch} membe r ({@code case} or{@code default}). 2495 * Return {@code true} if this label is associated with a {@code switch} membe r ({@code case} or{@code default}).
2147 * @return {@code true} if this label is associated with a {@code switch} memb er 2496 * @return {@code true} if this label is associated with a {@code switch} memb er
2148 */ 2497 */
2149 bool isOnSwitchMember() => _onSwitchMember; 2498 bool isOnSwitchMember() => _onSwitchMember;
2150 /** 2499 /**
2151 * Return {@code true} if this label is associated with a {@code switch} state ment. 2500 * Return {@code true} if this label is associated with a {@code switch} state ment.
2152 * @return {@code true} if this label is associated with a {@code switch} stat ement 2501 * @return {@code true} if this label is associated with a {@code switch} stat ement
2153 */ 2502 */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 */ 2535 */
2187 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; 2536 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY;
2188 /** 2537 /**
2189 * Initialize a newly created library element to have the given name. 2538 * Initialize a newly created library element to have the given name.
2190 * @param context the analysis context in which the library is defined 2539 * @param context the analysis context in which the library is defined
2191 * @param name the name of this element 2540 * @param name the name of this element
2192 */ 2541 */
2193 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co n1(name) { 2542 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co n1(name) {
2194 this._context = context; 2543 this._context = context;
2195 } 2544 }
2196 bool operator ==(Object object) => identical(this.runtimeType, object.runtimeT ype) && _definingCompilationUnit == ((object as LibraryElementImpl)).definingCom pilationUnit; 2545 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this);
2197 ElementImpl getChild(String identifier22) { 2546 bool operator ==(Object object) => identical(runtimeType, object.runtimeType) && _definingCompilationUnit == ((object as LibraryElementImpl)).definingCompilat ionUnit;
2198 if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier22) { 2547 ElementImpl getChild(String identifier27) {
2199 return (_definingCompilationUnit as CompilationUnitElementImpl); 2548 if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier27) {
2549 return _definingCompilationUnit as CompilationUnitElementImpl;
2200 } 2550 }
2201 for (CompilationUnitElement part in _parts) { 2551 for (CompilationUnitElement part in _parts) {
2202 if (((part as CompilationUnitElementImpl)).identifier == identifier22) { 2552 if (((part as CompilationUnitElementImpl)).identifier == identifier27) {
2203 return (part as CompilationUnitElementImpl); 2553 return part as CompilationUnitElementImpl;
2204 } 2554 }
2205 } 2555 }
2206 return null; 2556 return null;
2207 } 2557 }
2208 AnalysisContext get context => _context; 2558 AnalysisContext get context => _context;
2209 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit ; 2559 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit ;
2210 FunctionElement get entryPoint => _entryPoint; 2560 FunctionElement get entryPoint => _entryPoint;
2211 List<LibraryElement> get exportedLibraries { 2561 List<LibraryElement> get exportedLibraries {
2212 Set<LibraryElement> libraries = new Set<LibraryElement>(); 2562 Set<LibraryElement> libraries = new Set<LibraryElement>();
2213 for (ExportElement element in _exports) { 2563 for (ExportElement element in _exports) {
(...skipping 20 matching lines...) Expand all
2234 for (ImportElement element in _imports) { 2584 for (ImportElement element in _imports) {
2235 PrefixElement prefix4 = element.prefix; 2585 PrefixElement prefix4 = element.prefix;
2236 if (prefix4 != null) { 2586 if (prefix4 != null) {
2237 javaSetAdd(prefixes, prefix4); 2587 javaSetAdd(prefixes, prefix4);
2238 } 2588 }
2239 } 2589 }
2240 return new List.from(prefixes); 2590 return new List.from(prefixes);
2241 } 2591 }
2242 int get hashCode => _definingCompilationUnit.hashCode; 2592 int get hashCode => _definingCompilationUnit.hashCode;
2243 bool isBrowserApplication() => _entryPoint != null && isOrImportsBrowserLibrar y(); 2593 bool isBrowserApplication() => _entryPoint != null && isOrImportsBrowserLibrar y();
2594 bool isDartCore() => name == "dart.core";
2244 /** 2595 /**
2245 * Set the compilation unit that defines this library to the given compilation unit. 2596 * Set the compilation unit that defines this library to the given compilation unit.
2246 * @param definingCompilationUnit the compilation unit that defines this libra ry 2597 * @param definingCompilationUnit the compilation unit that defines this libra ry
2247 */ 2598 */
2248 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni t2) { 2599 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni t2) {
2249 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement = this; 2600 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement = this;
2250 this._definingCompilationUnit = definingCompilationUnit2; 2601 this._definingCompilationUnit = definingCompilationUnit2;
2251 } 2602 }
2252 /** 2603 /**
2253 * Set the entry point for this library to the given function. 2604 * Set the entry point for this library to the given function.
2254 * @param entryPoint the entry point for this library 2605 * @param entryPoint the entry point for this library
2255 */ 2606 */
2256 void set entryPoint(FunctionElement entryPoint2) { 2607 void set entryPoint(FunctionElement entryPoint2) {
2257 ((entryPoint2 as FunctionElementImpl)).enclosingElement = this;
2258 this._entryPoint = entryPoint2; 2608 this._entryPoint = entryPoint2;
2259 } 2609 }
2260 /** 2610 /**
2261 * Set the specifications of all of the exports defined in this library to the given array. 2611 * Set the specifications of all of the exports defined in this library to the given array.
2262 * @param exports the specifications of all of the exports defined in this lib rary 2612 * @param exports the specifications of all of the exports defined in this lib rary
2263 */ 2613 */
2264 void set exports(List<ExportElement> exports2) { 2614 void set exports(List<ExportElement> exports2) {
2615 for (ExportElement exportElement in exports2) {
2616 ((exportElement as ExportElementImpl)).enclosingElement = this;
2617 }
2265 this._exports = exports2; 2618 this._exports = exports2;
2266 } 2619 }
2267 /** 2620 /**
2268 * Set the specifications of all of the imports defined in this library to the given array. 2621 * Set the specifications of all of the imports defined in this library to the given array.
2269 * @param imports the specifications of all of the imports defined in this lib rary 2622 * @param imports the specifications of all of the imports defined in this lib rary
2270 */ 2623 */
2271 void set imports(List<ImportElement> imports2) { 2624 void set imports(List<ImportElement> imports2) {
2625 for (ImportElement importElement in imports2) {
2626 ((importElement as ImportElementImpl)).enclosingElement = this;
2627 PrefixElementImpl prefix5 = importElement.prefix as PrefixElementImpl;
2628 if (prefix5 != null) {
2629 prefix5.enclosingElement = this;
2630 }
2631 }
2272 this._imports = imports2; 2632 this._imports = imports2;
2273 } 2633 }
2274 /** 2634 /**
2275 * Set the compilation units that are included in this library using a {@code part} directive. 2635 * Set the compilation units that are included in this library using a {@code part} directive.
2276 * @param parts the compilation units that are included in this library using a {@code part}directive 2636 * @param parts the compilation units that are included in this library using a {@code part}directive
2277 */ 2637 */
2278 void set parts(List<CompilationUnitElement> parts2) { 2638 void set parts(List<CompilationUnitElement> parts2) {
2279 for (CompilationUnitElement compilationUnit in parts2) { 2639 for (CompilationUnitElement compilationUnit in parts2) {
2280 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this; 2640 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this;
2281 } 2641 }
2282 this._parts = parts2; 2642 this._parts = parts2;
2283 } 2643 }
2644 void visitChildren(ElementVisitor<Object> visitor) {
2645 super.visitChildren(visitor);
2646 safelyVisitChild(_definingCompilationUnit, visitor);
2647 safelyVisitChildren(_exports, visitor);
2648 safelyVisitChildren(_imports, visitor);
2649 safelyVisitChildren(_parts, visitor);
2650 }
2284 /** 2651 /**
2285 * Answer {@code true} if the receiver directly or indirectly imports the dart :html libraries. 2652 * Answer {@code true} if the receiver directly or indirectly imports the dart :html libraries.
2286 * @return {@code true} if the receiver directly or indirectly imports the dar t:html libraries 2653 * @return {@code true} if the receiver directly or indirectly imports the dar t:html libraries
2287 */ 2654 */
2288 bool isOrImportsBrowserLibrary() { 2655 bool isOrImportsBrowserLibrary() {
2289 List<LibraryElement> visited = new List<LibraryElement>(10); 2656 List<LibraryElement> visited = new List<LibraryElement>(10);
2290 Source htmlLibSource = definingCompilationUnit.source.resolve(DartSdk.DART_H TML); 2657 Source htmlLibSource = definingCompilationUnit.source.resolve("dart:html");
2291 visited.add(this); 2658 visited.add(this);
2292 for (int index = 0; index < visited.length; index++) { 2659 for (int index = 0; index < visited.length; index++) {
2293 LibraryElement library = visited[index]; 2660 LibraryElement library = visited[index];
2294 Source source8 = library.definingCompilationUnit.source; 2661 Source source10 = library.definingCompilationUnit.source;
2295 if (source8 == htmlLibSource) { 2662 if (source10 == htmlLibSource) {
2296 return true; 2663 return true;
2297 } 2664 }
2298 for (LibraryElement importedLibrary in library.importedLibraries) { 2665 for (LibraryElement importedLibrary in library.importedLibraries) {
2299 if (!visited.contains(importedLibrary)) { 2666 if (!visited.contains(importedLibrary)) {
2300 visited.add(importedLibrary); 2667 visited.add(importedLibrary);
2301 } 2668 }
2302 } 2669 }
2303 for (LibraryElement exportedLibrary in library.exportedLibraries) { 2670 for (LibraryElement exportedLibrary in library.exportedLibraries) {
2304 if (!visited.contains(exportedLibrary)) { 2671 if (!visited.contains(exportedLibrary)) {
2305 visited.add(exportedLibrary); 2672 visited.add(exportedLibrary);
2306 } 2673 }
2307 } 2674 }
2308 } 2675 }
2309 return false; 2676 return false;
2310 } 2677 }
2311 } 2678 }
2312 /** 2679 /**
2680 * Instances of the class {@code LocalVariableElementImpl} implement a {@code Lo calVariableElement}.
2681 */
2682 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria bleElement {
2683 /**
2684 * The offset to the beginning of the visible range for this element.
2685 */
2686 int _visibleRangeOffset = 0;
2687 /**
2688 * The length of the visible range for this element, or {@code -1} if this ele ment does not have a
2689 * visible range.
2690 */
2691 int _visibleRangeLength = -1;
2692 /**
2693 * An empty array of field elements.
2694 */
2695 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement> (0);
2696 /**
2697 * Initialize a newly created parameter element to have the given name.
2698 * @param name the name of this element
2699 */
2700 LocalVariableElementImpl(Identifier name) : super.con1(name) {
2701 }
2702 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this);
2703 ElementKind get kind => ElementKind.LOCAL_VARIABLE;
2704 SourceRange get visibleRange {
2705 if (_visibleRangeLength < 0) {
2706 return null;
2707 }
2708 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
2709 }
2710 /**
2711 * Set the visible range for this element to the range starting at the given o ffset with the given
2712 * length.
2713 * @param offset the offset to the beginning of the visible range for this ele ment
2714 * @param length the length of the visible range for this element, or {@code - 1} if this element
2715 * does not have a visible range
2716 */
2717 void setVisibleRange(int offset, int length) {
2718 _visibleRangeOffset = offset;
2719 _visibleRangeLength = length;
2720 }
2721 void appendTo(StringBuffer builder) {
2722 builder.write(type);
2723 builder.write(" ");
2724 builder.write(name);
2725 }
2726 }
2727 /**
2313 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle ment}. 2728 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle ment}.
2314 */ 2729 */
2315 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { 2730 class MethodElementImpl extends ExecutableElementImpl implements MethodElement {
2316 /** 2731 /**
2317 * An empty array of method elements. 2732 * An empty array of method elements.
2318 */ 2733 */
2319 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); 2734 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0);
2320 /** 2735 /**
2321 * Initialize a newly created method element to have the given name. 2736 * Initialize a newly created method element to have the given name.
2322 * @param name the name of this element 2737 * @param name the name of this element
2323 */ 2738 */
2324 MethodElementImpl.con1(Identifier name) : super.con1(name) { 2739 MethodElementImpl.con1(Identifier name) : super.con1(name) {
2325 _jtd_constructor_151_impl(name); 2740 _jtd_constructor_175_impl(name);
2326 } 2741 }
2327 _jtd_constructor_151_impl(Identifier name) { 2742 _jtd_constructor_175_impl(Identifier name) {
2328 } 2743 }
2329 /** 2744 /**
2330 * Initialize a newly created method element to have the given name. 2745 * Initialize a newly created method element to have the given name.
2331 * @param name the name of this element 2746 * @param name the name of this element
2332 * @param nameOffset the offset of the name of this element in the file that c ontains the 2747 * @param nameOffset the offset of the name of this element in the file that c ontains the
2333 * declaration of this element 2748 * declaration of this element
2334 */ 2749 */
2335 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set) { 2750 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set) {
2336 _jtd_constructor_152_impl(name, nameOffset); 2751 _jtd_constructor_176_impl(name, nameOffset);
2337 } 2752 }
2338 _jtd_constructor_152_impl(String name, int nameOffset) { 2753 _jtd_constructor_176_impl(String name, int nameOffset) {
2339 } 2754 }
2340 ClassElement get enclosingElement => (super.enclosingElement as ClassElement); 2755 accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
2756 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
2341 ElementKind get kind => ElementKind.METHOD; 2757 ElementKind get kind => ElementKind.METHOD;
2342 bool isAbstract() => hasModifier(Modifier.ABSTRACT); 2758 bool isAbstract() => hasModifier(Modifier.ABSTRACT);
2343 bool isStatic() => hasModifier(Modifier.STATIC); 2759 bool isStatic() => hasModifier(Modifier.STATIC);
2344 /** 2760 /**
2345 * Set whether this method is abstract to correspond to the given value. 2761 * Set whether this method is abstract to correspond to the given value.
2346 * @param isAbstract {@code true} if the method is abstract 2762 * @param isAbstract {@code true} if the method is abstract
2347 */ 2763 */
2348 void set abstract(bool isAbstract) { 2764 void set abstract(bool isAbstract) {
2349 setModifier(Modifier.ABSTRACT, isAbstract); 2765 setModifier(Modifier.ABSTRACT, isAbstract);
2350 } 2766 }
2351 /** 2767 /**
2352 * Set whether this method is static to correspond to the given value. 2768 * Set whether this method is static to correspond to the given value.
2353 * @param isStatic {@code true} if the method is static 2769 * @param isStatic {@code true} if the method is static
2354 */ 2770 */
2355 void set static(bool isStatic) { 2771 void set static(bool isStatic) {
2356 setModifier(Modifier.STATIC, isStatic); 2772 setModifier(Modifier.STATIC, isStatic);
2357 } 2773 }
2358 void appendTo(StringBuffer builder) { 2774 void appendTo(StringBuffer builder) {
2359 builder.add(enclosingElement.name); 2775 builder.write(enclosingElement.name);
2360 builder.add("."); 2776 builder.write(".");
2361 builder.add(name); 2777 builder.write(name);
2362 super.appendTo(builder); 2778 super.appendTo(builder);
2363 } 2779 }
2364 } 2780 }
2365 /** 2781 /**
2366 * The enumeration {@code Modifier} defines constants for all of the modifiers d efined by the Dart 2782 * The enumeration {@code Modifier} defines constants for all of the modifiers d efined by the Dart
2367 * language and for a few additional flags that are useful. 2783 * language and for a few additional flags that are useful.
2368 */ 2784 */
2369 class Modifier { 2785 class Modifier {
2370 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); 2786 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0);
2371 static final Modifier CONST = new Modifier('CONST', 1); 2787 static final Modifier CONST = new Modifier('CONST', 1);
2372 static final Modifier FACTORY = new Modifier('FACTORY', 2); 2788 static final Modifier FACTORY = new Modifier('FACTORY', 2);
2373 static final Modifier FINAL = new Modifier('FINAL', 3); 2789 static final Modifier FINAL = new Modifier('FINAL', 3);
2374 static final Modifier GETTER = new Modifier('GETTER', 4); 2790 static final Modifier GETTER = new Modifier('GETTER', 4);
2375 static final Modifier INITIALIZING_FORMAL = new Modifier('INITIALIZING_FORMAL' , 5); 2791 static final Modifier INITIALIZING_FORMAL = new Modifier('INITIALIZING_FORMAL' , 5);
2376 static final Modifier SETTER = new Modifier('SETTER', 6); 2792 static final Modifier MIXIN = new Modifier('MIXIN', 6);
2377 static final Modifier STATIC = new Modifier('STATIC', 7); 2793 static final Modifier SETTER = new Modifier('SETTER', 7);
2378 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 8); 2794 static final Modifier STATIC = new Modifier('STATIC', 8);
2379 static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER, INITIALIZING_FORMAL, SETTER, STATIC, SYNTHETIC]; 2795 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 9);
2796 static final Modifier TYPEDEF = new Modifier('TYPEDEF', 10);
2797 static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER, INITIALIZING_FORMAL, MIXIN, SETTER, STATIC, SYNTHETIC, TYPEDEF];
2380 final String __name; 2798 final String __name;
2381 final int __ordinal; 2799 final int __ordinal;
2382 Modifier(this.__name, this.__ordinal) { 2800 Modifier(this.__name, this.__ordinal) {
2383 } 2801 }
2384 String toString() => __name; 2802 String toString() => __name;
2385 } 2803 }
2386 /** 2804 /**
2387 * Instances of the class {@code MultiplyDefinedElementImpl} represent a collect ion of elements that 2805 * Instances of the class {@code MultiplyDefinedElementImpl} represent a collect ion of elements that
2388 * have the same name within the same scope. 2806 * have the same name within the same scope.
2389 */ 2807 */
(...skipping 13 matching lines...) Expand all
2403 /** 2821 /**
2404 * Initialize a newly created element to represent a list of conflicting eleme nts. 2822 * Initialize a newly created element to represent a list of conflicting eleme nts.
2405 * @param context the analysis context in which the multiply defined elements are defined 2823 * @param context the analysis context in which the multiply defined elements are defined
2406 * @param firstElement the first element that conflicts 2824 * @param firstElement the first element that conflicts
2407 * @param secondElement the second element that conflicts 2825 * @param secondElement the second element that conflicts
2408 */ 2826 */
2409 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem ent secondElement) { 2827 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem ent secondElement) {
2410 _name = firstElement.name; 2828 _name = firstElement.name;
2411 _conflictingElements = computeConflictingElements(firstElement, secondElemen t); 2829 _conflictingElements = computeConflictingElements(firstElement, secondElemen t);
2412 } 2830 }
2831 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this);
2413 Element getAncestor(Type elementClass) => null; 2832 Element getAncestor(Type elementClass) => null;
2414 List<Element> get conflictingElements => _conflictingElements; 2833 List<Element> get conflictingElements => _conflictingElements;
2415 AnalysisContext get context => _context; 2834 AnalysisContext get context => _context;
2416 Element get enclosingElement => null; 2835 Element get enclosingElement => null;
2417 ElementKind get kind => ElementKind.ERROR; 2836 ElementKind get kind => ElementKind.ERROR;
2418 LibraryElement get library => null; 2837 LibraryElement get library => null;
2419 ElementLocation get location => null; 2838 ElementLocation get location => null;
2420 List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY; 2839 List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY;
2421 String get name => _name; 2840 String get name => _name;
2422 int get nameOffset => -1; 2841 int get nameOffset => -1;
2423 Source get source => null; 2842 Source get source => null;
2424 bool isAccessibleIn(LibraryElement library) { 2843 bool isAccessibleIn(LibraryElement library) {
2425 for (Element element in _conflictingElements) { 2844 for (Element element in _conflictingElements) {
2426 if (element.isAccessibleIn(library)) { 2845 if (element.isAccessibleIn(library)) {
2427 return true; 2846 return true;
2428 } 2847 }
2429 } 2848 }
2430 return false; 2849 return false;
2431 } 2850 }
2432 bool isSynthetic() => true; 2851 bool isSynthetic() => true;
2433 String toString() { 2852 String toString() {
2434 StringBuffer builder = new StringBuffer(); 2853 StringBuffer builder = new StringBuffer();
2435 builder.add("["); 2854 builder.write("[");
2436 int count = _conflictingElements.length; 2855 int count = _conflictingElements.length;
2437 for (int i = 0; i < count; i++) { 2856 for (int i = 0; i < count; i++) {
2438 if (i > 0) { 2857 if (i > 0) {
2439 builder.add(", "); 2858 builder.write(", ");
2440 } 2859 }
2441 ((_conflictingElements[i] as ElementImpl)).appendTo(builder); 2860 ((_conflictingElements[i] as ElementImpl)).appendTo(builder);
2442 } 2861 }
2443 builder.add("]"); 2862 builder.write("]");
2444 return builder.toString(); 2863 return builder.toString();
2445 } 2864 }
2865 void visitChildren(ElementVisitor<Object> visitor) {
2866 }
2446 /** 2867 /**
2447 * Add the given element to the list of elements. If the element is a multiply -defined element, 2868 * Add the given element to the list of elements. If the element is a multiply -defined element,
2448 * add all of the conflicting elements that it represents. 2869 * add all of the conflicting elements that it represents.
2449 * @param elements the list to which the element(s) are to be added 2870 * @param elements the list to which the element(s) are to be added
2450 * @param element the element(s) to be added 2871 * @param element the element(s) to be added
2451 */ 2872 */
2452 void add(List<Element> elements, Element element) { 2873 void add(List<Element> elements, Element element) {
2453 if (element is MultiplyDefinedElementImpl) { 2874 if (element is MultiplyDefinedElementImpl) {
2454 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl ))._conflictingElements) { 2875 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl ))._conflictingElements) {
2455 elements.add(conflictingElement); 2876 elements.add(conflictingElement);
(...skipping 19 matching lines...) Expand all
2475 } 2896 }
2476 /** 2897 /**
2477 * Instances of the class {@code ParameterElementImpl} implement a {@code Parame terElement}. 2898 * Instances of the class {@code ParameterElementImpl} implement a {@code Parame terElement}.
2478 */ 2899 */
2479 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme nt { 2900 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme nt {
2480 /** 2901 /**
2481 * The kind of this parameter. 2902 * The kind of this parameter.
2482 */ 2903 */
2483 ParameterKind _parameterKind; 2904 ParameterKind _parameterKind;
2484 /** 2905 /**
2906 * The offset to the beginning of the visible range for this element.
2907 */
2908 int _visibleRangeOffset = 0;
2909 /**
2910 * The length of the visible range for this element, or {@code -1} if this ele ment does not have a
2911 * visible range.
2912 */
2913 int _visibleRangeLength = -1;
2914 /**
2485 * An empty array of field elements. 2915 * An empty array of field elements.
2486 */ 2916 */
2487 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0); 2917 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>(0);
2488 /** 2918 /**
2489 * Initialize a newly created parameter element to have the given name. 2919 * Initialize a newly created parameter element to have the given name.
2490 * @param name the name of this element 2920 * @param name the name of this element
2491 */ 2921 */
2492 ParameterElementImpl(Identifier name) : super.con1(name) { 2922 ParameterElementImpl(Identifier name) : super.con1(name) {
2493 } 2923 }
2924 accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
2494 ElementKind get kind => ElementKind.PARAMETER; 2925 ElementKind get kind => ElementKind.PARAMETER;
2495 ParameterKind get parameterKind => _parameterKind; 2926 ParameterKind get parameterKind => _parameterKind;
2927 SourceRange get visibleRange {
2928 if (_visibleRangeLength < 0) {
2929 return null;
2930 }
2931 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
2932 }
2496 bool isInitializingFormal() => hasModifier(Modifier.INITIALIZING_FORMAL); 2933 bool isInitializingFormal() => hasModifier(Modifier.INITIALIZING_FORMAL);
2497 /** 2934 /**
2498 * Set whether this parameter is an initializing formal parameter to match the given value. 2935 * Set whether this parameter is an initializing formal parameter to match the given value.
2499 * @param isInitializingFormal {@code true} if this parameter is an initializi ng formal parameter 2936 * @param isInitializingFormal {@code true} if this parameter is an initializi ng formal parameter
2500 */ 2937 */
2501 void set initializingFormal(bool isInitializingFormal) { 2938 void set initializingFormal(bool isInitializingFormal) {
2502 setModifier(Modifier.INITIALIZING_FORMAL, isInitializingFormal); 2939 setModifier(Modifier.INITIALIZING_FORMAL, isInitializingFormal);
2503 } 2940 }
2504 /** 2941 /**
2505 * Set the kind of this parameter to the given kind. 2942 * Set the kind of this parameter to the given kind.
2506 * @param parameterKind the new kind of this parameter 2943 * @param parameterKind the new kind of this parameter
2507 */ 2944 */
2508 void set parameterKind(ParameterKind parameterKind2) { 2945 void set parameterKind(ParameterKind parameterKind2) {
2509 this._parameterKind = parameterKind2; 2946 this._parameterKind = parameterKind2;
2510 } 2947 }
2948 /**
2949 * Set the visible range for this element to the range starting at the given o ffset with the given
2950 * length.
2951 * @param offset the offset to the beginning of the visible range for this ele ment
2952 * @param length the length of the visible range for this element, or {@code - 1} if this element
2953 * does not have a visible range
2954 */
2955 void setVisibleRange(int offset, int length) {
2956 _visibleRangeOffset = offset;
2957 _visibleRangeLength = length;
2958 }
2511 void appendTo(StringBuffer builder) { 2959 void appendTo(StringBuffer builder) {
2512 builder.add(type); 2960 builder.write(type);
2513 builder.add(" "); 2961 builder.write(" ");
2514 builder.add(name); 2962 builder.write(name);
2515 builder.add(" ("); 2963 builder.write(" (");
2516 builder.add(kind); 2964 builder.write(kind);
2517 builder.add(")"); 2965 builder.write(")");
2518 } 2966 }
2519 } 2967 }
2520 /** 2968 /**
2521 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle ment}. 2969 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle ment}.
2522 */ 2970 */
2523 class PrefixElementImpl extends ElementImpl implements PrefixElement { 2971 class PrefixElementImpl extends ElementImpl implements PrefixElement {
2524 /** 2972 /**
2525 * An array containing all of the libraries that are imported using this prefi x. 2973 * An array containing all of the libraries that are imported using this prefi x.
2526 */ 2974 */
2527 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; 2975 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY;
2528 /** 2976 /**
2529 * An empty array of prefix elements. 2977 * An empty array of prefix elements.
2530 */ 2978 */
2531 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); 2979 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0);
2532 /** 2980 /**
2533 * Initialize a newly created prefix element to have the given name. 2981 * Initialize a newly created prefix element to have the given name.
2534 * @param name the name of this element 2982 * @param name the name of this element
2535 */ 2983 */
2536 PrefixElementImpl(Identifier name) : super.con1(name) { 2984 PrefixElementImpl(Identifier name) : super.con1(name) {
2537 } 2985 }
2538 LibraryElement get enclosingElement => (super.enclosingElement as LibraryEleme nt); 2986 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this);
2987 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t;
2539 List<LibraryElement> get importedLibraries => _importedLibraries; 2988 List<LibraryElement> get importedLibraries => _importedLibraries;
2540 ElementKind get kind => ElementKind.PREFIX; 2989 ElementKind get kind => ElementKind.PREFIX;
2541 /** 2990 /**
2542 * Set the libraries that are imported using this prefix to the given librarie s. 2991 * Set the libraries that are imported using this prefix to the given librarie s.
2543 * @param importedLibraries the libraries that are imported using this prefix 2992 * @param importedLibraries the libraries that are imported using this prefix
2544 */ 2993 */
2545 void set importedLibraries(List<LibraryElement> importedLibraries2) { 2994 void set importedLibraries(List<LibraryElement> importedLibraries2) {
2546 for (LibraryElement library in importedLibraries2) { 2995 for (LibraryElement library in importedLibraries2) {
2547 ((library as LibraryElementImpl)).enclosingElement = this; 2996 ((library as LibraryElementImpl)).enclosingElement = this;
2548 } 2997 }
2549 this._importedLibraries = importedLibraries2; 2998 this._importedLibraries = importedLibraries2;
2550 } 2999 }
2551 void appendTo(StringBuffer builder) { 3000 void appendTo(StringBuffer builder) {
2552 builder.add("as "); 3001 builder.write("as ");
2553 super.appendTo(builder); 3002 super.appendTo(builder);
2554 } 3003 }
2555 } 3004 }
2556 /** 3005 /**
2557 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}. 3006 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}.
2558 */ 3007 */
2559 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement { 3008 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement {
2560 /** 3009 /**
2561 * The field associated with this accessor. 3010 * The variable associated with this accessor.
2562 */ 3011 */
2563 FieldElement _field; 3012 PropertyInducingElement _variable;
2564 /** 3013 /**
2565 * An empty array of property accessor elements. 3014 * An empty array of property accessor elements.
2566 */ 3015 */
2567 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl ement>(0); 3016 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl ement>(0);
2568 /** 3017 /**
2569 * Initialize a newly created synthetic property accessor element to be associ ated with the given
2570 * field.
2571 * @param name the name of this element
2572 */
2573 PropertyAccessorElementImpl.con1(FieldElementImpl field2) : super.con2(field2. name, -1) {
2574 _jtd_constructor_157_impl(field2);
2575 }
2576 _jtd_constructor_157_impl(FieldElementImpl field2) {
2577 this._field = field2;
2578 synthetic = true;
2579 }
2580 /**
2581 * Initialize a newly created property accessor element to have the given name . 3018 * Initialize a newly created property accessor element to have the given name .
2582 * @param name the name of this element 3019 * @param name the name of this element
2583 */ 3020 */
2584 PropertyAccessorElementImpl.con2(Identifier name) : super.con1(name) { 3021 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) {
2585 _jtd_constructor_158_impl(name); 3022 _jtd_constructor_181_impl(name);
2586 } 3023 }
2587 _jtd_constructor_158_impl(Identifier name) { 3024 _jtd_constructor_181_impl(Identifier name) {
2588 } 3025 }
2589 FieldElement get field => _field; 3026 /**
3027 * Initialize a newly created synthetic property accessor element to be associ ated with the given
3028 * variable.
3029 * @param variable the variable with which this access is associated
3030 */
3031 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : supe r.con2(variable2.name, -1) {
3032 _jtd_constructor_182_impl(variable2);
3033 }
3034 _jtd_constructor_182_impl(PropertyInducingElementImpl variable2) {
3035 this._variable = variable2;
3036 synthetic = true;
3037 }
3038 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this);
3039 bool operator ==(Object object) => super == object && identical(isGetter(), (( object as PropertyAccessorElement)).isGetter());
2590 ElementKind get kind { 3040 ElementKind get kind {
2591 if (isGetter()) { 3041 if (isGetter()) {
2592 return ElementKind.GETTER; 3042 return ElementKind.GETTER;
2593 } 3043 }
2594 return ElementKind.SETTER; 3044 return ElementKind.SETTER;
2595 } 3045 }
3046 PropertyInducingElement get variable => _variable;
2596 bool isGetter() => hasModifier(Modifier.GETTER); 3047 bool isGetter() => hasModifier(Modifier.GETTER);
2597 bool isSetter() => hasModifier(Modifier.SETTER); 3048 bool isSetter() => hasModifier(Modifier.SETTER);
2598 /** 3049 bool isStatic() => variable.isStatic();
2599 * Set the field associated with this accessor to the given field.
2600 * @param field the field associated with this accessor
2601 */
2602 void set field(FieldElement field3) {
2603 this._field = field3;
2604 }
2605 /** 3050 /**
2606 * Set whether this accessor is a getter to correspond to the given value. 3051 * Set whether this accessor is a getter to correspond to the given value.
2607 * @param isGetter {@code true} if the accessor is a getter 3052 * @param isGetter {@code true} if the accessor is a getter
2608 */ 3053 */
2609 void set getter(bool isGetter) { 3054 void set getter(bool isGetter) {
2610 setModifier(Modifier.GETTER, isGetter); 3055 setModifier(Modifier.GETTER, isGetter);
2611 } 3056 }
2612 /** 3057 /**
2613 * Set whether this accessor is a setter to correspond to the given value. 3058 * Set whether this accessor is a setter to correspond to the given value.
2614 * @param isSetter {@code true} if the accessor is a setter 3059 * @param isSetter {@code true} if the accessor is a setter
2615 */ 3060 */
2616 void set setter(bool isSetter) { 3061 void set setter(bool isSetter) {
2617 setModifier(Modifier.SETTER, isSetter); 3062 setModifier(Modifier.SETTER, isSetter);
2618 } 3063 }
3064 /**
3065 * Set the variable associated with this accessor to the given variable.
3066 * @param variable the variable associated with this accessor
3067 */
3068 void set variable(PropertyInducingElement variable3) {
3069 this._variable = variable3;
3070 }
2619 void appendTo(StringBuffer builder) { 3071 void appendTo(StringBuffer builder) {
2620 builder.add(isGetter() ? "get " : "set "); 3072 builder.write(isGetter() ? "get " : "set ");
2621 builder.add(field.name); 3073 builder.write(variable.name);
2622 super.appendTo(builder); 3074 super.appendTo(builder);
2623 } 3075 }
2624 } 3076 }
2625 /** 3077 /**
3078 * Instances of the class {@code PropertyInducingElementImpl} implement a{@code PropertyInducingElement}.
3079 */
3080 abstract class PropertyInducingElementImpl extends VariableElementImpl implement s PropertyInducingElement {
3081 /**
3082 * The getter associated with this element.
3083 */
3084 PropertyAccessorElement _getter;
3085 /**
3086 * 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 .
3087 */
3088 PropertyAccessorElement _setter;
3089 /**
3090 * An empty array of elements.
3091 */
3092 static List<PropertyInducingElement> EMPTY_ARRAY = new List<PropertyInducingEl ement>(0);
3093 /**
3094 * Initialize a newly created element to have the given name.
3095 * @param name the name of this element
3096 */
3097 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) {
3098 _jtd_constructor_183_impl(name);
3099 }
3100 _jtd_constructor_183_impl(Identifier name) {
3101 }
3102 /**
3103 * Initialize a newly created synthetic element to have the given name.
3104 * @param name the name of this element
3105 */
3106 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) {
3107 _jtd_constructor_184_impl(name);
3108 }
3109 _jtd_constructor_184_impl(String name) {
3110 synthetic = true;
3111 }
3112 PropertyAccessorElement get getter => _getter;
3113 PropertyAccessorElement get setter => _setter;
3114 /**
3115 * Set the getter associated with this element to the given accessor.
3116 * @param getter the getter associated with this element
3117 */
3118 void set getter(PropertyAccessorElement getter2) {
3119 this._getter = getter2;
3120 }
3121 /**
3122 * Set the setter associated with this element to the given accessor.
3123 * @param setter the setter associated with this element
3124 */
3125 void set setter(PropertyAccessorElement setter2) {
3126 this._setter = setter2;
3127 }
3128 }
3129 /**
2626 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}. 3130 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}.
2627 */ 3131 */
2628 class ShowCombinatorImpl implements ShowCombinator { 3132 class ShowCombinatorImpl implements ShowCombinator {
2629 /** 3133 /**
2630 * The names that are to be made visible in the importing library if they are defined in the 3134 * The names that are to be made visible in the importing library if they are defined in the
2631 * imported library. 3135 * imported library.
2632 */ 3136 */
2633 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; 3137 List<String> _shownNames = StringUtilities.EMPTY_ARRAY;
2634 /** 3138 /**
2635 * Initialize a newly created combinator. 3139 * Initialize a newly created combinator.
2636 */ 3140 */
2637 ShowCombinatorImpl() : super() { 3141 ShowCombinatorImpl() : super() {
2638 } 3142 }
2639 List<String> get shownNames => _shownNames; 3143 List<String> get shownNames => _shownNames;
2640 /** 3144 /**
2641 * Set the names that are to be made visible in the importing library if they are defined in the 3145 * Set the names that are to be made visible in the importing library if they are defined in the
2642 * imported library to the given names. 3146 * imported library to the given names.
2643 * @param shownNames the names that are to be made visible in the importing li brary 3147 * @param shownNames the names that are to be made visible in the importing li brary
2644 */ 3148 */
2645 void set shownNames(List<String> shownNames2) { 3149 void set shownNames(List<String> shownNames2) {
2646 this._shownNames = shownNames2; 3150 this._shownNames = shownNames2;
2647 } 3151 }
2648 String toString() { 3152 String toString() {
2649 StringBuffer builder = new StringBuffer(); 3153 StringBuffer builder = new StringBuffer();
2650 builder.add("show "); 3154 builder.write("show ");
2651 int count = _shownNames.length; 3155 int count = _shownNames.length;
2652 for (int i = 0; i < count; i++) { 3156 for (int i = 0; i < count; i++) {
2653 if (i > 0) { 3157 if (i > 0) {
2654 builder.add(", "); 3158 builder.write(", ");
2655 } 3159 }
2656 builder.add(_shownNames[i]); 3160 builder.write(_shownNames[i]);
2657 } 3161 }
2658 return builder.toString(); 3162 return builder.toString();
2659 } 3163 }
2660 } 3164 }
2661 /** 3165 /**
3166 * Instances of the class {@code TopLevelVariableElementImpl} implement a{@code TopLevelVariableElement}.
3167 */
3168 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement {
3169 /**
3170 * An empty array of top-level variable elements.
3171 */
3172 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl ement>(0);
3173 /**
3174 * Initialize a newly created top-level variable element to have the given nam e.
3175 * @param name the name of this element
3176 */
3177 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) {
3178 _jtd_constructor_186_impl(name);
3179 }
3180 _jtd_constructor_186_impl(Identifier name) {
3181 }
3182 /**
3183 * Initialize a newly created synthetic top-level variable element to have the given name.
3184 * @param name the name of this element
3185 */
3186 TopLevelVariableElementImpl.con2(String name) : super.con2(name) {
3187 _jtd_constructor_187_impl(name);
3188 }
3189 _jtd_constructor_187_impl(String name) {
3190 }
3191 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this);
3192 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
3193 bool isStatic() => true;
3194 }
3195 /**
2662 * Instances of the class {@code TypeAliasElementImpl} implement a {@code TypeAl iasElement}. 3196 * Instances of the class {@code TypeAliasElementImpl} implement a {@code TypeAl iasElement}.
2663 */ 3197 */
2664 class TypeAliasElementImpl extends ElementImpl implements TypeAliasElement { 3198 class TypeAliasElementImpl extends ElementImpl implements TypeAliasElement {
2665 /** 3199 /**
2666 * An array containing all of the parameters defined by this type alias. 3200 * An array containing all of the parameters defined by this type alias.
2667 */ 3201 */
2668 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; 3202 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
2669 /** 3203 /**
2670 * The type of function defined by this type alias. 3204 * The type of function defined by this type alias.
2671 */ 3205 */
2672 FunctionType _type; 3206 FunctionType _type;
2673 /** 3207 /**
2674 * An array containing all of the type variables defined for this type. 3208 * An array containing all of the type variables defined for this type.
2675 */ 3209 */
2676 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ; 3210 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ;
2677 /** 3211 /**
2678 * An empty array of type alias elements. 3212 * An empty array of type alias elements.
2679 */ 3213 */
2680 static List<TypeAliasElement> EMPTY_ARRAY = new List<TypeAliasElement>(0); 3214 static List<TypeAliasElement> EMPTY_ARRAY = new List<TypeAliasElement>(0);
2681 /** 3215 /**
2682 * Initialize a newly created type alias element to have the given name. 3216 * Initialize a newly created type alias element to have the given name.
2683 * @param name the name of this element 3217 * @param name the name of this element
2684 */ 3218 */
2685 TypeAliasElementImpl(Identifier name) : super.con1(name) { 3219 TypeAliasElementImpl(Identifier name) : super.con1(name) {
2686 } 3220 }
2687 ElementImpl getChild(String identifier23) { 3221 accept(ElementVisitor visitor) => visitor.visitTypeAliasElement(this);
3222 ElementImpl getChild(String identifier28) {
2688 for (VariableElement parameter in _parameters) { 3223 for (VariableElement parameter in _parameters) {
2689 if (((parameter as VariableElementImpl)).identifier == identifier23) { 3224 if (((parameter as VariableElementImpl)).identifier == identifier28) {
2690 return (parameter as VariableElementImpl); 3225 return parameter as VariableElementImpl;
2691 } 3226 }
2692 } 3227 }
2693 for (TypeVariableElement typeVariable in _typeVariables) { 3228 for (TypeVariableElement typeVariable in _typeVariables) {
2694 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier23 ) { 3229 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier28 ) {
2695 return (typeVariable as TypeVariableElementImpl); 3230 return typeVariable as TypeVariableElementImpl;
2696 } 3231 }
2697 } 3232 }
2698 return null; 3233 return null;
2699 } 3234 }
2700 CompilationUnitElement get enclosingElement => (super.enclosingElement as Comp ilationUnitElement); 3235 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi lationUnitElement;
2701 ElementKind get kind => ElementKind.TYPE_ALIAS; 3236 ElementKind get kind => ElementKind.TYPE_ALIAS;
2702 List<ParameterElement> get parameters => _parameters; 3237 List<ParameterElement> get parameters => _parameters;
2703 FunctionType get type => _type; 3238 FunctionType get type => _type;
2704 List<TypeVariableElement> get typeVariables => _typeVariables; 3239 List<TypeVariableElement> get typeVariables => _typeVariables;
2705 /** 3240 /**
2706 * Set the parameters defined by this type alias to the given parameters. 3241 * Set the parameters defined by this type alias to the given parameters.
2707 * @param parameters the parameters defined by this type alias 3242 * @param parameters the parameters defined by this type alias
2708 */ 3243 */
2709 void set parameters(List<ParameterElement> parameters8) { 3244 void set parameters(List<ParameterElement> parameters8) {
2710 if (parameters8 != null) { 3245 if (parameters8 != null) {
2711 for (ParameterElement parameter in parameters8) { 3246 for (ParameterElement parameter in parameters8) {
2712 ((parameter as ParameterElementImpl)).enclosingElement = this; 3247 ((parameter as ParameterElementImpl)).enclosingElement = this;
2713 } 3248 }
2714 } 3249 }
2715 this._parameters = parameters8; 3250 this._parameters = parameters8;
2716 } 3251 }
2717 /** 3252 /**
2718 * Set the type of function defined by this type alias to the given type. 3253 * Set the type of function defined by this type alias to the given type.
2719 * @param type the type of function defined by this type alias 3254 * @param type the type of function defined by this type alias
2720 */ 3255 */
2721 void set type(FunctionType type7) { 3256 void set type(FunctionType type8) {
2722 this._type = type7; 3257 this._type = type8;
2723 } 3258 }
2724 /** 3259 /**
2725 * Set the type variables defined for this type to the given variables. 3260 * Set the type variables defined for this type to the given variables.
2726 * @param typeVariables the type variables defined for this type 3261 * @param typeVariables the type variables defined for this type
2727 */ 3262 */
2728 void set typeVariables(List<TypeVariableElement> typeVariables3) { 3263 void set typeVariables(List<TypeVariableElement> typeVariables3) {
2729 for (TypeVariableElement variable in typeVariables3) { 3264 for (TypeVariableElement variable in typeVariables3) {
2730 ((variable as TypeVariableElementImpl)).enclosingElement = this; 3265 ((variable as TypeVariableElementImpl)).enclosingElement = this;
2731 } 3266 }
2732 this._typeVariables = typeVariables3; 3267 this._typeVariables = typeVariables3;
2733 } 3268 }
3269 void visitChildren(ElementVisitor<Object> visitor) {
3270 super.visitChildren(visitor);
3271 safelyVisitChildren(_parameters, visitor);
3272 safelyVisitChildren(_typeVariables, visitor);
3273 }
2734 void appendTo(StringBuffer builder) { 3274 void appendTo(StringBuffer builder) {
2735 builder.add("typedef "); 3275 builder.write("typedef ");
2736 builder.add(name); 3276 builder.write(name);
2737 int variableCount = _typeVariables.length; 3277 int variableCount = _typeVariables.length;
2738 if (variableCount > 0) { 3278 if (variableCount > 0) {
2739 builder.add("<"); 3279 builder.write("<");
2740 for (int i = 0; i < variableCount; i++) { 3280 for (int i = 0; i < variableCount; i++) {
2741 if (i > 0) { 3281 if (i > 0) {
2742 builder.add(", "); 3282 builder.write(", ");
2743 } 3283 }
2744 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); 3284 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
2745 } 3285 }
2746 builder.add(">"); 3286 builder.write(">");
2747 } 3287 }
2748 builder.add("("); 3288 builder.write("(");
2749 int parameterCount = _parameters.length; 3289 int parameterCount = _parameters.length;
2750 for (int i = 0; i < parameterCount; i++) { 3290 for (int i = 0; i < parameterCount; i++) {
2751 if (i > 0) { 3291 if (i > 0) {
2752 builder.add(", "); 3292 builder.write(", ");
2753 } 3293 }
2754 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); 3294 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
2755 } 3295 }
2756 builder.add(")"); 3296 builder.write(")");
2757 if (_type != null) { 3297 if (_type != null) {
2758 builder.add(" -> "); 3298 builder.write(" -> ");
2759 builder.add(_type.returnType); 3299 builder.write(_type.returnType);
2760 } 3300 }
2761 } 3301 }
2762 } 3302 }
2763 /** 3303 /**
2764 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ eVariableElement}. 3304 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ eVariableElement}.
2765 */ 3305 */
2766 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement { 3306 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement {
2767 /** 3307 /**
2768 * The type defined by this type variable. 3308 * The type defined by this type variable.
2769 */ 3309 */
2770 TypeVariableType _type; 3310 TypeVariableType _type;
2771 /** 3311 /**
2772 * The type representing the bound associated with this variable, or {@code nu ll} if this variable 3312 * The type representing the bound associated with this variable, or {@code nu ll} if this variable
2773 * does not have an explicit bound. 3313 * does not have an explicit bound.
2774 */ 3314 */
2775 Type2 _bound; 3315 Type2 _bound;
2776 /** 3316 /**
2777 * An empty array of type variable elements. 3317 * An empty array of type variable elements.
2778 */ 3318 */
2779 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0 ); 3319 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0 );
2780 /** 3320 /**
2781 * Initialize a newly created type variable element to have the given name. 3321 * Initialize a newly created type variable element to have the given name.
2782 * @param name the name of this element 3322 * @param name the name of this element
2783 */ 3323 */
2784 TypeVariableElementImpl(Identifier name) : super.con1(name) { 3324 TypeVariableElementImpl(Identifier name) : super.con1(name) {
2785 } 3325 }
3326 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this);
2786 Type2 get bound => _bound; 3327 Type2 get bound => _bound;
2787 ElementKind get kind => ElementKind.TYPE_VARIABLE; 3328 ElementKind get kind => ElementKind.TYPE_VARIABLE;
2788 TypeVariableType get type => _type; 3329 TypeVariableType get type => _type;
2789 /** 3330 /**
2790 * Set the type representing the bound associated with this variable to the gi ven type. 3331 * Set the type representing the bound associated with this variable to the gi ven type.
2791 * @param bound the type representing the bound associated with this variable 3332 * @param bound the type representing the bound associated with this variable
2792 */ 3333 */
2793 void set bound(Type2 bound2) { 3334 void set bound(Type2 bound2) {
2794 this._bound = bound2; 3335 this._bound = bound2;
2795 } 3336 }
2796 /** 3337 /**
2797 * Set the type defined by this type variable to the given type 3338 * Set the type defined by this type variable to the given type
2798 * @param type the type defined by this type variable 3339 * @param type the type defined by this type variable
2799 */ 3340 */
2800 void set type(TypeVariableType type8) { 3341 void set type(TypeVariableType type9) {
2801 this._type = type8; 3342 this._type = type9;
2802 } 3343 }
2803 void appendTo(StringBuffer builder) { 3344 void appendTo(StringBuffer builder) {
2804 builder.add(name); 3345 builder.write(name);
2805 if (_bound != null) { 3346 if (_bound != null) {
2806 builder.add(" extends "); 3347 builder.write(" extends ");
2807 builder.add(_bound); 3348 builder.write(_bound);
2808 } 3349 }
2809 } 3350 }
2810 } 3351 }
2811 /** 3352 /**
2812 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl eElement}. 3353 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl eElement}.
2813 */ 3354 */
2814 class VariableElementImpl extends ElementImpl implements VariableElement { 3355 abstract class VariableElementImpl extends ElementImpl implements VariableElemen t {
2815 /** 3356 /**
2816 * The declared type of this variable. 3357 * The declared type of this variable.
2817 */ 3358 */
2818 Type2 _type; 3359 Type2 _type;
2819 /** 3360 /**
2820 * A synthetic function representing this variable's initializer, or {@code nu ll} if this variable 3361 * A synthetic function representing this variable's initializer, or {@code nu ll} if this variable
2821 * does not have an initializer. 3362 * does not have an initializer.
2822 */ 3363 */
2823 FunctionElement _initializer; 3364 FunctionElement _initializer;
2824 /** 3365 /**
2825 * The offset to the beginning of the visible range for this element.
2826 */
2827 int _visibleRangeOffset = 0;
2828 /**
2829 * The length of the visible range for this element, or {@code -1} if this ele ment does not have a
2830 * visible range.
2831 */
2832 int _visibleRangeLength = -1;
2833 /**
2834 * An empty array of variable elements. 3366 * An empty array of variable elements.
2835 */ 3367 */
2836 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0); 3368 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>(0);
2837 /** 3369 /**
2838 * Initialize a newly created variable element to have the given name. 3370 * Initialize a newly created variable element to have the given name.
2839 * @param name the name of this element 3371 * @param name the name of this element
2840 */ 3372 */
2841 VariableElementImpl.con1(Identifier name) : super.con1(name) { 3373 VariableElementImpl.con1(Identifier name) : super.con1(name) {
2842 _jtd_constructor_162_impl(name); 3374 _jtd_constructor_190_impl(name);
2843 } 3375 }
2844 _jtd_constructor_162_impl(Identifier name) { 3376 _jtd_constructor_190_impl(Identifier name) {
2845 } 3377 }
2846 /** 3378 /**
2847 * Initialize a newly created variable element to have the given name. 3379 * Initialize a newly created variable element to have the given name.
2848 * @param name the name of this element 3380 * @param name the name of this element
2849 * @param nameOffset the offset of the name of this element in the file that c ontains the 3381 * @param nameOffset the offset of the name of this element in the file that c ontains the
2850 * declaration of this element 3382 * declaration of this element
2851 */ 3383 */
2852 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO ffset) { 3384 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO ffset) {
2853 _jtd_constructor_163_impl(name, nameOffset); 3385 _jtd_constructor_191_impl(name, nameOffset);
2854 } 3386 }
2855 _jtd_constructor_163_impl(String name, int nameOffset) { 3387 _jtd_constructor_191_impl(String name, int nameOffset) {
2856 } 3388 }
2857 FunctionElement get initializer => _initializer; 3389 FunctionElement get initializer => _initializer;
2858 ElementKind get kind => ElementKind.VARIABLE;
2859 Type2 get type => _type; 3390 Type2 get type => _type;
2860 SourceRange get visibleRange {
2861 if (_visibleRangeLength < 0) {
2862 return null;
2863 }
2864 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
2865 }
2866 bool isConst() => hasModifier(Modifier.CONST); 3391 bool isConst() => hasModifier(Modifier.CONST);
2867 bool isFinal() => hasModifier(Modifier.FINAL); 3392 bool isFinal() => hasModifier(Modifier.FINAL);
2868 /** 3393 /**
2869 * Set whether this variable is const to correspond to the given value. 3394 * Set whether this variable is const to correspond to the given value.
2870 * @param isConst {@code true} if the variable is const 3395 * @param isConst {@code true} if the variable is const
2871 */ 3396 */
2872 void set const2(bool isConst) { 3397 void set const2(bool isConst) {
2873 setModifier(Modifier.CONST, isConst); 3398 setModifier(Modifier.CONST, isConst);
2874 } 3399 }
2875 /** 3400 /**
(...skipping 10 matching lines...) Expand all
2886 void set initializer(FunctionElement initializer3) { 3411 void set initializer(FunctionElement initializer3) {
2887 if (initializer3 != null) { 3412 if (initializer3 != null) {
2888 ((initializer3 as FunctionElementImpl)).enclosingElement = this; 3413 ((initializer3 as FunctionElementImpl)).enclosingElement = this;
2889 } 3414 }
2890 this._initializer = initializer3; 3415 this._initializer = initializer3;
2891 } 3416 }
2892 /** 3417 /**
2893 * Set the declared type of this variable to the given type. 3418 * Set the declared type of this variable to the given type.
2894 * @param type the declared type of this variable 3419 * @param type the declared type of this variable
2895 */ 3420 */
2896 void set type(Type2 type9) { 3421 void set type(Type2 type10) {
2897 this._type = type9; 3422 this._type = type10;
2898 } 3423 }
2899 /** 3424 void visitChildren(ElementVisitor<Object> visitor) {
2900 * Set the visible range for this element to the range starting at the given o ffset with the given 3425 super.visitChildren(visitor);
2901 * length. 3426 safelyVisitChild(_initializer, visitor);
2902 * @param offset the offset to the beginning of the visible range for this ele ment
2903 * @param length the length of the visible range for this element, or {@code - 1} if this element
2904 * does not have a visible range
2905 */
2906 void setVisibleRange(int offset, int length) {
2907 _visibleRangeOffset = offset;
2908 _visibleRangeLength = length;
2909 } 3427 }
2910 void appendTo(StringBuffer builder) { 3428 void appendTo(StringBuffer builder) {
2911 builder.add(type); 3429 builder.write(type);
2912 builder.add(" "); 3430 builder.write(" ");
2913 builder.add(name); 3431 builder.write(name);
2914 } 3432 }
2915 } 3433 }
2916 /** 3434 /**
2917 * The unique instance of the class {@code BottomTypeImpl} implements the type { @code bottom}. 3435 * The unique instance of the class {@code BottomTypeImpl} implements the type { @code bottom}.
2918 */ 3436 */
2919 class BottomTypeImpl extends TypeImpl { 3437 class BottomTypeImpl extends TypeImpl {
2920 /** 3438 /**
2921 * The unique instance of this class. 3439 * The unique instance of this class.
2922 */ 3440 */
2923 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); 3441 static BottomTypeImpl _INSTANCE = new BottomTypeImpl();
(...skipping 26 matching lines...) Expand all
2950 * @return the unique instance of this class 3468 * @return the unique instance of this class
2951 */ 3469 */
2952 static DynamicTypeImpl get instance => _INSTANCE; 3470 static DynamicTypeImpl get instance => _INSTANCE;
2953 /** 3471 /**
2954 * Prevent the creation of instances of this class. 3472 * Prevent the creation of instances of this class.
2955 */ 3473 */
2956 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { 3474 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) {
2957 ((element as DynamicElementImpl)).type = this; 3475 ((element as DynamicElementImpl)).type = this;
2958 } 3476 }
2959 bool operator ==(Object object) => object is DynamicTypeImpl; 3477 bool operator ==(Object object) => object is DynamicTypeImpl;
3478 bool isDynamic() => true;
2960 bool isMoreSpecificThan(Type2 type) => false; 3479 bool isMoreSpecificThan(Type2 type) => false;
2961 bool isSubtypeOf(Type2 type) => false; 3480 bool isSubtypeOf(Type2 type) => identical(this, type);
2962 bool isSupertypeOf(Type2 type) => true; 3481 bool isSupertypeOf(Type2 type) => true;
2963 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy pes) => this; 3482 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy pes) => this;
2964 } 3483 }
2965 /** 3484 /**
2966 * Instances of the class {@code FunctionTypeImpl} defines the behavior common t o objects 3485 * Instances of the class {@code FunctionTypeImpl} defines the behavior common t o objects
2967 * representing the type of a function, method, constructor, getter, or setter. 3486 * representing the type of a function, method, constructor, getter, or setter.
2968 */ 3487 */
2969 class FunctionTypeImpl extends TypeImpl implements FunctionType { 3488 class FunctionTypeImpl extends TypeImpl implements FunctionType {
2970 /** 3489 /**
2971 * Return {@code true} if all of the types in the first array are equal to the corresponding types 3490 * Return {@code true} if all of the name/type pairs in the first map are equa l to the
2972 * in the second array. 3491 * corresponding name/type pairs in the second map. The maps are expected to i terate over their
2973 * @param firstTypes the first array of types being compared 3492 * entries in the same order in which those entries were added to the map.
2974 * @param secondTypes the second array of types being compared 3493 * @param firstTypes the first map of name/type pairs being compared
2975 * @return {@code true} if all of the types in the first array are equal to th e corresponding 3494 * @param secondTypes the second map of name/type pairs being compared
2976 * types in the second array 3495 * @return {@code true} if all of the name/type pairs in the first map are equ al to the
3496 * corresponding name/type pairs in the second map
2977 */ 3497 */
2978 static bool equals2(LinkedHashMap<String, Type2> firstTypes, LinkedHashMap<Str ing, Type2> secondTypes) { 3498 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy pes) {
2979 if (secondTypes.length != firstTypes.length) { 3499 if (secondTypes.length != firstTypes.length) {
2980 return false; 3500 return false;
2981 } 3501 }
2982 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes)); 3502 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes));
2983 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(firstTypes)); 3503 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(firstTypes));
2984 while (firstIterator.hasNext) { 3504 while (firstIterator.hasNext) {
2985 MapEntry<String, Type2> firstEntry = firstIterator.next(); 3505 MapEntry<String, Type2> firstEntry = firstIterator.next();
2986 MapEntry<String, Type2> secondEntry = secondIterator.next(); 3506 MapEntry<String, Type2> secondEntry = secondIterator.next();
2987 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) { 3507 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) {
2988 return false; 3508 return false;
2989 } 3509 }
2990 } 3510 }
2991 return true; 3511 return true;
2992 } 3512 }
2993 /** 3513 /**
2994 * Return a map containing the results of using the given argument types and p arameter types to 3514 * Return a map containing the results of using the given argument types and p arameter types to
2995 * perform a substitution on all of the values in the given map. The order of the entries will be 3515 * perform a substitution on all of the values in the given map. The order of the entries will be
2996 * preserved. 3516 * preserved.
2997 * @param types the types on which a substitution is to be performed 3517 * @param types the types on which a substitution is to be performed
2998 * @param argumentTypes the argument types for the substitution 3518 * @param argumentTypes the argument types for the substitution
2999 * @param parameterTypes the parameter types for the substitution 3519 * @param parameterTypes the parameter types for the substitution
3000 * @return the result of performing the substitution on each of the types 3520 * @return the result of performing the substitution on each of the types
3001 */ 3521 */
3002 static LinkedHashMap<String, Type2> substitute3(LinkedHashMap<String, Type2> t ypes, List<Type2> argumentTypes, List<Type2> parameterTypes) { 3522 static Map<String, Type2> substitute3(Map<String, Type2> types, List<Type2> ar gumentTypes, List<Type2> parameterTypes) {
3523 if (types.isEmpty) {
3524 return types;
3525 }
3003 LinkedHashMap<String, Type2> newTypes = new LinkedHashMap<String, Type2>(); 3526 LinkedHashMap<String, Type2> newTypes = new LinkedHashMap<String, Type2>();
3004 for (MapEntry<String, Type2> entry in getMapEntrySet(types)) { 3527 for (MapEntry<String, Type2> entry in getMapEntrySet(types)) {
3005 newTypes[entry.getKey()] = entry.getValue().substitute2(argumentTypes, par ameterTypes); 3528 newTypes[entry.getKey()] = entry.getValue().substitute2(argumentTypes, par ameterTypes);
3006 } 3529 }
3007 return newTypes; 3530 return newTypes;
3008 } 3531 }
3009 /** 3532 /**
3010 * An array containing the actual types of the type arguments. 3533 * An array containing the actual types of the type arguments.
3011 */ 3534 */
3012 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; 3535 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY;
3013 /** 3536 /**
3014 * An array containing the types of the normal parameters of this type of func tion. The parameter 3537 * An array containing the types of the normal parameters of this type of func tion. The parameter
3015 * types are in the same order as they appear in the declaration of the functi on. 3538 * types are in the same order as they appear in the declaration of the functi on.
3016 * @return the types of the normal parameters of this type of function 3539 * @return the types of the normal parameters of this type of function
3017 */ 3540 */
3018 List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY; 3541 List<Type2> _normalParameterTypes = TypeImpl.EMPTY_ARRAY;
3019 /** 3542 /**
3020 * A table mapping the names of optional (positional) parameters to the types of the optional 3543 * A table mapping the names of optional (positional) parameters to the types of the optional
3021 * parameters of this type of function. 3544 * parameters of this type of function.
3022 */ 3545 */
3023 List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY; 3546 List<Type2> _optionalParameterTypes = TypeImpl.EMPTY_ARRAY;
3024 /** 3547 /**
3025 * A table mapping the names of named parameters to the types of the named par ameters of this type 3548 * A table mapping the names of named parameters to the types of the named par ameters of this type
3026 * of function. 3549 * of function.
3027 */ 3550 */
3028 LinkedHashMap<String, Type2> _namedParameterTypes = new LinkedHashMap<String, Type2>(); 3551 Map<String, Type2> _namedParameterTypes = new Map();
3029 /** 3552 /**
3030 * The type of object returned by this type of function. 3553 * The type of object returned by this type of function.
3031 */ 3554 */
3032 Type2 _returnType = VoidTypeImpl.instance; 3555 Type2 _returnType = VoidTypeImpl.instance;
3033 /** 3556 /**
3034 * Initialize a newly created function type to be declared by the given elemen t and to have the 3557 * Initialize a newly created function type to be declared by the given elemen t and to have the
3035 * given name. 3558 * given name.
3036 * @param element the element representing the declaration of the function typ e 3559 * @param element the element representing the declaration of the function typ e
3037 */ 3560 */
3038 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name) { 3561 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name) {
3039 _jtd_constructor_209_impl(element); 3562 _jtd_constructor_242_impl(element);
3040 } 3563 }
3041 _jtd_constructor_209_impl(ExecutableElement element) { 3564 _jtd_constructor_242_impl(ExecutableElement element) {
3042 } 3565 }
3043 /** 3566 /**
3044 * Initialize a newly created function type to be declared by the given elemen t and to have the 3567 * Initialize a newly created function type to be declared by the given elemen t and to have the
3045 * given name. 3568 * given name.
3046 * @param element the element representing the declaration of the function typ e 3569 * @param element the element representing the declaration of the function typ e
3047 */ 3570 */
3048 FunctionTypeImpl.con2(TypeAliasElement element) : super(element, element == nu ll ? null : element.name) { 3571 FunctionTypeImpl.con2(TypeAliasElement element) : super(element, element == nu ll ? null : element.name) {
3049 _jtd_constructor_210_impl(element); 3572 _jtd_constructor_243_impl(element);
3050 } 3573 }
3051 _jtd_constructor_210_impl(TypeAliasElement element) { 3574 _jtd_constructor_243_impl(TypeAliasElement element) {
3052 } 3575 }
3053 bool operator ==(Object object) { 3576 bool operator ==(Object object) {
3054 if (object is! FunctionTypeImpl) { 3577 if (object is! FunctionTypeImpl) {
3055 return false; 3578 return false;
3056 } 3579 }
3057 FunctionTypeImpl otherType = (object as FunctionTypeImpl); 3580 FunctionTypeImpl otherType = object as FunctionTypeImpl;
3058 return element == otherType.element && JavaArrays.equals(_normalParameterTyp es, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterType s, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType ._namedParameterTypes); 3581 return element == otherType.element && JavaArrays.equals(_normalParameterTyp es, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterType s, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType ._namedParameterTypes);
3059 } 3582 }
3060 Map<String, Type2> get namedParameterTypes => _namedParameterTypes; 3583 Map<String, Type2> get namedParameterTypes => _namedParameterTypes;
3061 List<Type2> get normalParameterTypes => _normalParameterTypes; 3584 List<Type2> get normalParameterTypes => _normalParameterTypes;
3062 List<Type2> get optionalParameterTypes => _optionalParameterTypes; 3585 List<Type2> get optionalParameterTypes => _optionalParameterTypes;
3063 Type2 get returnType => _returnType; 3586 Type2 get returnType => _returnType;
3064 List<Type2> get typeArguments => _typeArguments; 3587 List<Type2> get typeArguments => _typeArguments;
3065 int get hashCode { 3588 int get hashCode {
3066 Element element34 = element; 3589 Element element37 = element;
3067 if (element34 == null) { 3590 if (element37 == null) {
3068 return 0; 3591 return 0;
3069 } 3592 }
3070 return element34.hashCode; 3593 return element37.hashCode;
3071 } 3594 }
3072 bool isSubtypeOf(Type2 type) { 3595 bool isSubtypeOf(Type2 type) {
3073 if (type == null || type is! FunctionType) { 3596 if (type == null) {
3074 return false; 3597 return false;
3075 } else if (identical(this, type) || this == type) { 3598 } else if (identical(this, type) || type.isDynamic() || type.isDartCoreFunct ion()) {
3599 return true;
3600 } else if (type is! FunctionType) {
3601 return false;
3602 } else if (this == type) {
3076 return true; 3603 return true;
3077 } 3604 }
3078 FunctionType t = this; 3605 FunctionType t = this;
3079 FunctionType s = (type as FunctionType); 3606 FunctionType s = type as FunctionType;
3080 if (t.normalParameterTypes.length != s.normalParameterTypes.length) { 3607 if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
3081 return false; 3608 return false;
3082 } else if (t.normalParameterTypes.length > 0) { 3609 } else if (t.normalParameterTypes.length > 0) {
3083 List<Type2> tTypes = t.normalParameterTypes; 3610 List<Type2> tTypes = t.normalParameterTypes;
3084 List<Type2> sTypes = s.normalParameterTypes; 3611 List<Type2> sTypes = s.normalParameterTypes;
3085 for (int i = 0; i < tTypes.length; i++) { 3612 for (int i = 0; i < tTypes.length; i++) {
3086 if (!tTypes[i].isAssignableTo(sTypes[i])) { 3613 if (!tTypes[i].isAssignableTo(sTypes[i])) {
3087 return false; 3614 return false;
3088 } 3615 }
3089 } 3616 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 this._typeArguments = typeArguments4; 3694 this._typeArguments = typeArguments4;
3168 } 3695 }
3169 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen tTypes, typeArguments); 3696 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen tTypes, typeArguments);
3170 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT ypes) { 3697 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT ypes) {
3171 if (argumentTypes.length != parameterTypes.length) { 3698 if (argumentTypes.length != parameterTypes.length) {
3172 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 3699 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
3173 } 3700 }
3174 if (argumentTypes.length == 0) { 3701 if (argumentTypes.length == 0) {
3175 return this; 3702 return this;
3176 } 3703 }
3177 Element element35 = element; 3704 Element element38 = element;
3178 FunctionTypeImpl newType = (element35 is ExecutableElement) ? new FunctionTy peImpl.con1((element35 as ExecutableElement)) : new FunctionTypeImpl.con2((eleme nt35 as TypeAliasElement)); 3705 FunctionTypeImpl newType = (element38 is ExecutableElement) ? new FunctionTy peImpl.con1((element38 as ExecutableElement)) : new FunctionTypeImpl.con2((eleme nt38 as TypeAliasElement));
3179 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes); 3706 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes);
3180 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar gumentTypes, parameterTypes); 3707 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar gumentTypes, parameterTypes);
3181 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes , argumentTypes, parameterTypes); 3708 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes , argumentTypes, parameterTypes);
3182 newType.namedParameterTypes = substitute3(_namedParameterTypes, argumentType s, parameterTypes); 3709 newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTyp es, parameterTypes);
3183 return newType; 3710 return newType;
3184 } 3711 }
3185 void appendTo(StringBuffer builder) { 3712 void appendTo(StringBuffer builder) {
3186 builder.add("("); 3713 builder.write("(");
3187 bool needsComma = false; 3714 bool needsComma = false;
3188 if (_normalParameterTypes.length > 0) { 3715 if (_normalParameterTypes.length > 0) {
3189 for (Type2 type in _normalParameterTypes) { 3716 for (Type2 type in _normalParameterTypes) {
3190 if (needsComma) { 3717 if (needsComma) {
3191 builder.add(", "); 3718 builder.write(", ");
3192 } else { 3719 } else {
3193 needsComma = true; 3720 needsComma = true;
3194 } 3721 }
3195 ((type as TypeImpl)).appendTo(builder); 3722 ((type as TypeImpl)).appendTo(builder);
3196 } 3723 }
3197 } 3724 }
3198 if (_optionalParameterTypes.length > 0) { 3725 if (_optionalParameterTypes.length > 0) {
3199 if (needsComma) { 3726 if (needsComma) {
3200 builder.add(", "); 3727 builder.write(", ");
3201 needsComma = false; 3728 needsComma = false;
3202 } 3729 }
3203 builder.add("["); 3730 builder.write("[");
3204 for (Type2 type in _optionalParameterTypes) { 3731 for (Type2 type in _optionalParameterTypes) {
3205 if (needsComma) { 3732 if (needsComma) {
3206 builder.add(", "); 3733 builder.write(", ");
3207 } else { 3734 } else {
3208 needsComma = true; 3735 needsComma = true;
3209 } 3736 }
3210 ((type as TypeImpl)).appendTo(builder); 3737 ((type as TypeImpl)).appendTo(builder);
3211 } 3738 }
3212 builder.add("]"); 3739 builder.write("]");
3213 needsComma = true; 3740 needsComma = true;
3214 } 3741 }
3215 if (_namedParameterTypes.length > 0) { 3742 if (_namedParameterTypes.length > 0) {
3216 if (needsComma) { 3743 if (needsComma) {
3217 builder.add(", "); 3744 builder.write(", ");
3218 needsComma = false; 3745 needsComma = false;
3219 } 3746 }
3220 builder.add("{"); 3747 builder.write("{");
3221 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes) ) { 3748 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes) ) {
3222 if (needsComma) { 3749 if (needsComma) {
3223 builder.add(", "); 3750 builder.write(", ");
3224 } else { 3751 } else {
3225 needsComma = true; 3752 needsComma = true;
3226 } 3753 }
3227 builder.add(entry.getKey()); 3754 builder.write(entry.getKey());
3228 builder.add(": "); 3755 builder.write(": ");
3229 ((entry.getValue() as TypeImpl)).appendTo(builder); 3756 ((entry.getValue() as TypeImpl)).appendTo(builder);
3230 } 3757 }
3231 builder.add("}"); 3758 builder.write("}");
3232 needsComma = true; 3759 needsComma = true;
3233 } 3760 }
3234 builder.add(") -> "); 3761 builder.write(") -> ");
3235 ((_returnType as TypeImpl)).appendTo(builder); 3762 if (_returnType == null) {
3763 builder.write("null");
3764 } else {
3765 ((_returnType as TypeImpl)).appendTo(builder);
3766 }
3236 } 3767 }
3237 } 3768 }
3238 /** 3769 /**
3239 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects 3770 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects
3240 * representing the type introduced by either a class or an interface, or a refe rence to such a 3771 * representing the type introduced by either a class or an interface, or a refe rence to such a
3241 * type. 3772 * type.
3242 */ 3773 */
3243 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { 3774 class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
3244 /** 3775 /**
3245 * An empty array of types. 3776 * An empty array of types.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 /** 3827 /**
3297 * Returns the set of all superinterfaces of the passed {@link Type}. This is a recursive method, 3828 * Returns the set of all superinterfaces of the passed {@link Type}. This is a recursive method,
3298 * callers should call the public {@link #computeSuperinterfaceSet(Type)}. 3829 * callers should call the public {@link #computeSuperinterfaceSet(Type)}.
3299 * @param type the {@link Type} to compute the set of superinterfaces of 3830 * @param type the {@link Type} to compute the set of superinterfaces of
3300 * @param set a {@link HashSet} used recursively by this method 3831 * @param set a {@link HashSet} used recursively by this method
3301 * @return the {@link Set} of superinterfaces of the passed {@link Type} 3832 * @return the {@link Set} of superinterfaces of the passed {@link Type}
3302 * @see #computeSuperinterfaceSet(Type) 3833 * @see #computeSuperinterfaceSet(Type)
3303 * @see #getLeastUpperBound(Type) 3834 * @see #getLeastUpperBound(Type)
3304 */ 3835 */
3305 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In terfaceType> set) { 3836 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In terfaceType> set) {
3306 Element element36 = type.element; 3837 Element element39 = type.element;
3307 if (element36 != null && element36 is ClassElement) { 3838 if (element39 != null && element39 is ClassElement) {
3308 ClassElement classElement = (element36 as ClassElement); 3839 ClassElement classElement = element39 as ClassElement;
3309 List<InterfaceType> superinterfaces = classElement.interfaces; 3840 List<InterfaceType> superinterfaces = classElement.interfaces;
3310 for (InterfaceType superinterface in superinterfaces) { 3841 for (InterfaceType superinterface in superinterfaces) {
3311 javaSetAdd(set, superinterface); 3842 javaSetAdd(set, superinterface);
3312 computeSuperinterfaceSet2(superinterface, set); 3843 computeSuperinterfaceSet2(superinterface, set);
3313 } 3844 }
3314 InterfaceType supertype4 = classElement.supertype; 3845 InterfaceType supertype4 = classElement.supertype;
3315 if (supertype4 != null) { 3846 if (supertype4 != null) {
3316 javaSetAdd(set, supertype4); 3847 javaSetAdd(set, supertype4);
3317 computeSuperinterfaceSet2(supertype4, set); 3848 computeSuperinterfaceSet2(supertype4, set);
3318 } 3849 }
3319 } 3850 }
3320 return set; 3851 return set;
3321 } 3852 }
3322 /** 3853 /**
3323 * An array containing the actual types of the type arguments. 3854 * An array containing the actual types of the type arguments.
3324 */ 3855 */
3325 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; 3856 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY;
3326 /** 3857 /**
3327 * Initialize a newly created type to be declared by the given element. 3858 * Initialize a newly created type to be declared by the given element.
3328 * @param element the element representing the declaration of the type 3859 * @param element the element representing the declaration of the type
3329 */ 3860 */
3330 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) { 3861 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) {
3331 _jtd_constructor_211_impl(element); 3862 _jtd_constructor_244_impl(element);
3332 } 3863 }
3333 _jtd_constructor_211_impl(ClassElement element) { 3864 _jtd_constructor_244_impl(ClassElement element) {
3334 } 3865 }
3335 /** 3866 /**
3336 * Initialize a newly created type to have the given name. This constructor sh ould only be used in 3867 * Initialize a newly created type to have the given name. This constructor sh ould only be used in
3337 * cases where there is no declaration of the type. 3868 * cases where there is no declaration of the type.
3338 * @param name the name of the type 3869 * @param name the name of the type
3339 */ 3870 */
3340 InterfaceTypeImpl.con2(String name) : super(null, name) { 3871 InterfaceTypeImpl.con2(String name) : super(null, name) {
3341 _jtd_constructor_212_impl(name); 3872 _jtd_constructor_245_impl(name);
3342 } 3873 }
3343 _jtd_constructor_212_impl(String name) { 3874 _jtd_constructor_245_impl(String name) {
3344 } 3875 }
3345 bool operator ==(Object object) { 3876 bool operator ==(Object object) {
3346 if (object is! InterfaceTypeImpl) { 3877 if (object is! InterfaceTypeImpl) {
3347 return false; 3878 return false;
3348 } 3879 }
3349 InterfaceTypeImpl otherType = (object as InterfaceTypeImpl); 3880 InterfaceTypeImpl otherType = object as InterfaceTypeImpl;
3350 return element == otherType.element && JavaArrays.equals(_typeArguments, oth erType._typeArguments); 3881 return element == otherType.element && JavaArrays.equals(_typeArguments, oth erType._typeArguments);
3351 } 3882 }
3352 ClassElement get element => (super.element as ClassElement); 3883 ClassElement get element => super.element as ClassElement;
3353 Type2 getLeastUpperBound(Type2 type) { 3884 Type2 getLeastUpperBound(Type2 type) {
3354 Type2 dynamicType = DynamicTypeImpl.instance; 3885 Type2 dynamicType = DynamicTypeImpl.instance;
3355 if (identical(this, dynamicType) || identical(type, dynamicType)) { 3886 if (identical(this, dynamicType) || identical(type, dynamicType)) {
3356 return dynamicType; 3887 return dynamicType;
3357 } 3888 }
3358 if (type == null || type is! InterfaceType) { 3889 if (type == null || type is! InterfaceType) {
3359 return null; 3890 return null;
3360 } 3891 }
3361 InterfaceType i = this; 3892 InterfaceType i = this;
3362 InterfaceType j = (type as InterfaceType); 3893 InterfaceType j = type as InterfaceType;
3363 Set<InterfaceType> si = computeSuperinterfaceSet(i); 3894 Set<InterfaceType> si = computeSuperinterfaceSet(i);
3364 Set<InterfaceType> sj = computeSuperinterfaceSet(j); 3895 Set<InterfaceType> sj = computeSuperinterfaceSet(j);
3365 javaSetAdd(si, i); 3896 javaSetAdd(si, i);
3366 javaSetAdd(sj, j); 3897 javaSetAdd(sj, j);
3367 si.retainAll(sj); 3898 si.retainAll(sj);
3368 Set<InterfaceType> s = si; 3899 Set<InterfaceType> s = si;
3369 List<InterfaceType> sn = new List.from(s); 3900 List<InterfaceType> sn = new List.from(s);
3370 List<int> depths = new List<int>(sn.length); 3901 List<int> depths = new List<int>.filled(sn.length, 0);
3371 int maxDepth = 0; 3902 int maxDepth = 0;
3372 for (int n = 0; n < sn.length; n++) { 3903 for (int n = 0; n < sn.length; n++) {
3373 depths[n] = computeLongestInheritancePathToObject(sn[n]); 3904 depths[n] = computeLongestInheritancePathToObject(sn[n]);
3374 if (depths[n] > maxDepth) { 3905 if (depths[n] > maxDepth) {
3375 maxDepth = depths[n]; 3906 maxDepth = depths[n];
3376 } 3907 }
3377 } 3908 }
3378 for (; maxDepth >= 0; maxDepth--) { 3909 for (; maxDepth >= 0; maxDepth--) {
3379 int indexOfLeastUpperBound = -1; 3910 int indexOfLeastUpperBound = -1;
3380 int numberOfTypesAtMaxDepth = 0; 3911 int numberOfTypesAtMaxDepth = 0;
3381 for (int m = 0; m < depths.length; m++) { 3912 for (int m = 0; m < depths.length; m++) {
3382 if (depths[m] == maxDepth) { 3913 if (depths[m] == maxDepth) {
3383 numberOfTypesAtMaxDepth++; 3914 numberOfTypesAtMaxDepth++;
3384 indexOfLeastUpperBound = m; 3915 indexOfLeastUpperBound = m;
3385 } 3916 }
3386 } 3917 }
3387 if (numberOfTypesAtMaxDepth == 1) { 3918 if (numberOfTypesAtMaxDepth == 1) {
3388 return sn[indexOfLeastUpperBound]; 3919 return sn[indexOfLeastUpperBound];
3389 } 3920 }
3390 } 3921 }
3391 return null; 3922 return null;
3392 } 3923 }
3393 Type2 get superclass { 3924 Type2 get superclass {
3394 ClassElement classElement = element; 3925 ClassElement classElement = element;
3395 return element.supertype.substitute2(_typeArguments, TypeVariableTypeImpl.ge tTypes(classElement.typeVariables)); 3926 return element.supertype.substitute2(_typeArguments, TypeVariableTypeImpl.ge tTypes(classElement.typeVariables));
3396 } 3927 }
3397 List<Type2> get typeArguments => _typeArguments; 3928 List<Type2> get typeArguments => _typeArguments;
3398 int get hashCode { 3929 int get hashCode {
3399 ClassElement element37 = element; 3930 ClassElement element40 = element;
3400 if (element37 == null) { 3931 if (element40 == null) {
3401 return 0; 3932 return 0;
3402 } 3933 }
3403 return element37.hashCode; 3934 return element40.hashCode;
3935 }
3936 bool isDartCoreFunction() {
3937 ClassElement element41 = element;
3938 if (element41 == null) {
3939 return false;
3940 }
3941 return element41.name == "Function" && element41.library.isDartCore();
3404 } 3942 }
3405 bool isDirectSupertypeOf(InterfaceType type) { 3943 bool isDirectSupertypeOf(InterfaceType type) {
3406 ClassElement i = element; 3944 ClassElement i = element;
3407 ClassElement j = type.element; 3945 ClassElement j = type.element;
3408 InterfaceType supertype5 = j.supertype; 3946 InterfaceType supertype5 = j.supertype;
3409 if (supertype5 == null) { 3947 if (supertype5 == null) {
3410 return false; 3948 return false;
3411 } 3949 }
3412 ClassElement supertypeElement = supertype5.element; 3950 ClassElement supertypeElement = supertype5.element;
3413 if (supertypeElement == i) { 3951 if (supertypeElement == i) {
(...skipping 10 matching lines...) Expand all
3424 } 3962 }
3425 } 3963 }
3426 return false; 3964 return false;
3427 } 3965 }
3428 bool isMoreSpecificThan(Type2 type) { 3966 bool isMoreSpecificThan(Type2 type) {
3429 if (identical(type, DynamicTypeImpl.instance)) { 3967 if (identical(type, DynamicTypeImpl.instance)) {
3430 return true; 3968 return true;
3431 } else if (type is! InterfaceType) { 3969 } else if (type is! InterfaceType) {
3432 return false; 3970 return false;
3433 } 3971 }
3434 InterfaceType s = (type as InterfaceType); 3972 InterfaceType s = type as InterfaceType;
3435 if (this == s) { 3973 if (this == s) {
3436 return true; 3974 return true;
3437 } 3975 }
3438 if (s.isDirectSupertypeOf(this)) { 3976 if (s.isDirectSupertypeOf(this)) {
3439 return true; 3977 return true;
3440 } 3978 }
3441 ClassElement tElement = element; 3979 ClassElement tElement = element;
3442 ClassElement sElement = s.element; 3980 ClassElement sElement = s.element;
3443 if (tElement == sElement) { 3981 if (tElement == sElement) {
3444 List<Type2> tArguments = typeArguments; 3982 List<Type2> tArguments = typeArguments;
(...skipping 17 matching lines...) Expand all
3462 if (identical(type, DynamicTypeImpl.instance)) { 4000 if (identical(type, DynamicTypeImpl.instance)) {
3463 return true; 4001 return true;
3464 } else if (type is TypeVariableType) { 4002 } else if (type is TypeVariableType) {
3465 return true; 4003 return true;
3466 } else if (type is! InterfaceType) { 4004 } else if (type is! InterfaceType) {
3467 return false; 4005 return false;
3468 } else if (this == type) { 4006 } else if (this == type) {
3469 return true; 4007 return true;
3470 } 4008 }
3471 InterfaceType typeT = this; 4009 InterfaceType typeT = this;
3472 InterfaceType typeS = (type as InterfaceType); 4010 InterfaceType typeS = type as InterfaceType;
3473 ClassElement elementT = element; 4011 ClassElement elementT = element;
3474 if (elementT == null) { 4012 if (elementT == null) {
3475 return false; 4013 return false;
3476 } 4014 }
3477 typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.t ypeVariables)); 4015 typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.t ypeVariables));
3478 if (typeT == typeS) { 4016 if (typeT == typeS) {
3479 return true; 4017 return true;
3480 } else if (elementT == typeS.element) { 4018 } else if (elementT == typeS.element) {
3481 List<Type2> typeTArgs = typeT.typeArguments; 4019 List<Type2> typeTArgs = typeT.typeArguments;
3482 List<Type2> typeSArgs = typeS.typeArguments; 4020 List<Type2> typeSArgs = typeS.typeArguments;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 4059 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
3522 } 4060 }
3523 if (argumentTypes.length == 0) { 4061 if (argumentTypes.length == 0) {
3524 return this; 4062 return this;
3525 } 4063 }
3526 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); 4064 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element);
3527 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p arameterTypes); 4065 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p arameterTypes);
3528 return newType; 4066 return newType;
3529 } 4067 }
3530 void appendTo(StringBuffer builder) { 4068 void appendTo(StringBuffer builder) {
3531 builder.add(name); 4069 builder.write(name);
3532 int argumentCount = _typeArguments.length; 4070 int argumentCount = _typeArguments.length;
3533 if (argumentCount > 0) { 4071 if (argumentCount > 0) {
3534 builder.add("<"); 4072 builder.write("<");
3535 for (int i = 0; i < argumentCount; i++) { 4073 for (int i = 0; i < argumentCount; i++) {
3536 if (i > 0) { 4074 if (i > 0) {
3537 builder.add(", "); 4075 builder.write(", ");
3538 } 4076 }
3539 ((_typeArguments[i] as TypeImpl)).appendTo(builder); 4077 ((_typeArguments[i] as TypeImpl)).appendTo(builder);
3540 } 4078 }
3541 builder.add(">"); 4079 builder.write(">");
3542 } 4080 }
3543 } 4081 }
3544 } 4082 }
3545 /** 4083 /**
3546 * The abstract class {@code TypeImpl} implements the behavior common to objects representing the 4084 * The abstract class {@code TypeImpl} implements the behavior common to objects representing the
3547 * declared type of elements in the element model. 4085 * declared type of elements in the element model.
3548 */ 4086 */
3549 abstract class TypeImpl implements Type2 { 4087 abstract class TypeImpl implements Type2 {
3550 /** 4088 /**
3551 * Return an array containing the results of using the given argument types an d parameter types to 4089 * Return an array containing the results of using the given argument types an d parameter types to
3552 * perform a substitution on all of the given types. 4090 * perform a substitution on all of the given types.
3553 * @param types the types on which a substitution is to be performed 4091 * @param types the types on which a substitution is to be performed
3554 * @param argumentTypes the argument types for the substitution 4092 * @param argumentTypes the argument types for the substitution
3555 * @param parameterTypes the parameter types for the substitution 4093 * @param parameterTypes the parameter types for the substitution
3556 * @return the result of performing the substitution on each of the types 4094 * @return the result of performing the substitution on each of the types
3557 */ 4095 */
3558 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li st<Type2> parameterTypes) { 4096 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li st<Type2> parameterTypes) {
3559 int length6 = types.length; 4097 int length6 = types.length;
4098 if (length6 == 0) {
4099 return types;
4100 }
3560 List<Type2> newTypes = new List<Type2>(length6); 4101 List<Type2> newTypes = new List<Type2>(length6);
3561 for (int i = 0; i < length6; i++) { 4102 for (int i = 0; i < length6; i++) {
3562 newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes); 4103 newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes);
3563 } 4104 }
3564 return newTypes; 4105 return newTypes;
3565 } 4106 }
3566 /** 4107 /**
3567 * The element representing the declaration of this type, or {@code null} if t he type has not, or 4108 * The element representing the declaration of this type, or {@code null} if t he type has not, or
3568 * cannot, be associated with an element. 4109 * cannot, be associated with an element.
3569 */ 4110 */
(...skipping 12 matching lines...) Expand all
3582 * @param name the name of the type 4123 * @param name the name of the type
3583 */ 4124 */
3584 TypeImpl(Element element, String name) { 4125 TypeImpl(Element element, String name) {
3585 this._element = element; 4126 this._element = element;
3586 this._name = name; 4127 this._name = name;
3587 } 4128 }
3588 Element get element => _element; 4129 Element get element => _element;
3589 Type2 getLeastUpperBound(Type2 type) => null; 4130 Type2 getLeastUpperBound(Type2 type) => null;
3590 String get name => _name; 4131 String get name => _name;
3591 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this); 4132 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this);
4133 bool isDartCoreFunction() => false;
4134 bool isDynamic() => false;
3592 bool isMoreSpecificThan(Type2 type) => false; 4135 bool isMoreSpecificThan(Type2 type) => false;
3593 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); 4136 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this);
4137 bool isVoid() => false;
3594 String toString() { 4138 String toString() {
3595 StringBuffer builder = new StringBuffer(); 4139 StringBuffer builder = new StringBuffer();
3596 appendTo(builder); 4140 appendTo(builder);
3597 return builder.toString(); 4141 return builder.toString();
3598 } 4142 }
3599 /** 4143 /**
3600 * Append a textual representation of this type to the given builder. 4144 * Append a textual representation of this type to the given builder.
3601 * @param builder the builder to which the text is to be appended 4145 * @param builder the builder to which the text is to be appended
3602 */ 4146 */
3603 void appendTo(StringBuffer builder) { 4147 void appendTo(StringBuffer builder) {
3604 if (_name == null) { 4148 if (_name == null) {
3605 builder.add("<unnamed type>"); 4149 builder.write("<unnamed type>");
3606 } else { 4150 } else {
3607 builder.add(_name); 4151 builder.write(_name);
3608 } 4152 }
3609 } 4153 }
3610 } 4154 }
3611 /** 4155 /**
3612 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o bjects representing 4156 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o bjects representing
3613 * the type introduced by a type variable. 4157 * the type introduced by a type variable.
3614 */ 4158 */
3615 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { 4159 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType {
3616 /** 4160 /**
3617 * Return an array containing the type variable types defined by the given arr ay of type variable 4161 * Return an array containing the type variable types defined by the given arr ay of type variable
(...skipping 10 matching lines...) Expand all
3628 return types; 4172 return types;
3629 } 4173 }
3630 /** 4174 /**
3631 * Initialize a newly created type variable to be declared by the given elemen t and to have the 4175 * Initialize a newly created type variable to be declared by the given elemen t and to have the
3632 * given name. 4176 * given name.
3633 * @param element the element representing the declaration of the type variabl e 4177 * @param element the element representing the declaration of the type variabl e
3634 */ 4178 */
3635 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam e) { 4179 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam e) {
3636 } 4180 }
3637 bool operator ==(Object object) => object is TypeVariableTypeImpl && element = = ((object as TypeVariableTypeImpl)).element; 4181 bool operator ==(Object object) => object is TypeVariableTypeImpl && element = = ((object as TypeVariableTypeImpl)).element;
3638 TypeVariableElement get element => (super.element as TypeVariableElement); 4182 TypeVariableElement get element => super.element as TypeVariableElement;
3639 int get hashCode => element.hashCode; 4183 int get hashCode => element.hashCode;
3640 bool isMoreSpecificThan(Type2 type) { 4184 bool isMoreSpecificThan(Type2 type) {
3641 Type2 upperBound = element.bound; 4185 Type2 upperBound = element.bound;
3642 return type == upperBound; 4186 return type == upperBound;
3643 } 4187 }
3644 bool isSubtypeOf(Type2 type) => true; 4188 bool isSubtypeOf(Type2 type) => true;
3645 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { 4189 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
3646 int length7 = parameterTypes.length; 4190 int length7 = parameterTypes.length;
3647 for (int i = 0; i < length7; i++) { 4191 for (int i = 0; i < length7; i++) {
3648 if (parameterTypes[i] == this) { 4192 if (parameterTypes[i] == this) {
(...skipping 16 matching lines...) Expand all
3665 * @return the unique instance of this class 4209 * @return the unique instance of this class
3666 */ 4210 */
3667 static VoidTypeImpl get instance => _INSTANCE; 4211 static VoidTypeImpl get instance => _INSTANCE;
3668 /** 4212 /**
3669 * Prevent the creation of instances of this class. 4213 * Prevent the creation of instances of this class.
3670 */ 4214 */
3671 VoidTypeImpl() : super(null, Keyword.VOID.syntax) { 4215 VoidTypeImpl() : super(null, Keyword.VOID.syntax) {
3672 } 4216 }
3673 bool operator ==(Object object) => identical(object, this); 4217 bool operator ==(Object object) => identical(object, this);
3674 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam icTypeImpl.instance); 4218 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam icTypeImpl.instance);
4219 bool isVoid() => true;
3675 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this; 4220 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this;
3676 } 4221 }
3677 /** 4222 /**
3678 * The interface {@code FunctionType} defines the behavior common to objects rep resenting the type 4223 * The interface {@code FunctionType} defines the behavior common to objects rep resenting the type
3679 * of a function, method, constructor, getter, or setter. Function types come in three variations: 4224 * of a function, method, constructor, getter, or setter. Function types come in three variations:
3680 * <ol> 4225 * <ol>
3681 * <li>The types of functions that only have required parameters. These have the general form 4226 * <li>The types of functions that only have required parameters. These have the general form
3682 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i>.</li> 4227 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i>.</li>
3683 * <li>The types of functions with optional positional parameters. These have th e general form 4228 * <li>The types of functions with optional positional parameters. These have th e general form
3684 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, [T<sub>n+1</sub>, &hellip;, T<sub >n+k</sub>]) &rarr; 4229 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, [T<sub>n+1</sub>, &hellip;, T<sub >n+k</sub>]) &rarr;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3916 String get name; 4461 String get name;
3917 /** 4462 /**
3918 * Return {@code true} if this type is assignable to the given type. A type <i >T</i> may be 4463 * Return {@code true} if this type is assignable to the given type. A type <i >T</i> may be
3919 * assigned to a type <i>S</i>, written <i>T</i> &hArr; <i>S</i>, iff either < i>T</i> <: <i>S</i> 4464 * assigned to a type <i>S</i>, written <i>T</i> &hArr; <i>S</i>, iff either < i>T</i> <: <i>S</i>
3920 * or <i>S</i> <: <i>T</i>. 4465 * or <i>S</i> <: <i>T</i>.
3921 * @param type the type being compared with this type 4466 * @param type the type being compared with this type
3922 * @return {@code true} if this type is assignable to the given type 4467 * @return {@code true} if this type is assignable to the given type
3923 */ 4468 */
3924 bool isAssignableTo(Type2 type); 4469 bool isAssignableTo(Type2 type);
3925 /** 4470 /**
4471 * Return {@code true} if this type represents the type 'Function' defined in the dart:core
4472 * library.
4473 * @return {@code true} if this type represents the type 'Function' defined in the dart:core
4474 * library
4475 */
4476 bool isDartCoreFunction();
4477 /**
4478 * Return {@code true} if this type represents the type 'dynamic'.
4479 * @return {@code true} if this type represents the type 'dynamic'
4480 */
4481 bool isDynamic();
4482 /**
3926 * Return {@code true} if this type is more specific than the given type. 4483 * Return {@code true} if this type is more specific than the given type.
3927 * @param type the type being compared with this type 4484 * @param type the type being compared with this type
3928 * @return {@code true} if this type is more specific than the given type 4485 * @return {@code true} if this type is more specific than the given type
3929 */ 4486 */
3930 bool isMoreSpecificThan(Type2 type); 4487 bool isMoreSpecificThan(Type2 type);
3931 /** 4488 /**
3932 * Return {@code true} if this type is a subtype of the given type. 4489 * Return {@code true} if this type is a subtype of the given type.
3933 * @param type the type being compared with this type 4490 * @param type the type being compared with this type
3934 * @return {@code true} if this type is a subtype of the given type 4491 * @return {@code true} if this type is a subtype of the given type
3935 */ 4492 */
3936 bool isSubtypeOf(Type2 type); 4493 bool isSubtypeOf(Type2 type);
3937 /** 4494 /**
3938 * Return {@code true} if this type is a supertype of the given type. A type < i>S</i> is a 4495 * Return {@code true} if this type is a supertype of the given type. A type < i>S</i> is a
3939 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt ype of <i>S</i>. 4496 * supertype of <i>T</i>, written <i>S</i> :> <i>T</i>, iff <i>T</i> is a subt ype of <i>S</i>.
3940 * @param type the type being compared with this type 4497 * @param type the type being compared with this type
3941 * @return {@code true} if this type is a supertype of the given type 4498 * @return {@code true} if this type is a supertype of the given type
3942 */ 4499 */
3943 bool isSupertypeOf(Type2 type); 4500 bool isSupertypeOf(Type2 type);
3944 /** 4501 /**
4502 * Return {@code true} if this type represents the type 'void'.
4503 * @return {@code true} if this type represents the type 'void'
4504 */
4505 bool isVoid();
4506 /**
3945 * Return the type resulting from substituting the given arguments for the giv en parameters in 4507 * Return the type resulting from substituting the given arguments for the giv en parameters in
3946 * this type. The specification defines this operation in section 2: <blockquo te> The notation 4508 * this type. The specification defines this operation in section 2: <blockquo te> The notation
3947 * <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>]E</ i> denotes a copy of 4509 * <i>[x<sub>1</sub>, ..., x<sub>n</sub>/y<sub>1</sub>, ..., y<sub>n</sub>]E</ i> denotes a copy of
3948 * <i>E</i> in which all occurrences of <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with 4510 * <i>E</i> in which all occurrences of <i>y<sub>i</sub>, 1 <= i <= n</i> have been replaced with
3949 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification , this method will 4511 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification , this method will
3950 * not create a copy of this type if no substitutions were required, but will return this type 4512 * not create a copy of this type if no substitutions were required, but will return this type
3951 * directly. 4513 * directly.
3952 * @param argumentTypes the actual type arguments being substituted for the pa rameters 4514 * @param argumentTypes the actual type arguments being substituted for the pa rameters
3953 * @param parameterTypes the parameters to be replaced 4515 * @param parameterTypes the parameters to be replaced
3954 * @return the result of performing the substitution 4516 * @return the result of performing the substitution
3955 */ 4517 */
3956 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 4518 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
3957 } 4519 }
3958 /** 4520 /**
3959 * The interface {@code TypeVariableType} defines the behavior of objects repres enting the type 4521 * The interface {@code TypeVariableType} defines the behavior of objects repres enting the type
3960 * introduced by a type variable. 4522 * introduced by a type variable.
3961 */ 4523 */
3962 abstract class TypeVariableType implements Type2 { 4524 abstract class TypeVariableType implements Type2 {
3963 TypeVariableElement get element; 4525 TypeVariableElement get element;
3964 } 4526 }
3965 /** 4527 /**
3966 * The interface {@code VoidType} defines the behavior of the unique object repr esenting the type{@code void}. 4528 * The interface {@code VoidType} defines the behavior of the unique object repr esenting the type{@code void}.
3967 */ 4529 */
3968 abstract class VoidType implements Type2 { 4530 abstract class VoidType implements Type2 {
3969 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 4531 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
3970 } 4532 }
OLDNEW
« no previous file with comments | « pkg/analyzer-experimental/lib/src/generated/ast.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