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

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

Issue 12253009: Fresh drop of analyzer-experimental. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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;
11 import 'ast.dart'; 11 import 'ast.dart';
12 import 'package:analyzer-experimental/src/generated/utilities_dart.dart'; 12 import 'engine.dart' show AnalysisContext;
13 import 'utilities_dart.dart';
13 14
14 /** 15 /**
15 * The interface {@code Annotation} defines the behavior of objects representing a single annotation 16 * The interface {@code Annotation} defines the behavior of objects representing a single annotation
16 * associated with an element. 17 * associated with an element.
17 */ 18 */
18 abstract class Annotation { 19 abstract class Annotation {
19 /** 20 /**
20 * Return the element representing the field, variable, or const constructor b eing used as an 21 * Return the element representing the field, variable, or const constructor b eing used as an
21 * annotation. 22 * annotation.
22 * @return the field, variable, or constructor being used as an annotation 23 * @return the field, variable, or constructor being used as an annotation
23 */ 24 */
24 Element get element; 25 Element get element;
25 } 26 }
26 /** 27 /**
27 * The interface {@code ClassElement} defines the behavior of elements that repr esent a class. 28 * The interface {@code ClassElement} defines the behavior of elements that repr esent a class.
28 */ 29 */
29 abstract class ClassElement implements Element { 30 abstract class ClassElement implements Element {
30 /** 31 /**
31 * Return an array containing all of the accessors (getters and setters) conta ined in this class. 32 * Return an array containing all of the accessors (getters and setters) decla red in this class.
32 * @return the accessors contained in this class 33 * @return the accessors declared in this class
33 */ 34 */
34 List<PropertyAccessorElement> get accessors; 35 List<PropertyAccessorElement> get accessors;
35 /** 36 /**
36 * Return an array containing all of the constructors contained in this class. 37 * Return an array containing all the supertypes defined for this class and it s supertypes.
37 * @return the constructors contained in this class 38 * @return all the supertypes of this class, including mixins
39 */
40 List<InterfaceType> get allSupertypes;
41 /**
42 * Return an array containing all of the constructors declared in this class.
43 * @return the constructors declared in this class
38 */ 44 */
39 List<ConstructorElement> get constructors; 45 List<ConstructorElement> get constructors;
40 /** 46 /**
41 * Return an array containing all of the fields contained in this class. 47 * Return an array containing all of the fields declared in this class.
42 * @return the fields contained in this class 48 * @return the fields declared in this class
43 */ 49 */
44 List<FieldElement> get fields; 50 List<FieldElement> get fields;
45 /** 51 /**
46 * Return an array containing all of the interfaces that are implemented by th is class. 52 * Return an array containing all of the interfaces that are implemented by th is class.
47 * @return the interfaces that are implemented by this class 53 * @return the interfaces that are implemented by this class
48 */ 54 */
49 List<InterfaceType> get interfaces; 55 List<InterfaceType> get interfaces;
50 /** 56 /**
51 * Return an array containing all of the methods contained in this class. 57 * Return an array containing all of the methods declared in this class.
52 * @return the methods contained in this class 58 * @return the methods declared in this class
53 */ 59 */
54 List<MethodElement> get methods; 60 List<MethodElement> get methods;
55 /** 61 /**
56 * Return an array containing all of the mixins that are applied to the class being extended in 62 * Return an array containing all of the mixins that are applied to the class being extended in
57 * order to derive the superclass of this class. 63 * order to derive the superclass of this class.
58 * @return the mixins that are applied to derive the superclass of this class 64 * @return the mixins that are applied to derive the superclass of this class
59 */ 65 */
60 List<InterfaceType> get mixins; 66 List<InterfaceType> get mixins;
61 /** 67 /**
68 * Return the named constructor declared in this class with the given name, or {@code null} if
69 * this class does not declare a named constructor with the given name.
70 * @param name the name of the constructor to be returned
71 * @return the element representing the specified constructor
72 */
73 ConstructorElement getNamedConstructor(String name);
74 /**
62 * Return the superclass of this class, or {@code null} if the class represent s the class 75 * Return the superclass of this class, or {@code null} if the class represent s the class
63 * 'Object'. All other classes will have a non-{@code null} superclass. If the superclass was not 76 * 'Object'. All other classes will have a non-{@code null} superclass. If the superclass was not
64 * explicitly declared then the implicit superclass 'Object' will be returned. 77 * explicitly declared then the implicit superclass 'Object' will be returned.
65 * @return the superclass of this class 78 * @return the superclass of this class
66 */ 79 */
67 InterfaceType get supertype; 80 InterfaceType get supertype;
68 /** 81 /**
69 * Return the type defined by the class. 82 * Return the type defined by the class.
70 * @return the type defined by the class 83 * @return the type defined by the class
71 */ 84 */
72 InterfaceType get type; 85 InterfaceType get type;
73 /** 86 /**
74 * Return an array containing all of the type variables defined for this class . 87 * Return an array containing all of the type variables declared for this clas s.
75 * @return the type variables defined for this class 88 * @return the type variables declared for this class
76 */ 89 */
77 List<TypeVariableElement> get typeVariables; 90 List<TypeVariableElement> get typeVariables;
78 /** 91 /**
92 * Return the unnamed constructor declared in this class, or {@code null} if t his class does not
93 * declare an unnamed constructor but does declare named constructors. The ret urned constructor
94 * will be synthetic if this class does not declare any constructors, in which case it will
95 * represent the default constructor for the class.
96 * @return the unnamed constructor defined in this class
97 */
98 ConstructorElement get unnamedConstructor;
99 /**
79 * 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
80 * <i>has unimplemented members</i>. 101 * <i>has unimplemented members</i>.
81 * @return {@code true} if this class is abstract 102 * @return {@code true} if this class is abstract
82 */ 103 */
83 bool isAbstract(); 104 bool isAbstract();
105 /**
106 * 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
108 * 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>
110 * with respect to library <i>L</i> is:
111 * <ul>
112 * <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.
114 * 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>.
116 * Otherwise, we say that the lookup has failed.</li>
117 * </ul>
118 * </blockquote>
119 * @param getterName the name of the getter being looked up
120 * @param library the library with respect to which the lookup is being perfor med
121 * @return the result of looking up the given getter in this class with respec t to the given
122 * library
123 */
124 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library );
125 /**
126 * Return the element representing the method that results from looking up the given method in
127 * this class with respect to the given library, or {@code null} if the look u p fails. The
128 * behavior of this method is defined by the Dart Language Specification in se ction 12.15.1:
129 * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> wit h respect to library
130 * <i>L</i> is:
131 * <ul>
132 * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessib le to <i>L</i>, then
133 * that method is the result of the lookup. Otherwise, if <i>C</i> has a super class <i>S</i>, then
134 * the result of the lookup is the result of looking up method <i>m</i> in <i> S</i> with respect
135 * to <i>L</i>. Otherwise, we say that the lookup has failed.</li>
136 * </ul>
137 * </blockquote>
138 * @param methodName the name of the method being looked up
139 * @param library the library with respect to which the lookup is being perfor med
140 * @return the result of looking up the given method in this class with respec t to the given
141 * library
142 */
143 MethodElement lookUpMethod(String methodName, LibraryElement library);
144 /**
145 * Return the element representing the setter that results from looking up the given setter in
146 * this class with respect to the given library, or {@code null} if the look u p fails. The
147 * behavior of this method is defined by the Dart Language Specification in se ction 12.16:
148 * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
149 * with respect to library <i>L</i> is:
150 * <ul>
151 * <li>If <i>C</i> declares an instance getter (respectively setter) named <i> m</i> that is
152 * accessible to <i>L</i>, then that getter (respectively setter) is the resul t of the lookup.
153 * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lo okup is the result
154 * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respec t to <i>L</i>.
155 * Otherwise, we say that the lookup has failed.</li>
156 * </ul>
157 * </blockquote>
158 * @param setterName the name of the setter being looked up
159 * @param library the library with respect to which the lookup is being perfor med
160 * @return the result of looking up the given setter in this class with respec t to the given
161 * library
162 */
163 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library );
84 } 164 }
85 /** 165 /**
86 * The interface {@code CompilationUnitElement} defines the behavior of elements representing a 166 * The interface {@code CompilationUnitElement} defines the behavior of elements representing a
87 * compilation unit. 167 * compilation unit.
88 */ 168 */
89 abstract class CompilationUnitElement implements Element { 169 abstract class CompilationUnitElement implements Element {
90 /** 170 /**
91 * Return an array containing all of the top-level accessors (getters and sett ers) contained in 171 * Return an array containing all of the top-level accessors (getters and sett ers) contained in
92 * this compilation unit. 172 * this compilation unit.
93 * @return the top-level accessors contained in this compilation unit 173 * @return the top-level accessors contained in this compilation unit
94 */ 174 */
95 List<PropertyAccessorElement> get accessors; 175 List<PropertyAccessorElement> get accessors;
96 /** 176 /**
97 * Return the library in which this compilation unit is defined. 177 * Return the library in which this compilation unit is defined.
98 * @return the library in which this compilation unit is defined 178 * @return the library in which this compilation unit is defined
99 */ 179 */
100 LibraryElement get enclosingElement; 180 LibraryElement get enclosingElement;
101 /** 181 /**
102 * Return an array containing all of the fields contained in this compilation unit.
103 * @return the fields contained in this compilation unit
104 */
105 List<FieldElement> get fields;
106 /**
107 * Return an array containing all of the top-level functions contained in this compilation unit. 182 * Return an array containing all of the top-level functions contained in this compilation unit.
108 * @return the top-level functions contained in this compilation unit 183 * @return the top-level functions contained in this compilation unit
109 */ 184 */
110 List<FunctionElement> get functions; 185 List<FunctionElement> get functions;
111 /** 186 /**
112 * Return the source that corresponds to this compilation unit.
113 * @return the source that corresponds to this compilation unit
114 */
115 Source get source;
116 /**
117 * Return an array containing all of the type aliases contained in this compil ation unit. 187 * Return an array containing all of the type aliases contained in this compil ation unit.
118 * @return the type aliases contained in this compilation unit 188 * @return the type aliases contained in this compilation unit
119 */ 189 */
120 List<TypeAliasElement> get typeAliases; 190 List<TypeAliasElement> get typeAliases;
121 /** 191 /**
122 * Return an array containing all of the classes contained in this compilation unit. 192 * Return an array containing all of the classes contained in this compilation unit.
123 * @return the classes contained in this compilation unit 193 * @return the classes contained in this compilation unit
124 */ 194 */
125 List<ClassElement> get types; 195 List<ClassElement> get types;
196 /**
197 * Return an array containing all of the variables contained in this compilati on unit.
198 * @return the variables contained in this compilation unit
199 */
200 List<VariableElement> get variables;
126 } 201 }
127 /** 202 /**
128 * The interface {@code ConstructorElement} defines the behavior of elements rep resenting a 203 * The interface {@code ConstructorElement} defines the behavior of elements rep resenting a
129 * constructor or a factory method defined within a type. 204 * constructor or a factory method defined within a type.
130 */ 205 */
131 abstract class ConstructorElement implements ExecutableElement { 206 abstract class ConstructorElement implements ExecutableElement {
132 /** 207 /**
133 * Return the type in which this constructor is defined. 208 * Return the type in which this constructor is defined.
134 * @return the type in which this constructor is defined 209 * @return the type in which this constructor is defined
135 */ 210 */
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 */ 286 */
212 String get name; 287 String get name;
213 /** 288 /**
214 * Return the offset of the name of this element in the file that contains the declaration of this 289 * Return the offset of the name of this element in the file that contains the declaration of this
215 * element, or {@code -1} if this element is synthetic, does not have a name, or otherwise does 290 * element, or {@code -1} if this element is synthetic, does not have a name, or otherwise does
216 * not have an offset. 291 * not have an offset.
217 * @return the offset of the name of this element 292 * @return the offset of the name of this element
218 */ 293 */
219 int get nameOffset; 294 int get nameOffset;
220 /** 295 /**
296 * Return the source that contains this element, or {@code null} if this eleme nt is not contained
297 * in a source.
298 * @return the source that contains this element
299 */
300 Source get source;
301 /**
302 * Return {@code true} if this element, assuming that it is within scope, is a ccessible to code in
303 * the given library. This is defined by the Dart Language Specification in se ction 3.2:
304 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i >m</i> is declared
305 * in <i>L</i> or if <i>m</i> is public. </blockquote>
306 * @param library the library in which a possible reference to this element wo uld occur
307 * @return {@code true} if this element is accessible to code in the given lib rary
308 */
309 bool isAccessibleIn(LibraryElement library);
310 /**
221 * Return {@code true} if this element is synthetic. A synthetic element is an element that is not 311 * Return {@code true} if this element is synthetic. A synthetic element is an element that is not
222 * represented in the source code explicitly, but is implied by the source cod e, such as the 312 * represented in the source code explicitly, but is implied by the source cod e, such as the
223 * default constructor for a class that does not explicitly define any constru ctors. 313 * default constructor for a class that does not explicitly define any constru ctors.
224 * @return {@code true} if this element is synthetic 314 * @return {@code true} if this element is synthetic
225 */ 315 */
226 bool isSynthetic(); 316 bool isSynthetic();
227 } 317 }
228 /** 318 /**
229 * The enumeration {@code ElementKind} defines the various kinds of elements in the element model. 319 * The enumeration {@code ElementKind} defines the various kinds of elements in the element model.
230 */ 320 */
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 /** 445 /**
356 * Return {@code true} if this field is a static field. 446 * Return {@code true} if this field is a static field.
357 * @return {@code true} if this field is a static field 447 * @return {@code true} if this field is a static field
358 */ 448 */
359 bool isStatic(); 449 bool isStatic();
360 } 450 }
361 /** 451 /**
362 * The interface {@code FunctionElement} defines the behavior of elements repres enting a function. 452 * The interface {@code FunctionElement} defines the behavior of elements repres enting a function.
363 */ 453 */
364 abstract class FunctionElement implements ExecutableElement { 454 abstract class FunctionElement implements ExecutableElement {
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;
365 } 468 }
366 /** 469 /**
367 * The interface {@code HideCombinator} defines the behavior of combinators that cause some of the 470 * The interface {@code HideCombinator} defines the behavior of combinators that cause some of the
368 * names in a namespace to be hidden when being imported. 471 * names in a namespace to be hidden when being imported.
369 */ 472 */
370 abstract class HideCombinator implements NamespaceCombinator { 473 abstract class HideCombinator implements NamespaceCombinator {
371 /** 474 /**
372 * Return an array containing the names that are not to be made visible in the importing library 475 * Return an array containing the names that are not to be made visible in the importing library
373 * even if they are defined in the imported library. 476 * even if they are defined in the imported library.
374 * @return the names from the imported library that are hidden from the import ing library 477 * @return the names from the imported library that are hidden from the import ing library
375 */ 478 */
376 List<String> get hiddenNames; 479 List<String> get hiddenNames;
377 } 480 }
378 /** 481 /**
379 * The interface {@code HtmlElement} defines the behavior of elements representi ng an HTML file. 482 * The interface {@code HtmlElement} defines the behavior of elements representi ng an HTML file.
380 */ 483 */
381 abstract class HtmlElement implements Element { 484 abstract class HtmlElement implements Element {
382 /** 485 /**
383 * Return an array containing all of the libraries contained in or referenced from script tags in 486 * Return an array containing all of the libraries contained in or referenced from script tags in
384 * the HTML file. This includes libraries that are defined by the content of a script file as well 487 * the HTML file. This includes libraries that are defined by the content of a script file as well
385 * as libraries that are referenced in the {@core src} attribute of a script t ag. 488 * as libraries that are referenced in the {@core src} attribute of a script t ag.
386 * @return the libraries referenced from script tags in the HTML file 489 * @return the libraries referenced from script tags in the HTML file
387 */ 490 */
388 List<LibraryElement> get libraries; 491 List<LibraryElement> get libraries;
389 /**
390 * Return the source that corresponds to this HTML file.
391 * @return the source that corresponds to this HTML file
392 */
393 Source get source;
394 } 492 }
395 /** 493 /**
396 * The interface {@code ImportElement} defines the behavior of objects represent ing information 494 * The interface {@code ImportElement} defines the behavior of objects represent ing information
397 * about a single import directive within a library. 495 * about a single import directive within a library.
398 */ 496 */
399 abstract class ImportElement implements Element { 497 abstract class ImportElement implements Element {
400 /** 498 /**
401 * An empty array of import elements. 499 * An empty array of import elements.
402 */ 500 */
403 static List<ImportElement> EMPTY_ARRAY = new List<ImportElement>.fixedLength(0 ); 501 static List<ImportElement> EMPTY_ARRAY = new List<ImportElement>.fixedLength(0 );
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 * @return the compilation unit that defines this library 537 * @return the compilation unit that defines this library
440 */ 538 */
441 CompilationUnitElement get definingCompilationUnit; 539 CompilationUnitElement get definingCompilationUnit;
442 /** 540 /**
443 * Return the entry point for this library, or {@code null} if this library do es not have an entry 541 * Return the entry point for this library, or {@code null} if this library do es not have an entry
444 * point. The entry point is defined to be a zero argument top-level function whose name is{@code main}. 542 * point. The entry point is defined to be a zero argument top-level function whose name is{@code main}.
445 * @return the entry point for this library 543 * @return the entry point for this library
446 */ 544 */
447 FunctionElement get entryPoint; 545 FunctionElement get entryPoint;
448 /** 546 /**
547 * Return an array containing all of the libraries that are exported from this library.
548 * @return an array containing all of the libraries that are exported from thi s library
549 */
550 List<LibraryElement> get exportedLibraries;
551 /**
449 * Return an array containing all of the exports defined in this library. 552 * Return an array containing all of the exports defined in this library.
450 * @return the exports defined in this library 553 * @return the exports defined in this library
451 */ 554 */
452 List<ExportElement> get exports; 555 List<ExportElement> get exports;
453 /** 556 /**
454 * Return an array containing all of the libraries that are imported into this library. This 557 * Return an array containing all of the libraries that are imported into this library. This
455 * includes all of the libraries that are imported using a prefix (also availa ble through the 558 * includes all of the libraries that are imported using a prefix (also availa ble through the
456 * prefixes returned by {@link #getPrefixes()}) and those that are imported wi thout a prefix. 559 * prefixes returned by {@link #getPrefixes()}) and those that are imported wi thout a prefix.
457 * @return an array containing all of the libraries that are imported into thi s library 560 * @return an array containing all of the libraries that are imported into thi s library
458 */ 561 */
459 List<LibraryElement> get importedLibraries; 562 List<LibraryElement> get importedLibraries;
460 /** 563 /**
461 * Return an array containing all of the imports defined in this library. 564 * Return an array containing all of the imports defined in this library.
462 * @return the imports defined in this library 565 * @return the imports defined in this library
463 */ 566 */
464 List<ImportElement> get imports; 567 List<ImportElement> get imports;
465 /** 568 /**
466 * Return an array containing all of the compilation units that are included i n this library using 569 * Return an array containing all of the compilation units that are included i n this library using
467 * a {@code part} directive. This does not include the defining compilation un it that contains the{@code part} directives. 570 * a {@code part} directive. This does not include the defining compilation un it that contains the{@code part} directives.
468 * @return the compilation units that are included in this library 571 * @return the compilation units that are included in this library
469 */ 572 */
470 List<CompilationUnitElement> get parts; 573 List<CompilationUnitElement> get parts;
471 /** 574 /**
472 * Return an array containing elements for each of the prefixes used to {@code import} libraries 575 * Return an array containing elements for each of the prefixes used to {@code import} libraries
473 * into this library. Each prefix can be used in more than one {@code import} directive. 576 * into this library. Each prefix can be used in more than one {@code import} directive.
474 * @return the prefixes used to {@code import} libraries into this library 577 * @return the prefixes used to {@code import} libraries into this library
475 */ 578 */
476 List<PrefixElement> get prefixes; 579 List<PrefixElement> get prefixes;
580 /**
581 * 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
583 */
584 bool isBrowserApplication();
477 } 585 }
478 /** 586 /**
479 * The interface {@code MethodElement} defines the behavior of elements that rep resent a method 587 * The interface {@code MethodElement} defines the behavior of elements that rep resent a method
480 * defined within a type. 588 * defined within a type.
481 */ 589 */
482 abstract class MethodElement implements ExecutableElement { 590 abstract class MethodElement implements ExecutableElement {
483 /** 591 /**
484 * Return the type in which this method is defined. 592 * Return the type in which this method is defined.
485 * @return the type in which this method is defined 593 * @return the type in which this method is defined
486 */ 594 */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 /** 634 /**
527 * The interface {@code ParameterElement} defines the behavior of elements repre senting a parameter 635 * The interface {@code ParameterElement} defines the behavior of elements repre senting a parameter
528 * defined within an executable element. 636 * defined within an executable element.
529 */ 637 */
530 abstract class ParameterElement implements VariableElement { 638 abstract class ParameterElement implements VariableElement {
531 /** 639 /**
532 * Return the kind of this parameter. 640 * Return the kind of this parameter.
533 * @return the kind of this parameter 641 * @return the kind of this parameter
534 */ 642 */
535 ParameterKind get parameterKind; 643 ParameterKind get parameterKind;
644 /**
645 * Return {@code true} if this parameter is an initializing formal parameter.
646 * @return {@code true} if this parameter is an initializing formal parameter
647 */
648 bool isInitializingFormal();
536 } 649 }
537 /** 650 /**
538 * The interface {@code PrefixElement} defines the behavior common to elements t hat represent a 651 * The interface {@code PrefixElement} defines the behavior common to elements t hat represent a
539 * prefix used to import one or more libraries into another library. 652 * prefix used to import one or more libraries into another library.
540 */ 653 */
541 abstract class PrefixElement implements Element { 654 abstract class PrefixElement implements Element {
542 /** 655 /**
543 * Return the library into which other libraries are imported using this prefi x. 656 * Return the library into which other libraries are imported using this prefi x.
544 * @return the library into which other libraries are imported using this pref ix 657 * @return the library into which other libraries are imported using this pref ix
545 */ 658 */
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 * @return a synthetic function representing this variable's initializer 770 * @return a synthetic function representing this variable's initializer
658 */ 771 */
659 FunctionElement get initializer; 772 FunctionElement get initializer;
660 /** 773 /**
661 * Return the declared type of this variable, or {@code null} if the variable did not have a 774 * Return the declared type of this variable, or {@code null} if the variable did not have a
662 * declared type (such as if it was declared using the keyword 'var'). 775 * declared type (such as if it was declared using the keyword 'var').
663 * @return the declared type of this variable 776 * @return the declared type of this variable
664 */ 777 */
665 Type2 get type; 778 Type2 get type;
666 /** 779 /**
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 /**
667 * Return {@code true} if this variable is a const variable. Variables are con st if they have been 795 * Return {@code true} if this variable is a const variable. Variables are con st if they have been
668 * marked as being const using the {@code const} modifier. 796 * marked as being const using the {@code const} modifier.
669 * @return {@code true} if this variable is a const variable 797 * @return {@code true} if this variable is a const variable
670 */ 798 */
671 bool isConst(); 799 bool isConst();
672 /** 800 /**
673 * Return {@code true} if this variable is a final variable. Variables are fin al if they have been 801 * Return {@code true} if this variable is a final variable. Variables are fin al if they have been
674 * marked as being final using either the {@code final} or {@code const} modif iers. 802 * marked as being final using either the {@code final} or {@code const} modif iers.
675 * @return {@code true} if this variable is a final variable 803 * @return {@code true} if this variable is a final variable
676 */ 804 */
(...skipping 13 matching lines...) Expand all
690 static List<AnnotationImpl> EMPTY_ARRAY = new List<AnnotationImpl>.fixedLength (0); 818 static List<AnnotationImpl> EMPTY_ARRAY = new List<AnnotationImpl>.fixedLength (0);
691 /** 819 /**
692 * Initialize a newly created annotation. 820 * Initialize a newly created annotation.
693 * @param element the element representing the field, variable, or constructor being used as an 821 * @param element the element representing the field, variable, or constructor being used as an
694 * annotation 822 * annotation
695 */ 823 */
696 AnnotationImpl(Element element) { 824 AnnotationImpl(Element element) {
697 this._element = element; 825 this._element = element;
698 } 826 }
699 Element get element => _element; 827 Element get element => _element;
828 String toString() => "@${_element.toString()}";
700 } 829 }
701 /** 830 /**
702 * Instances of the class {@code ClassElementImpl} implement a {@code ClassEleme nt}. 831 * Instances of the class {@code ClassElementImpl} implement a {@code ClassEleme nt}.
703 */ 832 */
704 class ClassElementImpl extends ElementImpl implements ClassElement { 833 class ClassElementImpl extends ElementImpl implements ClassElement {
705 /** 834 /**
706 * An array containing all of the accessors (getters and setters) contained in this class. 835 * An array containing all of the accessors (getters and setters) contained in this class.
707 */ 836 */
708 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY; 837 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY;
709 /** 838 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 * An empty array of type elements. 872 * An empty array of type elements.
744 */ 873 */
745 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>.fixedLength(0); 874 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>.fixedLength(0);
746 /** 875 /**
747 * Initialize a newly created class element to have the given name. 876 * Initialize a newly created class element to have the given name.
748 * @param name the name of this element 877 * @param name the name of this element
749 */ 878 */
750 ClassElementImpl(Identifier name) : super.con1(name) { 879 ClassElementImpl(Identifier name) : super.con1(name) {
751 } 880 }
752 List<PropertyAccessorElement> get accessors => _accessors; 881 List<PropertyAccessorElement> get accessors => _accessors;
753 ElementImpl getChild(String identifier) { 882 List<InterfaceType> get allSupertypes {
883 Collection<InterfaceType> list = new Set<InterfaceType>();
884 collectAllSupertypes(list);
885 return new List.from(list);
886 }
887 ElementImpl getChild(String identifier19) {
754 for (PropertyAccessorElement accessor in _accessors) { 888 for (PropertyAccessorElement accessor in _accessors) {
755 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { 889 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier19 ) {
756 return accessor as PropertyAccessorElementImpl; 890 return (accessor as PropertyAccessorElementImpl);
757 } 891 }
758 } 892 }
759 for (ConstructorElement constructor in _constructors) { 893 for (ConstructorElement constructor in _constructors) {
760 if ((constructor as ConstructorElementImpl).identifier == identifier) { 894 if (((constructor as ConstructorElementImpl)).identifier == identifier19) {
761 return constructor as ConstructorElementImpl; 895 return (constructor as ConstructorElementImpl);
762 } 896 }
763 } 897 }
764 for (FieldElement field in _fields) { 898 for (FieldElement field in _fields) {
765 if ((field as FieldElementImpl).identifier == identifier) { 899 if (((field as FieldElementImpl)).identifier == identifier19) {
766 return field as FieldElementImpl; 900 return (field as FieldElementImpl);
767 } 901 }
768 } 902 }
769 for (MethodElement method in _methods) { 903 for (MethodElement method in _methods) {
770 if ((method as MethodElementImpl).identifier == identifier) { 904 if (((method as MethodElementImpl)).identifier == identifier19) {
771 return method as MethodElementImpl; 905 return (method as MethodElementImpl);
772 } 906 }
773 } 907 }
774 for (TypeVariableElement typeVariable in _typeVariables) { 908 for (TypeVariableElement typeVariable in _typeVariables) {
775 if ((typeVariable as TypeVariableElementImpl).identifier == identifier) { 909 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier19 ) {
danrubel 2013/02/13 20:28:51 extraneous parenthesis
776 return typeVariable as TypeVariableElementImpl; 910 return (typeVariable as TypeVariableElementImpl);
777 } 911 }
778 } 912 }
779 return null; 913 return null;
780 } 914 }
781 List<ConstructorElement> get constructors => _constructors; 915 List<ConstructorElement> get constructors => _constructors;
782 List<FieldElement> get fields => _fields; 916 List<FieldElement> get fields => _fields;
783 List<InterfaceType> get interfaces => _interfaces; 917 List<InterfaceType> get interfaces => _interfaces;
784 ElementKind get kind => ElementKind.CLASS; 918 ElementKind get kind => ElementKind.CLASS;
785 List<MethodElement> get methods => _methods; 919 List<MethodElement> get methods => _methods;
786 List<InterfaceType> get mixins => _mixins; 920 List<InterfaceType> get mixins => _mixins;
921 ConstructorElement getNamedConstructor(String name21) {
922 for (ConstructorElement element in constructors) {
923 String elementName = element.name;
924 if (elementName != null && elementName == name21) {
925 return element;
926 }
927 }
928 return null;
929 }
787 InterfaceType get supertype => _supertype; 930 InterfaceType get supertype => _supertype;
788 InterfaceType get type => _type; 931 InterfaceType get type => _type;
789 List<TypeVariableElement> get typeVariables => _typeVariables; 932 List<TypeVariableElement> get typeVariables => _typeVariables;
933 ConstructorElement get unnamedConstructor {
934 for (ConstructorElement element in constructors) {
935 String name10 = element.name;
936 if (name10 == null || name10.isEmpty) {
937 return element;
938 }
939 }
940 return null;
941 }
790 bool isAbstract() => hasModifier(Modifier.ABSTRACT); 942 bool isAbstract() => hasModifier(Modifier.ABSTRACT);
943 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library ) {
944 PropertyAccessorElement element = getGetter(getterName);
945 if (element != null && element.isAccessibleIn(library)) {
946 return element;
947 }
948 for (InterfaceType mixin in _mixins) {
949 ClassElement mixinElement = mixin.element;
950 if (mixinElement != null) {
951 element = ((mixinElement as ClassElementImpl)).getGetter(getterName);
952 if (element != null && element.isAccessibleIn(library)) {
953 return element;
954 }
955 }
956 }
957 if (_supertype != null) {
958 ClassElement supertypeElement = _supertype.element;
959 if (supertypeElement != null) {
960 element = supertypeElement.lookUpGetter(getterName, library);
961 if (element != null && element.isAccessibleIn(library)) {
962 return element;
963 }
964 }
965 }
966 return null;
967 }
968 MethodElement lookUpMethod(String methodName, LibraryElement library) {
969 MethodElement element = getMethod(methodName);
970 if (element != null && element.isAccessibleIn(library)) {
971 return element;
972 }
973 for (InterfaceType mixin in _mixins) {
974 ClassElement mixinElement = mixin.element;
975 if (mixinElement != null) {
976 element = ((mixinElement as ClassElementImpl)).getMethod(methodName);
977 if (element != null && element.isAccessibleIn(library)) {
978 return element;
979 }
980 }
981 }
982 if (_supertype != null) {
983 ClassElement supertypeElement = _supertype.element;
984 if (supertypeElement != null) {
985 element = supertypeElement.lookUpMethod(methodName, library);
986 if (element != null && element.isAccessibleIn(library)) {
987 return element;
988 }
989 }
990 }
991 return null;
992 }
993 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library ) {
994 PropertyAccessorElement element = getSetter(setterName);
995 if (element != null && element.isAccessibleIn(library)) {
996 return element;
997 }
998 for (InterfaceType mixin in _mixins) {
999 ClassElement mixinElement = mixin.element;
1000 if (mixinElement != null) {
1001 element = ((mixinElement as ClassElementImpl)).getSetter(setterName);
1002 if (element != null && element.isAccessibleIn(library)) {
1003 return element;
1004 }
1005 }
1006 }
1007 if (_supertype != null) {
1008 ClassElement supertypeElement = _supertype.element;
1009 if (supertypeElement != null) {
1010 element = supertypeElement.lookUpSetter(setterName, library);
1011 if (element != null && element.isAccessibleIn(library)) {
1012 return element;
1013 }
1014 }
1015 }
1016 return null;
1017 }
791 /** 1018 /**
792 * Set whether this class is abstract to correspond to the given value. 1019 * Set whether this class is abstract to correspond to the given value.
793 * @param isAbstract {@code true} if the class is abstract 1020 * @param isAbstract {@code true} if the class is abstract
794 */ 1021 */
795 void set abstract(bool isAbstract) { 1022 void set abstract(bool isAbstract) {
796 setModifier(Modifier.ABSTRACT, isAbstract); 1023 setModifier(Modifier.ABSTRACT, isAbstract);
797 } 1024 }
798 /** 1025 /**
799 * Set the accessors contained in this class to the given accessors. 1026 * Set the accessors contained in this class to the given accessors.
800 * @param accessors the accessors contained in this class 1027 * @param accessors the accessors contained in this class
801 */ 1028 */
802 void set accessors2(List<PropertyAccessorElement> accessors) { 1029 void set accessors(List<PropertyAccessorElement> accessors2) {
803 for (PropertyAccessorElement accessor in accessors) { 1030 for (PropertyAccessorElement accessor in accessors2) {
804 (accessor as PropertyAccessorElementImpl).enclosingElement2 = this; 1031 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this;
805 } 1032 }
806 this._accessors = accessors; 1033 this._accessors = accessors2;
807 } 1034 }
808 /** 1035 /**
809 * Set the constructors contained in this class to the given constructors. 1036 * Set the constructors contained in this class to the given constructors.
810 * @param constructors the constructors contained in this class 1037 * @param constructors the constructors contained in this class
811 */ 1038 */
812 void set constructors2(List<ConstructorElement> constructors) { 1039 void set constructors(List<ConstructorElement> constructors2) {
813 for (ConstructorElement constructor in constructors) { 1040 for (ConstructorElement constructor in constructors2) {
814 (constructor as ConstructorElementImpl).enclosingElement2 = this; 1041 ((constructor as ConstructorElementImpl)).enclosingElement = this;
815 } 1042 }
816 this._constructors = constructors; 1043 this._constructors = constructors2;
817 } 1044 }
818 /** 1045 /**
819 * Set the fields contained in this class to the given fields. 1046 * Set the fields contained in this class to the given fields.
820 * @param fields the fields contained in this class 1047 * @param fields the fields contained in this class
821 */ 1048 */
822 void set fields3(List<FieldElement> fields) { 1049 void set fields(List<FieldElement> fields2) {
823 for (FieldElement field in fields) { 1050 for (FieldElement field in fields2) {
824 (field as FieldElementImpl).enclosingElement2 = this; 1051 ((field as FieldElementImpl)).enclosingElement = this;
825 } 1052 }
826 this._fields = fields; 1053 this._fields = fields2;
827 } 1054 }
828 /** 1055 /**
829 * Set the interfaces that are implemented by this class to the given types. 1056 * Set the interfaces that are implemented by this class to the given types.
830 * @param the interfaces that are implemented by this class 1057 * @param the interfaces that are implemented by this class
831 */ 1058 */
832 void set interfaces2(List<InterfaceType> interfaces) { 1059 void set interfaces(List<InterfaceType> interfaces2) {
833 this._interfaces = interfaces; 1060 this._interfaces = interfaces2;
834 } 1061 }
835 /** 1062 /**
836 * Set the methods contained in this class to the given methods. 1063 * Set the methods contained in this class to the given methods.
837 * @param methods the methods contained in this class 1064 * @param methods the methods contained in this class
838 */ 1065 */
839 void set methods2(List<MethodElement> methods) { 1066 void set methods(List<MethodElement> methods2) {
840 for (MethodElement method in methods) { 1067 for (MethodElement method in methods2) {
841 (method as MethodElementImpl).enclosingElement2 = this; 1068 ((method as MethodElementImpl)).enclosingElement = this;
842 } 1069 }
843 this._methods = methods; 1070 this._methods = methods2;
844 } 1071 }
845 /** 1072 /**
846 * Set the mixins that are applied to the class being extended in order to der ive the superclass 1073 * Set the mixins that are applied to the class being extended in order to der ive the superclass
847 * of this class to the given types. 1074 * of this class to the given types.
848 * @param mixins the mixins that are applied to derive the superclass of this class 1075 * @param mixins the mixins that are applied to derive the superclass of this class
849 */ 1076 */
850 void set mixins2(List<InterfaceType> mixins) { 1077 void set mixins(List<InterfaceType> mixins2) {
851 this._mixins = mixins; 1078 this._mixins = mixins2;
852 } 1079 }
853 /** 1080 /**
854 * Set the superclass of the class to the given type. 1081 * Set the superclass of the class to the given type.
855 * @param supertype the superclass of the class 1082 * @param supertype the superclass of the class
856 */ 1083 */
857 void set supertype2(InterfaceType supertype) { 1084 void set supertype(InterfaceType supertype2) {
858 this._supertype = supertype; 1085 this._supertype = supertype2;
859 } 1086 }
860 /** 1087 /**
861 * Set the type defined by the class to the given type. 1088 * Set the type defined by the class to the given type.
862 * @param type the type defined by the class 1089 * @param type the type defined by the class
863 */ 1090 */
864 void set type9(InterfaceType type) { 1091 void set type(InterfaceType type4) {
865 this._type = type; 1092 this._type = type4;
866 } 1093 }
867 /** 1094 /**
868 * Set the type variables defined for this class to the given type variables. 1095 * Set the type variables defined for this class to the given type variables.
869 * @param typeVariables the type variables defined for this class 1096 * @param typeVariables the type variables defined for this class
870 */ 1097 */
871 void set typeVariables2(List<TypeVariableElement> typeVariables) { 1098 void set typeVariables(List<TypeVariableElement> typeVariables2) {
872 for (TypeVariableElement typeVariable in typeVariables) { 1099 for (TypeVariableElement typeVariable in typeVariables2) {
873 (typeVariable as TypeVariableElementImpl).enclosingElement2 = this; 1100 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this;
874 } 1101 }
875 this._typeVariables = typeVariables; 1102 this._typeVariables = typeVariables2;
876 } 1103 }
877 String toString() { 1104 void appendTo(StringBuffer builder) {
878 String name15 = name; 1105 String name11 = name;
879 return name15 == null ? "<unnamed class>" : "class ${name15}"; 1106 if (name11 == null) {
1107 builder.add("{unnamed class}");
1108 } else {
1109 builder.add(name11);
1110 }
1111 int variableCount = _typeVariables.length;
1112 if (variableCount > 0) {
1113 builder.add("<");
1114 for (int i = 0; i < variableCount; i++) {
1115 if (i > 0) {
1116 builder.add(", ");
1117 }
1118 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
1119 }
1120 builder.add(">");
1121 }
1122 }
1123 void collectAllSupertypes(Collection<InterfaceType> list) {
1124 if (_supertype == null || list.contains(_supertype)) {
1125 return;
1126 }
1127 list.add(_supertype);
1128 ((_supertype.element as ClassElementImpl)).collectAllSupertypes(list);
1129 for (InterfaceType type in interfaces) {
1130 if (!list.contains(type)) {
1131 list.add(type);
1132 ((type.element as ClassElementImpl)).collectAllSupertypes(list);
1133 }
1134 }
1135 for (InterfaceType type in mixins) {
1136 if (!list.contains(type)) {
1137 list.add(type);
1138 }
1139 }
1140 }
1141 /**
1142 * Return the element representing the getter with the given name that is decl ared in this class,
1143 * or {@code null} if this class does not declare a getter with the given name .
1144 * @param getterName the name of the getter to be returned
1145 * @return the getter declared in this class with the given name
1146 */
1147 PropertyAccessorElement getGetter(String getterName) {
1148 for (PropertyAccessorElement accessor in _accessors) {
1149 if (accessor.isGetter() && accessor.name == getterName) {
1150 return accessor;
1151 }
1152 }
1153 return null;
1154 }
1155 /**
1156 * Return the element representing the method with the given name that is decl ared in this class,
1157 * or {@code null} if this class does not declare a method with the given name .
1158 * @param methodName the name of the method to be returned
1159 * @return the method declared in this class with the given name
1160 */
1161 MethodElement getMethod(String methodName) {
1162 for (MethodElement method in _methods) {
1163 if (method.name == methodName) {
1164 return method;
1165 }
1166 }
1167 return null;
1168 }
1169 /**
1170 * Return the element representing the setter with the given name that is decl ared in this class,
1171 * or {@code null} if this class does not declare a setter with the given name .
1172 * @param setterName the name of the getter to be returned
1173 * @return the getter declared in this class with the given name
1174 */
1175 PropertyAccessorElement getSetter(String setterName) {
1176 for (PropertyAccessorElement accessor in _accessors) {
1177 if (accessor.isSetter() && accessor.name == setterName) {
1178 return accessor;
1179 }
1180 }
1181 return null;
880 } 1182 }
881 } 1183 }
882 /** 1184 /**
883 * Instances of the class {@code CompilationUnitElementImpl} implement a{@link C ompilationUnitElement}. 1185 * Instances of the class {@code CompilationUnitElementImpl} implement a{@link C ompilationUnitElement}.
884 */ 1186 */
885 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE lement { 1187 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE lement {
886 /** 1188 /**
887 * An array containing all of the top-level accessors (getters and setters) co ntained in this 1189 * An array containing all of the top-level accessors (getters and setters) co ntained in this
888 * compilation unit. 1190 * compilation unit.
889 */ 1191 */
890 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY; 1192 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY;
891 /** 1193 /**
892 * An array containing all of the fields contained in this compilation unit.
893 */
894 List<FieldElement> _fields = FieldElementImpl.EMPTY_ARRAY;
895 /**
896 * An array containing all of the top-level functions contained in this compil ation unit. 1194 * An array containing all of the top-level functions contained in this compil ation unit.
897 */ 1195 */
898 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; 1196 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
899 /** 1197 /**
1198 * An array containing all of the variables contained in this compilation unit .
1199 */
1200 List<VariableElement> _variables = VariableElementImpl.EMPTY_ARRAY;
1201 /**
900 * The source that corresponds to this compilation unit. 1202 * The source that corresponds to this compilation unit.
901 */ 1203 */
902 Source _source; 1204 Source _source;
903 /** 1205 /**
904 * An array containing all of the type aliases contained in this compilation u nit. 1206 * An array containing all of the type aliases contained in this compilation u nit.
905 */ 1207 */
906 List<TypeAliasElement> _typeAliases = TypeAliasElementImpl.EMPTY_ARRAY; 1208 List<TypeAliasElement> _typeAliases = TypeAliasElementImpl.EMPTY_ARRAY;
907 /** 1209 /**
908 * An array containing all of the types contained in this compilation unit. 1210 * An array containing all of the types contained in this compilation unit.
909 */ 1211 */
910 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; 1212 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY;
911 /** 1213 /**
912 * An empty array of compilation unit elements. 1214 * An empty array of compilation unit elements.
913 */ 1215 */
914 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>.fixedLength(0); 1216 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>.fixedLength(0);
915 /** 1217 /**
916 * Initialize a newly created compilation unit element to have the given name. 1218 * Initialize a newly created compilation unit element to have the given name.
917 * @param name the name of this element 1219 * @param name the name of this element
918 */ 1220 */
919 CompilationUnitElementImpl(String name) : super.con2(name, -1) { 1221 CompilationUnitElementImpl(String name) : super.con2(name, -1) {
920 } 1222 }
921 bool operator ==(Object object) => this.runtimeType == object.runtimeType && _ source == (object as CompilationUnitElementImpl).source; 1223 bool operator ==(Object object) => identical(this.runtimeType, object.runtimeT ype) && _source == ((object as CompilationUnitElementImpl)).source;
922 List<PropertyAccessorElement> get accessors => _accessors; 1224 List<PropertyAccessorElement> get accessors => _accessors;
923 ElementImpl getChild(String identifier) { 1225 ElementImpl getChild(String identifier20) {
924 for (PropertyAccessorElement accessor in _accessors) { 1226 for (PropertyAccessorElement accessor in _accessors) {
925 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { 1227 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier20 ) {
926 return accessor as PropertyAccessorElementImpl; 1228 return (accessor as PropertyAccessorElementImpl);
927 } 1229 }
928 } 1230 }
929 for (FieldElement field in _fields) { 1231 for (VariableElement variable in _variables) {
930 if ((field as FieldElementImpl).identifier == identifier) { 1232 if (((variable as VariableElementImpl)).identifier == identifier20) {
931 return field as FieldElementImpl; 1233 return (variable as VariableElementImpl);
932 } 1234 }
933 } 1235 }
934 for (ExecutableElement function in _functions) { 1236 for (ExecutableElement function in _functions) {
935 if ((function as ExecutableElementImpl).identifier == identifier) { 1237 if (((function as ExecutableElementImpl)).identifier == identifier20) {
936 return function as ExecutableElementImpl; 1238 return (function as ExecutableElementImpl);
937 } 1239 }
938 } 1240 }
939 for (TypeAliasElement typeAlias in _typeAliases) { 1241 for (TypeAliasElement typeAlias in _typeAliases) {
940 if ((typeAlias as TypeAliasElementImpl).identifier == identifier) { 1242 if (((typeAlias as TypeAliasElementImpl)).identifier == identifier20) {
941 return typeAlias as TypeAliasElementImpl; 1243 return (typeAlias as TypeAliasElementImpl);
942 } 1244 }
943 } 1245 }
944 for (ClassElement type in _types) { 1246 for (ClassElement type in _types) {
945 if ((type as ClassElementImpl).identifier == identifier) { 1247 if (((type as ClassElementImpl)).identifier == identifier20) {
946 return type as ClassElementImpl; 1248 return (type as ClassElementImpl);
947 } 1249 }
948 } 1250 }
949 return null; 1251 return null;
950 } 1252 }
951 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t; 1253 LibraryElement get enclosingElement => (super.enclosingElement as LibraryEleme nt);
952 List<FieldElement> get fields => _fields;
953 List<FunctionElement> get functions => _functions; 1254 List<FunctionElement> get functions => _functions;
954 String get identifier => source.fullName; 1255 String get identifier => source.fullName;
955 ElementKind get kind => ElementKind.COMPILATION_UNIT; 1256 ElementKind get kind => ElementKind.COMPILATION_UNIT;
956 Source get source => _source; 1257 Source get source => _source;
957 List<TypeAliasElement> get typeAliases => _typeAliases; 1258 List<TypeAliasElement> get typeAliases => _typeAliases;
958 List<ClassElement> get types => _types; 1259 List<ClassElement> get types => _types;
1260 List<VariableElement> get variables => _variables;
959 int get hashCode => _source.hashCode; 1261 int get hashCode => _source.hashCode;
960 /** 1262 /**
961 * Set the top-level accessors (getters and setters) contained in this compila tion unit to the 1263 * Set the top-level accessors (getters and setters) contained in this compila tion unit to the
962 * given accessors. 1264 * given accessors.
963 * @param the top-level accessors (getters and setters) contained in this comp ilation unit 1265 * @param the top-level accessors (getters and setters) contained in this comp ilation unit
964 */ 1266 */
965 void set accessors3(List<PropertyAccessorElement> accessors) { 1267 void set accessors(List<PropertyAccessorElement> accessors3) {
966 for (PropertyAccessorElement accessor in accessors) { 1268 for (PropertyAccessorElement accessor in accessors3) {
967 (accessor as PropertyAccessorElementImpl).enclosingElement2 = this; 1269 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this;
968 } 1270 }
969 this._accessors = accessors; 1271 this._accessors = accessors3;
970 }
971 /**
972 * Set the fields contained in this compilation unit to the given fields.
973 * @param fields the fields contained in this compilation unit
974 */
975 void set fields4(List<FieldElement> fields) {
976 for (FieldElement field in fields) {
977 (field as FieldElementImpl).enclosingElement2 = this;
978 }
979 this._fields = fields;
980 } 1272 }
981 /** 1273 /**
982 * Set the top-level functions contained in this compilation unit to the given functions. 1274 * Set the top-level functions contained in this compilation unit to the given functions.
983 * @param functions the top-level functions contained in this compilation unit 1275 * @param functions the top-level functions contained in this compilation unit
984 */ 1276 */
985 void set functions2(List<FunctionElement> functions) { 1277 void set functions(List<FunctionElement> functions2) {
986 for (FunctionElement function in functions) { 1278 for (FunctionElement function in functions2) {
987 (function as FunctionElementImpl).enclosingElement2 = this; 1279 ((function as FunctionElementImpl)).enclosingElement = this;
988 } 1280 }
989 this._functions = functions; 1281 this._functions = functions2;
990 } 1282 }
991 /** 1283 /**
992 * Set the source that corresponds to this compilation unit to the given sourc e. 1284 * Set the source that corresponds to this compilation unit to the given sourc e.
993 * @param source the source that corresponds to this compilation unit 1285 * @param source the source that corresponds to this compilation unit
994 */ 1286 */
995 void set source3(Source source) { 1287 void set source(Source source5) {
996 this._source = source; 1288 this._source = source5;
997 } 1289 }
998 /** 1290 /**
999 * Set the type aliases contained in this compilation unit to the given type a liases. 1291 * Set the type aliases contained in this compilation unit to the given type a liases.
1000 * @param typeAliases the type aliases contained in this compilation unit 1292 * @param typeAliases the type aliases contained in this compilation unit
1001 */ 1293 */
1002 void set typeAliases2(List<TypeAliasElement> typeAliases) { 1294 void set typeAliases(List<TypeAliasElement> typeAliases2) {
1003 for (TypeAliasElement typeAlias in typeAliases) { 1295 for (TypeAliasElement typeAlias in typeAliases2) {
1004 (typeAlias as TypeAliasElementImpl).enclosingElement2 = this; 1296 ((typeAlias as TypeAliasElementImpl)).enclosingElement = this;
1005 } 1297 }
1006 this._typeAliases = typeAliases; 1298 this._typeAliases = typeAliases2;
1007 } 1299 }
1008 /** 1300 /**
1009 * Set the types contained in this compilation unit to the given types. 1301 * Set the types contained in this compilation unit to the given types.
1010 * @param types types contained in this compilation unit 1302 * @param types types contained in this compilation unit
1011 */ 1303 */
1012 void set types2(List<ClassElement> types) { 1304 void set types(List<ClassElement> types2) {
1013 for (ClassElement type in types) { 1305 for (ClassElement type in types2) {
1014 (type as ClassElementImpl).enclosingElement2 = this; 1306 ((type as ClassElementImpl)).enclosingElement = this;
1015 } 1307 }
1016 this._types = types; 1308 this._types = types2;
1309 }
1310 /**
1311 * Set the variables contained in this compilation unit to the given variables .
1312 * @param variables the variables contained in this compilation unit
1313 */
1314 void set variables(List<VariableElement> variables2) {
1315 for (VariableElement field in variables2) {
1316 ((field as VariableElementImpl)).enclosingElement = this;
1317 }
1318 this._variables = variables2;
1319 }
1320 void appendTo(StringBuffer builder) {
1321 if (_source == null) {
1322 builder.add("{compilation unit}");
1323 } else {
1324 builder.add(_source.fullName);
1325 }
1017 } 1326 }
1018 } 1327 }
1019 /** 1328 /**
1020 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons tructorElement}. 1329 * Instances of the class {@code ConstructorElementImpl} implement a {@code Cons tructorElement}.
1021 */ 1330 */
1022 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement { 1331 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo rElement {
1023 /** 1332 /**
1024 * An empty array of constructor elements. 1333 * An empty array of constructor elements.
1025 */ 1334 */
1026 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>.fix edLength(0); 1335 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>.fix edLength(0);
1027 /** 1336 /**
1028 * Initialize a newly created constructor element to have the given name. 1337 * Initialize a newly created constructor element to have the given name.
1029 * @param name the name of this element 1338 * @param name the name of this element
1030 */ 1339 */
1031 ConstructorElementImpl(Identifier name) : super.con1(name) { 1340 ConstructorElementImpl(Identifier name) : super.con1(name) {
1032 } 1341 }
1033 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 1342 ClassElement get enclosingElement => (super.enclosingElement as ClassElement);
1034 ElementKind get kind => ElementKind.CONSTRUCTOR; 1343 ElementKind get kind => ElementKind.CONSTRUCTOR;
1035 bool isConst() => hasModifier(Modifier.CONST); 1344 bool isConst() => hasModifier(Modifier.CONST);
1036 bool isFactory() => hasModifier(Modifier.FACTORY); 1345 bool isFactory() => hasModifier(Modifier.FACTORY);
1037 /** 1346 /**
1038 * Set whether this constructor represents a factory method to the given value . 1347 * Set whether this constructor represents a factory method to the given value .
1039 * @param isFactory {@code true} if this constructor represents a factory meth od 1348 * @param isFactory {@code true} if this constructor represents a factory meth od
1040 */ 1349 */
1041 void set factory(bool isFactory) { 1350 void set factory(bool isFactory) {
1042 setModifier(Modifier.FACTORY, isFactory); 1351 setModifier(Modifier.FACTORY, isFactory);
1043 } 1352 }
1353 void appendTo(StringBuffer builder) {
1354 builder.add(enclosingElement.name);
1355 String name12 = name;
1356 if (name12 != null && !name12.isEmpty) {
1357 builder.add(".");
1358 builder.add(name12);
1359 }
1360 super.appendTo(builder);
1361 }
1044 } 1362 }
1045 /** 1363 /**
1046 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele ment representing 1364 * Instances of the class {@code DynamicElementImpl} represent the synthetic ele ment representing
1047 * the declaration of the type {@code dynamic}. 1365 * the declaration of the type {@code dynamic}.
1048 */ 1366 */
1049 class DynamicElementImpl extends ElementImpl { 1367 class DynamicElementImpl extends ElementImpl {
1050 /** 1368 /**
1369 * Return the unique instance of this class.
1370 * @return the unique instance of this class
1371 */
1372 static DynamicElementImpl get instance => (DynamicTypeImpl.instance.element as DynamicElementImpl);
1373 /**
1051 * The type defined by this element. 1374 * The type defined by this element.
1052 */ 1375 */
1053 DynamicTypeImpl _type; 1376 DynamicTypeImpl _type;
1054 /** 1377 /**
1055 * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be 1378 * Initialize a newly created instance of this class. Instances of this class should <b>not</b> be
1056 * created except as part of creating the type associated with this element. T he single instance 1379 * created except as part of creating the type associated with this element. T he single instance
1057 * of this class should be accessed through the single instance of the class{@ link DynamicTypeImpl}. 1380 * of this class should be accessed through the method {@link #getInstance()}.
1058 */ 1381 */
1059 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { 1382 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) {
1060 setModifier(Modifier.SYNTHETIC, true); 1383 setModifier(Modifier.SYNTHETIC, true);
1061 } 1384 }
1062 ElementKind get kind => ElementKind.DYNAMIC; 1385 ElementKind get kind => ElementKind.DYNAMIC;
1063 /** 1386 /**
1064 * Return the type defined by this element. 1387 * Return the type defined by this element.
1065 * @return the type defined by this element 1388 * @return the type defined by this element
1066 */ 1389 */
1067 DynamicTypeImpl get type => _type; 1390 DynamicTypeImpl get type => _type;
1068 /** 1391 /**
1069 * Set the type defined by this element to the given type. 1392 * Set the type defined by this element to the given type.
1070 * @param type the type defined by this element 1393 * @param type the type defined by this element
1071 */ 1394 */
1072 void set type10(DynamicTypeImpl type) { 1395 void set type(DynamicTypeImpl type5) {
1073 this._type = type; 1396 this._type = type5;
1074 } 1397 }
1075 } 1398 }
1076 /** 1399 /**
1077 * The abstract class {@code ElementImpl} implements the behavior common to obje cts that implement 1400 * The abstract class {@code ElementImpl} implements the behavior common to obje cts that implement
1078 * an {@link Element}. 1401 * an {@link Element}.
1079 */ 1402 */
1080 abstract class ElementImpl implements Element { 1403 abstract class ElementImpl implements Element {
1081 /** 1404 /**
1082 * The enclosing element of this element, or {@code null} if this element is a t the root of the 1405 * The enclosing element of this element, or {@code null} if this element is a t the root of the
1083 * element structure. 1406 * element structure.
(...skipping 13 matching lines...) Expand all
1097 */ 1420 */
1098 Set<Modifier> _modifiers; 1421 Set<Modifier> _modifiers;
1099 /** 1422 /**
1100 * An array containing all of the metadata associated with this element. 1423 * An array containing all of the metadata associated with this element.
1101 */ 1424 */
1102 List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY; 1425 List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY;
1103 /** 1426 /**
1104 * Initialize a newly created element to have the given name. 1427 * Initialize a newly created element to have the given name.
1105 * @param name the name of this element 1428 * @param name the name of this element
1106 */ 1429 */
1107 ElementImpl.con1(Identifier name) { 1430 ElementImpl.con1(Identifier name22) {
1108 _jtd_constructor_129_impl(name); 1431 _jtd_constructor_135_impl(name22);
1109 } 1432 }
1110 _jtd_constructor_129_impl(Identifier name) { 1433 _jtd_constructor_135_impl(Identifier name22) {
1111 _jtd_constructor_130_impl(name == null ? "" : name.name, name == null ? -1 : name.offset); 1434 _jtd_constructor_136_impl(name22 == null ? "" : name22.name, name22 == null ? -1 : name22.offset);
1112 } 1435 }
1113 /** 1436 /**
1114 * Initialize a newly created element to have the given name. 1437 * Initialize a newly created element to have the given name.
1115 * @param name the name of this element 1438 * @param name the name of this element
1116 * @param nameOffset the offset of the name of this element in the file that c ontains the 1439 * @param nameOffset the offset of the name of this element in the file that c ontains the
1117 * declaration of this element 1440 * declaration of this element
1118 */ 1441 */
1119 ElementImpl.con2(String name, int nameOffset) { 1442 ElementImpl.con2(String name8, int nameOffset2) {
1120 _jtd_constructor_130_impl(name, nameOffset); 1443 _jtd_constructor_136_impl(name8, nameOffset2);
1121 } 1444 }
1122 _jtd_constructor_130_impl(String name, int nameOffset) { 1445 _jtd_constructor_136_impl(String name8, int nameOffset2) {
1123 this._name = name; 1446 this._name = name8;
1124 this._nameOffset = nameOffset; 1447 this._nameOffset = nameOffset2;
1125 this._modifiers = new Set(); 1448 this._modifiers = new Set();
1126 } 1449 }
1127 bool operator ==(Object object) => object is Element && (object as Element).lo cation == location; 1450 bool operator ==(Object object) => object is Element && ((object as Element)). location == location;
1128 Element getAncestor(Type elementClass) { 1451 Element getAncestor(Type elementClass) {
1129 Element ancestor = _enclosingElement; 1452 Element ancestor = _enclosingElement;
1130 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { 1453 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) {
1131 ancestor = ancestor.enclosingElement; 1454 ancestor = ancestor.enclosingElement;
1132 } 1455 }
1133 return ancestor as Element; 1456 return (ancestor as Element);
1134 } 1457 }
1135 /** 1458 /**
1136 * Return the child of this element that is uniquely identified by the given i dentifier, or{@code null} if there is no such child. 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.
1137 * @param identifier the identifier used to select a child 1460 * @param identifier the identifier used to select a child
1138 * @return the child of this element with the given identifier 1461 * @return the child of this element with the given identifier
1139 */ 1462 */
1140 ElementImpl getChild(String identifier) => null; 1463 ElementImpl getChild(String identifier) => null;
1141 AnalysisContext get context { 1464 AnalysisContext get context {
1142 if (_enclosingElement == null) { 1465 if (_enclosingElement == null) {
1143 return null; 1466 return null;
1144 } 1467 }
1145 return _enclosingElement.context; 1468 return _enclosingElement.context;
1146 } 1469 }
1147 Element get enclosingElement => _enclosingElement; 1470 Element get enclosingElement => _enclosingElement;
1148 LibraryElement get library => getAncestor(LibraryElement); 1471 LibraryElement get library => getAncestor(LibraryElement);
1149 ElementLocation get location => new ElementLocationImpl.con1(this); 1472 ElementLocation get location => new ElementLocationImpl.con1(this);
1150 List<Annotation> get metadata => _metadata; 1473 List<Annotation> get metadata => _metadata;
1151 String get name => _name; 1474 String get name => _name;
1152 int get nameOffset => _nameOffset; 1475 int get nameOffset => _nameOffset;
1476 Source get source {
1477 if (_enclosingElement == null) {
1478 return null;
1479 }
1480 return _enclosingElement.source;
1481 }
1153 int get hashCode => location.hashCode; 1482 int get hashCode => location.hashCode;
1483 bool isAccessibleIn(LibraryElement library18) {
1484 if (Identifier.isPrivateName(_name)) {
1485 return library18 == library;
1486 }
1487 return true;
1488 }
1154 bool isSynthetic() => hasModifier(Modifier.SYNTHETIC); 1489 bool isSynthetic() => hasModifier(Modifier.SYNTHETIC);
1155 /** 1490 /**
1156 * Set the metadata associate with this element to the given array of annotati ons. 1491 * Set the metadata associate with this element to the given array of annotati ons.
1157 * @param metadata the metadata to be associated with this element 1492 * @param metadata the metadata to be associated with this element
1158 */ 1493 */
1159 void set metadata2(List<Annotation> metadata) { 1494 void set metadata(List<Annotation> metadata2) {
1160 this._metadata = metadata; 1495 this._metadata = metadata2;
1161 } 1496 }
1162 /** 1497 /**
1163 * Set whether this element is synthetic to correspond to the given value. 1498 * Set whether this element is synthetic to correspond to the given value.
1164 * @param isSynthetic {@code true} if the element is synthetic 1499 * @param isSynthetic {@code true} if the element is synthetic
1165 */ 1500 */
1166 void set synthetic(bool isSynthetic) { 1501 void set synthetic(bool isSynthetic) {
1167 setModifier(Modifier.SYNTHETIC, isSynthetic); 1502 setModifier(Modifier.SYNTHETIC, isSynthetic);
1168 } 1503 }
1504 String toString() {
1505 StringBuffer builder = new StringBuffer();
1506 appendTo(builder);
1507 return builder.toString();
1508 }
1509 /**
1510 * Append a textual representation of this type to the given builder.
1511 * @param builder the builder to which the text is to be appended
1512 */
1513 void appendTo(StringBuffer builder) {
1514 if (_name == null) {
1515 builder.add("<unnamed ");
1516 builder.add(runtimeType.toString());
1517 builder.add(">");
1518 } else {
1519 builder.add(_name);
1520 }
1521 }
1169 /** 1522 /**
1170 * Return an identifier that uniquely identifies this element among the childr en of this element's 1523 * Return an identifier that uniquely identifies this element among the childr en of this element's
1171 * parent. 1524 * parent.
1172 * @return an identifier that uniquely identifies this element relative to its parent 1525 * @return an identifier that uniquely identifies this element relative to its parent
1173 */ 1526 */
1174 String get identifier => name; 1527 String get identifier => name;
1175 /** 1528 /**
1176 * Return {@code true} if this element has the given modifier associated with it. 1529 * Return {@code true} if this element has the given modifier associated with it.
1177 * @param modifier the modifier being tested for 1530 * @param modifier the modifier being tested for
1178 * @return {@code true} if this element has the given modifier associated with it 1531 * @return {@code true} if this element has the given modifier associated with it
1179 */ 1532 */
1180 bool hasModifier(Modifier modifier) => _modifiers.contains(modifier); 1533 bool hasModifier(Modifier modifier) => _modifiers.contains(modifier);
1181 /** 1534 /**
1182 * Set the enclosing element of this element to the given element. 1535 * Set the enclosing element of this element to the given element.
1183 * @param element the enclosing element of this element 1536 * @param element the enclosing element of this element
1184 */ 1537 */
1185 void set enclosingElement2(ElementImpl element) { 1538 void set enclosingElement(ElementImpl element) {
1186 _enclosingElement = element; 1539 _enclosingElement = element;
1187 } 1540 }
1188 /** 1541 /**
1189 * Set whether the given modifier is associated with this element to correspon d to the given 1542 * Set whether the given modifier is associated with this element to correspon d to the given
1190 * value. 1543 * value.
1191 * @param modifier the modifier to be set 1544 * @param modifier the modifier to be set
1192 * @param value {@code true} if the modifier is to be associated with this ele ment 1545 * @param value {@code true} if the modifier is to be associated with this ele ment
1193 */ 1546 */
1194 void setModifier(Modifier modifier, bool value) { 1547 void setModifier(Modifier modifier, bool value) {
1195 if (value) { 1548 if (value) {
1196 _modifiers.add(modifier); 1549 _modifiers.add(modifier);
1197 } else { 1550 } else {
1198 _modifiers.remove(modifier); 1551 _modifiers.remove(modifier);
1199 } 1552 }
1200 } 1553 }
1201 } 1554 }
1202 /** 1555 /**
1203 * Instances of the class {@code ElementLocationImpl} implement an {@link Elemen tLocation}. 1556 * Instances of the class {@code ElementLocationImpl} implement an {@link Elemen tLocation}.
1204 */ 1557 */
1205 class ElementLocationImpl implements ElementLocation { 1558 class ElementLocationImpl implements ElementLocation {
1206 /** 1559 /**
1207 * The path to the element whose location is represented by this object. 1560 * The path to the element whose location is represented by this object.
1208 */ 1561 */
1209 List<String> _components; 1562 List<String> _components;
1210 /** 1563 /**
1211 * The character used to separate components in the encoded form. 1564 * The character used to separate components in the encoded form.
1212 */ 1565 */
1213 static int _SEPARATOR_CHAR = 0x3b; 1566 static int _SEPARATOR_CHAR = 0x3B;
1214 /** 1567 /**
1215 * Initialize a newly created location to represent the given element. 1568 * Initialize a newly created location to represent the given element.
1216 * @param element the element whose location is being represented 1569 * @param element the element whose location is being represented
1217 */ 1570 */
1218 ElementLocationImpl.con1(Element element) { 1571 ElementLocationImpl.con1(Element element) {
1219 _jtd_constructor_131_impl(element); 1572 _jtd_constructor_137_impl(element);
1220 } 1573 }
1221 _jtd_constructor_131_impl(Element element) { 1574 _jtd_constructor_137_impl(Element element) {
1222 List<String> components = new List<String>(); 1575 List<String> components = new List<String>();
1223 Element ancestor = element; 1576 Element ancestor = element;
1224 while (ancestor != null) { 1577 while (ancestor != null) {
1225 components.insertRange(0, 1, (ancestor as ElementImpl).identifier); 1578 components.insertRange(0, 1, ((ancestor as ElementImpl)).identifier);
1226 ancestor = ancestor.enclosingElement; 1579 ancestor = ancestor.enclosingElement;
1227 } 1580 }
1228 this._components = new List.from(components); 1581 this._components = new List.from(components);
1229 } 1582 }
1230 /** 1583 /**
1231 * Initialize a newly created location from the given encoded form. 1584 * Initialize a newly created location from the given encoded form.
1232 * @param encoding the encoded form of a location 1585 * @param encoding the encoded form of a location
1233 */ 1586 */
1234 ElementLocationImpl.con2(String encoding) { 1587 ElementLocationImpl.con2(String encoding) {
1235 _jtd_constructor_132_impl(encoding); 1588 _jtd_constructor_138_impl(encoding);
1236 } 1589 }
1237 _jtd_constructor_132_impl(String encoding) { 1590 _jtd_constructor_138_impl(String encoding) {
1238 this._components = decode(encoding); 1591 this._components = decode(encoding);
1239 } 1592 }
1240 bool operator ==(Object object) { 1593 bool operator ==(Object object) {
1241 if (object is! ElementLocationImpl) { 1594 if (object is! ElementLocationImpl) {
1242 return false; 1595 return false;
1243 } 1596 }
1244 ElementLocationImpl location = object as ElementLocationImpl; 1597 ElementLocationImpl location = (object as ElementLocationImpl);
1245 return JavaArrays.equals(_components, location._components); 1598 return JavaArrays.equals(_components, location._components);
1246 } 1599 }
1247 /** 1600 /**
1248 * Return the path to the element whose location is represented by this object . 1601 * Return the path to the element whose location is represented by this object .
1249 * @return the path to the element whose location is represented by this objec t 1602 * @return the path to the element whose location is represented by this objec t
1250 */ 1603 */
1251 List<String> get components => _components; 1604 List<String> get components => _components;
1252 String get encoding { 1605 String get encoding {
1253 StringBuffer builder = new StringBuffer(); 1606 StringBuffer builder = new StringBuffer();
1254 int length2 = _components.length; 1607 int length2 = _components.length;
1255 for (int i = 0; i < length2; i++) { 1608 for (int i = 0; i < length2; i++) {
1256 if (i > 0) { 1609 if (i > 0) {
1257 builder.addCharCode(ElementLocationImpl._SEPARATOR_CHAR); 1610 builder.addCharCode(_SEPARATOR_CHAR);
1258 } 1611 }
1259 encode(builder, _components[i]); 1612 encode(builder, _components[i]);
1260 } 1613 }
1261 return builder.toString(); 1614 return builder.toString();
1262 } 1615 }
1263 int get hashCode => JavaArrays.makeHashCode(_components); 1616 int get hashCode => JavaArrays.makeHashCode(_components);
1617 String toString() => encoding;
1264 /** 1618 /**
1265 * Decode the encoded form of a location into an array of components. 1619 * Decode the encoded form of a location into an array of components.
1266 * @param encoding the encoded form of a location 1620 * @param encoding the encoded form of a location
1267 * @return the components that were encoded 1621 * @return the components that were encoded
1268 */ 1622 */
1269 List<String> decode(String encoding) { 1623 List<String> decode(String encoding) {
1270 List<String> components = new List<String>(); 1624 List<String> components = new List<String>();
1271 StringBuffer builder = new StringBuffer(); 1625 StringBuffer builder = new StringBuffer();
1272 int index = 0; 1626 int index = 0;
1273 int length3 = encoding.length; 1627 int length3 = encoding.length;
1274 while (index < length3) { 1628 while (index < length3) {
1275 int currentChar = encoding.charCodeAt(index); 1629 int currentChar = encoding.codeUnitAt(index);
1276 if (currentChar == ElementLocationImpl._SEPARATOR_CHAR) { 1630 if (currentChar == _SEPARATOR_CHAR) {
1277 if (index + 1 < length3 && encoding.charCodeAt(index + 1) == ElementLoca tionImpl._SEPARATOR_CHAR) { 1631 if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_ CHAR) {
1278 builder.addCharCode(ElementLocationImpl._SEPARATOR_CHAR); 1632 builder.addCharCode(_SEPARATOR_CHAR);
1279 index += 2; 1633 index += 2;
1280 } else { 1634 } else {
1281 components.add(builder.toString()); 1635 components.add(builder.toString());
1282 builder.clear(); 1636 builder.clear();
1283 index++; 1637 index++;
1284 } 1638 }
1285 } else { 1639 } else {
1286 builder.addCharCode(currentChar); 1640 builder.addCharCode(currentChar);
1287 index++; 1641 index++;
1288 } 1642 }
1289 } 1643 }
1290 if (builder.length > 0) { 1644 if (builder.length > 0) {
1291 components.add(builder.toString()); 1645 components.add(builder.toString());
1292 } 1646 }
1293 return new List.from(components); 1647 return new List.from(components);
1294 } 1648 }
1295 /** 1649 /**
1296 * Append an encoded form of the given component to the given builder. 1650 * Append an encoded form of the given component to the given builder.
1297 * @param builder the builder to which the encoded component is to be appended 1651 * @param builder the builder to which the encoded component is to be appended
1298 * @param component the component to be appended to the builder 1652 * @param component the component to be appended to the builder
1299 */ 1653 */
1300 void encode(StringBuffer builder, String component) { 1654 void encode(StringBuffer builder, String component) {
1301 int length4 = component.length; 1655 int length4 = component.length;
1302 for (int i = 0; i < length4; i++) { 1656 for (int i = 0; i < length4; i++) {
1303 int currentChar = component.charCodeAt(i); 1657 int currentChar = component.codeUnitAt(i);
1304 if (currentChar == ElementLocationImpl._SEPARATOR_CHAR) { 1658 if (currentChar == _SEPARATOR_CHAR) {
1305 builder.addCharCode(ElementLocationImpl._SEPARATOR_CHAR); 1659 builder.addCharCode(_SEPARATOR_CHAR);
1306 } 1660 }
1307 builder.addCharCode(currentChar); 1661 builder.addCharCode(currentChar);
1308 } 1662 }
1309 } 1663 }
1310 } 1664 }
1311 /** 1665 /**
1312 * The abstract class {@code ExecutableElementImpl} implements the behavior comm on to{@code ExecutableElement}s. 1666 * The abstract class {@code ExecutableElementImpl} implements the behavior comm on to{@code ExecutableElement}s.
1313 */ 1667 */
1314 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement { 1668 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl ement {
1315 /** 1669 /**
(...skipping 18 matching lines...) Expand all
1334 FunctionType _type; 1688 FunctionType _type;
1335 /** 1689 /**
1336 * An empty array of executable elements. 1690 * An empty array of executable elements.
1337 */ 1691 */
1338 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>.fixed Length(0); 1692 static List<ExecutableElement> EMPTY_ARRAY = new List<ExecutableElement>.fixed Length(0);
1339 /** 1693 /**
1340 * Initialize a newly created executable element to have the given name. 1694 * Initialize a newly created executable element to have the given name.
1341 * @param name the name of this element 1695 * @param name the name of this element
1342 */ 1696 */
1343 ExecutableElementImpl.con1(Identifier name) : super.con1(name) { 1697 ExecutableElementImpl.con1(Identifier name) : super.con1(name) {
1344 _jtd_constructor_133_impl(name); 1698 _jtd_constructor_139_impl(name);
1345 } 1699 }
1346 _jtd_constructor_133_impl(Identifier name) { 1700 _jtd_constructor_139_impl(Identifier name) {
1347 } 1701 }
1348 /** 1702 /**
1349 * Initialize a newly created executable element to have the given name. 1703 * Initialize a newly created executable element to have the given name.
1350 * @param name the name of this element 1704 * @param name the name of this element
1351 * @param nameOffset the offset of the name of this element in the file that c ontains the 1705 * @param nameOffset the offset of the name of this element in the file that c ontains the
1352 * declaration of this element 1706 * declaration of this element
1353 */ 1707 */
1354 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam eOffset) { 1708 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam eOffset) {
1355 _jtd_constructor_134_impl(name, nameOffset); 1709 _jtd_constructor_140_impl(name, nameOffset);
1356 } 1710 }
1357 _jtd_constructor_134_impl(String name, int nameOffset) { 1711 _jtd_constructor_140_impl(String name, int nameOffset) {
1358 } 1712 }
1359 ElementImpl getChild(String identifier) { 1713 ElementImpl getChild(String identifier21) {
1360 for (ExecutableElement function in _functions) { 1714 for (ExecutableElement function in _functions) {
1361 if ((function as ExecutableElementImpl).identifier == identifier) { 1715 if (((function as ExecutableElementImpl)).identifier == identifier21) {
1362 return function as ExecutableElementImpl; 1716 return (function as ExecutableElementImpl);
1363 } 1717 }
1364 } 1718 }
1365 for (LabelElement label in _labels) { 1719 for (LabelElement label in _labels) {
1366 if ((label as LabelElementImpl).identifier == identifier) { 1720 if (((label as LabelElementImpl)).identifier == identifier21) {
1367 return label as LabelElementImpl; 1721 return (label as LabelElementImpl);
1368 } 1722 }
1369 } 1723 }
1370 for (VariableElement variable in _localVariables) { 1724 for (VariableElement variable in _localVariables) {
1371 if ((variable as VariableElementImpl).identifier == identifier) { 1725 if (((variable as VariableElementImpl)).identifier == identifier21) {
1372 return variable as VariableElementImpl; 1726 return (variable as VariableElementImpl);
1373 } 1727 }
1374 } 1728 }
1375 for (ParameterElement parameter in _parameters) { 1729 for (ParameterElement parameter in _parameters) {
1376 if ((parameter as ParameterElementImpl).identifier == identifier) { 1730 if (((parameter as ParameterElementImpl)).identifier == identifier21) {
1377 return parameter as ParameterElementImpl; 1731 return (parameter as ParameterElementImpl);
1378 } 1732 }
1379 } 1733 }
1380 return null; 1734 return null;
1381 } 1735 }
1382 List<ExecutableElement> get functions => _functions; 1736 List<ExecutableElement> get functions => _functions;
1383 List<LabelElement> get labels => _labels; 1737 List<LabelElement> get labels => _labels;
1384 List<VariableElement> get localVariables => _localVariables; 1738 List<VariableElement> get localVariables => _localVariables;
1385 List<ParameterElement> get parameters => _parameters; 1739 List<ParameterElement> get parameters => _parameters;
1386 FunctionType get type => _type; 1740 FunctionType get type => _type;
1387 /** 1741 /**
1388 * Set the functions defined within this executable element to the given funct ions. 1742 * Set the functions defined within this executable element to the given funct ions.
1389 * @param functions the functions defined within this executable element 1743 * @param functions the functions defined within this executable element
1390 */ 1744 */
1391 void set functions3(List<ExecutableElement> functions) { 1745 void set functions(List<ExecutableElement> functions3) {
1392 for (ExecutableElement function in functions) { 1746 for (ExecutableElement function in functions3) {
1393 (function as ExecutableElementImpl).enclosingElement2 = this; 1747 ((function as ExecutableElementImpl)).enclosingElement = this;
1394 } 1748 }
1395 this._functions = functions; 1749 this._functions = functions3;
1396 } 1750 }
1397 /** 1751 /**
1398 * Set the labels defined within this executable element to the given labels. 1752 * Set the labels defined within this executable element to the given labels.
1399 * @param labels the labels defined within this executable element 1753 * @param labels the labels defined within this executable element
1400 */ 1754 */
1401 void set labels2(List<LabelElement> labels) { 1755 void set labels(List<LabelElement> labels2) {
1402 for (LabelElement label in labels) { 1756 for (LabelElement label in labels2) {
1403 (label as LabelElementImpl).enclosingElement2 = this; 1757 ((label as LabelElementImpl)).enclosingElement = this;
1404 } 1758 }
1405 this._labels = labels; 1759 this._labels = labels2;
1406 } 1760 }
1407 /** 1761 /**
1408 * Set the local variables defined within this executable element to the given variables. 1762 * Set the local variables defined within this executable element to the given variables.
1409 * @param localVariables the local variables defined within this executable el ement 1763 * @param localVariables the local variables defined within this executable el ement
1410 */ 1764 */
1411 void set localVariables2(List<VariableElement> localVariables) { 1765 void set localVariables(List<VariableElement> localVariables2) {
1412 for (VariableElement variable in localVariables) { 1766 for (VariableElement variable in localVariables2) {
1413 (variable as VariableElementImpl).enclosingElement2 = this; 1767 ((variable as VariableElementImpl)).enclosingElement = this;
1414 } 1768 }
1415 this._localVariables = localVariables; 1769 this._localVariables = localVariables2;
1416 } 1770 }
1417 /** 1771 /**
1418 * Set the parameters defined by this executable element to the given paramete rs. 1772 * Set the parameters defined by this executable element to the given paramete rs.
1419 * @param parameters the parameters defined by this executable element 1773 * @param parameters the parameters defined by this executable element
1420 */ 1774 */
1421 void set parameters7(List<ParameterElement> parameters) { 1775 void set parameters(List<ParameterElement> parameters7) {
1422 for (ParameterElement parameter in parameters) { 1776 for (ParameterElement parameter in parameters7) {
1423 (parameter as ParameterElementImpl).enclosingElement2 = this; 1777 ((parameter as ParameterElementImpl)).enclosingElement = this;
1424 } 1778 }
1425 this._parameters = parameters; 1779 this._parameters = parameters7;
1426 } 1780 }
1427 /** 1781 /**
1428 * Set the type of function defined by this executable element to the given ty pe. 1782 * Set the type of function defined by this executable element to the given ty pe.
1429 * @param type the type of function defined by this executable element 1783 * @param type the type of function defined by this executable element
1430 */ 1784 */
1431 void set type11(FunctionType type) { 1785 void set type(FunctionType type6) {
1432 this._type = type; 1786 this._type = type6;
1787 }
1788 void appendTo(StringBuffer builder) {
1789 builder.add("(");
1790 int parameterCount = _parameters.length;
1791 for (int i = 0; i < parameterCount; i++) {
1792 if (i > 0) {
1793 builder.add(", ");
1794 }
1795 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
1796 }
1797 builder.add(")");
1798 if (_type != null) {
1799 builder.add(" -> ");
1800 builder.add(_type.returnType);
1801 }
1433 } 1802 }
1434 } 1803 }
1435 /** 1804 /**
1436 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl ement}. 1805 * Instances of the class {@code ExportElementImpl} implement an {@link ExportEl ement}.
1437 */ 1806 */
1438 class ExportElementImpl extends ElementImpl implements ExportElement { 1807 class ExportElementImpl extends ElementImpl implements ExportElement {
1439 /** 1808 /**
1440 * The library that is exported from this library by this export directive. 1809 * The library that is exported from this library by this export directive.
1441 */ 1810 */
1442 LibraryElement _exportedLibrary; 1811 LibraryElement _exportedLibrary;
1443 /** 1812 /**
1444 * The combinators that were specified as part of the export directive in the order in which they 1813 * The combinators that were specified as part of the export directive in the order in which they
1445 * were specified. 1814 * were specified.
1446 */ 1815 */
1447 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; 1816 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY;
1448 /** 1817 /**
1449 * Initialize a newly created export element. 1818 * Initialize a newly created export element.
1450 */ 1819 */
1451 ExportElementImpl() : super.con1(null) { 1820 ExportElementImpl() : super.con1(null) {
1452 } 1821 }
1453 List<NamespaceCombinator> get combinators => _combinators; 1822 List<NamespaceCombinator> get combinators => _combinators;
1454 LibraryElement get exportedLibrary => _exportedLibrary; 1823 LibraryElement get exportedLibrary => _exportedLibrary;
1455 ElementKind get kind => ElementKind.EXPORT; 1824 ElementKind get kind => ElementKind.EXPORT;
1456 /** 1825 /**
1457 * Set the combinators that were specified as part of the export directive to the given array of 1826 * Set the combinators that were specified as part of the export directive to the given array of
1458 * combinators. 1827 * combinators.
1459 * @param combinators the combinators that were specified as part of the expor t directive 1828 * @param combinators the combinators that were specified as part of the expor t directive
1460 */ 1829 */
1461 void set combinators2(List<NamespaceCombinator> combinators) { 1830 void set combinators(List<NamespaceCombinator> combinators2) {
1462 this._combinators = combinators; 1831 this._combinators = combinators2;
1463 } 1832 }
1464 /** 1833 /**
1465 * Set the library that is exported from this library by this import directive to the given 1834 * Set the library that is exported from this library by this import directive to the given
1466 * library. 1835 * library.
1467 * @param exportedLibrary the library that is exported from this library 1836 * @param exportedLibrary the library that is exported from this library
1468 */ 1837 */
1469 void set exportedLibrary2(LibraryElement exportedLibrary) { 1838 void set exportedLibrary(LibraryElement exportedLibrary2) {
1470 this._exportedLibrary = exportedLibrary; 1839 this._exportedLibrary = exportedLibrary2;
1840 }
1841 void appendTo(StringBuffer builder) {
1842 builder.add("export ");
1843 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder);
1471 } 1844 }
1472 } 1845 }
1473 /** 1846 /**
1474 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme nt}. 1847 * Instances of the class {@code FieldElementImpl} implement a {@code FieldEleme nt}.
1475 */ 1848 */
1476 class FieldElementImpl extends VariableElementImpl implements FieldElement { 1849 class FieldElementImpl extends VariableElementImpl implements FieldElement {
1477 /** 1850 /**
1478 * The getter associated with this field. 1851 * The getter associated with this field.
1479 */ 1852 */
1480 PropertyAccessorElement _getter; 1853 PropertyAccessorElement _getter;
1481 /** 1854 /**
1482 * 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. 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.
1483 */ 1856 */
1484 PropertyAccessorElement _setter; 1857 PropertyAccessorElement _setter;
1485 /** 1858 /**
1486 * An empty array of field elements. 1859 * An empty array of field elements.
1487 */ 1860 */
1488 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>.fixedLength(0); 1861 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>.fixedLength(0);
1489 /** 1862 /**
1490 * Initialize a newly created field element to have the given name. 1863 * Initialize a newly created field element to have the given name.
1491 * @param name the name of this element 1864 * @param name the name of this element
1492 */ 1865 */
1493 FieldElementImpl.con1(Identifier name) : super.con1(name) { 1866 FieldElementImpl.con1(Identifier name) : super.con1(name) {
1494 _jtd_constructor_136_impl(name); 1867 _jtd_constructor_142_impl(name);
1495 } 1868 }
1496 _jtd_constructor_136_impl(Identifier name) { 1869 _jtd_constructor_142_impl(Identifier name) {
1497 } 1870 }
1498 /** 1871 /**
1499 * Initialize a newly created synthetic field element to have the given name. 1872 * Initialize a newly created synthetic field element to have the given name.
1500 * @param name the name of this element 1873 * @param name the name of this element
1501 */ 1874 */
1502 FieldElementImpl.con2(String name) : super.con2(name, -1) { 1875 FieldElementImpl.con2(String name) : super.con2(name, -1) {
1503 _jtd_constructor_137_impl(name); 1876 _jtd_constructor_143_impl(name);
1504 } 1877 }
1505 _jtd_constructor_137_impl(String name) { 1878 _jtd_constructor_143_impl(String name) {
1506 synthetic = true; 1879 synthetic = true;
1507 } 1880 }
1508 PropertyAccessorElement get getter => _getter; 1881 PropertyAccessorElement get getter => _getter;
1509 ElementKind get kind => ElementKind.FIELD; 1882 ElementKind get kind => ElementKind.FIELD;
1510 PropertyAccessorElement get setter => _setter; 1883 PropertyAccessorElement get setter => _setter;
1511 bool isStatic() => hasModifier(Modifier.STATIC); 1884 bool isStatic() => hasModifier(Modifier.STATIC);
1512 /** 1885 /**
1513 * Set the getter associated with this field to the given accessor. 1886 * Set the getter associated with this field to the given accessor.
1514 * @param getter the getter associated with this field 1887 * @param getter the getter associated with this field
1515 */ 1888 */
1516 void set getter2(PropertyAccessorElement getter) { 1889 void set getter(PropertyAccessorElement getter2) {
1517 this._getter = getter; 1890 this._getter = getter2;
1518 } 1891 }
1519 /** 1892 /**
1520 * Set the setter associated with this field to the given accessor. 1893 * Set the setter associated with this field to the given accessor.
1521 * @param setter the setter associated with this field 1894 * @param setter the setter associated with this field
1522 */ 1895 */
1523 void set setter2(PropertyAccessorElement setter) { 1896 void set setter(PropertyAccessorElement setter2) {
1524 this._setter = setter; 1897 this._setter = setter2;
1525 } 1898 }
1526 /** 1899 /**
1527 * Set whether this field is static to correspond to the given value. 1900 * Set whether this field is static to correspond to the given value.
1528 * @param isStatic {@code true} if the field is static 1901 * @param isStatic {@code true} if the field is static
1529 */ 1902 */
1530 void set static(bool isStatic) { 1903 void set static(bool isStatic) {
1531 setModifier(Modifier.STATIC, isStatic); 1904 setModifier(Modifier.STATIC, isStatic);
1532 } 1905 }
1533 String toString() => "field ${type} ${name}";
1534 } 1906 }
1535 /** 1907 /**
1536 * Instances of the class {@code FunctionElementImpl} implement a {@code Functio nElement}. 1908 * Instances of the class {@code FunctionElementImpl} implement a {@code Functio nElement}.
1537 */ 1909 */
1538 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme nt { 1910 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme nt {
1539 /** 1911 /**
1912 * The offset to the beginning of the visible range for this element.
1913 */
1914 int _visibleRangeOffset = 0;
1915 /**
1916 * The length of the visible range for this element, or {@code -1} if this ele ment does not have a
1917 * visible range.
1918 */
1919 int _visibleRangeLength = -1;
1920 /**
1540 * An empty array of function elements. 1921 * An empty array of function elements.
1541 */ 1922 */
1542 static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>.fixedLeng th(0); 1923 static List<FunctionElement> EMPTY_ARRAY = new List<FunctionElement>.fixedLeng th(0);
1543 /** 1924 /**
1544 * Initialize a newly created synthetic function element. 1925 * Initialize a newly created synthetic function element.
1545 */ 1926 */
1546 FunctionElementImpl() : super.con2("", -1) { 1927 FunctionElementImpl() : super.con2("", -1) {
1547 _jtd_constructor_138_impl(); 1928 _jtd_constructor_144_impl();
1548 } 1929 }
1549 _jtd_constructor_138_impl() { 1930 _jtd_constructor_144_impl() {
1550 synthetic = true; 1931 synthetic = true;
1551 } 1932 }
1552 /** 1933 /**
1553 * Initialize a newly created function element to have the given name. 1934 * Initialize a newly created function element to have the given name.
1554 * @param name the name of this element 1935 * @param name the name of this element
1555 */ 1936 */
1556 FunctionElementImpl.con1(Identifier name) : super.con1(name) { 1937 FunctionElementImpl.con1(Identifier name) : super.con1(name) {
1557 _jtd_constructor_139_impl(name); 1938 _jtd_constructor_145_impl(name);
1558 } 1939 }
1559 _jtd_constructor_139_impl(Identifier name) { 1940 _jtd_constructor_145_impl(Identifier name) {
1560 } 1941 }
1561 String get identifier => name; 1942 String get identifier => name;
1562 ElementKind get kind => ElementKind.FUNCTION; 1943 ElementKind get kind => ElementKind.FUNCTION;
1944 SourceRange get visibleRange {
1945 if (_visibleRangeLength < 0) {
1946 return null;
1947 }
1948 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
1949 }
1950 /**
1951 * Set the visible range for this element to the range starting at the given o ffset with the given
1952 * length.
1953 * @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
1955 * does not have a visible range
1956 */
1957 void setVisibleRange(int offset, int length) {
1958 _visibleRangeOffset = offset;
1959 _visibleRangeLength = length;
1960 }
1961 void appendTo(StringBuffer builder) {
1962 String name13 = name;
1963 if (name13 != null) {
1964 builder.add(name13);
1965 }
1966 super.appendTo(builder);
1967 }
1563 } 1968 }
1564 /** 1969 /**
1565 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}. 1970 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}.
1566 */ 1971 */
1567 class HideCombinatorImpl implements HideCombinator { 1972 class HideCombinatorImpl implements HideCombinator {
1568 /** 1973 /**
1569 * The names that are not to be made visible in the importing library even if they are defined in 1974 * The names that are not to be made visible in the importing library even if they are defined in
1570 * the imported library. 1975 * the imported library.
1571 */ 1976 */
1572 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; 1977 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY;
1573 /** 1978 /**
1574 * Initialize a newly created combinator. 1979 * Initialize a newly created combinator.
1575 */ 1980 */
1576 HideCombinatorImpl() : super() { 1981 HideCombinatorImpl() : super() {
1577 } 1982 }
1578 List<String> get hiddenNames => _hiddenNames; 1983 List<String> get hiddenNames => _hiddenNames;
1579 /** 1984 /**
1580 * Set the names that are not to be made visible in the importing library even if they are defined 1985 * Set the names that are not to be made visible in the importing library even if they are defined
1581 * in the imported library to the given names. 1986 * in the imported library to the given names.
1582 * @param hiddenNames the names that are not to be made visible in the importi ng library 1987 * @param hiddenNames the names that are not to be made visible in the importi ng library
1583 */ 1988 */
1584 void set hiddenNames2(List<String> hiddenNames) { 1989 void set hiddenNames(List<String> hiddenNames2) {
1585 this._hiddenNames = hiddenNames; 1990 this._hiddenNames = hiddenNames2;
1991 }
1992 String toString() {
1993 StringBuffer builder = new StringBuffer();
1994 builder.add("show ");
1995 int count = _hiddenNames.length;
1996 for (int i = 0; i < count; i++) {
1997 if (i > 0) {
1998 builder.add(", ");
1999 }
2000 builder.add(_hiddenNames[i]);
2001 }
2002 return builder.toString();
1586 } 2003 }
1587 } 2004 }
1588 /** 2005 /**
1589 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen t}. 2006 * Instances of the class {@code HtmlElementImpl} implement an {@link HtmlElemen t}.
1590 */ 2007 */
1591 class HtmlElementImpl extends ElementImpl implements HtmlElement { 2008 class HtmlElementImpl extends ElementImpl implements HtmlElement {
1592 /** 2009 /**
1593 * An empty array of HTML file elements. 2010 * An empty array of HTML file elements.
1594 */ 2011 */
1595 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>.fixedLength(0); 2012 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>.fixedLength(0);
(...skipping 10 matching lines...) Expand all
1606 */ 2023 */
1607 Source _source; 2024 Source _source;
1608 /** 2025 /**
1609 * Initialize a newly created HTML element to have the given name. 2026 * Initialize a newly created HTML element to have the given name.
1610 * @param context the analysis context in which the HTML file is defined 2027 * @param context the analysis context in which the HTML file is defined
1611 * @param name the name of this element 2028 * @param name the name of this element
1612 */ 2029 */
1613 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { 2030 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) {
1614 this._context = context; 2031 this._context = context;
1615 } 2032 }
1616 bool operator ==(Object object) => this.runtimeType == object.runtimeType && _ source == (object as CompilationUnitElementImpl).source; 2033 bool operator ==(Object object) => identical(this.runtimeType, object.runtimeT ype) && _source == ((object as CompilationUnitElementImpl)).source;
1617 AnalysisContext get context => _context; 2034 AnalysisContext get context => _context;
1618 ElementKind get kind => ElementKind.HTML; 2035 ElementKind get kind => ElementKind.HTML;
1619 List<LibraryElement> get libraries => _libraries; 2036 List<LibraryElement> get libraries => _libraries;
1620 Source get source => _source; 2037 Source get source => _source;
1621 int get hashCode => _source.hashCode; 2038 int get hashCode => _source.hashCode;
1622 /** 2039 /**
1623 * Set the libraries contained in or referenced from script tags in the HTML f ile to the given 2040 * Set the libraries contained in or referenced from script tags in the HTML f ile to the given
1624 * libraries. 2041 * libraries.
1625 * @param libraries the libraries contained in or referenced from script tags in the HTML file 2042 * @param libraries the libraries contained in or referenced from script tags in the HTML file
1626 */ 2043 */
1627 void set libraries2(List<LibraryElement> libraries) { 2044 void set libraries(List<LibraryElement> libraries2) {
1628 this._libraries = libraries; 2045 this._libraries = libraries2;
1629 } 2046 }
1630 /** 2047 /**
1631 * Set the source that corresponds to this HTML file to the given source. 2048 * Set the source that corresponds to this HTML file to the given source.
1632 * @param source the source that corresponds to this HTML file 2049 * @param source the source that corresponds to this HTML file
1633 */ 2050 */
1634 void set source4(Source source) { 2051 void set source(Source source6) {
1635 this._source = source; 2052 this._source = source6;
2053 }
2054 void appendTo(StringBuffer builder) {
2055 if (_source == null) {
2056 builder.add("{HTML file}");
2057 } else {
2058 builder.add(_source.fullName);
2059 }
1636 } 2060 }
1637 } 2061 }
1638 /** 2062 /**
1639 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl ement}. 2063 * Instances of the class {@code ImportElementImpl} implement an {@link ImportEl ement}.
1640 */ 2064 */
1641 class ImportElementImpl extends ElementImpl implements ImportElement { 2065 class ImportElementImpl extends ElementImpl implements ImportElement {
1642 /** 2066 /**
1643 * The library that is imported into this library by this import directive. 2067 * The library that is imported into this library by this import directive.
1644 */ 2068 */
1645 LibraryElement _importedLibrary; 2069 LibraryElement _importedLibrary;
(...skipping 14 matching lines...) Expand all
1660 } 2084 }
1661 List<NamespaceCombinator> get combinators => _combinators; 2085 List<NamespaceCombinator> get combinators => _combinators;
1662 LibraryElement get importedLibrary => _importedLibrary; 2086 LibraryElement get importedLibrary => _importedLibrary;
1663 ElementKind get kind => ElementKind.IMPORT; 2087 ElementKind get kind => ElementKind.IMPORT;
1664 PrefixElement get prefix => _prefix; 2088 PrefixElement get prefix => _prefix;
1665 /** 2089 /**
1666 * Set the combinators that were specified as part of the import directive to the given array of 2090 * Set the combinators that were specified as part of the import directive to the given array of
1667 * combinators. 2091 * combinators.
1668 * @param combinators the combinators that were specified as part of the impor t directive 2092 * @param combinators the combinators that were specified as part of the impor t directive
1669 */ 2093 */
1670 void set combinators3(List<NamespaceCombinator> combinators) { 2094 void set combinators(List<NamespaceCombinator> combinators3) {
1671 this._combinators = combinators; 2095 this._combinators = combinators3;
1672 } 2096 }
1673 /** 2097 /**
1674 * Set the library that is imported into this library by this import directive to the given 2098 * Set the library that is imported into this library by this import directive to the given
1675 * library. 2099 * library.
1676 * @param importedLibrary the library that is imported into this library 2100 * @param importedLibrary the library that is imported into this library
1677 */ 2101 */
1678 void set importedLibrary2(LibraryElement importedLibrary) { 2102 void set importedLibrary(LibraryElement importedLibrary3) {
1679 this._importedLibrary = importedLibrary; 2103 this._importedLibrary = importedLibrary3;
1680 } 2104 }
1681 /** 2105 /**
1682 * Set the prefix that was specified as part of the import directive to the gi ven prefix. 2106 * Set the prefix that was specified as part of the import directive to the gi ven prefix.
1683 * @param prefix the prefix that was specified as part of the import directive 2107 * @param prefix the prefix that was specified as part of the import directive
1684 */ 2108 */
1685 void set prefix4(PrefixElement prefix) { 2109 void set prefix(PrefixElement prefix3) {
1686 this._prefix = prefix; 2110 this._prefix = prefix3;
2111 }
2112 void appendTo(StringBuffer builder) {
2113 builder.add("import ");
2114 ((_importedLibrary as LibraryElementImpl)).appendTo(builder);
1687 } 2115 }
1688 } 2116 }
1689 /** 2117 /**
1690 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme nt}. 2118 * Instances of the class {@code LabelElementImpl} implement a {@code LabelEleme nt}.
1691 */ 2119 */
1692 class LabelElementImpl extends ElementImpl implements LabelElement { 2120 class LabelElementImpl extends ElementImpl implements LabelElement {
1693 /** 2121 /**
1694 * A flag indicating whether this label is associated with a {@code switch} st atement. 2122 * A flag indicating whether this label is associated with a {@code switch} st atement.
1695 */ 2123 */
1696 bool _onSwitchStatement = false; 2124 bool _onSwitchStatement = false;
1697 /** 2125 /**
1698 * A flag indicating whether this label is associated with a {@code switch} me mber ({@code case}or {@code default}). 2126 * A flag indicating whether this label is associated with a {@code switch} me mber ({@code case}or {@code default}).
1699 */ 2127 */
1700 bool _onSwitchMember = false; 2128 bool _onSwitchMember = false;
1701 /** 2129 /**
1702 * An empty array of label elements. 2130 * An empty array of label elements.
1703 */ 2131 */
1704 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>.fixedLength(0); 2132 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>.fixedLength(0);
1705 /** 2133 /**
1706 * Initialize a newly created label element to have the given name. 2134 * Initialize a newly created label element to have the given name.
1707 * @param name the name of this element 2135 * @param name the name of this element
1708 * @param onSwitchStatement {@code true} if this label is associated with a {@ code switch}statement 2136 * @param onSwitchStatement {@code true} if this label is associated with a {@ code switch}statement
1709 * @param onSwitchMember {@code true} if this label is associated with a {@cod e switch} member 2137 * @param onSwitchMember {@code true} if this label is associated with a {@cod e switch} member
1710 */ 2138 */
1711 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) { 2139 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember) : super.con1(name) {
1712 this._onSwitchStatement = onSwitchStatement; 2140 this._onSwitchStatement = onSwitchStatement;
1713 this._onSwitchMember = onSwitchMember; 2141 this._onSwitchMember = onSwitchMember;
1714 } 2142 }
1715 ExecutableElement get enclosingElement => super.enclosingElement as Executable Element; 2143 ExecutableElement get enclosingElement => (super.enclosingElement as Executabl eElement);
1716 ElementKind get kind => ElementKind.LABEL; 2144 ElementKind get kind => ElementKind.LABEL;
1717 /** 2145 /**
1718 * Return {@code true} if this label is associated with a {@code switch} membe r ({@code case} or{@code default}). 2146 * Return {@code true} if this label is associated with a {@code switch} membe r ({@code case} or{@code default}).
1719 * @return {@code true} if this label is associated with a {@code switch} memb er 2147 * @return {@code true} if this label is associated with a {@code switch} memb er
1720 */ 2148 */
1721 bool isOnSwitchMember() => _onSwitchMember; 2149 bool isOnSwitchMember() => _onSwitchMember;
1722 /** 2150 /**
1723 * Return {@code true} if this label is associated with a {@code switch} state ment. 2151 * Return {@code true} if this label is associated with a {@code switch} state ment.
1724 * @return {@code true} if this label is associated with a {@code switch} stat ement 2152 * @return {@code true} if this label is associated with a {@code switch} stat ement
1725 */ 2153 */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 */ 2186 */
1759 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; 2187 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY;
1760 /** 2188 /**
1761 * Initialize a newly created library element to have the given name. 2189 * Initialize a newly created library element to have the given name.
1762 * @param context the analysis context in which the library is defined 2190 * @param context the analysis context in which the library is defined
1763 * @param name the name of this element 2191 * @param name the name of this element
1764 */ 2192 */
1765 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co n1(name) { 2193 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co n1(name) {
1766 this._context = context; 2194 this._context = context;
1767 } 2195 }
1768 bool operator ==(Object object) => this.runtimeType == object.runtimeType && _ definingCompilationUnit == (object as LibraryElementImpl).definingCompilationUni t; 2196 bool operator ==(Object object) => identical(this.runtimeType, object.runtimeT ype) && _definingCompilationUnit == ((object as LibraryElementImpl)).definingCom pilationUnit;
1769 ElementImpl getChild(String identifier) { 2197 ElementImpl getChild(String identifier22) {
1770 if ((_definingCompilationUnit as CompilationUnitElementImpl).identifier == i dentifier) { 2198 if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier22) {
1771 return _definingCompilationUnit as CompilationUnitElementImpl; 2199 return (_definingCompilationUnit as CompilationUnitElementImpl);
1772 } 2200 }
1773 for (CompilationUnitElement part in _parts) { 2201 for (CompilationUnitElement part in _parts) {
1774 if ((part as CompilationUnitElementImpl).identifier == identifier) { 2202 if (((part as CompilationUnitElementImpl)).identifier == identifier22) {
1775 return part as CompilationUnitElementImpl; 2203 return (part as CompilationUnitElementImpl);
1776 } 2204 }
1777 } 2205 }
1778 return null; 2206 return null;
1779 } 2207 }
1780 AnalysisContext get context => _context; 2208 AnalysisContext get context => _context;
1781 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit ; 2209 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit ;
1782 FunctionElement get entryPoint => _entryPoint; 2210 FunctionElement get entryPoint => _entryPoint;
2211 List<LibraryElement> get exportedLibraries {
2212 Set<LibraryElement> libraries = new Set<LibraryElement>();
2213 for (ExportElement element in _exports) {
2214 LibraryElement library = element.exportedLibrary;
2215 javaSetAdd(libraries, library);
2216 }
2217 return new List.from(libraries);
2218 }
1783 List<ExportElement> get exports => _exports; 2219 List<ExportElement> get exports => _exports;
1784 String get identifier => _definingCompilationUnit.source.fullName; 2220 String get identifier => _definingCompilationUnit.source.fullName;
1785 List<LibraryElement> get importedLibraries { 2221 List<LibraryElement> get importedLibraries {
1786 Set<LibraryElement> libraries = new Set<LibraryElement>(); 2222 Set<LibraryElement> libraries = new Set<LibraryElement>();
1787 for (ImportElement element in _imports) { 2223 for (ImportElement element in _imports) {
1788 LibraryElement prefix = element.importedLibrary; 2224 LibraryElement prefix = element.importedLibrary;
1789 javaSetAdd(libraries, prefix); 2225 javaSetAdd(libraries, prefix);
1790 } 2226 }
1791 return new List.from(libraries); 2227 return new List.from(libraries);
1792 } 2228 }
1793 List<ImportElement> get imports => _imports; 2229 List<ImportElement> get imports => _imports;
1794 ElementKind get kind => ElementKind.LIBRARY; 2230 ElementKind get kind => ElementKind.LIBRARY;
1795 List<CompilationUnitElement> get parts => _parts; 2231 List<CompilationUnitElement> get parts => _parts;
1796 List<PrefixElement> get prefixes { 2232 List<PrefixElement> get prefixes {
1797 Set<PrefixElement> prefixes = new Set<PrefixElement>(); 2233 Set<PrefixElement> prefixes = new Set<PrefixElement>();
1798 for (ImportElement element in _imports) { 2234 for (ImportElement element in _imports) {
1799 PrefixElement prefix5 = element.prefix; 2235 PrefixElement prefix4 = element.prefix;
1800 if (prefix5 != null) { 2236 if (prefix4 != null) {
1801 javaSetAdd(prefixes, prefix5); 2237 javaSetAdd(prefixes, prefix4);
1802 } 2238 }
1803 } 2239 }
1804 return new List.from(prefixes); 2240 return new List.from(prefixes);
1805 } 2241 }
1806 int get hashCode => _definingCompilationUnit.hashCode; 2242 int get hashCode => _definingCompilationUnit.hashCode;
2243 bool isBrowserApplication() => _entryPoint != null && isOrImportsBrowserLibrar y();
1807 /** 2244 /**
1808 * Set the compilation unit that defines this library to the given compilation unit. 2245 * Set the compilation unit that defines this library to the given compilation unit.
1809 * @param definingCompilationUnit the compilation unit that defines this libra ry 2246 * @param definingCompilationUnit the compilation unit that defines this libra ry
1810 */ 2247 */
1811 void set definingCompilationUnit2(CompilationUnitElement definingCompilationUn it) { 2248 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni t2) {
1812 (definingCompilationUnit as CompilationUnitElementImpl).enclosingElement2 = this; 2249 ((definingCompilationUnit2 as CompilationUnitElementImpl)).enclosingElement = this;
1813 this._definingCompilationUnit = definingCompilationUnit; 2250 this._definingCompilationUnit = definingCompilationUnit2;
1814 } 2251 }
1815 /** 2252 /**
1816 * Set the entry point for this library to the given function. 2253 * Set the entry point for this library to the given function.
1817 * @param entryPoint the entry point for this library 2254 * @param entryPoint the entry point for this library
1818 */ 2255 */
1819 void set entryPoint2(FunctionElement entryPoint) { 2256 void set entryPoint(FunctionElement entryPoint2) {
1820 (entryPoint as FunctionElementImpl).enclosingElement2 = this; 2257 ((entryPoint2 as FunctionElementImpl)).enclosingElement = this;
1821 this._entryPoint = entryPoint; 2258 this._entryPoint = entryPoint2;
1822 } 2259 }
1823 /** 2260 /**
1824 * Set the specifications of all of the exports defined in this library to the given array. 2261 * Set the specifications of all of the exports defined in this library to the given array.
1825 * @param exports the specifications of all of the exports defined in this lib rary 2262 * @param exports the specifications of all of the exports defined in this lib rary
1826 */ 2263 */
1827 void set exports2(List<ExportElement> exports) { 2264 void set exports(List<ExportElement> exports2) {
1828 this._exports = exports; 2265 this._exports = exports2;
1829 } 2266 }
1830 /** 2267 /**
1831 * Set the specifications of all of the imports defined in this library to the given array. 2268 * Set the specifications of all of the imports defined in this library to the given array.
1832 * @param imports the specifications of all of the imports defined in this lib rary 2269 * @param imports the specifications of all of the imports defined in this lib rary
1833 */ 2270 */
1834 void set imports2(List<ImportElement> imports) { 2271 void set imports(List<ImportElement> imports2) {
1835 this._imports = imports; 2272 this._imports = imports2;
1836 } 2273 }
1837 /** 2274 /**
1838 * Set the compilation units that are included in this library using a {@code part} directive. 2275 * Set the compilation units that are included in this library using a {@code part} directive.
1839 * @param parts 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
1840 */ 2277 */
1841 void set parts2(List<CompilationUnitElement> parts) { 2278 void set parts(List<CompilationUnitElement> parts2) {
1842 for (CompilationUnitElement compilationUnit in parts) { 2279 for (CompilationUnitElement compilationUnit in parts2) {
1843 (compilationUnit as CompilationUnitElementImpl).enclosingElement2 = this; 2280 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this;
1844 } 2281 }
1845 this._parts = parts; 2282 this._parts = parts2;
2283 }
2284 /**
2285 * 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
2287 */
2288 bool isOrImportsBrowserLibrary() {
2289 List<LibraryElement> visited = new List<LibraryElement>(10);
2290 Source htmlLibSource = definingCompilationUnit.source.resolve(DartSdk.DART_H TML);
2291 visited.add(this);
2292 for (int index = 0; index < visited.length; index++) {
2293 LibraryElement library = visited[index];
2294 Source source8 = library.definingCompilationUnit.source;
2295 if (source8 == htmlLibSource) {
2296 return true;
2297 }
2298 for (LibraryElement importedLibrary in library.importedLibraries) {
2299 if (!visited.contains(importedLibrary)) {
2300 visited.add(importedLibrary);
2301 }
2302 }
2303 for (LibraryElement exportedLibrary in library.exportedLibraries) {
2304 if (!visited.contains(exportedLibrary)) {
2305 visited.add(exportedLibrary);
2306 }
2307 }
2308 }
2309 return false;
1846 } 2310 }
1847 } 2311 }
1848 /** 2312 /**
1849 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle ment}. 2313 * Instances of the class {@code MethodElementImpl} implement a {@code MethodEle ment}.
1850 */ 2314 */
1851 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { 2315 class MethodElementImpl extends ExecutableElementImpl implements MethodElement {
1852 /** 2316 /**
1853 * An empty array of method elements. 2317 * An empty array of method elements.
1854 */ 2318 */
1855 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>.fixedLength(0 ); 2319 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>.fixedLength(0 );
1856 /** 2320 /**
1857 * Initialize a newly created method element to have the given name. 2321 * Initialize a newly created method element to have the given name.
1858 * @param name the name of this element 2322 * @param name the name of this element
1859 */ 2323 */
1860 MethodElementImpl(Identifier name) : super.con1(name) { 2324 MethodElementImpl.con1(Identifier name) : super.con1(name) {
2325 _jtd_constructor_151_impl(name);
1861 } 2326 }
1862 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 2327 _jtd_constructor_151_impl(Identifier name) {
2328 }
2329 /**
2330 * Initialize a newly created method element to have the given name.
2331 * @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
2333 * declaration of this element
2334 */
2335 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff set) {
2336 _jtd_constructor_152_impl(name, nameOffset);
2337 }
2338 _jtd_constructor_152_impl(String name, int nameOffset) {
2339 }
2340 ClassElement get enclosingElement => (super.enclosingElement as ClassElement);
1863 ElementKind get kind => ElementKind.METHOD; 2341 ElementKind get kind => ElementKind.METHOD;
1864 bool isAbstract() => hasModifier(Modifier.ABSTRACT); 2342 bool isAbstract() => hasModifier(Modifier.ABSTRACT);
1865 bool isStatic() => hasModifier(Modifier.STATIC); 2343 bool isStatic() => hasModifier(Modifier.STATIC);
1866 /** 2344 /**
1867 * Set whether this method is abstract to correspond to the given value. 2345 * Set whether this method is abstract to correspond to the given value.
1868 * @param isAbstract {@code true} if the method is abstract 2346 * @param isAbstract {@code true} if the method is abstract
1869 */ 2347 */
1870 void set abstract(bool isAbstract) { 2348 void set abstract(bool isAbstract) {
1871 setModifier(Modifier.ABSTRACT, isAbstract); 2349 setModifier(Modifier.ABSTRACT, isAbstract);
1872 } 2350 }
1873 /** 2351 /**
1874 * Set whether this method is static to correspond to the given value. 2352 * Set whether this method is static to correspond to the given value.
1875 * @param isStatic {@code true} if the method is static 2353 * @param isStatic {@code true} if the method is static
1876 */ 2354 */
1877 void set static(bool isStatic) { 2355 void set static(bool isStatic) {
1878 setModifier(Modifier.STATIC, isStatic); 2356 setModifier(Modifier.STATIC, isStatic);
1879 } 2357 }
1880 String toString() { 2358 void appendTo(StringBuffer builder) {
1881 StringBuffer builder = new StringBuffer();
1882 builder.add("method ");
1883 builder.add(enclosingElement.name); 2359 builder.add(enclosingElement.name);
1884 builder.add("."); 2360 builder.add(".");
1885 builder.add(name); 2361 builder.add(name);
1886 builder.add(type); 2362 super.appendTo(builder);
1887 return builder.toString();
1888 } 2363 }
1889 } 2364 }
1890 /** 2365 /**
1891 * The enumeration {@code Modifier} defines constants for all of the modifiers d efined by the Dart 2366 * The enumeration {@code Modifier} defines constants for all of the modifiers d efined by the Dart
1892 * language. 2367 * language and for a few additional flags that are useful.
1893 */ 2368 */
1894 class Modifier { 2369 class Modifier {
1895 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); 2370 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0);
1896 static final Modifier CONST = new Modifier('CONST', 1); 2371 static final Modifier CONST = new Modifier('CONST', 1);
1897 static final Modifier FACTORY = new Modifier('FACTORY', 2); 2372 static final Modifier FACTORY = new Modifier('FACTORY', 2);
1898 static final Modifier FINAL = new Modifier('FINAL', 3); 2373 static final Modifier FINAL = new Modifier('FINAL', 3);
1899 static final Modifier GETTER = new Modifier('GETTER', 4); 2374 static final Modifier GETTER = new Modifier('GETTER', 4);
1900 static final Modifier SETTER = new Modifier('SETTER', 5); 2375 static final Modifier INITIALIZING_FORMAL = new Modifier('INITIALIZING_FORMAL' , 5);
1901 static final Modifier STATIC = new Modifier('STATIC', 6); 2376 static final Modifier SETTER = new Modifier('SETTER', 6);
1902 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 7); 2377 static final Modifier STATIC = new Modifier('STATIC', 7);
1903 static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER, SETTER, STATIC, SYNTHETIC]; 2378 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 8);
2379 static final List<Modifier> values = [ABSTRACT, CONST, FACTORY, FINAL, GETTER, INITIALIZING_FORMAL, SETTER, STATIC, SYNTHETIC];
1904 final String __name; 2380 final String __name;
1905 final int __ordinal; 2381 final int __ordinal;
1906 Modifier(this.__name, this.__ordinal) { 2382 Modifier(this.__name, this.__ordinal) {
1907 } 2383 }
1908 String toString() => __name; 2384 String toString() => __name;
1909 } 2385 }
1910 /** 2386 /**
1911 * Instances of the class {@code MultiplyDefinedElementImpl} represent a collect ion of elements that 2387 * Instances of the class {@code MultiplyDefinedElementImpl} represent a collect ion of elements that
1912 * have the same name within the same scope. 2388 * have the same name within the same scope.
1913 */ 2389 */
(...skipping 23 matching lines...) Expand all
1937 Element getAncestor(Type elementClass) => null; 2413 Element getAncestor(Type elementClass) => null;
1938 List<Element> get conflictingElements => _conflictingElements; 2414 List<Element> get conflictingElements => _conflictingElements;
1939 AnalysisContext get context => _context; 2415 AnalysisContext get context => _context;
1940 Element get enclosingElement => null; 2416 Element get enclosingElement => null;
1941 ElementKind get kind => ElementKind.ERROR; 2417 ElementKind get kind => ElementKind.ERROR;
1942 LibraryElement get library => null; 2418 LibraryElement get library => null;
1943 ElementLocation get location => null; 2419 ElementLocation get location => null;
1944 List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY; 2420 List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY;
1945 String get name => _name; 2421 String get name => _name;
1946 int get nameOffset => -1; 2422 int get nameOffset => -1;
2423 Source get source => null;
2424 bool isAccessibleIn(LibraryElement library) {
2425 for (Element element in _conflictingElements) {
2426 if (element.isAccessibleIn(library)) {
2427 return true;
2428 }
2429 }
2430 return false;
2431 }
1947 bool isSynthetic() => true; 2432 bool isSynthetic() => true;
2433 String toString() {
2434 StringBuffer builder = new StringBuffer();
2435 builder.add("[");
2436 int count = _conflictingElements.length;
2437 for (int i = 0; i < count; i++) {
2438 if (i > 0) {
2439 builder.add(", ");
2440 }
2441 ((_conflictingElements[i] as ElementImpl)).appendTo(builder);
2442 }
2443 builder.add("]");
2444 return builder.toString();
2445 }
1948 /** 2446 /**
1949 * Add the given element to the list of elements. If the element is a multiply -defined element, 2447 * Add the given element to the list of elements. If the element is a multiply -defined element,
1950 * add all of the conflicting elements that it represents. 2448 * add all of the conflicting elements that it represents.
1951 * @param elements the list to which the element(s) are to be added 2449 * @param elements the list to which the element(s) are to be added
1952 * @param element the element(s) to be added 2450 * @param element the element(s) to be added
1953 */ 2451 */
1954 void add(List<Element> elements, Element element) { 2452 void add(List<Element> elements, Element element) {
1955 if (element is MultiplyDefinedElementImpl) { 2453 if (element is MultiplyDefinedElementImpl) {
1956 for (Element conflictingElement in (element as MultiplyDefinedElementImpl) ._conflictingElements) { 2454 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl ))._conflictingElements) {
1957 elements.add(conflictingElement); 2455 elements.add(conflictingElement);
1958 } 2456 }
1959 } else { 2457 } else {
1960 elements.add(element); 2458 elements.add(element);
1961 } 2459 }
1962 } 2460 }
1963 /** 2461 /**
1964 * Use the given elements to construct an array of conflicting elements. If ei ther of the given 2462 * Use the given elements to construct an array of conflicting elements. If ei ther of the given
1965 * elements are multiply-defined elements then the conflicting elements they r epresent will be 2463 * elements are multiply-defined elements then the conflicting elements they r epresent will be
1966 * included in the array. Otherwise, the element itself will be included. 2464 * included in the array. Otherwise, the element itself will be included.
(...skipping 21 matching lines...) Expand all
1988 */ 2486 */
1989 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>.fixedLe ngth(0); 2487 static List<ParameterElement> EMPTY_ARRAY = new List<ParameterElement>.fixedLe ngth(0);
1990 /** 2488 /**
1991 * Initialize a newly created parameter element to have the given name. 2489 * Initialize a newly created parameter element to have the given name.
1992 * @param name the name of this element 2490 * @param name the name of this element
1993 */ 2491 */
1994 ParameterElementImpl(Identifier name) : super.con1(name) { 2492 ParameterElementImpl(Identifier name) : super.con1(name) {
1995 } 2493 }
1996 ElementKind get kind => ElementKind.PARAMETER; 2494 ElementKind get kind => ElementKind.PARAMETER;
1997 ParameterKind get parameterKind => _parameterKind; 2495 ParameterKind get parameterKind => _parameterKind;
2496 bool isInitializingFormal() => hasModifier(Modifier.INITIALIZING_FORMAL);
2497 /**
2498 * 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
2500 */
2501 void set initializingFormal(bool isInitializingFormal) {
2502 setModifier(Modifier.INITIALIZING_FORMAL, isInitializingFormal);
2503 }
1998 /** 2504 /**
1999 * Set the kind of this parameter to the given kind. 2505 * Set the kind of this parameter to the given kind.
2000 * @param parameterKind the new kind of this parameter 2506 * @param parameterKind the new kind of this parameter
2001 */ 2507 */
2002 void set parameterKind2(ParameterKind parameterKind) { 2508 void set parameterKind(ParameterKind parameterKind2) {
2003 this._parameterKind = parameterKind; 2509 this._parameterKind = parameterKind2;
2004 } 2510 }
2005 String toString() => "parameter ${type} ${name} (${kind})"; 2511 void appendTo(StringBuffer builder) {
2512 builder.add(type);
2513 builder.add(" ");
2514 builder.add(name);
2515 builder.add(" (");
2516 builder.add(kind);
2517 builder.add(")");
2518 }
2006 } 2519 }
2007 /** 2520 /**
2008 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle ment}. 2521 * Instances of the class {@code PrefixElementImpl} implement a {@code PrefixEle ment}.
2009 */ 2522 */
2010 class PrefixElementImpl extends ElementImpl implements PrefixElement { 2523 class PrefixElementImpl extends ElementImpl implements PrefixElement {
2011 /** 2524 /**
2012 * An array containing all of the libraries that are imported using this prefi x. 2525 * An array containing all of the libraries that are imported using this prefi x.
2013 */ 2526 */
2014 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; 2527 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY;
2015 /** 2528 /**
2016 * An empty array of prefix elements. 2529 * An empty array of prefix elements.
2017 */ 2530 */
2018 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>.fixedLength(0 ); 2531 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>.fixedLength(0 );
2019 /** 2532 /**
2020 * Initialize a newly created prefix element to have the given name. 2533 * Initialize a newly created prefix element to have the given name.
2021 * @param name the name of this element 2534 * @param name the name of this element
2022 */ 2535 */
2023 PrefixElementImpl(Identifier name) : super.con1(name) { 2536 PrefixElementImpl(Identifier name) : super.con1(name) {
2024 } 2537 }
2025 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t; 2538 LibraryElement get enclosingElement => (super.enclosingElement as LibraryEleme nt);
2026 List<LibraryElement> get importedLibraries => _importedLibraries; 2539 List<LibraryElement> get importedLibraries => _importedLibraries;
2027 ElementKind get kind => ElementKind.PREFIX; 2540 ElementKind get kind => ElementKind.PREFIX;
2028 /** 2541 /**
2029 * Set the libraries that are imported using this prefix to the given librarie s. 2542 * Set the libraries that are imported using this prefix to the given librarie s.
2030 * @param importedLibraries the libraries that are imported using this prefix 2543 * @param importedLibraries the libraries that are imported using this prefix
2031 */ 2544 */
2032 void set importedLibraries2(List<LibraryElement> importedLibraries) { 2545 void set importedLibraries(List<LibraryElement> importedLibraries2) {
2033 for (LibraryElement library in importedLibraries) { 2546 for (LibraryElement library in importedLibraries2) {
2034 (library as LibraryElementImpl).enclosingElement2 = this; 2547 ((library as LibraryElementImpl)).enclosingElement = this;
2035 } 2548 }
2036 this._importedLibraries = importedLibraries; 2549 this._importedLibraries = importedLibraries2;
2550 }
2551 void appendTo(StringBuffer builder) {
2552 builder.add("as ");
2553 super.appendTo(builder);
2037 } 2554 }
2038 } 2555 }
2039 /** 2556 /**
2040 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}. 2557 * Instances of the class {@code PropertyAccessorElementImpl} implement a{@code PropertyAccessorElement}.
2041 */ 2558 */
2042 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement { 2559 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope rtyAccessorElement {
2043 /** 2560 /**
2044 * The field associated with this accessor. 2561 * The field associated with this accessor.
2045 */ 2562 */
2046 FieldElement _field; 2563 FieldElement _field;
2047 /** 2564 /**
2048 * An empty array of property accessor elements. 2565 * An empty array of property accessor elements.
2049 */ 2566 */
2050 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl ement>.fixedLength(0); 2567 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl ement>.fixedLength(0);
2051 /** 2568 /**
2052 * Initialize a newly created synthetic property accessor element to be associ ated with the given 2569 * Initialize a newly created synthetic property accessor element to be associ ated with the given
2053 * field. 2570 * field.
2054 * @param name the name of this element 2571 * @param name the name of this element
2055 */ 2572 */
2056 PropertyAccessorElementImpl.con1(FieldElementImpl field) : super.con2(field.na me, -1) { 2573 PropertyAccessorElementImpl.con1(FieldElementImpl field2) : super.con2(field2. name, -1) {
2057 _jtd_constructor_150_impl(field); 2574 _jtd_constructor_157_impl(field2);
2058 } 2575 }
2059 _jtd_constructor_150_impl(FieldElementImpl field) { 2576 _jtd_constructor_157_impl(FieldElementImpl field2) {
2060 this._field = field; 2577 this._field = field2;
2061 synthetic = true; 2578 synthetic = true;
2062 } 2579 }
2063 /** 2580 /**
2064 * Initialize a newly created property accessor element to have the given name . 2581 * Initialize a newly created property accessor element to have the given name .
2065 * @param name the name of this element 2582 * @param name the name of this element
2066 */ 2583 */
2067 PropertyAccessorElementImpl.con2(Identifier name) : super.con1(name) { 2584 PropertyAccessorElementImpl.con2(Identifier name) : super.con1(name) {
2068 _jtd_constructor_151_impl(name); 2585 _jtd_constructor_158_impl(name);
2069 } 2586 }
2070 _jtd_constructor_151_impl(Identifier name) { 2587 _jtd_constructor_158_impl(Identifier name) {
2071 } 2588 }
2072 FieldElement get field => _field; 2589 FieldElement get field => _field;
2073 ElementKind get kind { 2590 ElementKind get kind {
2074 if (isGetter()) { 2591 if (isGetter()) {
2075 return ElementKind.GETTER; 2592 return ElementKind.GETTER;
2076 } 2593 }
2077 return ElementKind.SETTER; 2594 return ElementKind.SETTER;
2078 } 2595 }
2079 bool isGetter() => hasModifier(Modifier.GETTER); 2596 bool isGetter() => hasModifier(Modifier.GETTER);
2080 bool isSetter() => hasModifier(Modifier.SETTER); 2597 bool isSetter() => hasModifier(Modifier.SETTER);
2081 /** 2598 /**
2082 * Set the field associated with this accessor to the given field. 2599 * Set the field associated with this accessor to the given field.
2083 * @param field the field associated with this accessor 2600 * @param field the field associated with this accessor
2084 */ 2601 */
2085 void set field2(FieldElement field) { 2602 void set field(FieldElement field3) {
2086 this._field = field; 2603 this._field = field3;
2087 } 2604 }
2088 /** 2605 /**
2089 * Set whether this accessor is a getter to correspond to the given value. 2606 * Set whether this accessor is a getter to correspond to the given value.
2090 * @param isGetter {@code true} if the accessor is a getter 2607 * @param isGetter {@code true} if the accessor is a getter
2091 */ 2608 */
2092 void set getter(bool isGetter) { 2609 void set getter(bool isGetter) {
2093 setModifier(Modifier.GETTER, isGetter); 2610 setModifier(Modifier.GETTER, isGetter);
2094 } 2611 }
2095 /** 2612 /**
2096 * Set whether this accessor is a setter to correspond to the given value. 2613 * Set whether this accessor is a setter to correspond to the given value.
2097 * @param isSetter {@code true} if the accessor is a setter 2614 * @param isSetter {@code true} if the accessor is a setter
2098 */ 2615 */
2099 void set setter(bool isSetter) { 2616 void set setter(bool isSetter) {
2100 setModifier(Modifier.SETTER, isSetter); 2617 setModifier(Modifier.SETTER, isSetter);
2101 } 2618 }
2619 void appendTo(StringBuffer builder) {
2620 builder.add(isGetter() ? "get " : "set ");
2621 builder.add(field.name);
2622 super.appendTo(builder);
2623 }
2102 } 2624 }
2103 /** 2625 /**
2104 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}. 2626 * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowComb inator}.
2105 */ 2627 */
2106 class ShowCombinatorImpl implements ShowCombinator { 2628 class ShowCombinatorImpl implements ShowCombinator {
2107 /** 2629 /**
2108 * The names that are to be made visible in the importing library if they are defined in the 2630 * The names that are to be made visible in the importing library if they are defined in the
2109 * imported library. 2631 * imported library.
2110 */ 2632 */
2111 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; 2633 List<String> _shownNames = StringUtilities.EMPTY_ARRAY;
2112 /** 2634 /**
2113 * Initialize a newly created combinator. 2635 * Initialize a newly created combinator.
2114 */ 2636 */
2115 ShowCombinatorImpl() : super() { 2637 ShowCombinatorImpl() : super() {
2116 } 2638 }
2117 List<String> get shownNames => _shownNames; 2639 List<String> get shownNames => _shownNames;
2118 /** 2640 /**
2119 * Set the names that are to be made visible in the importing library if they are defined in the 2641 * Set the names that are to be made visible in the importing library if they are defined in the
2120 * imported library to the given names. 2642 * imported library to the given names.
2121 * @param shownNames the names that are to be made visible in the importing li brary 2643 * @param shownNames the names that are to be made visible in the importing li brary
2122 */ 2644 */
2123 void set shownNames2(List<String> shownNames) { 2645 void set shownNames(List<String> shownNames2) {
2124 this._shownNames = shownNames; 2646 this._shownNames = shownNames2;
2647 }
2648 String toString() {
2649 StringBuffer builder = new StringBuffer();
2650 builder.add("show ");
2651 int count = _shownNames.length;
2652 for (int i = 0; i < count; i++) {
2653 if (i > 0) {
2654 builder.add(", ");
2655 }
2656 builder.add(_shownNames[i]);
2657 }
2658 return builder.toString();
2125 } 2659 }
2126 } 2660 }
2127 /** 2661 /**
2128 * Instances of the class {@code TypeAliasElementImpl} implement a {@code TypeAl iasElement}. 2662 * Instances of the class {@code TypeAliasElementImpl} implement a {@code TypeAl iasElement}.
2129 */ 2663 */
2130 class TypeAliasElementImpl extends ElementImpl implements TypeAliasElement { 2664 class TypeAliasElementImpl extends ElementImpl implements TypeAliasElement {
2131 /** 2665 /**
2132 * An array containing all of the parameters defined by this type alias. 2666 * An array containing all of the parameters defined by this type alias.
2133 */ 2667 */
2134 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; 2668 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
2135 /** 2669 /**
2136 * The type of function defined by this type alias. 2670 * The type of function defined by this type alias.
2137 */ 2671 */
2138 FunctionType _type; 2672 FunctionType _type;
2139 /** 2673 /**
2140 * An array containing all of the type variables defined for this type. 2674 * An array containing all of the type variables defined for this type.
2141 */ 2675 */
2142 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ; 2676 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY ;
2143 /** 2677 /**
2144 * An empty array of type alias elements. 2678 * An empty array of type alias elements.
2145 */ 2679 */
2146 static List<TypeAliasElement> EMPTY_ARRAY = new List<TypeAliasElement>.fixedLe ngth(0); 2680 static List<TypeAliasElement> EMPTY_ARRAY = new List<TypeAliasElement>.fixedLe ngth(0);
2147 /** 2681 /**
2148 * Initialize a newly created type alias element to have the given name. 2682 * Initialize a newly created type alias element to have the given name.
2149 * @param name the name of this element 2683 * @param name the name of this element
2150 */ 2684 */
2151 TypeAliasElementImpl(Identifier name) : super.con1(name) { 2685 TypeAliasElementImpl(Identifier name) : super.con1(name) {
2152 } 2686 }
2153 ElementImpl getChild(String identifier) { 2687 ElementImpl getChild(String identifier23) {
2154 for (VariableElement parameter in _parameters) { 2688 for (VariableElement parameter in _parameters) {
2155 if ((parameter as VariableElementImpl).identifier == identifier) { 2689 if (((parameter as VariableElementImpl)).identifier == identifier23) {
2156 return parameter as VariableElementImpl; 2690 return (parameter as VariableElementImpl);
2157 } 2691 }
2158 } 2692 }
2159 for (TypeVariableElement typeVariable in _typeVariables) { 2693 for (TypeVariableElement typeVariable in _typeVariables) {
2160 if ((typeVariable as TypeVariableElementImpl).identifier == identifier) { 2694 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier23 ) {
2161 return typeVariable as TypeVariableElementImpl; 2695 return (typeVariable as TypeVariableElementImpl);
2162 } 2696 }
2163 } 2697 }
2164 return null; 2698 return null;
2165 } 2699 }
2166 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi lationUnitElement; 2700 CompilationUnitElement get enclosingElement => (super.enclosingElement as Comp ilationUnitElement);
2167 ElementKind get kind => ElementKind.TYPE_ALIAS; 2701 ElementKind get kind => ElementKind.TYPE_ALIAS;
2168 List<ParameterElement> get parameters => _parameters; 2702 List<ParameterElement> get parameters => _parameters;
2169 FunctionType get type => _type; 2703 FunctionType get type => _type;
2170 List<TypeVariableElement> get typeVariables => _typeVariables; 2704 List<TypeVariableElement> get typeVariables => _typeVariables;
2171 /** 2705 /**
2172 * Set the parameters defined by this type alias to the given parameters. 2706 * Set the parameters defined by this type alias to the given parameters.
2173 * @param parameters the parameters defined by this type alias 2707 * @param parameters the parameters defined by this type alias
2174 */ 2708 */
2175 void set parameters8(List<ParameterElement> parameters) { 2709 void set parameters(List<ParameterElement> parameters8) {
2176 if (parameters != null) { 2710 if (parameters8 != null) {
2177 for (ParameterElement parameter in parameters) { 2711 for (ParameterElement parameter in parameters8) {
2178 (parameter as ParameterElementImpl).enclosingElement2 = this; 2712 ((parameter as ParameterElementImpl)).enclosingElement = this;
2179 } 2713 }
2180 } 2714 }
2181 this._parameters = parameters; 2715 this._parameters = parameters8;
2182 } 2716 }
2183 /** 2717 /**
2184 * Set the type of function defined by this type alias to the given type. 2718 * Set the type of function defined by this type alias to the given type.
2185 * @param type the type of function defined by this type alias 2719 * @param type the type of function defined by this type alias
2186 */ 2720 */
2187 void set type12(FunctionType type) { 2721 void set type(FunctionType type7) {
2188 this._type = type; 2722 this._type = type7;
2189 } 2723 }
2190 /** 2724 /**
2191 * Set the type variables defined for this type to the given variables. 2725 * Set the type variables defined for this type to the given variables.
2192 * @param typeVariables the type variables defined for this type 2726 * @param typeVariables the type variables defined for this type
2193 */ 2727 */
2194 void set typeVariables3(List<TypeVariableElement> typeVariables) { 2728 void set typeVariables(List<TypeVariableElement> typeVariables3) {
2195 for (TypeVariableElement variable in typeVariables) { 2729 for (TypeVariableElement variable in typeVariables3) {
2196 (variable as TypeVariableElementImpl).enclosingElement2 = this; 2730 ((variable as TypeVariableElementImpl)).enclosingElement = this;
2197 } 2731 }
2198 this._typeVariables = typeVariables; 2732 this._typeVariables = typeVariables3;
2733 }
2734 void appendTo(StringBuffer builder) {
2735 builder.add("typedef ");
2736 builder.add(name);
2737 int variableCount = _typeVariables.length;
2738 if (variableCount > 0) {
2739 builder.add("<");
2740 for (int i = 0; i < variableCount; i++) {
2741 if (i > 0) {
2742 builder.add(", ");
2743 }
2744 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
2745 }
2746 builder.add(">");
2747 }
2748 builder.add("(");
2749 int parameterCount = _parameters.length;
2750 for (int i = 0; i < parameterCount; i++) {
2751 if (i > 0) {
2752 builder.add(", ");
2753 }
2754 ((_parameters[i] as ParameterElementImpl)).appendTo(builder);
2755 }
2756 builder.add(")");
2757 if (_type != null) {
2758 builder.add(" -> ");
2759 builder.add(_type.returnType);
2760 }
2199 } 2761 }
2200 } 2762 }
2201 /** 2763 /**
2202 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ eVariableElement}. 2764 * Instances of the class {@code TypeVariableElementImpl} implement a {@code Typ eVariableElement}.
2203 */ 2765 */
2204 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement { 2766 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement {
2205 /** 2767 /**
2206 * The type defined by this type variable. 2768 * The type defined by this type variable.
2207 */ 2769 */
2208 TypeVariableType _type; 2770 TypeVariableType _type;
(...skipping 12 matching lines...) Expand all
2221 */ 2783 */
2222 TypeVariableElementImpl(Identifier name) : super.con1(name) { 2784 TypeVariableElementImpl(Identifier name) : super.con1(name) {
2223 } 2785 }
2224 Type2 get bound => _bound; 2786 Type2 get bound => _bound;
2225 ElementKind get kind => ElementKind.TYPE_VARIABLE; 2787 ElementKind get kind => ElementKind.TYPE_VARIABLE;
2226 TypeVariableType get type => _type; 2788 TypeVariableType get type => _type;
2227 /** 2789 /**
2228 * Set the type representing the bound associated with this variable to the gi ven type. 2790 * Set the type representing the bound associated with this variable to the gi ven type.
2229 * @param bound the type representing the bound associated with this variable 2791 * @param bound the type representing the bound associated with this variable
2230 */ 2792 */
2231 void set bound3(Type2 bound) { 2793 void set bound(Type2 bound2) {
2232 this._bound = bound; 2794 this._bound = bound2;
2233 } 2795 }
2234 /** 2796 /**
2235 * Set the type defined by this type variable to the given type 2797 * Set the type defined by this type variable to the given type
2236 * @param type the type defined by this type variable 2798 * @param type the type defined by this type variable
2237 */ 2799 */
2238 void set type13(TypeVariableType type) { 2800 void set type(TypeVariableType type8) {
2239 this._type = type; 2801 this._type = type8;
2802 }
2803 void appendTo(StringBuffer builder) {
2804 builder.add(name);
2805 if (_bound != null) {
2806 builder.add(" extends ");
2807 builder.add(_bound);
2808 }
2240 } 2809 }
2241 } 2810 }
2242 /** 2811 /**
2243 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl eElement}. 2812 * Instances of the class {@code VariableElementImpl} implement a {@code Variabl eElement}.
2244 */ 2813 */
2245 class VariableElementImpl extends ElementImpl implements VariableElement { 2814 class VariableElementImpl extends ElementImpl implements VariableElement {
2246 /** 2815 /**
2247 * The declared type of this variable. 2816 * The declared type of this variable.
2248 */ 2817 */
2249 Type2 _type; 2818 Type2 _type;
2250 /** 2819 /**
2251 * A synthetic function representing this variable's initializer, or {@code nu ll} if this variable 2820 * A synthetic function representing this variable's initializer, or {@code nu ll} if this variable
2252 * does not have an initializer. 2821 * does not have an initializer.
2253 */ 2822 */
2254 FunctionElement _initializer; 2823 FunctionElement _initializer;
2255 /** 2824 /**
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 /**
2256 * An empty array of variable elements. 2834 * An empty array of variable elements.
2257 */ 2835 */
2258 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>.fixedLeng th(0); 2836 static List<VariableElement> EMPTY_ARRAY = new List<VariableElement>.fixedLeng th(0);
2259 /** 2837 /**
2260 * Initialize a newly created variable element to have the given name. 2838 * Initialize a newly created variable element to have the given name.
2261 * @param name the name of this element 2839 * @param name the name of this element
2262 */ 2840 */
2263 VariableElementImpl.con1(Identifier name) : super.con1(name) { 2841 VariableElementImpl.con1(Identifier name) : super.con1(name) {
2264 _jtd_constructor_155_impl(name); 2842 _jtd_constructor_162_impl(name);
2265 } 2843 }
2266 _jtd_constructor_155_impl(Identifier name) { 2844 _jtd_constructor_162_impl(Identifier name) {
2267 } 2845 }
2268 /** 2846 /**
2269 * Initialize a newly created variable element to have the given name. 2847 * Initialize a newly created variable element to have the given name.
2270 * @param name the name of this element 2848 * @param name the name of this element
2271 * @param nameOffset the offset of the name of this element in the file that c ontains the 2849 * @param nameOffset the offset of the name of this element in the file that c ontains the
2272 * declaration of this element 2850 * declaration of this element
2273 */ 2851 */
2274 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO ffset) { 2852 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO ffset) {
2275 _jtd_constructor_156_impl(name, nameOffset); 2853 _jtd_constructor_163_impl(name, nameOffset);
2276 } 2854 }
2277 _jtd_constructor_156_impl(String name, int nameOffset) { 2855 _jtd_constructor_163_impl(String name, int nameOffset) {
2278 } 2856 }
2279 FunctionElement get initializer => _initializer; 2857 FunctionElement get initializer => _initializer;
2280 ElementKind get kind => ElementKind.VARIABLE; 2858 ElementKind get kind => ElementKind.VARIABLE;
2281 Type2 get type => _type; 2859 Type2 get type => _type;
2860 SourceRange get visibleRange {
2861 if (_visibleRangeLength < 0) {
2862 return null;
2863 }
2864 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
2865 }
2282 bool isConst() => hasModifier(Modifier.CONST); 2866 bool isConst() => hasModifier(Modifier.CONST);
2283 bool isFinal() => hasModifier(Modifier.FINAL); 2867 bool isFinal() => hasModifier(Modifier.FINAL);
2284 /** 2868 /**
2285 * Set whether this variable is const to correspond to the given value. 2869 * Set whether this variable is const to correspond to the given value.
2286 * @param isConst {@code true} if the variable is const 2870 * @param isConst {@code true} if the variable is const
2287 */ 2871 */
2288 void set const2(bool isConst) { 2872 void set const2(bool isConst) {
2289 setModifier(Modifier.CONST, isConst); 2873 setModifier(Modifier.CONST, isConst);
2290 } 2874 }
2291 /** 2875 /**
2292 * Set whether this variable is final to correspond to the given value. 2876 * Set whether this variable is final to correspond to the given value.
2293 * @param isFinal {@code true} if the variable is final 2877 * @param isFinal {@code true} if the variable is final
2294 */ 2878 */
2295 void set final2(bool isFinal) { 2879 void set final2(bool isFinal) {
2296 setModifier(Modifier.FINAL, isFinal); 2880 setModifier(Modifier.FINAL, isFinal);
2297 } 2881 }
2298 /** 2882 /**
2299 * Set the function representing this variable's initializer to the given func tion. 2883 * Set the function representing this variable's initializer to the given func tion.
2300 * @param initializer the function representing this variable's initializer 2884 * @param initializer the function representing this variable's initializer
2301 */ 2885 */
2302 void set initializer3(FunctionElement initializer) { 2886 void set initializer(FunctionElement initializer3) {
2303 if (initializer != null) { 2887 if (initializer3 != null) {
2304 (initializer as FunctionElementImpl).enclosingElement2 = this; 2888 ((initializer3 as FunctionElementImpl)).enclosingElement = this;
2305 } 2889 }
2306 this._initializer = initializer; 2890 this._initializer = initializer3;
2307 } 2891 }
2308 /** 2892 /**
2309 * Set the declared type of this variable to the given type. 2893 * Set the declared type of this variable to the given type.
2310 * @param type the declared type of this variable 2894 * @param type the declared type of this variable
2311 */ 2895 */
2312 void set type14(Type2 type) { 2896 void set type(Type2 type9) {
2313 this._type = type; 2897 this._type = type9;
2314 } 2898 }
2315 String toString() => "variable ${type} ${name}"; 2899 /**
2900 * Set the visible range for this element to the range starting at the given o ffset with the given
2901 * length.
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 }
2910 void appendTo(StringBuffer builder) {
2911 builder.add(type);
2912 builder.add(" ");
2913 builder.add(name);
2914 }
2316 } 2915 }
2317 /** 2916 /**
2318 * The unique instance of the class {@code BottomTypeImpl} implements the type { @code bottom}. 2917 * The unique instance of the class {@code BottomTypeImpl} implements the type { @code bottom}.
2319 */ 2918 */
2320 class BottomTypeImpl extends TypeImpl { 2919 class BottomTypeImpl extends TypeImpl {
2321 /** 2920 /**
2322 * The unique instance of this class. 2921 * The unique instance of this class.
2323 */ 2922 */
2324 static BottomTypeImpl _INSTANCE = new BottomTypeImpl(); 2923 static BottomTypeImpl _INSTANCE = new BottomTypeImpl();
2325 /** 2924 /**
2326 * Return the unique instance of this class. 2925 * Return the unique instance of this class.
2327 * @return the unique instance of this class 2926 * @return the unique instance of this class
2328 */ 2927 */
2329 static BottomTypeImpl get instance => _INSTANCE; 2928 static BottomTypeImpl get instance => _INSTANCE;
2330 /** 2929 /**
2331 * Prevent the creation of instances of this class. 2930 * Prevent the creation of instances of this class.
2332 */ 2931 */
2333 BottomTypeImpl() : super(null, "<bottom>") { 2932 BottomTypeImpl() : super(null, "<bottom>") {
2334 } 2933 }
2335 bool operator ==(Object object) => object == this; 2934 bool operator ==(Object object) => identical(object, this);
2336 bool isMoreSpecificThan(Type2 type) => true; 2935 bool isMoreSpecificThan(Type2 type) => true;
2337 bool isSubtypeOf(Type2 type) => true; 2936 bool isSubtypeOf(Type2 type) => true;
2338 bool isSupertypeOf(Type2 type) => false; 2937 bool isSupertypeOf(Type2 type) => false;
2339 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp es) => this; 2938 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp es) => this;
2340 } 2939 }
2341 /** 2940 /**
2342 * The unique instance of the class {@code DynamicTypeImpl} implements the type {@code dynamic}. 2941 * The unique instance of the class {@code DynamicTypeImpl} implements the type {@code dynamic}.
2343 */ 2942 */
2344 class DynamicTypeImpl extends TypeImpl { 2943 class DynamicTypeImpl extends TypeImpl {
2345 /** 2944 /**
2346 * The unique instance of this class. 2945 * The unique instance of this class.
2347 */ 2946 */
2348 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl(); 2947 static DynamicTypeImpl _INSTANCE = new DynamicTypeImpl();
2349 /** 2948 /**
2350 * Return the unique instance of this class. 2949 * Return the unique instance of this class.
2351 * @return the unique instance of this class 2950 * @return the unique instance of this class
2352 */ 2951 */
2353 static DynamicTypeImpl get instance => _INSTANCE; 2952 static DynamicTypeImpl get instance => _INSTANCE;
2354 /** 2953 /**
2355 * Prevent the creation of instances of this class. 2954 * Prevent the creation of instances of this class.
2356 */ 2955 */
2357 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { 2956 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) {
2358 (element as DynamicElementImpl).type10 = this; 2957 ((element as DynamicElementImpl)).type = this;
2359 } 2958 }
2360 bool operator ==(Object object) => object is DynamicTypeImpl; 2959 bool operator ==(Object object) => object is DynamicTypeImpl;
2361 bool isMoreSpecificThan(Type2 type) => false; 2960 bool isMoreSpecificThan(Type2 type) => false;
2362 bool isSubtypeOf(Type2 type) => false; 2961 bool isSubtypeOf(Type2 type) => false;
2363 bool isSupertypeOf(Type2 type) => true; 2962 bool isSupertypeOf(Type2 type) => true;
2364 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy pes) => this; 2963 DynamicTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTy pes) => this;
2365 } 2964 }
2366 /** 2965 /**
2367 * Instances of the class {@code FunctionTypeImpl} defines the behavior common t o objects 2966 * Instances of the class {@code FunctionTypeImpl} defines the behavior common t o objects
2368 * representing the type of a function, method, constructor, getter, or setter. 2967 * representing the type of a function, method, constructor, getter, or setter.
2369 */ 2968 */
2370 class FunctionTypeImpl extends TypeImpl implements FunctionType { 2969 class FunctionTypeImpl extends TypeImpl implements FunctionType {
2371 /** 2970 /**
2372 * Return {@code true} if all of the types in the first array are equal to the corresponding types 2971 * Return {@code true} if all of the types in the first array are equal to the corresponding types
2373 * in the second array. 2972 * in the second array.
2374 * @param firstTypes the first array of types being compared 2973 * @param firstTypes the first array of types being compared
2375 * @param secondTypes the second array of types being compared 2974 * @param secondTypes the second array of types being compared
2376 * @return {@code true} if all of the types in the first array are equal to th e corresponding 2975 * @return {@code true} if all of the types in the first array are equal to th e corresponding
2377 * types in the second array 2976 * types in the second array
2378 */ 2977 */
2379 static bool equals2(LinkedHashMap<String, Type2> firstTypes, LinkedHashMap<Str ing, Type2> secondTypes) { 2978 static bool equals2(LinkedHashMap<String, Type2> firstTypes, LinkedHashMap<Str ing, Type2> secondTypes) {
2380 if (secondTypes.length != firstTypes.length) { 2979 if (secondTypes.length != firstTypes.length) {
2381 return false; 2980 return false;
2382 } 2981 }
2383 HasNextIterator<MapEntry<String, Type2>> firstIterator = new HasNextIterator (getMapEntrySet(firstTypes).iterator); 2982 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes));
2384 HasNextIterator<MapEntry<String, Type2>> secondIterator = new HasNextIterato r(getMapEntrySet(firstTypes).iterator); 2983 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(firstTypes));
2385 while (firstIterator.hasNext) { 2984 while (firstIterator.hasNext) {
2386 MapEntry<String, Type2> firstEntry = firstIterator.next(); 2985 MapEntry<String, Type2> firstEntry = firstIterator.next();
2387 MapEntry<String, Type2> secondEntry = secondIterator.next(); 2986 MapEntry<String, Type2> secondEntry = secondIterator.next();
2388 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) { 2987 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) {
2389 return false; 2988 return false;
2390 } 2989 }
2391 } 2990 }
2392 return true; 2991 return true;
2393 } 2992 }
2394 /** 2993 /**
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 /** 3029 /**
2431 * The type of object returned by this type of function. 3030 * The type of object returned by this type of function.
2432 */ 3031 */
2433 Type2 _returnType = VoidTypeImpl.instance; 3032 Type2 _returnType = VoidTypeImpl.instance;
2434 /** 3033 /**
2435 * Initialize a newly created function type to be declared by the given elemen t and to have the 3034 * Initialize a newly created function type to be declared by the given elemen t and to have the
2436 * given name. 3035 * given name.
2437 * @param element the element representing the declaration of the function typ e 3036 * @param element the element representing the declaration of the function typ e
2438 */ 3037 */
2439 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name) { 3038 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name) {
2440 _jtd_constructor_200_impl(element); 3039 _jtd_constructor_209_impl(element);
2441 } 3040 }
2442 _jtd_constructor_200_impl(ExecutableElement element) { 3041 _jtd_constructor_209_impl(ExecutableElement element) {
2443 } 3042 }
2444 /** 3043 /**
2445 * Initialize a newly created function type to be declared by the given elemen t and to have the 3044 * Initialize a newly created function type to be declared by the given elemen t and to have the
2446 * given name. 3045 * given name.
2447 * @param element the element representing the declaration of the function typ e 3046 * @param element the element representing the declaration of the function typ e
2448 */ 3047 */
2449 FunctionTypeImpl.con2(TypeAliasElement element) : super(element, element == nu ll ? null : element.name) { 3048 FunctionTypeImpl.con2(TypeAliasElement element) : super(element, element == nu ll ? null : element.name) {
2450 _jtd_constructor_201_impl(element); 3049 _jtd_constructor_210_impl(element);
2451 } 3050 }
2452 _jtd_constructor_201_impl(TypeAliasElement element) { 3051 _jtd_constructor_210_impl(TypeAliasElement element) {
2453 } 3052 }
2454 bool operator ==(Object object) { 3053 bool operator ==(Object object) {
2455 if (object is! FunctionTypeImpl) { 3054 if (object is! FunctionTypeImpl) {
2456 return false; 3055 return false;
2457 } 3056 }
2458 FunctionTypeImpl otherType = object as FunctionTypeImpl; 3057 FunctionTypeImpl otherType = (object as FunctionTypeImpl);
2459 return element == otherType.element && JavaArrays.equals(_normalParameterTyp es, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterType s, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType ._namedParameterTypes); 3058 return element == otherType.element && JavaArrays.equals(_normalParameterTyp es, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterType s, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType ._namedParameterTypes);
2460 } 3059 }
2461 Map<String, Type2> get namedParameterTypes => _namedParameterTypes; 3060 Map<String, Type2> get namedParameterTypes => _namedParameterTypes;
2462 List<Type2> get normalParameterTypes => _normalParameterTypes; 3061 List<Type2> get normalParameterTypes => _normalParameterTypes;
2463 List<Type2> get optionalParameterTypes => _optionalParameterTypes; 3062 List<Type2> get optionalParameterTypes => _optionalParameterTypes;
2464 Type2 get returnType => _returnType; 3063 Type2 get returnType => _returnType;
2465 List<Type2> get typeArguments => _typeArguments; 3064 List<Type2> get typeArguments => _typeArguments;
2466 int get hashCode { 3065 int get hashCode {
2467 Element element29 = element; 3066 Element element34 = element;
2468 if (element29 == null) { 3067 if (element34 == null) {
2469 return 0; 3068 return 0;
2470 } 3069 }
2471 return element29.hashCode; 3070 return element34.hashCode;
2472 } 3071 }
2473 bool isSubtypeOf(Type2 type) { 3072 bool isSubtypeOf(Type2 type) {
2474 if (type == null || type is! FunctionType) { 3073 if (type == null || type is! FunctionType) {
2475 return false; 3074 return false;
2476 } else if (this == type || this == type) { 3075 } else if (identical(this, type) || this == type) {
2477 return true; 3076 return true;
2478 } 3077 }
2479 FunctionType t = this; 3078 FunctionType t = this;
2480 FunctionType s = type as FunctionType; 3079 FunctionType s = (type as FunctionType);
2481 if (t.normalParameterTypes.length != s.normalParameterTypes.length) { 3080 if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
2482 return false; 3081 return false;
2483 } else if (t.normalParameterTypes.length > 0) { 3082 } else if (t.normalParameterTypes.length > 0) {
2484 List<Type2> tTypes = t.normalParameterTypes; 3083 List<Type2> tTypes = t.normalParameterTypes;
2485 List<Type2> sTypes = s.normalParameterTypes; 3084 List<Type2> sTypes = s.normalParameterTypes;
2486 for (int i = 0; i < tTypes.length; i++) { 3085 for (int i = 0; i < tTypes.length; i++) {
2487 if (!tTypes[i].isAssignableTo(sTypes[i])) { 3086 if (!tTypes[i].isAssignableTo(sTypes[i])) {
2488 return false; 3087 return false;
2489 } 3088 }
2490 } 3089 }
(...skipping 14 matching lines...) Expand all
2505 } 3104 }
2506 } else if (s.optionalParameterTypes.length > 0) { 3105 } else if (s.optionalParameterTypes.length > 0) {
2507 return false; 3106 return false;
2508 } 3107 }
2509 if (t.namedParameterTypes.length > 0) { 3108 if (t.namedParameterTypes.length > 0) {
2510 Map<String, Type2> namedTypesT = t.namedParameterTypes; 3109 Map<String, Type2> namedTypesT = t.namedParameterTypes;
2511 Map<String, Type2> namedTypesS = s.namedParameterTypes; 3110 Map<String, Type2> namedTypesS = s.namedParameterTypes;
2512 if (namedTypesT.length < namedTypesS.length) { 3111 if (namedTypesT.length < namedTypesS.length) {
2513 return false; 3112 return false;
2514 } 3113 }
2515 HasNextIterator<MapEntry<String, Type2>> iteratorS = new HasNextIterator(g etMapEntrySet(namedTypesS).iterator); 3114 JavaIterator<MapEntry<String, Type2>> iteratorS = new JavaIterator(getMapE ntrySet(namedTypesS));
2516 while (iteratorS.hasNext) { 3115 while (iteratorS.hasNext) {
2517 MapEntry<String, Type2> entryS = iteratorS.next(); 3116 MapEntry<String, Type2> entryS = iteratorS.next();
2518 Type2 typeT = namedTypesT[entryS.getKey()]; 3117 Type2 typeT = namedTypesT[entryS.getKey()];
2519 if (typeT == null) { 3118 if (typeT == null) {
2520 return false; 3119 return false;
2521 } 3120 }
2522 if (!entryS.getValue().isAssignableTo(typeT)) { 3121 if (!entryS.getValue().isAssignableTo(typeT)) {
2523 return false; 3122 return false;
2524 } 3123 }
2525 } 3124 }
2526 } else if (s.namedParameterTypes.length > 0) { 3125 } else if (s.namedParameterTypes.length > 0) {
2527 return false; 3126 return false;
2528 } 3127 }
2529 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo( s.returnType); 3128 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo( s.returnType);
2530 } 3129 }
2531 /** 3130 /**
2532 * Set the mapping of the names of named parameters to the types of the named parameters of this 3131 * Set the mapping of the names of named parameters to the types of the named parameters of this
2533 * type of function to the given mapping. 3132 * type of function to the given mapping.
2534 * @param namedParameterTypes the mapping of the names of named parameters to the types of the 3133 * @param namedParameterTypes the mapping of the names of named parameters to the types of the
2535 * named parameters of this type of function 3134 * named parameters of this type of function
2536 */ 3135 */
2537 void set namedParameterTypes2(LinkedHashMap<String, Type2> namedParameterTypes ) { 3136 void set namedParameterTypes(LinkedHashMap<String, Type2> namedParameterTypes2 ) {
2538 this._namedParameterTypes = namedParameterTypes; 3137 this._namedParameterTypes = namedParameterTypes2;
2539 } 3138 }
2540 /** 3139 /**
2541 * Set the types of the normal parameters of this type of function to the type s in the given 3140 * Set the types of the normal parameters of this type of function to the type s in the given
2542 * array. 3141 * array.
2543 * @param normalParameterTypes the types of the normal parameters of this type of function 3142 * @param normalParameterTypes the types of the normal parameters of this type of function
2544 */ 3143 */
2545 void set normalParameterTypes2(List<Type2> normalParameterTypes) { 3144 void set normalParameterTypes(List<Type2> normalParameterTypes2) {
2546 this._normalParameterTypes = normalParameterTypes; 3145 this._normalParameterTypes = normalParameterTypes2;
2547 } 3146 }
2548 /** 3147 /**
2549 * Set the types of the optional parameters of this type of function to the ty pes in the given 3148 * Set the types of the optional parameters of this type of function to the ty pes in the given
2550 * array. 3149 * array.
2551 * @param optionalParameterTypes the types of the optional parameters of this type of function 3150 * @param optionalParameterTypes the types of the optional parameters of this type of function
2552 */ 3151 */
2553 void set optionalParameterTypes2(List<Type2> optionalParameterTypes) { 3152 void set optionalParameterTypes(List<Type2> optionalParameterTypes2) {
2554 this._optionalParameterTypes = optionalParameterTypes; 3153 this._optionalParameterTypes = optionalParameterTypes2;
2555 } 3154 }
2556 /** 3155 /**
2557 * Set the type of object returned by this type of function to the given type. 3156 * Set the type of object returned by this type of function to the given type.
2558 * @param returnType the type of object returned by this type of function 3157 * @param returnType the type of object returned by this type of function
2559 */ 3158 */
2560 void set returnType7(Type2 returnType) { 3159 void set returnType(Type2 returnType3) {
2561 this._returnType = returnType; 3160 this._returnType = returnType3;
2562 } 3161 }
2563 /** 3162 /**
2564 * Set the actual types of the type arguments to the given types. 3163 * Set the actual types of the type arguments to the given types.
2565 * @param typeArguments the actual types of the type arguments 3164 * @param typeArguments the actual types of the type arguments
2566 */ 3165 */
2567 void set typeArguments4(List<Type2> typeArguments) { 3166 void set typeArguments(List<Type2> typeArguments4) {
2568 this._typeArguments = typeArguments; 3167 this._typeArguments = typeArguments4;
2569 } 3168 }
2570 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen tTypes, typeArguments); 3169 FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumen tTypes, typeArguments);
2571 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT ypes) { 3170 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT ypes) {
2572 if (argumentTypes.length != parameterTypes.length) { 3171 if (argumentTypes.length != parameterTypes.length) {
2573 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 3172 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
2574 } 3173 }
2575 if (argumentTypes.length == 0) { 3174 if (argumentTypes.length == 0) {
2576 return this; 3175 return this;
2577 } 3176 }
2578 Element element30 = element; 3177 Element element35 = element;
2579 FunctionTypeImpl newType = (element30 is ExecutableElement) ? new FunctionTy peImpl.con1(element30 as ExecutableElement) : new FunctionTypeImpl.con2(element3 0 as TypeAliasElement); 3178 FunctionTypeImpl newType = (element35 is ExecutableElement) ? new FunctionTy peImpl.con1((element35 as ExecutableElement)) : new FunctionTypeImpl.con2((eleme nt35 as TypeAliasElement));
2580 newType.returnType7 = _returnType.substitute2(argumentTypes, parameterTypes) ; 3179 newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes);
2581 newType.normalParameterTypes2 = TypeImpl.substitute(_normalParameterTypes, a rgumentTypes, parameterTypes); 3180 newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, ar gumentTypes, parameterTypes);
2582 newType.optionalParameterTypes2 = TypeImpl.substitute(_optionalParameterType s, argumentTypes, parameterTypes); 3181 newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes , argumentTypes, parameterTypes);
2583 newType.namedParameterTypes2 = substitute3(_namedParameterTypes, argumentTyp es, parameterTypes); 3182 newType.namedParameterTypes = substitute3(_namedParameterTypes, argumentType s, parameterTypes);
2584 return newType; 3183 return newType;
2585 } 3184 }
2586 String toString() { 3185 void appendTo(StringBuffer builder) {
2587 StringBuffer builder = new StringBuffer();
2588 builder.add("("); 3186 builder.add("(");
2589 bool needsComma = false; 3187 bool needsComma = false;
2590 if (_normalParameterTypes.length > 0) { 3188 if (_normalParameterTypes.length > 0) {
2591 for (Type2 type in _normalParameterTypes) { 3189 for (Type2 type in _normalParameterTypes) {
2592 if (needsComma) { 3190 if (needsComma) {
2593 builder.add(", "); 3191 builder.add(", ");
2594 } else { 3192 } else {
2595 needsComma = true; 3193 needsComma = true;
2596 } 3194 }
2597 builder.add(type); 3195 ((type as TypeImpl)).appendTo(builder);
2598 } 3196 }
2599 } 3197 }
2600 if (_optionalParameterTypes.length > 0) { 3198 if (_optionalParameterTypes.length > 0) {
2601 if (needsComma) { 3199 if (needsComma) {
2602 builder.add(", "); 3200 builder.add(", ");
2603 needsComma = false; 3201 needsComma = false;
2604 } 3202 }
2605 builder.add("["); 3203 builder.add("[");
2606 for (Type2 type in _optionalParameterTypes) { 3204 for (Type2 type in _optionalParameterTypes) {
2607 if (needsComma) { 3205 if (needsComma) {
2608 builder.add(", "); 3206 builder.add(", ");
2609 } else { 3207 } else {
2610 needsComma = true; 3208 needsComma = true;
2611 } 3209 }
2612 builder.add(type); 3210 ((type as TypeImpl)).appendTo(builder);
2613 } 3211 }
2614 builder.add("]"); 3212 builder.add("]");
2615 needsComma = true; 3213 needsComma = true;
2616 } 3214 }
2617 if (_namedParameterTypes.length > 0) { 3215 if (_namedParameterTypes.length > 0) {
2618 if (needsComma) { 3216 if (needsComma) {
2619 builder.add(", "); 3217 builder.add(", ");
2620 needsComma = false; 3218 needsComma = false;
2621 } 3219 }
2622 builder.add("{"); 3220 builder.add("{");
2623 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes) ) { 3221 for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes) ) {
2624 if (needsComma) { 3222 if (needsComma) {
2625 builder.add(", "); 3223 builder.add(", ");
2626 } else { 3224 } else {
2627 needsComma = true; 3225 needsComma = true;
2628 } 3226 }
2629 builder.add(entry.getKey()); 3227 builder.add(entry.getKey());
2630 builder.add(": "); 3228 builder.add(": ");
2631 builder.add(entry.getValue()); 3229 ((entry.getValue() as TypeImpl)).appendTo(builder);
2632 } 3230 }
2633 builder.add("}"); 3231 builder.add("}");
2634 needsComma = true; 3232 needsComma = true;
2635 } 3233 }
2636 builder.add(") -> "); 3234 builder.add(") -> ");
2637 builder.add(_returnType); 3235 ((_returnType as TypeImpl)).appendTo(builder);
2638 return builder.toString();
2639 } 3236 }
2640 } 3237 }
2641 /** 3238 /**
2642 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects 3239 * Instances of the class {@code InterfaceTypeImpl} defines the behavior common to objects
2643 * representing the type introduced by either a class or an interface, or a refe rence to such a 3240 * representing the type introduced by either a class or an interface, or a refe rence to such a
2644 * type. 3241 * type.
2645 */ 3242 */
2646 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { 3243 class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
2647 /** 3244 /**
2648 * An empty array of types. 3245 * An empty array of types.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 /** 3296 /**
2700 * Returns the set of all superinterfaces of the passed {@link Type}. This is a recursive method, 3297 * Returns the set of all superinterfaces of the passed {@link Type}. This is a recursive method,
2701 * callers should call the public {@link #computeSuperinterfaceSet(Type)}. 3298 * callers should call the public {@link #computeSuperinterfaceSet(Type)}.
2702 * @param type the {@link Type} to compute the set of superinterfaces of 3299 * @param type the {@link Type} to compute the set of superinterfaces of
2703 * @param set a {@link HashSet} used recursively by this method 3300 * @param set a {@link HashSet} used recursively by this method
2704 * @return the {@link Set} of superinterfaces of the passed {@link Type} 3301 * @return the {@link Set} of superinterfaces of the passed {@link Type}
2705 * @see #computeSuperinterfaceSet(Type) 3302 * @see #computeSuperinterfaceSet(Type)
2706 * @see #getLeastUpperBound(Type) 3303 * @see #getLeastUpperBound(Type)
2707 */ 3304 */
2708 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In terfaceType> set) { 3305 static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<In terfaceType> set) {
2709 Element element31 = type.element; 3306 Element element36 = type.element;
2710 if (element31 != null && element31 is ClassElement) { 3307 if (element36 != null && element36 is ClassElement) {
2711 ClassElement classElement = element31 as ClassElement; 3308 ClassElement classElement = (element36 as ClassElement);
2712 List<InterfaceType> superinterfaces = classElement.interfaces; 3309 List<InterfaceType> superinterfaces = classElement.interfaces;
2713 for (InterfaceType superinterface in superinterfaces) { 3310 for (InterfaceType superinterface in superinterfaces) {
2714 javaSetAdd(set, superinterface); 3311 javaSetAdd(set, superinterface);
2715 computeSuperinterfaceSet2(superinterface, set); 3312 computeSuperinterfaceSet2(superinterface, set);
2716 } 3313 }
2717 InterfaceType supertype4 = classElement.supertype; 3314 InterfaceType supertype4 = classElement.supertype;
2718 if (supertype4 != null) { 3315 if (supertype4 != null) {
2719 javaSetAdd(set, supertype4); 3316 javaSetAdd(set, supertype4);
2720 computeSuperinterfaceSet2(supertype4, set); 3317 computeSuperinterfaceSet2(supertype4, set);
2721 } 3318 }
2722 } 3319 }
2723 return set; 3320 return set;
2724 } 3321 }
2725 /** 3322 /**
2726 * An array containing the actual types of the type arguments. 3323 * An array containing the actual types of the type arguments.
2727 */ 3324 */
2728 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY; 3325 List<Type2> _typeArguments = TypeImpl.EMPTY_ARRAY;
2729 /** 3326 /**
2730 * Initialize a newly created type to be declared by the given element. 3327 * Initialize a newly created type to be declared by the given element.
2731 * @param element the element representing the declaration of the type 3328 * @param element the element representing the declaration of the type
2732 */ 3329 */
2733 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) { 3330 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) {
2734 _jtd_constructor_202_impl(element); 3331 _jtd_constructor_211_impl(element);
2735 } 3332 }
2736 _jtd_constructor_202_impl(ClassElement element) { 3333 _jtd_constructor_211_impl(ClassElement element) {
2737 } 3334 }
2738 /** 3335 /**
2739 * Initialize a newly created type to have the given name. This constructor sh ould only be used in 3336 * Initialize a newly created type to have the given name. This constructor sh ould only be used in
2740 * cases where there is no declaration of the type. 3337 * cases where there is no declaration of the type.
2741 * @param name the name of the type 3338 * @param name the name of the type
2742 */ 3339 */
2743 InterfaceTypeImpl.con2(String name) : super(null, name) { 3340 InterfaceTypeImpl.con2(String name) : super(null, name) {
2744 _jtd_constructor_203_impl(name); 3341 _jtd_constructor_212_impl(name);
2745 } 3342 }
2746 _jtd_constructor_203_impl(String name) { 3343 _jtd_constructor_212_impl(String name) {
2747 } 3344 }
2748 bool operator ==(Object object) { 3345 bool operator ==(Object object) {
2749 if (object is! InterfaceTypeImpl) { 3346 if (object is! InterfaceTypeImpl) {
2750 return false; 3347 return false;
2751 } 3348 }
2752 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; 3349 InterfaceTypeImpl otherType = (object as InterfaceTypeImpl);
2753 return element == otherType.element && JavaArrays.equals(_typeArguments, oth erType._typeArguments); 3350 return element == otherType.element && JavaArrays.equals(_typeArguments, oth erType._typeArguments);
2754 } 3351 }
2755 ClassElement get element => super.element as ClassElement; 3352 ClassElement get element => (super.element as ClassElement);
2756 Type2 getLeastUpperBound(Type2 type) { 3353 Type2 getLeastUpperBound(Type2 type) {
2757 Type2 dynamicType = DynamicTypeImpl.instance; 3354 Type2 dynamicType = DynamicTypeImpl.instance;
2758 if (this == dynamicType || type == dynamicType) { 3355 if (identical(this, dynamicType) || identical(type, dynamicType)) {
2759 return dynamicType; 3356 return dynamicType;
2760 } 3357 }
2761 if (type == null || type is! InterfaceType) { 3358 if (type == null || type is! InterfaceType) {
2762 return null; 3359 return null;
2763 } 3360 }
2764 InterfaceType i = this; 3361 InterfaceType i = this;
2765 InterfaceType j = type as InterfaceType; 3362 InterfaceType j = (type as InterfaceType);
2766 Set<InterfaceType> si = computeSuperinterfaceSet(i); 3363 Set<InterfaceType> si = computeSuperinterfaceSet(i);
2767 Set<InterfaceType> sj = computeSuperinterfaceSet(j); 3364 Set<InterfaceType> sj = computeSuperinterfaceSet(j);
2768 javaSetAdd(si, i); 3365 javaSetAdd(si, i);
2769 javaSetAdd(sj, j); 3366 javaSetAdd(sj, j);
2770 si.retainAll(sj); 3367 si.retainAll(sj);
2771 Set<InterfaceType> s = si; 3368 Set<InterfaceType> s = si;
2772 List<InterfaceType> sn = new List.from(s); 3369 List<InterfaceType> sn = new List.from(s);
2773 List<int> depths = new List<int>.fixedLength(sn.length); 3370 List<int> depths = new List<int>.fixedLength(sn.length);
2774 int maxDepth = 0; 3371 int maxDepth = 0;
2775 for (int n = 0; n < sn.length; n++) { 3372 for (int n = 0; n < sn.length; n++) {
(...skipping 16 matching lines...) Expand all
2792 } 3389 }
2793 } 3390 }
2794 return null; 3391 return null;
2795 } 3392 }
2796 Type2 get superclass { 3393 Type2 get superclass {
2797 ClassElement classElement = element; 3394 ClassElement classElement = element;
2798 return element.supertype.substitute2(_typeArguments, TypeVariableTypeImpl.ge tTypes(classElement.typeVariables)); 3395 return element.supertype.substitute2(_typeArguments, TypeVariableTypeImpl.ge tTypes(classElement.typeVariables));
2799 } 3396 }
2800 List<Type2> get typeArguments => _typeArguments; 3397 List<Type2> get typeArguments => _typeArguments;
2801 int get hashCode { 3398 int get hashCode {
2802 ClassElement element32 = element; 3399 ClassElement element37 = element;
2803 if (element32 == null) { 3400 if (element37 == null) {
2804 return 0; 3401 return 0;
2805 } 3402 }
2806 return element32.hashCode; 3403 return element37.hashCode;
2807 } 3404 }
2808 bool isDirectSupertypeOf(InterfaceType type) { 3405 bool isDirectSupertypeOf(InterfaceType type) {
2809 ClassElement i = element; 3406 ClassElement i = element;
2810 ClassElement j = type.element; 3407 ClassElement j = type.element;
2811 Type2 supertype5 = j.supertype; 3408 InterfaceType supertype5 = j.supertype;
2812 if (supertype5 == null) { 3409 if (supertype5 == null) {
2813 return false; 3410 return false;
2814 } 3411 }
2815 ClassElement supertypeElement = supertype5.element as ClassElement; 3412 ClassElement supertypeElement = supertype5.element;
2816 if (supertypeElement == i) { 3413 if (supertypeElement == i) {
2817 return true; 3414 return true;
2818 } 3415 }
2819 for (Type2 interfaceType in j.interfaces) { 3416 for (InterfaceType interfaceType in j.interfaces) {
2820 if (interfaceType == i) { 3417 if (interfaceType.element == i) {
2821 return true; 3418 return true;
2822 } 3419 }
2823 } 3420 }
2824 for (Type2 mixinType in j.mixins) { 3421 for (InterfaceType mixinType in j.mixins) {
2825 if (mixinType == i) { 3422 if (mixinType.element == i) {
2826 return true; 3423 return true;
2827 } 3424 }
2828 } 3425 }
2829 return false; 3426 return false;
2830 } 3427 }
2831 bool isMoreSpecificThan(Type2 type) { 3428 bool isMoreSpecificThan(Type2 type) {
2832 if (type == DynamicTypeImpl.instance) { 3429 if (identical(type, DynamicTypeImpl.instance)) {
2833 return true; 3430 return true;
2834 } else if (type is! InterfaceType) { 3431 } else if (type is! InterfaceType) {
2835 return false; 3432 return false;
2836 } 3433 }
2837 InterfaceType s = type as InterfaceType; 3434 InterfaceType s = (type as InterfaceType);
2838 if (this == s) { 3435 if (this == s) {
2839 return true; 3436 return true;
2840 } 3437 }
2841 if (s.isDirectSupertypeOf(this)) { 3438 if (s.isDirectSupertypeOf(this)) {
2842 return true; 3439 return true;
2843 } 3440 }
2844 ClassElement tElement = element; 3441 ClassElement tElement = element;
2845 ClassElement sElement = s.element; 3442 ClassElement sElement = s.element;
2846 if (tElement == sElement) { 3443 if (tElement == sElement) {
2847 List<Type2> tArguments = typeArguments; 3444 List<Type2> tArguments = typeArguments;
2848 List<Type2> sArguments = s.typeArguments; 3445 List<Type2> sArguments = s.typeArguments;
2849 if (tArguments.length != sArguments.length) { 3446 if (tArguments.length != sArguments.length) {
2850 return false; 3447 return false;
2851 } 3448 }
2852 for (int i = 0; i < tArguments.length; i++) { 3449 for (int i = 0; i < tArguments.length; i++) {
2853 if (!tArguments[i].isMoreSpecificThan(sArguments[i])) { 3450 if (!tArguments[i].isMoreSpecificThan(sArguments[i])) {
2854 return false; 3451 return false;
2855 } 3452 }
2856 } 3453 }
2857 return true; 3454 return true;
2858 } 3455 }
2859 if (element.supertype == null) { 3456 if (element.supertype == null) {
2860 return false; 3457 return false;
2861 } 3458 }
2862 return element.supertype.isMoreSpecificThan(type); 3459 return element.supertype.isMoreSpecificThan(type);
2863 } 3460 }
2864 bool isSubtypeOf(Type2 type) { 3461 bool isSubtypeOf(Type2 type) {
2865 if (type == DynamicTypeImpl.instance) { 3462 if (identical(type, DynamicTypeImpl.instance)) {
2866 return true; 3463 return true;
2867 } else if (type is TypeVariableType) { 3464 } else if (type is TypeVariableType) {
2868 return true; 3465 return true;
2869 } else if (type is! InterfaceType) { 3466 } else if (type is! InterfaceType) {
2870 return false; 3467 return false;
2871 } else if (this == type) { 3468 } else if (this == type) {
2872 return true; 3469 return true;
2873 } 3470 }
2874 InterfaceType typeT = this; 3471 InterfaceType typeT = this;
2875 InterfaceType typeS = type as InterfaceType; 3472 InterfaceType typeS = (type as InterfaceType);
2876 ClassElement elementT = element; 3473 ClassElement elementT = element;
2877 if (elementT == null) { 3474 if (elementT == null) {
2878 return false; 3475 return false;
2879 } 3476 }
2880 typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.t ypeVariables)); 3477 typeT = substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(elementT.t ypeVariables));
2881 if (typeT == typeS) { 3478 if (typeT == typeS) {
2882 return true; 3479 return true;
2883 } else if (elementT == typeS.element) { 3480 } else if (elementT == typeS.element) {
2884 List<Type2> typeTArgs = typeT.typeArguments; 3481 List<Type2> typeTArgs = typeT.typeArguments;
2885 List<Type2> typeSArgs = typeS.typeArguments; 3482 List<Type2> typeSArgs = typeS.typeArguments;
(...skipping 22 matching lines...) Expand all
2908 if (mixinType == typeS) { 3505 if (mixinType == typeS) {
2909 return true; 3506 return true;
2910 } 3507 }
2911 } 3508 }
2912 return supertype6.isSubtypeOf(typeS); 3509 return supertype6.isSubtypeOf(typeS);
2913 } 3510 }
2914 /** 3511 /**
2915 * Set the actual types of the type arguments to those in the given array. 3512 * Set the actual types of the type arguments to those in the given array.
2916 * @param typeArguments the actual types of the type arguments 3513 * @param typeArguments the actual types of the type arguments
2917 */ 3514 */
2918 void set typeArguments5(List<Type2> typeArguments) { 3515 void set typeArguments(List<Type2> typeArguments5) {
2919 this._typeArguments = typeArguments; 3516 this._typeArguments = typeArguments5;
2920 } 3517 }
2921 InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argume ntTypes, typeArguments); 3518 InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argume ntTypes, typeArguments);
2922 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter Types) { 3519 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter Types) {
2923 if (argumentTypes.length != parameterTypes.length) { 3520 if (argumentTypes.length != parameterTypes.length) {
2924 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})"); 3521 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes. length}) != parameterTypes.length (${parameterTypes.length})");
2925 } 3522 }
2926 if (argumentTypes.length == 0) { 3523 if (argumentTypes.length == 0) {
2927 return this; 3524 return this;
2928 } 3525 }
2929 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); 3526 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element);
2930 newType.typeArguments5 = TypeImpl.substitute(_typeArguments, argumentTypes, parameterTypes); 3527 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p arameterTypes);
2931 return newType; 3528 return newType;
2932 } 3529 }
3530 void appendTo(StringBuffer builder) {
3531 builder.add(name);
3532 int argumentCount = _typeArguments.length;
3533 if (argumentCount > 0) {
3534 builder.add("<");
3535 for (int i = 0; i < argumentCount; i++) {
3536 if (i > 0) {
3537 builder.add(", ");
3538 }
3539 ((_typeArguments[i] as TypeImpl)).appendTo(builder);
3540 }
3541 builder.add(">");
3542 }
3543 }
2933 } 3544 }
2934 /** 3545 /**
2935 * The abstract class {@code TypeImpl} implements the behavior common to objects representing the 3546 * The abstract class {@code TypeImpl} implements the behavior common to objects representing the
2936 * declared type of elements in the element model. 3547 * declared type of elements in the element model.
2937 */ 3548 */
2938 abstract class TypeImpl implements Type2 { 3549 abstract class TypeImpl implements Type2 {
2939 /** 3550 /**
2940 * Return an array containing the results of using the given argument types an d parameter types to 3551 * Return an array containing the results of using the given argument types an d parameter types to
2941 * perform a substitution on all of the given types. 3552 * perform a substitution on all of the given types.
2942 * @param types the types on which a substitution is to be performed 3553 * @param types the types on which a substitution is to be performed
(...skipping 30 matching lines...) Expand all
2973 TypeImpl(Element element, String name) { 3584 TypeImpl(Element element, String name) {
2974 this._element = element; 3585 this._element = element;
2975 this._name = name; 3586 this._name = name;
2976 } 3587 }
2977 Element get element => _element; 3588 Element get element => _element;
2978 Type2 getLeastUpperBound(Type2 type) => null; 3589 Type2 getLeastUpperBound(Type2 type) => null;
2979 String get name => _name; 3590 String get name => _name;
2980 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this); 3591 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf( this);
2981 bool isMoreSpecificThan(Type2 type) => false; 3592 bool isMoreSpecificThan(Type2 type) => false;
2982 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); 3593 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this);
2983 String toString() => _name == null ? "<unnamed type>" : "type ${_name}"; 3594 String toString() {
3595 StringBuffer builder = new StringBuffer();
3596 appendTo(builder);
3597 return builder.toString();
3598 }
3599 /**
3600 * Append a textual representation of this type to the given builder.
3601 * @param builder the builder to which the text is to be appended
3602 */
3603 void appendTo(StringBuffer builder) {
3604 if (_name == null) {
3605 builder.add("<unnamed type>");
3606 } else {
3607 builder.add(_name);
3608 }
3609 }
2984 } 3610 }
2985 /** 3611 /**
2986 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o bjects representing 3612 * Instances of the class {@code TypeVariableTypeImpl} defines the behavior of o bjects representing
2987 * the type introduced by a type variable. 3613 * the type introduced by a type variable.
2988 */ 3614 */
2989 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { 3615 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType {
2990 /** 3616 /**
2991 * Return an array containing the type variable types defined by the given arr ay of type variable 3617 * Return an array containing the type variable types defined by the given arr ay of type variable
2992 * elements. 3618 * elements.
2993 * @param typeVariables the type variable elements defining the type variable types to be returned 3619 * @param typeVariables the type variable elements defining the type variable types to be returned
2994 * @return the type variable types defined by the type variable elements 3620 * @return the type variable types defined by the type variable elements
2995 */ 3621 */
2996 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables ) { 3622 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables ) {
2997 int count = typeVariables.length; 3623 int count = typeVariables.length;
2998 List<TypeVariableType> types = new List<TypeVariableType>.fixedLength(count) ; 3624 List<TypeVariableType> types = new List<TypeVariableType>.fixedLength(count) ;
2999 for (int i = 0; i < count; i++) { 3625 for (int i = 0; i < count; i++) {
3000 types[i] = typeVariables[i].type; 3626 types[i] = typeVariables[i].type;
3001 } 3627 }
3002 return types; 3628 return types;
3003 } 3629 }
3004 /** 3630 /**
3005 * Initialize a newly created type variable to be declared by the given elemen t and to have the 3631 * Initialize a newly created type variable to be declared by the given elemen t and to have the
3006 * given name. 3632 * given name.
3007 * @param element the element representing the declaration of the type variabl e 3633 * @param element the element representing the declaration of the type variabl e
3008 */ 3634 */
3009 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam e) { 3635 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam e) {
3010 } 3636 }
3011 bool operator ==(Object object) => object is TypeVariableTypeImpl && element = = (object as TypeVariableTypeImpl).element; 3637 bool operator ==(Object object) => object is TypeVariableTypeImpl && element = = ((object as TypeVariableTypeImpl)).element;
3012 TypeVariableElement get element => super.element as TypeVariableElement; 3638 TypeVariableElement get element => (super.element as TypeVariableElement);
3013 int get hashCode => element.hashCode; 3639 int get hashCode => element.hashCode;
3014 bool isMoreSpecificThan(Type2 type) { 3640 bool isMoreSpecificThan(Type2 type) {
3015 Type2 upperBound = element.bound; 3641 Type2 upperBound = element.bound;
3016 return type == upperBound; 3642 return type == upperBound;
3017 } 3643 }
3018 bool isSubtypeOf(Type2 type) => true; 3644 bool isSubtypeOf(Type2 type) => true;
3019 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { 3645 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
3020 int length7 = parameterTypes.length; 3646 int length7 = parameterTypes.length;
3021 for (int i = 0; i < length7; i++) { 3647 for (int i = 0; i < length7; i++) {
3022 if (parameterTypes[i] == this) { 3648 if (parameterTypes[i] == this) {
(...skipping 14 matching lines...) Expand all
3037 /** 3663 /**
3038 * Return the unique instance of this class. 3664 * Return the unique instance of this class.
3039 * @return the unique instance of this class 3665 * @return the unique instance of this class
3040 */ 3666 */
3041 static VoidTypeImpl get instance => _INSTANCE; 3667 static VoidTypeImpl get instance => _INSTANCE;
3042 /** 3668 /**
3043 * Prevent the creation of instances of this class. 3669 * Prevent the creation of instances of this class.
3044 */ 3670 */
3045 VoidTypeImpl() : super(null, Keyword.VOID.syntax) { 3671 VoidTypeImpl() : super(null, Keyword.VOID.syntax) {
3046 } 3672 }
3047 bool operator ==(Object object) => object == this; 3673 bool operator ==(Object object) => identical(object, this);
3048 bool isSubtypeOf(Type2 type) => type == this || type == DynamicTypeImpl.instan ce; 3674 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam icTypeImpl.instance);
3049 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this; 3675 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this;
3050 } 3676 }
3051 /** 3677 /**
3052 * The interface {@code FunctionType} defines the behavior common to objects rep resenting the type 3678 * The interface {@code FunctionType} defines the behavior common to objects rep resenting the type
3053 * of a function, method, constructor, getter, or setter. Function types come in three variations: 3679 * of a function, method, constructor, getter, or setter. Function types come in three variations:
3054 * <ol> 3680 * <ol>
3055 * <li>The types of functions that only have required parameters. These have the general form 3681 * <li>The types of functions that only have required parameters. These have the general form
3056 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i>.</li> 3682 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>) &rarr; T</i>.</li>
3057 * <li>The types of functions with optional positional parameters. These have th e general form 3683 * <li>The types of functions with optional positional parameters. These have th e general form
3058 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, [T<sub>n+1</sub>, &hellip;, T<sub >n+k</sub>]) &rarr; 3684 * <i>(T<sub>1</sub>, &hellip;, T<sub>n</sub>, [T<sub>n+1</sub>, &hellip;, T<sub >n+k</sub>]) &rarr;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 */ 3961 */
3336 abstract class TypeVariableType implements Type2 { 3962 abstract class TypeVariableType implements Type2 {
3337 TypeVariableElement get element; 3963 TypeVariableElement get element;
3338 } 3964 }
3339 /** 3965 /**
3340 * The interface {@code VoidType} defines the behavior of the unique object repr esenting the type{@code void}. 3966 * The interface {@code VoidType} defines the behavior of the unique object repr esenting the type{@code void}.
3341 */ 3967 */
3342 abstract class VoidType implements Type2 { 3968 abstract class VoidType implements Type2 {
3343 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 3969 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
3344 } 3970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698