| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 |
| 3 library engine.element; | 4 library engine.element; |
| 5 |
| 4 import 'dart:collection'; | 6 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
| 7 import 'utilities_collection.dart'; | 9 import 'utilities_collection.dart'; |
| 8 import 'source.dart'; | 10 import 'source.dart'; |
| 9 import 'scanner.dart' show Keyword; | 11 import 'scanner.dart' show Keyword; |
| 10 import 'ast.dart' show Identifier, LibraryIdentifier; | 12 import 'ast.dart' show Identifier, LibraryIdentifier; |
| 11 import 'sdk.dart' show DartSdk; | 13 import 'sdk.dart' show DartSdk; |
| 12 import 'html.dart' show XmlTagNode; | 14 import 'html.dart' show XmlTagNode; |
| 13 import 'engine.dart' show AnalysisContext; | 15 import 'engine.dart' show AnalysisContext; |
| 14 import 'constant.dart' show EvaluationResultImpl; | 16 import 'constant.dart' show EvaluationResultImpl; |
| 15 import 'utilities_dart.dart'; | 17 import 'utilities_dart.dart'; |
| 18 |
| 16 /** | 19 /** |
| 17 * The interface `ClassElement` defines the behavior of elements that represent
a class. | 20 * The interface `ClassElement` defines the behavior of elements that represent
a class. |
| 18 * | 21 * |
| 19 * @coverage dart.engine.element | 22 * @coverage dart.engine.element |
| 20 */ | 23 */ |
| 21 abstract class ClassElement implements Element { | 24 abstract class ClassElement implements Element { |
| 22 | |
| 23 /** | 25 /** |
| 24 * Return an array containing all of the accessors (getters and setters) decla
red in this class. | 26 * Return an array containing all of the accessors (getters and setters) decla
red in this class. |
| 25 * | 27 * |
| 26 * @return the accessors declared in this class | 28 * @return the accessors declared in this class |
| 27 */ | 29 */ |
| 28 List<PropertyAccessorElement> get accessors; | 30 List<PropertyAccessorElement> get accessors; |
| 29 | 31 |
| 30 /** | 32 /** |
| 31 * Return an array containing all the supertypes defined for this class and it
s supertypes. This | 33 * Return an array containing all the supertypes defined for this class and it
s supertypes. This |
| 32 * includes superclasses, mixins and interfaces. | 34 * includes superclasses, mixins and interfaces. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 * | 258 * |
| 257 * </blockquote> | 259 * </blockquote> |
| 258 * | 260 * |
| 259 * @param setterName the name of the setter being looked up | 261 * @param setterName the name of the setter being looked up |
| 260 * @param library the library with respect to which the lookup is being perfor
med | 262 * @param library the library with respect to which the lookup is being perfor
med |
| 261 * @return the result of looking up the given setter in this class with respec
t to the given | 263 * @return the result of looking up the given setter in this class with respec
t to the given |
| 262 * library | 264 * library |
| 263 */ | 265 */ |
| 264 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
); | 266 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
); |
| 265 } | 267 } |
| 268 |
| 266 /** | 269 /** |
| 267 * The interface `ClassMemberElement` defines the behavior of elements that are
contained | 270 * The interface `ClassMemberElement` defines the behavior of elements that are
contained |
| 268 * within a [ClassElement]. | 271 * within a [ClassElement]. |
| 269 */ | 272 */ |
| 270 abstract class ClassMemberElement implements Element { | 273 abstract class ClassMemberElement implements Element { |
| 271 | |
| 272 /** | 274 /** |
| 273 * Return the type in which this member is defined. | 275 * Return the type in which this member is defined. |
| 274 * | 276 * |
| 275 * @return the type in which this member is defined | 277 * @return the type in which this member is defined |
| 276 */ | 278 */ |
| 277 ClassElement get enclosingElement; | 279 ClassElement get enclosingElement; |
| 278 | 280 |
| 279 /** | 281 /** |
| 280 * Return `true` if this element is a static element. A static element is an e
lement that is | 282 * Return `true` if this element is a static element. A static element is an e
lement that is |
| 281 * not associated with a particular instance, but rather with an entire librar
y or class. | 283 * not associated with a particular instance, but rather with an entire librar
y or class. |
| 282 * | 284 * |
| 283 * @return `true` if this executable element is a static element | 285 * @return `true` if this executable element is a static element |
| 284 */ | 286 */ |
| 285 bool get isStatic; | 287 bool get isStatic; |
| 286 } | 288 } |
| 289 |
| 287 /** | 290 /** |
| 288 * The interface `CompilationUnitElement` defines the behavior of elements repre
senting a | 291 * The interface `CompilationUnitElement` defines the behavior of elements repre
senting a |
| 289 * compilation unit. | 292 * compilation unit. |
| 290 * | 293 * |
| 291 * @coverage dart.engine.element | 294 * @coverage dart.engine.element |
| 292 */ | 295 */ |
| 293 abstract class CompilationUnitElement implements Element, UriReferencedElement { | 296 abstract class CompilationUnitElement implements Element, UriReferencedElement { |
| 294 | |
| 295 /** | 297 /** |
| 296 * Return an array containing all of the top-level accessors (getters and sett
ers) contained in | 298 * Return an array containing all of the top-level accessors (getters and sett
ers) contained in |
| 297 * this compilation unit. | 299 * this compilation unit. |
| 298 * | 300 * |
| 299 * @return the top-level accessors contained in this compilation unit | 301 * @return the top-level accessors contained in this compilation unit |
| 300 */ | 302 */ |
| 301 List<PropertyAccessorElement> get accessors; | 303 List<PropertyAccessorElement> get accessors; |
| 302 | 304 |
| 303 /** | 305 /** |
| 304 * Return the library in which this compilation unit is defined. | 306 * Return the library in which this compilation unit is defined. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 */ | 339 */ |
| 338 ClassElement getType(String className); | 340 ClassElement getType(String className); |
| 339 | 341 |
| 340 /** | 342 /** |
| 341 * Return an array containing all of the classes contained in this compilation
unit. | 343 * Return an array containing all of the classes contained in this compilation
unit. |
| 342 * | 344 * |
| 343 * @return the classes contained in this compilation unit | 345 * @return the classes contained in this compilation unit |
| 344 */ | 346 */ |
| 345 List<ClassElement> get types; | 347 List<ClassElement> get types; |
| 346 } | 348 } |
| 349 |
| 347 /** | 350 /** |
| 348 * The interface `ConstructorElement` defines the behavior of elements represent
ing a | 351 * The interface `ConstructorElement` defines the behavior of elements represent
ing a |
| 349 * constructor or a factory method defined within a type. | 352 * constructor or a factory method defined within a type. |
| 350 * | 353 * |
| 351 * @coverage dart.engine.element | 354 * @coverage dart.engine.element |
| 352 */ | 355 */ |
| 353 abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme
nt { | 356 abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme
nt { |
| 354 | |
| 355 /** | 357 /** |
| 356 * Return the constructor to which this constructor is redirecting. | 358 * Return the constructor to which this constructor is redirecting. |
| 357 * | 359 * |
| 358 * @return the constructor to which this constructor is redirecting | 360 * @return the constructor to which this constructor is redirecting |
| 359 */ | 361 */ |
| 360 ConstructorElement get redirectedConstructor; | 362 ConstructorElement get redirectedConstructor; |
| 361 | 363 |
| 362 /** | 364 /** |
| 363 * Return `true` if this constructor is a const constructor. | 365 * Return `true` if this constructor is a const constructor. |
| 364 * | 366 * |
| 365 * @return `true` if this constructor is a const constructor | 367 * @return `true` if this constructor is a const constructor |
| 366 */ | 368 */ |
| 367 bool get isConst; | 369 bool get isConst; |
| 368 | 370 |
| 369 /** | 371 /** |
| 370 * Return `true` if this constructor can be used as a default constructor - un
named and has | 372 * Return `true` if this constructor can be used as a default constructor - un
named and has |
| 371 * no required parameters. | 373 * no required parameters. |
| 372 * | 374 * |
| 373 * @return `true` if this constructor can be used as a default constructor. | 375 * @return `true` if this constructor can be used as a default constructor. |
| 374 */ | 376 */ |
| 375 bool get isDefaultConstructor; | 377 bool get isDefaultConstructor; |
| 376 | 378 |
| 377 /** | 379 /** |
| 378 * Return `true` if this constructor represents a factory constructor. | 380 * Return `true` if this constructor represents a factory constructor. |
| 379 * | 381 * |
| 380 * @return `true` if this constructor represents a factory constructor | 382 * @return `true` if this constructor represents a factory constructor |
| 381 */ | 383 */ |
| 382 bool get isFactory; | 384 bool get isFactory; |
| 383 } | 385 } |
| 386 |
| 384 /** | 387 /** |
| 385 * The interface `Element` defines the behavior common to all of the elements in
the element | 388 * The interface `Element` defines the behavior common to all of the elements in
the element |
| 386 * model. Generally speaking, the element model is a semantic model of the progr
am that represents | 389 * model. Generally speaking, the element model is a semantic model of the progr
am that represents |
| 387 * things that are declared with a name and hence can be referenced elsewhere in
the code. | 390 * things that are declared with a name and hence can be referenced elsewhere in
the code. |
| 388 * | 391 * |
| 389 * There are two exceptions to the general case. First, there are elements in th
e element model that | 392 * There are two exceptions to the general case. First, there are elements in th
e element model that |
| 390 * are created for the convenience of various kinds of analysis but that do not
have any | 393 * are created for the convenience of various kinds of analysis but that do not
have any |
| 391 * corresponding declaration within the source code. Such elements are marked as
being | 394 * corresponding declaration within the source code. Such elements are marked as
being |
| 392 * <i>synthetic</i>. Examples of synthetic elements include | 395 * <i>synthetic</i>. Examples of synthetic elements include |
| 393 * | 396 * |
| 394 * * default constructors in classes that do not define any explicit constructor
s, | 397 * * default constructors in classes that do not define any explicit constructor
s, |
| 395 * * getters and setters that are induced by explicit field declarations, | 398 * * getters and setters that are induced by explicit field declarations, |
| 396 * * fields that are induced by explicit declarations of getters and setters, an
d | 399 * * fields that are induced by explicit declarations of getters and setters, an
d |
| 397 * * functions representing the initialization expression for a variable. | 400 * * functions representing the initialization expression for a variable. |
| 398 * | 401 * |
| 399 * | 402 * |
| 400 * Second, there are elements in the element model that do not have a name. Thes
e correspond to | 403 * Second, there are elements in the element model that do not have a name. Thes
e correspond to |
| 401 * unnamed functions and exist in order to more accurately represent the semanti
c structure of the | 404 * unnamed functions and exist in order to more accurately represent the semanti
c structure of the |
| 402 * program. | 405 * program. |
| 403 * | 406 * |
| 404 * @coverage dart.engine.element | 407 * @coverage dart.engine.element |
| 405 */ | 408 */ |
| 406 abstract class Element { | 409 abstract class Element { |
| 407 | |
| 408 /** | 410 /** |
| 409 * A comparator that can be used to sort elements by their name offset. Elemen
ts with a smaller | 411 * A comparator that can be used to sort elements by their name offset. Elemen
ts with a smaller |
| 410 * offset will be sorted to be before elements with a larger name offset. | 412 * offset will be sorted to be before elements with a larger name offset. |
| 411 */ | 413 */ |
| 412 static final Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Eleme
nt secondElement) => firstElement.nameOffset - secondElement.nameOffset; | 414 static final Comparator<Element> SORT_BY_OFFSET = (Element firstElement, Eleme
nt secondElement) => firstElement.nameOffset - secondElement.nameOffset; |
| 413 | 415 |
| 414 /** | 416 /** |
| 415 * Use the given visitor to visit this element. | 417 * Use the given visitor to visit this element. |
| 416 * | 418 * |
| 417 * @param visitor the visitor that will visit this element | 419 * @param visitor the visitor that will visit this element |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 * the given library. This is defined by the Dart Language Specification in se
ction 3.2: | 528 * the given library. This is defined by the Dart Language Specification in se
ction 3.2: |
| 527 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i
>m</i> is declared | 529 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i
>m</i> is declared |
| 528 * in <i>L</i> or if <i>m</i> is public. </blockquote> | 530 * in <i>L</i> or if <i>m</i> is public. </blockquote> |
| 529 * | 531 * |
| 530 * @param library the library in which a possible reference to this element wo
uld occur | 532 * @param library the library in which a possible reference to this element wo
uld occur |
| 531 * @return `true` if this element is accessible to code in the given library | 533 * @return `true` if this element is accessible to code in the given library |
| 532 */ | 534 */ |
| 533 bool isAccessibleIn(LibraryElement library); | 535 bool isAccessibleIn(LibraryElement library); |
| 534 | 536 |
| 535 /** | 537 /** |
| 538 * Return `true` if this element has an annotation of the form '@deprecated' o
r |
| 539 * '@Deprecated('..')'. |
| 540 * |
| 541 * @return `true` if this element is deprecated |
| 542 */ |
| 543 bool get isDeprecated; |
| 544 |
| 545 /** |
| 536 * Return `true` if this element is synthetic. A synthetic element is an eleme
nt that is not | 546 * Return `true` if this element is synthetic. A synthetic element is an eleme
nt that is not |
| 537 * represented in the source code explicitly, but is implied by the source cod
e, such as the | 547 * represented in the source code explicitly, but is implied by the source cod
e, such as the |
| 538 * default constructor for a class that does not explicitly define any constru
ctors. | 548 * default constructor for a class that does not explicitly define any constru
ctors. |
| 539 * | 549 * |
| 540 * @return `true` if this element is synthetic | 550 * @return `true` if this element is synthetic |
| 541 */ | 551 */ |
| 542 bool get isSynthetic; | 552 bool get isSynthetic; |
| 543 | 553 |
| 544 /** | 554 /** |
| 545 * Use the given visitor to visit all of the children of this element. There i
s no guarantee of | 555 * Use the given visitor to visit all of the children of this element. There i
s no guarantee of |
| 546 * the order in which the children will be visited. | 556 * the order in which the children will be visited. |
| 547 * | 557 * |
| 548 * @param visitor the visitor that will be used to visit the children of this
element | 558 * @param visitor the visitor that will be used to visit the children of this
element |
| 549 */ | 559 */ |
| 550 void visitChildren(ElementVisitor visitor); | 560 void visitChildren(ElementVisitor visitor); |
| 551 } | 561 } |
| 562 |
| 552 /** | 563 /** |
| 553 * The interface `ElementAnnotation` defines the behavior of objects representin
g a single | 564 * The interface `ElementAnnotation` defines the behavior of objects representin
g a single |
| 554 * annotation associated with an element. | 565 * annotation associated with an element. |
| 555 * | 566 * |
| 556 * @coverage dart.engine.element | 567 * @coverage dart.engine.element |
| 557 */ | 568 */ |
| 558 abstract class ElementAnnotation { | 569 abstract class ElementAnnotation { |
| 559 | |
| 560 /** | 570 /** |
| 561 * Return the element representing the field, variable, or const constructor b
eing used as an | 571 * Return the element representing the field, variable, or const constructor b
eing used as an |
| 562 * annotation. | 572 * annotation. |
| 563 * | 573 * |
| 564 * @return the field, variable, or constructor being used as an annotation | 574 * @return the field, variable, or constructor being used as an annotation |
| 565 */ | 575 */ |
| 566 Element get element; | 576 Element get element; |
| 567 } | 577 } |
| 578 |
| 568 /** | 579 /** |
| 569 * The enumeration `ElementKind` defines the various kinds of elements in the el
ement model. | 580 * The enumeration `ElementKind` defines the various kinds of elements in the el
ement model. |
| 570 * | 581 * |
| 571 * @coverage dart.engine.element | 582 * @coverage dart.engine.element |
| 572 */ | 583 */ |
| 573 class ElementKind extends Enum<ElementKind> { | 584 class ElementKind extends Enum<ElementKind> { |
| 574 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class"); | 585 static final ElementKind CLASS = new ElementKind('CLASS', 0, "class"); |
| 586 |
| 575 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT'
, 1, "compilation unit"); | 587 static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT'
, 1, "compilation unit"); |
| 588 |
| 576 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons
tructor"); | 589 static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "cons
tructor"); |
| 590 |
| 577 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>"); | 591 static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 3, "<dynamic>"); |
| 592 |
| 578 static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML
_SCRIPT', 4, "embedded html script"); | 593 static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML
_SCRIPT', 4, "embedded html script"); |
| 594 |
| 579 static final ElementKind ERROR = new ElementKind('ERROR', 5, "<error>"); | 595 static final ElementKind ERROR = new ElementKind('ERROR', 5, "<error>"); |
| 596 |
| 580 static final ElementKind EXPORT = new ElementKind('EXPORT', 6, "export directi
ve"); | 597 static final ElementKind EXPORT = new ElementKind('EXPORT', 6, "export directi
ve"); |
| 598 |
| 581 static final ElementKind EXTERNAL_HTML_SCRIPT = new ElementKind('EXTERNAL_HTML
_SCRIPT', 7, "external html script"); | 599 static final ElementKind EXTERNAL_HTML_SCRIPT = new ElementKind('EXTERNAL_HTML
_SCRIPT', 7, "external html script"); |
| 600 |
| 582 static final ElementKind FIELD = new ElementKind('FIELD', 8, "field"); | 601 static final ElementKind FIELD = new ElementKind('FIELD', 8, "field"); |
| 602 |
| 583 static final ElementKind FUNCTION = new ElementKind('FUNCTION', 9, "function")
; | 603 static final ElementKind FUNCTION = new ElementKind('FUNCTION', 9, "function")
; |
| 604 |
| 584 static final ElementKind GETTER = new ElementKind('GETTER', 10, "getter"); | 605 static final ElementKind GETTER = new ElementKind('GETTER', 10, "getter"); |
| 606 |
| 585 static final ElementKind HTML = new ElementKind('HTML', 11, "html"); | 607 static final ElementKind HTML = new ElementKind('HTML', 11, "html"); |
| 608 |
| 586 static final ElementKind IMPORT = new ElementKind('IMPORT', 12, "import direct
ive"); | 609 static final ElementKind IMPORT = new ElementKind('IMPORT', 12, "import direct
ive"); |
| 610 |
| 587 static final ElementKind LABEL = new ElementKind('LABEL', 13, "label"); | 611 static final ElementKind LABEL = new ElementKind('LABEL', 13, "label"); |
| 612 |
| 588 static final ElementKind LIBRARY = new ElementKind('LIBRARY', 14, "library"); | 613 static final ElementKind LIBRARY = new ElementKind('LIBRARY', 14, "library"); |
| 614 |
| 589 static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 15
, "local variable"); | 615 static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 15
, "local variable"); |
| 616 |
| 590 static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); | 617 static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); |
| 618 |
| 591 static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); | 619 static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); |
| 620 |
| 592 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "paramet
er"); | 621 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "paramet
er"); |
| 622 |
| 593 static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix
"); | 623 static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix
"); |
| 624 |
| 594 static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); | 625 static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); |
| 626 |
| 595 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA
BLE', 21, "top level variable"); | 627 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA
BLE', 21, "top level variable"); |
| 628 |
| 596 static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_
ALIAS', 22, "function type alias"); | 629 static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_
ALIAS', 22, "function type alias"); |
| 630 |
| 597 static final ElementKind TYPE_PARAMETER = new ElementKind('TYPE_PARAMETER', 23
, "type parameter"); | 631 static final ElementKind TYPE_PARAMETER = new ElementKind('TYPE_PARAMETER', 23
, "type parameter"); |
| 632 |
| 598 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe
>"); | 633 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe
>"); |
| 634 |
| 599 static final List<ElementKind> values = [ | 635 static final List<ElementKind> values = [ |
| 600 CLASS, | 636 CLASS, |
| 601 COMPILATION_UNIT, | 637 COMPILATION_UNIT, |
| 602 CONSTRUCTOR, | 638 CONSTRUCTOR, |
| 603 DYNAMIC, | 639 DYNAMIC, |
| 604 EMBEDDED_HTML_SCRIPT, | 640 EMBEDDED_HTML_SCRIPT, |
| 605 ERROR, | 641 ERROR, |
| 606 EXPORT, | 642 EXPORT, |
| 607 EXTERNAL_HTML_SCRIPT, | 643 EXTERNAL_HTML_SCRIPT, |
| 608 FIELD, | 644 FIELD, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 680 |
| 645 /** | 681 /** |
| 646 * Initialize a newly created element kind to have the given display name. | 682 * Initialize a newly created element kind to have the given display name. |
| 647 * | 683 * |
| 648 * @param displayName the name displayed in the UI for this kind of element | 684 * @param displayName the name displayed in the UI for this kind of element |
| 649 */ | 685 */ |
| 650 ElementKind(String name, int ordinal, String displayName) : super(name, ordina
l) { | 686 ElementKind(String name, int ordinal, String displayName) : super(name, ordina
l) { |
| 651 this.displayName = displayName; | 687 this.displayName = displayName; |
| 652 } | 688 } |
| 653 } | 689 } |
| 690 |
| 654 /** | 691 /** |
| 655 * The interface `ElementLocation` defines the behavior of objects that represen
t the location | 692 * The interface `ElementLocation` defines the behavior of objects that represen
t the location |
| 656 * of an element within the element model. | 693 * of an element within the element model. |
| 657 * | 694 * |
| 658 * @coverage dart.engine.element | 695 * @coverage dart.engine.element |
| 659 */ | 696 */ |
| 660 abstract class ElementLocation { | 697 abstract class ElementLocation { |
| 661 | |
| 662 /** | 698 /** |
| 663 * Return an encoded representation of this location that can be used to creat
e a location that is | 699 * Return an encoded representation of this location that can be used to creat
e a location that is |
| 664 * equal to this location. | 700 * equal to this location. |
| 665 * | 701 * |
| 666 * @return an encoded representation of this location | 702 * @return an encoded representation of this location |
| 667 */ | 703 */ |
| 668 String get encoding; | 704 String get encoding; |
| 669 } | 705 } |
| 706 |
| 670 /** | 707 /** |
| 671 * The interface `ElementVisitor` defines the behavior of objects that can be us
ed to visit an | 708 * The interface `ElementVisitor` defines the behavior of objects that can be us
ed to visit an |
| 672 * element structure. | 709 * element structure. |
| 673 * | 710 * |
| 674 * @coverage dart.engine.element | 711 * @coverage dart.engine.element |
| 675 */ | 712 */ |
| 676 abstract class ElementVisitor<R> { | 713 abstract class ElementVisitor<R> { |
| 677 R visitClassElement(ClassElement element); | 714 R visitClassElement(ClassElement element); |
| 715 |
| 678 R visitCompilationUnitElement(CompilationUnitElement element); | 716 R visitCompilationUnitElement(CompilationUnitElement element); |
| 717 |
| 679 R visitConstructorElement(ConstructorElement element); | 718 R visitConstructorElement(ConstructorElement element); |
| 719 |
| 680 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); | 720 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); |
| 721 |
| 681 R visitExportElement(ExportElement element); | 722 R visitExportElement(ExportElement element); |
| 723 |
| 682 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element); | 724 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element); |
| 725 |
| 683 R visitFieldElement(FieldElement element); | 726 R visitFieldElement(FieldElement element); |
| 727 |
| 684 R visitFieldFormalParameterElement(FieldFormalParameterElement element); | 728 R visitFieldFormalParameterElement(FieldFormalParameterElement element); |
| 729 |
| 685 R visitFunctionElement(FunctionElement element); | 730 R visitFunctionElement(FunctionElement element); |
| 731 |
| 686 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element); | 732 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element); |
| 733 |
| 687 R visitHtmlElement(HtmlElement element); | 734 R visitHtmlElement(HtmlElement element); |
| 735 |
| 688 R visitImportElement(ImportElement element); | 736 R visitImportElement(ImportElement element); |
| 737 |
| 689 R visitLabelElement(LabelElement element); | 738 R visitLabelElement(LabelElement element); |
| 739 |
| 690 R visitLibraryElement(LibraryElement element); | 740 R visitLibraryElement(LibraryElement element); |
| 741 |
| 691 R visitLocalVariableElement(LocalVariableElement element); | 742 R visitLocalVariableElement(LocalVariableElement element); |
| 743 |
| 692 R visitMethodElement(MethodElement element); | 744 R visitMethodElement(MethodElement element); |
| 745 |
| 693 R visitMultiplyDefinedElement(MultiplyDefinedElement element); | 746 R visitMultiplyDefinedElement(MultiplyDefinedElement element); |
| 747 |
| 694 R visitParameterElement(ParameterElement element); | 748 R visitParameterElement(ParameterElement element); |
| 749 |
| 695 R visitPrefixElement(PrefixElement element); | 750 R visitPrefixElement(PrefixElement element); |
| 751 |
| 696 R visitPropertyAccessorElement(PropertyAccessorElement element); | 752 R visitPropertyAccessorElement(PropertyAccessorElement element); |
| 753 |
| 697 R visitTopLevelVariableElement(TopLevelVariableElement element); | 754 R visitTopLevelVariableElement(TopLevelVariableElement element); |
| 755 |
| 698 R visitTypeParameterElement(TypeParameterElement element); | 756 R visitTypeParameterElement(TypeParameterElement element); |
| 699 } | 757 } |
| 758 |
| 700 /** | 759 /** |
| 701 * The interface `EmbeddedHtmlScriptElement` defines the behavior of elements re
presenting a | 760 * The interface `EmbeddedHtmlScriptElement` defines the behavior of elements re
presenting a |
| 702 * script tag in an HTML file having content that defines a Dart library. | 761 * script tag in an HTML file having content that defines a Dart library. |
| 703 * | 762 * |
| 704 * @coverage dart.engine.element | 763 * @coverage dart.engine.element |
| 705 */ | 764 */ |
| 706 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { | 765 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { |
| 707 | |
| 708 /** | 766 /** |
| 709 * Return the library element defined by the content of the script tag. | 767 * Return the library element defined by the content of the script tag. |
| 710 * | 768 * |
| 711 * @return the library element (not `null`) | 769 * @return the library element (not `null`) |
| 712 */ | 770 */ |
| 713 LibraryElement get scriptLibrary; | 771 LibraryElement get scriptLibrary; |
| 714 } | 772 } |
| 773 |
| 715 /** | 774 /** |
| 716 * The interface `ExecutableElement` defines the behavior of elements representi
ng an | 775 * The interface `ExecutableElement` defines the behavior of elements representi
ng an |
| 717 * executable object, including functions, methods, constructors, getters, and s
etters. | 776 * executable object, including functions, methods, constructors, getters, and s
etters. |
| 718 * | 777 * |
| 719 * @coverage dart.engine.element | 778 * @coverage dart.engine.element |
| 720 */ | 779 */ |
| 721 abstract class ExecutableElement implements Element { | 780 abstract class ExecutableElement implements Element { |
| 722 | |
| 723 /** | 781 /** |
| 724 * Return an array containing all of the functions defined within this executa
ble element. | 782 * Return an array containing all of the functions defined within this executa
ble element. |
| 725 * | 783 * |
| 726 * @return the functions defined within this executable element | 784 * @return the functions defined within this executable element |
| 727 */ | 785 */ |
| 728 List<FunctionElement> get functions; | 786 List<FunctionElement> get functions; |
| 729 | 787 |
| 730 /** | 788 /** |
| 731 * Return an array containing all of the labels defined within this executable
element. | 789 * Return an array containing all of the labels defined within this executable
element. |
| 732 * | 790 * |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 bool get isOperator; | 830 bool get isOperator; |
| 773 | 831 |
| 774 /** | 832 /** |
| 775 * Return `true` if this element is a static element. A static element is an e
lement that is | 833 * Return `true` if this element is a static element. A static element is an e
lement that is |
| 776 * not associated with a particular instance, but rather with an entire librar
y or class. | 834 * not associated with a particular instance, but rather with an entire librar
y or class. |
| 777 * | 835 * |
| 778 * @return `true` if this executable element is a static element | 836 * @return `true` if this executable element is a static element |
| 779 */ | 837 */ |
| 780 bool get isStatic; | 838 bool get isStatic; |
| 781 } | 839 } |
| 840 |
| 782 /** | 841 /** |
| 783 * The interface `ExportElement` defines the behavior of objects representing in
formation | 842 * The interface `ExportElement` defines the behavior of objects representing in
formation |
| 784 * about a single export directive within a library. | 843 * about a single export directive within a library. |
| 785 * | 844 * |
| 786 * @coverage dart.engine.element | 845 * @coverage dart.engine.element |
| 787 */ | 846 */ |
| 788 abstract class ExportElement implements Element, UriReferencedElement { | 847 abstract class ExportElement implements Element, UriReferencedElement { |
| 789 | |
| 790 /** | 848 /** |
| 791 * An empty array of export elements. | 849 * An empty array of export elements. |
| 792 */ | 850 */ |
| 793 static final List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); | 851 static final List<ExportElement> EMPTY_ARRAY = new List<ExportElement>(0); |
| 794 | 852 |
| 795 /** | 853 /** |
| 796 * Return an array containing the combinators that were specified as part of t
he export directive | 854 * Return an array containing the combinators that were specified as part of t
he export directive |
| 797 * in the order in which they were specified. | 855 * in the order in which they were specified. |
| 798 * | 856 * |
| 799 * @return the combinators specified in the export directive | 857 * @return the combinators specified in the export directive |
| 800 */ | 858 */ |
| 801 List<NamespaceCombinator> get combinators; | 859 List<NamespaceCombinator> get combinators; |
| 802 | 860 |
| 803 /** | 861 /** |
| 804 * Return the library that is exported from this library by this export direct
ive. | 862 * Return the library that is exported from this library by this export direct
ive. |
| 805 * | 863 * |
| 806 * @return the library that is exported from this library | 864 * @return the library that is exported from this library |
| 807 */ | 865 */ |
| 808 LibraryElement get exportedLibrary; | 866 LibraryElement get exportedLibrary; |
| 809 } | 867 } |
| 868 |
| 810 /** | 869 /** |
| 811 * The interface `ExternalHtmlScriptElement` defines the behavior of elements re
presenting a | 870 * The interface `ExternalHtmlScriptElement` defines the behavior of elements re
presenting a |
| 812 * script tag in an HTML file having a `source` attribute that references a Dart
library | 871 * script tag in an HTML file having a `source` attribute that references a Dart
library |
| 813 * source file. | 872 * source file. |
| 814 * | 873 * |
| 815 * @coverage dart.engine.element | 874 * @coverage dart.engine.element |
| 816 */ | 875 */ |
| 817 abstract class ExternalHtmlScriptElement implements HtmlScriptElement { | 876 abstract class ExternalHtmlScriptElement implements HtmlScriptElement { |
| 818 | |
| 819 /** | 877 /** |
| 820 * Return the source referenced by this element, or `null` if this element doe
s not | 878 * Return the source referenced by this element, or `null` if this element doe
s not |
| 821 * reference a Dart library source file. | 879 * reference a Dart library source file. |
| 822 * | 880 * |
| 823 * @return the source for the external Dart library | 881 * @return the source for the external Dart library |
| 824 */ | 882 */ |
| 825 Source get scriptSource; | 883 Source get scriptSource; |
| 826 } | 884 } |
| 885 |
| 827 /** | 886 /** |
| 828 * The interface `FieldElement` defines the behavior of elements representing a
field defined | 887 * The interface `FieldElement` defines the behavior of elements representing a
field defined |
| 829 * within a type. | 888 * within a type. |
| 830 * | 889 * |
| 831 * @coverage dart.engine.element | 890 * @coverage dart.engine.element |
| 832 */ | 891 */ |
| 833 abstract class FieldElement implements ClassMemberElement, PropertyInducingEleme
nt { | 892 abstract class FieldElement implements ClassMemberElement, PropertyInducingEleme
nt { |
| 834 } | 893 } |
| 894 |
| 835 /** | 895 /** |
| 836 * The interface `FieldFormalParameterElement` defines the behavior of elements
representing a | 896 * The interface `FieldFormalParameterElement` defines the behavior of elements
representing a |
| 837 * field formal parameter defined within a constructor element. | 897 * field formal parameter defined within a constructor element. |
| 838 */ | 898 */ |
| 839 abstract class FieldFormalParameterElement implements ParameterElement { | 899 abstract class FieldFormalParameterElement implements ParameterElement { |
| 840 | |
| 841 /** | 900 /** |
| 842 * Return the field element associated with this field formal parameter, or `n
ull` if the | 901 * Return the field element associated with this field formal parameter, or `n
ull` if the |
| 843 * parameter references a field that doesn't exist. | 902 * parameter references a field that doesn't exist. |
| 844 * | 903 * |
| 845 * @return the field element associated with this field formal parameter | 904 * @return the field element associated with this field formal parameter |
| 846 */ | 905 */ |
| 847 FieldElement get field; | 906 FieldElement get field; |
| 848 } | 907 } |
| 908 |
| 849 /** | 909 /** |
| 850 * The interface `FunctionElement` defines the behavior of elements representing
a function. | 910 * The interface `FunctionElement` defines the behavior of elements representing
a function. |
| 851 * | 911 * |
| 852 * @coverage dart.engine.element | 912 * @coverage dart.engine.element |
| 853 */ | 913 */ |
| 854 abstract class FunctionElement implements ExecutableElement, LocalElement { | 914 abstract class FunctionElement implements ExecutableElement, LocalElement { |
| 855 } | 915 } |
| 916 |
| 856 /** | 917 /** |
| 857 * The interface `FunctionTypeAliasElement` defines the behavior of elements rep
resenting a | 918 * The interface `FunctionTypeAliasElement` defines the behavior of elements rep
resenting a |
| 858 * function type alias (`typedef`). | 919 * function type alias (`typedef`). |
| 859 * | 920 * |
| 860 * @coverage dart.engine.element | 921 * @coverage dart.engine.element |
| 861 */ | 922 */ |
| 862 abstract class FunctionTypeAliasElement implements Element { | 923 abstract class FunctionTypeAliasElement implements Element { |
| 863 | |
| 864 /** | 924 /** |
| 865 * Return the compilation unit in which this type alias is defined. | 925 * Return the compilation unit in which this type alias is defined. |
| 866 * | 926 * |
| 867 * @return the compilation unit in which this type alias is defined | 927 * @return the compilation unit in which this type alias is defined |
| 868 */ | 928 */ |
| 869 CompilationUnitElement get enclosingElement; | 929 CompilationUnitElement get enclosingElement; |
| 870 | 930 |
| 871 /** | 931 /** |
| 872 * Return an array containing all of the parameters defined by this type alias
. | 932 * Return an array containing all of the parameters defined by this type alias
. |
| 873 * | 933 * |
| (...skipping 15 matching lines...) Expand all Loading... |
| 889 */ | 949 */ |
| 890 FunctionType get type; | 950 FunctionType get type; |
| 891 | 951 |
| 892 /** | 952 /** |
| 893 * Return an array containing all of the type parameters defined for this type
. | 953 * Return an array containing all of the type parameters defined for this type
. |
| 894 * | 954 * |
| 895 * @return the type parameters defined for this type | 955 * @return the type parameters defined for this type |
| 896 */ | 956 */ |
| 897 List<TypeParameterElement> get typeParameters; | 957 List<TypeParameterElement> get typeParameters; |
| 898 } | 958 } |
| 959 |
| 899 /** | 960 /** |
| 900 * The interface `HideElementCombinator` defines the behavior of combinators tha
t cause some | 961 * The interface `HideElementCombinator` defines the behavior of combinators tha
t cause some |
| 901 * of the names in a namespace to be hidden when being imported. | 962 * of the names in a namespace to be hidden when being imported. |
| 902 * | 963 * |
| 903 * @coverage dart.engine.element | 964 * @coverage dart.engine.element |
| 904 */ | 965 */ |
| 905 abstract class HideElementCombinator implements NamespaceCombinator { | 966 abstract class HideElementCombinator implements NamespaceCombinator { |
| 906 | |
| 907 /** | 967 /** |
| 908 * Return an array containing the names that are not to be made visible in the
importing library | 968 * Return an array containing the names that are not to be made visible in the
importing library |
| 909 * even if they are defined in the imported library. | 969 * even if they are defined in the imported library. |
| 910 * | 970 * |
| 911 * @return the names from the imported library that are hidden from the import
ing library | 971 * @return the names from the imported library that are hidden from the import
ing library |
| 912 */ | 972 */ |
| 913 List<String> get hiddenNames; | 973 List<String> get hiddenNames; |
| 914 } | 974 } |
| 975 |
| 915 /** | 976 /** |
| 916 * The interface `HtmlElement` defines the behavior of elements representing an
HTML file. | 977 * The interface `HtmlElement` defines the behavior of elements representing an
HTML file. |
| 917 * | 978 * |
| 918 * @coverage dart.engine.element | 979 * @coverage dart.engine.element |
| 919 */ | 980 */ |
| 920 abstract class HtmlElement implements Element { | 981 abstract class HtmlElement implements Element { |
| 921 | |
| 922 /** | 982 /** |
| 923 * Return an array containing all of the script elements contained in the HTML
file. This includes | 983 * Return an array containing all of the script elements contained in the HTML
file. This includes |
| 924 * scripts with libraries that are defined by the content of a script tag as w
ell as libraries | 984 * scripts with libraries that are defined by the content of a script tag as w
ell as libraries |
| 925 * that are referenced in the {@core source} attribute of a script tag. | 985 * that are referenced in the {@core source} attribute of a script tag. |
| 926 * | 986 * |
| 927 * @return the script elements in the HTML file (not `null`, contains no `null
`s) | 987 * @return the script elements in the HTML file (not `null`, contains no `null
`s) |
| 928 */ | 988 */ |
| 929 List<HtmlScriptElement> get scripts; | 989 List<HtmlScriptElement> get scripts; |
| 930 } | 990 } |
| 991 |
| 931 /** | 992 /** |
| 932 * The interface `HtmlScriptElement` defines the behavior of elements representi
ng a script | 993 * The interface `HtmlScriptElement` defines the behavior of elements representi
ng a script |
| 933 * tag in an HTML file. | 994 * tag in an HTML file. |
| 934 * | 995 * |
| 935 * @see EmbeddedHtmlScriptElement | 996 * @see EmbeddedHtmlScriptElement |
| 936 * @see ExternalHtmlScriptElement | 997 * @see ExternalHtmlScriptElement |
| 937 * @coverage dart.engine.element | 998 * @coverage dart.engine.element |
| 938 */ | 999 */ |
| 939 abstract class HtmlScriptElement implements Element { | 1000 abstract class HtmlScriptElement implements Element { |
| 940 } | 1001 } |
| 1002 |
| 941 /** | 1003 /** |
| 942 * The interface `ImportElement` defines the behavior of objects representing in
formation | 1004 * The interface `ImportElement` defines the behavior of objects representing in
formation |
| 943 * about a single import directive within a library. | 1005 * about a single import directive within a library. |
| 944 * | 1006 * |
| 945 * @coverage dart.engine.element | 1007 * @coverage dart.engine.element |
| 946 */ | 1008 */ |
| 947 abstract class ImportElement implements Element, UriReferencedElement { | 1009 abstract class ImportElement implements Element, UriReferencedElement { |
| 948 | |
| 949 /** | 1010 /** |
| 950 * An empty array of import elements. | 1011 * An empty array of import elements. |
| 951 */ | 1012 */ |
| 952 static final List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0); | 1013 static final List<ImportElement> EMPTY_ARRAY = new List<ImportElement>(0); |
| 953 | 1014 |
| 954 /** | 1015 /** |
| 955 * Return an array containing the combinators that were specified as part of t
he import directive | 1016 * Return an array containing the combinators that were specified as part of t
he import directive |
| 956 * in the order in which they were specified. | 1017 * in the order in which they were specified. |
| 957 * | 1018 * |
| 958 * @return the combinators specified in the import directive | 1019 * @return the combinators specified in the import directive |
| (...skipping 25 matching lines...) Expand all Loading... |
| 984 int get prefixOffset; | 1045 int get prefixOffset; |
| 985 | 1046 |
| 986 /** | 1047 /** |
| 987 * Return the offset of the character immediately following the last character
of this node's URI, | 1048 * Return the offset of the character immediately following the last character
of this node's URI, |
| 988 * or `-1` for synthetic import. | 1049 * or `-1` for synthetic import. |
| 989 * | 1050 * |
| 990 * @return the offset of the character just past the node's URI | 1051 * @return the offset of the character just past the node's URI |
| 991 */ | 1052 */ |
| 992 int get uriEnd; | 1053 int get uriEnd; |
| 993 } | 1054 } |
| 1055 |
| 994 /** | 1056 /** |
| 995 * The interface `LabelElement` defines the behavior of elements representing a
label | 1057 * The interface `LabelElement` defines the behavior of elements representing a
label |
| 996 * associated with a statement. | 1058 * associated with a statement. |
| 997 * | 1059 * |
| 998 * @coverage dart.engine.element | 1060 * @coverage dart.engine.element |
| 999 */ | 1061 */ |
| 1000 abstract class LabelElement implements Element { | 1062 abstract class LabelElement implements Element { |
| 1001 | |
| 1002 /** | 1063 /** |
| 1003 * Return the executable element in which this label is defined. | 1064 * Return the executable element in which this label is defined. |
| 1004 * | 1065 * |
| 1005 * @return the executable element in which this label is defined | 1066 * @return the executable element in which this label is defined |
| 1006 */ | 1067 */ |
| 1007 ExecutableElement get enclosingElement; | 1068 ExecutableElement get enclosingElement; |
| 1008 } | 1069 } |
| 1070 |
| 1009 /** | 1071 /** |
| 1010 * The interface `LibraryElement` defines the behavior of elements representing
a library. | 1072 * The interface `LibraryElement` defines the behavior of elements representing
a library. |
| 1011 * | 1073 * |
| 1012 * @coverage dart.engine.element | 1074 * @coverage dart.engine.element |
| 1013 */ | 1075 */ |
| 1014 abstract class LibraryElement implements Element { | 1076 abstract class LibraryElement implements Element { |
| 1015 | |
| 1016 /** | 1077 /** |
| 1017 * Return the compilation unit that defines this library. | 1078 * Return the compilation unit that defines this library. |
| 1018 * | 1079 * |
| 1019 * @return the compilation unit that defines this library | 1080 * @return the compilation unit that defines this library |
| 1020 */ | 1081 */ |
| 1021 CompilationUnitElement get definingCompilationUnit; | 1082 CompilationUnitElement get definingCompilationUnit; |
| 1022 | 1083 |
| 1023 /** | 1084 /** |
| 1024 * Return the entry point for this library, or `null` if this library does not
have an entry | 1085 * Return the entry point for this library, or `null` if this library does not
have an entry |
| 1025 * point. The entry point is defined to be a zero argument top-level function
whose name is | 1086 * point. The entry point is defined to be a zero argument top-level function
whose name is |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 | 1169 |
| 1109 /** | 1170 /** |
| 1110 * Return `true` if this library is up to date with respect to the given time
stamp. If any | 1171 * Return `true` if this library is up to date with respect to the given time
stamp. If any |
| 1111 * transitively referenced Source is newer than the time stamp, this method re
turns false. | 1172 * transitively referenced Source is newer than the time stamp, this method re
turns false. |
| 1112 * | 1173 * |
| 1113 * @param timeStamp the time stamp to compare against | 1174 * @param timeStamp the time stamp to compare against |
| 1114 * @return `true` if this library is up to date with respect to the given time
stamp | 1175 * @return `true` if this library is up to date with respect to the given time
stamp |
| 1115 */ | 1176 */ |
| 1116 bool isUpToDate2(int timeStamp); | 1177 bool isUpToDate2(int timeStamp); |
| 1117 } | 1178 } |
| 1179 |
| 1118 /** | 1180 /** |
| 1119 * The interface `LocalElement` defines the behavior of elements that can be (bu
t are not | 1181 * The interface `LocalElement` defines the behavior of elements that can be (bu
t are not |
| 1120 * required to be) defined within a method or function (an [ExecutableElement]). | 1182 * required to be) defined within a method or function (an [ExecutableElement]). |
| 1121 * | 1183 * |
| 1122 * @coverage dart.engine.element | 1184 * @coverage dart.engine.element |
| 1123 */ | 1185 */ |
| 1124 abstract class LocalElement implements Element { | 1186 abstract class LocalElement implements Element { |
| 1125 | |
| 1126 /** | 1187 /** |
| 1127 * Return a source range that covers the approximate portion of the source in
which the name of | 1188 * Return a source range that covers the approximate portion of the source in
which the name of |
| 1128 * this element is visible, or `null` if there is no single range of character
s within which | 1189 * this element is visible, or `null` if there is no single range of character
s within which |
| 1129 * the element name is visible. | 1190 * the element name is visible. |
| 1130 * | 1191 * |
| 1131 * * For a local variable, this includes everything from the end of the variab
le's initializer | 1192 * * For a local variable, this includes everything from the end of the variab
le's initializer |
| 1132 * to the end of the block that encloses the variable declaration. | 1193 * to the end of the block that encloses the variable declaration. |
| 1133 * * For a parameter, this includes the body of the method or function that de
clares the | 1194 * * For a parameter, this includes the body of the method or function that de
clares the |
| 1134 * parameter. | 1195 * parameter. |
| 1135 * * For a local function, this includes everything from the beginning of the
function's body to | 1196 * * For a local function, this includes everything from the beginning of the
function's body to |
| 1136 * the end of the block that encloses the function declaration. | 1197 * the end of the block that encloses the function declaration. |
| 1137 * * For top-level functions, `null` will be returned because they are potenti
ally visible | 1198 * * For top-level functions, `null` will be returned because they are potenti
ally visible |
| 1138 * in multiple sources. | 1199 * in multiple sources. |
| 1139 * | 1200 * |
| 1140 * | 1201 * |
| 1141 * @return the range of characters in which the name of this element is visibl
e | 1202 * @return the range of characters in which the name of this element is visibl
e |
| 1142 */ | 1203 */ |
| 1143 SourceRange get visibleRange; | 1204 SourceRange get visibleRange; |
| 1144 } | 1205 } |
| 1206 |
| 1145 /** | 1207 /** |
| 1146 * The interface `LocalVariableElement` defines the behavior common to elements
that represent | 1208 * The interface `LocalVariableElement` defines the behavior common to elements
that represent |
| 1147 * a local variable. | 1209 * a local variable. |
| 1148 * | 1210 * |
| 1149 * @coverage dart.engine.element | 1211 * @coverage dart.engine.element |
| 1150 */ | 1212 */ |
| 1151 abstract class LocalVariableElement implements LocalElement, VariableElement { | 1213 abstract class LocalVariableElement implements LocalElement, VariableElement { |
| 1152 } | 1214 } |
| 1215 |
| 1153 /** | 1216 /** |
| 1154 * The interface `MethodElement` defines the behavior of elements that represent
a method | 1217 * The interface `MethodElement` defines the behavior of elements that represent
a method |
| 1155 * defined within a type. | 1218 * defined within a type. |
| 1156 * | 1219 * |
| 1157 * @coverage dart.engine.element | 1220 * @coverage dart.engine.element |
| 1158 */ | 1221 */ |
| 1159 abstract class MethodElement implements ClassMemberElement, ExecutableElement { | 1222 abstract class MethodElement implements ClassMemberElement, ExecutableElement { |
| 1160 | |
| 1161 /** | 1223 /** |
| 1162 * Return `true` if this method is abstract. Methods are abstract if they are
not external | 1224 * Return `true` if this method is abstract. Methods are abstract if they are
not external |
| 1163 * and have no body. | 1225 * and have no body. |
| 1164 * | 1226 * |
| 1165 * @return `true` if this method is abstract | 1227 * @return `true` if this method is abstract |
| 1166 */ | 1228 */ |
| 1167 bool get isAbstract; | 1229 bool get isAbstract; |
| 1168 } | 1230 } |
| 1231 |
| 1169 /** | 1232 /** |
| 1170 * The interface `MultiplyDefinedElement` defines the behavior of pseudo-element
s that | 1233 * The interface `MultiplyDefinedElement` defines the behavior of pseudo-element
s that |
| 1171 * represent multiple elements defined within a single scope that have the same
name. This situation | 1234 * represent multiple elements defined within a single scope that have the same
name. This situation |
| 1172 * is not allowed by the language, so objects implementing this interface always
represent an error. | 1235 * is not allowed by the language, so objects implementing this interface always
represent an error. |
| 1173 * As a result, most of the normal operations on elements do not make sense and
will return useless | 1236 * As a result, most of the normal operations on elements do not make sense and
will return useless |
| 1174 * results. | 1237 * results. |
| 1175 * | 1238 * |
| 1176 * @coverage dart.engine.element | 1239 * @coverage dart.engine.element |
| 1177 */ | 1240 */ |
| 1178 abstract class MultiplyDefinedElement implements Element { | 1241 abstract class MultiplyDefinedElement implements Element { |
| 1179 | |
| 1180 /** | 1242 /** |
| 1181 * Return an array containing all of the elements that were defined within the
scope to have the | 1243 * Return an array containing all of the elements that were defined within the
scope to have the |
| 1182 * same name. | 1244 * same name. |
| 1183 * | 1245 * |
| 1184 * @return the elements that were defined with the same name | 1246 * @return the elements that were defined with the same name |
| 1185 */ | 1247 */ |
| 1186 List<Element> get conflictingElements; | 1248 List<Element> get conflictingElements; |
| 1187 | 1249 |
| 1188 /** | 1250 /** |
| 1189 * Return the type of this element as the dynamic type. | 1251 * Return the type of this element as the dynamic type. |
| 1190 * | 1252 * |
| 1191 * @return the type of this element as the dynamic type | 1253 * @return the type of this element as the dynamic type |
| 1192 */ | 1254 */ |
| 1193 Type2 get type; | 1255 Type2 get type; |
| 1194 } | 1256 } |
| 1257 |
| 1195 /** | 1258 /** |
| 1196 * The interface `NamespaceCombinator` defines the behavior common to objects th
at control how | 1259 * The interface `NamespaceCombinator` defines the behavior common to objects th
at control how |
| 1197 * namespaces are combined. | 1260 * namespaces are combined. |
| 1198 * | 1261 * |
| 1199 * @coverage dart.engine.element | 1262 * @coverage dart.engine.element |
| 1200 */ | 1263 */ |
| 1201 abstract class NamespaceCombinator { | 1264 abstract class NamespaceCombinator { |
| 1202 | |
| 1203 /** | 1265 /** |
| 1204 * An empty array of namespace combinators. | 1266 * An empty array of namespace combinators. |
| 1205 */ | 1267 */ |
| 1206 static final List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombina
tor>(0); | 1268 static final List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombina
tor>(0); |
| 1207 } | 1269 } |
| 1270 |
| 1208 /** | 1271 /** |
| 1209 * The interface `ParameterElement` defines the behavior of elements representin
g a parameter | 1272 * The interface `ParameterElement` defines the behavior of elements representin
g a parameter |
| 1210 * defined within an executable element. | 1273 * defined within an executable element. |
| 1211 * | 1274 * |
| 1212 * @coverage dart.engine.element | 1275 * @coverage dart.engine.element |
| 1213 */ | 1276 */ |
| 1214 abstract class ParameterElement implements LocalElement, VariableElement { | 1277 abstract class ParameterElement implements LocalElement, VariableElement { |
| 1215 | |
| 1216 /** | 1278 /** |
| 1217 * Return a source range that covers the portion of the source in which the de
fault value for this | 1279 * Return a source range that covers the portion of the source in which the de
fault value for this |
| 1218 * parameter is specified, or `null` if there is no default value. | 1280 * parameter is specified, or `null` if there is no default value. |
| 1219 * | 1281 * |
| 1220 * @return the range of characters in which the default value of this paramete
r is specified | 1282 * @return the range of characters in which the default value of this paramete
r is specified |
| 1221 */ | 1283 */ |
| 1222 SourceRange get defaultValueRange; | 1284 SourceRange get defaultValueRange; |
| 1223 | 1285 |
| 1224 /** | 1286 /** |
| 1225 * Return the kind of this parameter. | 1287 * Return the kind of this parameter. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1236 */ | 1298 */ |
| 1237 List<ParameterElement> get parameters; | 1299 List<ParameterElement> get parameters; |
| 1238 | 1300 |
| 1239 /** | 1301 /** |
| 1240 * Return `true` if this parameter is an initializing formal parameter. | 1302 * Return `true` if this parameter is an initializing formal parameter. |
| 1241 * | 1303 * |
| 1242 * @return `true` if this parameter is an initializing formal parameter | 1304 * @return `true` if this parameter is an initializing formal parameter |
| 1243 */ | 1305 */ |
| 1244 bool get isInitializingFormal; | 1306 bool get isInitializingFormal; |
| 1245 } | 1307 } |
| 1308 |
| 1246 /** | 1309 /** |
| 1247 * The interface `PrefixElement` defines the behavior common to elements that re
present a | 1310 * The interface `PrefixElement` defines the behavior common to elements that re
present a |
| 1248 * prefix used to import one or more libraries into another library. | 1311 * prefix used to import one or more libraries into another library. |
| 1249 * | 1312 * |
| 1250 * @coverage dart.engine.element | 1313 * @coverage dart.engine.element |
| 1251 */ | 1314 */ |
| 1252 abstract class PrefixElement implements Element { | 1315 abstract class PrefixElement implements Element { |
| 1253 | |
| 1254 /** | 1316 /** |
| 1255 * Return the library into which other libraries are imported using this prefi
x. | 1317 * Return the library into which other libraries are imported using this prefi
x. |
| 1256 * | 1318 * |
| 1257 * @return the library into which other libraries are imported using this pref
ix | 1319 * @return the library into which other libraries are imported using this pref
ix |
| 1258 */ | 1320 */ |
| 1259 LibraryElement get enclosingElement; | 1321 LibraryElement get enclosingElement; |
| 1260 | 1322 |
| 1261 /** | 1323 /** |
| 1262 * Return an array containing all of the libraries that are imported using thi
s prefix. | 1324 * Return an array containing all of the libraries that are imported using thi
s prefix. |
| 1263 * | 1325 * |
| 1264 * @return the libraries that are imported using this prefix | 1326 * @return the libraries that are imported using this prefix |
| 1265 */ | 1327 */ |
| 1266 List<LibraryElement> get importedLibraries; | 1328 List<LibraryElement> get importedLibraries; |
| 1267 } | 1329 } |
| 1330 |
| 1268 /** | 1331 /** |
| 1269 * The interface `PropertyAccessorElement` defines the behavior of elements repr
esenting a | 1332 * The interface `PropertyAccessorElement` defines the behavior of elements repr
esenting a |
| 1270 * getter or a setter. Note that explicitly defined property accessors implicitl
y define a synthetic | 1333 * getter or a setter. Note that explicitly defined property accessors implicitl
y define a synthetic |
| 1271 * field. Symmetrically, synthetic accessors are implicitly created for explicit
ly defined fields. | 1334 * field. Symmetrically, synthetic accessors are implicitly created for explicit
ly defined fields. |
| 1272 * The following rules apply: | 1335 * The following rules apply: |
| 1273 * | 1336 * |
| 1274 * * Every explicit field is represented by a non-synthetic [FieldElement]. | 1337 * * Every explicit field is represented by a non-synthetic [FieldElement]. |
| 1275 * * Every explicit field induces a getter and possibly a setter, both of which
are represented by | 1338 * * Every explicit field induces a getter and possibly a setter, both of which
are represented by |
| 1276 * synthetic [PropertyAccessorElement]s. | 1339 * synthetic [PropertyAccessorElement]s. |
| 1277 * * Every explicit getter or setter is represented by a non-synthetic | 1340 * * Every explicit getter or setter is represented by a non-synthetic |
| 1278 * [PropertyAccessorElement]. | 1341 * [PropertyAccessorElement]. |
| 1279 * * Every explicit getter or setter (or pair thereof if they have the same name
) induces a field | 1342 * * Every explicit getter or setter (or pair thereof if they have the same name
) induces a field |
| 1280 * that is represented by a synthetic [FieldElement]. | 1343 * that is represented by a synthetic [FieldElement]. |
| 1281 * | 1344 * |
| 1282 * | 1345 * |
| 1283 * @coverage dart.engine.element | 1346 * @coverage dart.engine.element |
| 1284 */ | 1347 */ |
| 1285 abstract class PropertyAccessorElement implements ExecutableElement { | 1348 abstract class PropertyAccessorElement implements ExecutableElement { |
| 1286 | |
| 1287 /** | 1349 /** |
| 1288 * Return the accessor representing the getter that corresponds to (has the sa
me name as) this | 1350 * Return the accessor representing the getter that corresponds to (has the sa
me name as) this |
| 1289 * setter, or `null` if this accessor is not a setter or if there is no corres
ponding | 1351 * setter, or `null` if this accessor is not a setter or if there is no corres
ponding |
| 1290 * getter. | 1352 * getter. |
| 1291 * | 1353 * |
| 1292 * @return the getter that corresponds to this setter | 1354 * @return the getter that corresponds to this setter |
| 1293 */ | 1355 */ |
| 1294 PropertyAccessorElement get correspondingGetter; | 1356 PropertyAccessorElement get correspondingGetter; |
| 1295 | 1357 |
| 1296 /** | 1358 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1325 */ | 1387 */ |
| 1326 bool get isGetter; | 1388 bool get isGetter; |
| 1327 | 1389 |
| 1328 /** | 1390 /** |
| 1329 * Return `true` if this accessor represents a setter. | 1391 * Return `true` if this accessor represents a setter. |
| 1330 * | 1392 * |
| 1331 * @return `true` if this accessor represents a setter | 1393 * @return `true` if this accessor represents a setter |
| 1332 */ | 1394 */ |
| 1333 bool get isSetter; | 1395 bool get isSetter; |
| 1334 } | 1396 } |
| 1397 |
| 1335 /** | 1398 /** |
| 1336 * The interface `PropertyInducingElement` defines the behavior of elements repr
esenting a | 1399 * The interface `PropertyInducingElement` defines the behavior of elements repr
esenting a |
| 1337 * variable that has an associated getter and possibly a setter. Note that expli
citly defined | 1400 * variable that has an associated getter and possibly a setter. Note that expli
citly defined |
| 1338 * variables implicitly define a synthetic getter and that non-`final` explicitl
y defined | 1401 * variables implicitly define a synthetic getter and that non-`final` explicitl
y defined |
| 1339 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel
ds are implicitly | 1402 * variables implicitly define a synthetic setter. Symmetrically, synthetic fiel
ds are implicitly |
| 1340 * created for explicitly defined getters and setters. The following rules apply
: | 1403 * created for explicitly defined getters and setters. The following rules apply
: |
| 1341 * | 1404 * |
| 1342 * * Every explicit variable is represented by a non-synthetic [PropertyInducing
Element]. | 1405 * * Every explicit variable is represented by a non-synthetic [PropertyInducing
Element]. |
| 1343 * * Every explicit variable induces a getter and possibly a setter, both of whi
ch are represented | 1406 * * Every explicit variable induces a getter and possibly a setter, both of whi
ch are represented |
| 1344 * by synthetic [PropertyAccessorElement]s. | 1407 * by synthetic [PropertyAccessorElement]s. |
| 1345 * * Every explicit getter or setter is represented by a non-synthetic | 1408 * * Every explicit getter or setter is represented by a non-synthetic |
| 1346 * [PropertyAccessorElement]. | 1409 * [PropertyAccessorElement]. |
| 1347 * * Every explicit getter or setter (or pair thereof if they have the same name
) induces a | 1410 * * Every explicit getter or setter (or pair thereof if they have the same name
) induces a |
| 1348 * variable that is represented by a synthetic [PropertyInducingElement]. | 1411 * variable that is represented by a synthetic [PropertyInducingElement]. |
| 1349 * | 1412 * |
| 1350 * | 1413 * |
| 1351 * @coverage dart.engine.element | 1414 * @coverage dart.engine.element |
| 1352 */ | 1415 */ |
| 1353 abstract class PropertyInducingElement implements VariableElement { | 1416 abstract class PropertyInducingElement implements VariableElement { |
| 1354 | |
| 1355 /** | 1417 /** |
| 1356 * Return the getter associated with this variable. If this variable was expli
citly defined (is | 1418 * Return the getter associated with this variable. If this variable was expli
citly defined (is |
| 1357 * not synthetic) then the getter associated with it will be synthetic. | 1419 * not synthetic) then the getter associated with it will be synthetic. |
| 1358 * | 1420 * |
| 1359 * @return the getter associated with this variable | 1421 * @return the getter associated with this variable |
| 1360 */ | 1422 */ |
| 1361 PropertyAccessorElement get getter; | 1423 PropertyAccessorElement get getter; |
| 1362 | 1424 |
| 1363 /** | 1425 /** |
| 1364 * Return the setter associated with this variable, or `null` if the variable
is effectively | 1426 * Return the setter associated with this variable, or `null` if the variable
is effectively |
| 1365 * `final` and therefore does not have a setter associated with it. (This can
happen either | 1427 * `final` and therefore does not have a setter associated with it. (This can
happen either |
| 1366 * because the variable is explicitly defined as being `final` or because the
variable is | 1428 * because the variable is explicitly defined as being `final` or because the
variable is |
| 1367 * induced by an explicit getter that does not have a corresponding setter.) I
f this variable was | 1429 * induced by an explicit getter that does not have a corresponding setter.) I
f this variable was |
| 1368 * explicitly defined (is not synthetic) then the setter associated with it wi
ll be synthetic. | 1430 * explicitly defined (is not synthetic) then the setter associated with it wi
ll be synthetic. |
| 1369 * | 1431 * |
| 1370 * @return the setter associated with this variable | 1432 * @return the setter associated with this variable |
| 1371 */ | 1433 */ |
| 1372 PropertyAccessorElement get setter; | 1434 PropertyAccessorElement get setter; |
| 1373 | 1435 |
| 1374 /** | 1436 /** |
| 1375 * Return `true` if this element is a static element. A static element is an e
lement that is | 1437 * Return `true` if this element is a static element. A static element is an e
lement that is |
| 1376 * not associated with a particular instance, but rather with an entire librar
y or class. | 1438 * not associated with a particular instance, but rather with an entire librar
y or class. |
| 1377 * | 1439 * |
| 1378 * @return `true` if this executable element is a static element | 1440 * @return `true` if this executable element is a static element |
| 1379 */ | 1441 */ |
| 1380 bool get isStatic; | 1442 bool get isStatic; |
| 1381 } | 1443 } |
| 1444 |
| 1382 /** | 1445 /** |
| 1383 * The interface `ShowElementCombinator` defines the behavior of combinators tha
t cause some | 1446 * The interface `ShowElementCombinator` defines the behavior of combinators tha
t cause some |
| 1384 * of the names in a namespace to be visible (and the rest hidden) when being im
ported. | 1447 * of the names in a namespace to be visible (and the rest hidden) when being im
ported. |
| 1385 * | 1448 * |
| 1386 * @coverage dart.engine.element | 1449 * @coverage dart.engine.element |
| 1387 */ | 1450 */ |
| 1388 abstract class ShowElementCombinator implements NamespaceCombinator { | 1451 abstract class ShowElementCombinator implements NamespaceCombinator { |
| 1389 | |
| 1390 /** | 1452 /** |
| 1391 * Return the offset of the character immediately following the last character
of this node. | 1453 * Return the offset of the character immediately following the last character
of this node. |
| 1392 * | 1454 * |
| 1393 * @return the offset of the character just past this node | 1455 * @return the offset of the character just past this node |
| 1394 */ | 1456 */ |
| 1395 int get end; | 1457 int get end; |
| 1396 | 1458 |
| 1397 /** | 1459 /** |
| 1398 * Return the offset of the 'show' keyword of this element. | 1460 * Return the offset of the 'show' keyword of this element. |
| 1399 * | 1461 * |
| 1400 * @return the offset of the 'show' keyword of this element | 1462 * @return the offset of the 'show' keyword of this element |
| 1401 */ | 1463 */ |
| 1402 int get offset; | 1464 int get offset; |
| 1403 | 1465 |
| 1404 /** | 1466 /** |
| 1405 * Return an array containing the names that are to be made visible in the imp
orting library if | 1467 * Return an array containing the names that are to be made visible in the imp
orting library if |
| 1406 * they are defined in the imported library. | 1468 * they are defined in the imported library. |
| 1407 * | 1469 * |
| 1408 * @return the names from the imported library that are visible in the importi
ng library | 1470 * @return the names from the imported library that are visible in the importi
ng library |
| 1409 */ | 1471 */ |
| 1410 List<String> get shownNames; | 1472 List<String> get shownNames; |
| 1411 } | 1473 } |
| 1474 |
| 1412 /** | 1475 /** |
| 1413 * The interface `TopLevelVariableElement` defines the behavior of elements repr
esenting a | 1476 * The interface `TopLevelVariableElement` defines the behavior of elements repr
esenting a |
| 1414 * top-level variable. | 1477 * top-level variable. |
| 1415 * | 1478 * |
| 1416 * @coverage dart.engine.element | 1479 * @coverage dart.engine.element |
| 1417 */ | 1480 */ |
| 1418 abstract class TopLevelVariableElement implements PropertyInducingElement { | 1481 abstract class TopLevelVariableElement implements PropertyInducingElement { |
| 1419 } | 1482 } |
| 1483 |
| 1420 /** | 1484 /** |
| 1421 * The interface `TypeParameterElement` defines the behavior of elements represe
nting a type | 1485 * The interface `TypeParameterElement` defines the behavior of elements represe
nting a type |
| 1422 * parameter. | 1486 * parameter. |
| 1423 * | 1487 * |
| 1424 * @coverage dart.engine.element | 1488 * @coverage dart.engine.element |
| 1425 */ | 1489 */ |
| 1426 abstract class TypeParameterElement implements Element { | 1490 abstract class TypeParameterElement implements Element { |
| 1427 | |
| 1428 /** | 1491 /** |
| 1429 * Return the type representing the bound associated with this parameter, or `
null` if this | 1492 * Return the type representing the bound associated with this parameter, or `
null` if this |
| 1430 * parameter does not have an explicit bound. | 1493 * parameter does not have an explicit bound. |
| 1431 * | 1494 * |
| 1432 * @return the type representing the bound associated with this parameter | 1495 * @return the type representing the bound associated with this parameter |
| 1433 */ | 1496 */ |
| 1434 Type2 get bound; | 1497 Type2 get bound; |
| 1435 | 1498 |
| 1436 /** | 1499 /** |
| 1437 * Return the type defined by this type parameter. | 1500 * Return the type defined by this type parameter. |
| 1438 * | 1501 * |
| 1439 * @return the type defined by this type parameter | 1502 * @return the type defined by this type parameter |
| 1440 */ | 1503 */ |
| 1441 TypeParameterType get type; | 1504 TypeParameterType get type; |
| 1442 } | 1505 } |
| 1506 |
| 1443 /** | 1507 /** |
| 1444 * The interface `UndefinedElement` defines the behavior of pseudo-elements that
represent | 1508 * The interface `UndefinedElement` defines the behavior of pseudo-elements that
represent |
| 1445 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing | 1509 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing |
| 1446 * this interface always represent an error. As a result, most of the normal ope
rations on elements | 1510 * this interface always represent an error. As a result, most of the normal ope
rations on elements |
| 1447 * do not make sense and will return useless results. | 1511 * do not make sense and will return useless results. |
| 1448 * | 1512 * |
| 1449 * @coverage dart.engine.element | 1513 * @coverage dart.engine.element |
| 1450 */ | 1514 */ |
| 1451 abstract class UndefinedElement implements Element { | 1515 abstract class UndefinedElement implements Element { |
| 1452 } | 1516 } |
| 1517 |
| 1453 /** | 1518 /** |
| 1454 * The interface `UriReferencedElement` defines the behavior of objects included
into a | 1519 * The interface `UriReferencedElement` defines the behavior of objects included
into a |
| 1455 * library using some URI. | 1520 * library using some URI. |
| 1456 * | 1521 * |
| 1457 * @coverage dart.engine.element | 1522 * @coverage dart.engine.element |
| 1458 */ | 1523 */ |
| 1459 abstract class UriReferencedElement implements Element { | 1524 abstract class UriReferencedElement implements Element { |
| 1460 | |
| 1461 /** | 1525 /** |
| 1462 * Return the URI that is used to include this element into the enclosing libr
ary, or `null` | 1526 * Return the URI that is used to include this element into the enclosing libr
ary, or `null` |
| 1463 * if this is the defining compilation unit of a library. | 1527 * if this is the defining compilation unit of a library. |
| 1464 * | 1528 * |
| 1465 * @return the URI that is used to include this element into the enclosing lib
rary | 1529 * @return the URI that is used to include this element into the enclosing lib
rary |
| 1466 */ | 1530 */ |
| 1467 String get uri; | 1531 String get uri; |
| 1468 } | 1532 } |
| 1533 |
| 1469 /** | 1534 /** |
| 1470 * The interface `VariableElement` defines the behavior common to elements that
represent a | 1535 * The interface `VariableElement` defines the behavior common to elements that
represent a |
| 1471 * variable. | 1536 * variable. |
| 1472 * | 1537 * |
| 1473 * @coverage dart.engine.element | 1538 * @coverage dart.engine.element |
| 1474 */ | 1539 */ |
| 1475 abstract class VariableElement implements Element { | 1540 abstract class VariableElement implements Element { |
| 1476 | |
| 1477 /** | 1541 /** |
| 1478 * Return a synthetic function representing this variable's initializer, or `n
ull` if this | 1542 * Return a synthetic function representing this variable's initializer, or `n
ull` if this |
| 1479 * variable does not have an initializer. The function will have no parameters
. The return type of | 1543 * variable does not have an initializer. The function will have no parameters
. The return type of |
| 1480 * the function will be the compile-time type of the initialization expression
. | 1544 * the function will be the compile-time type of the initialization expression
. |
| 1481 * | 1545 * |
| 1482 * @return a synthetic function representing this variable's initializer | 1546 * @return a synthetic function representing this variable's initializer |
| 1483 */ | 1547 */ |
| 1484 FunctionElement get initializer; | 1548 FunctionElement get initializer; |
| 1485 | 1549 |
| 1486 /** | 1550 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1500 | 1564 |
| 1501 /** | 1565 /** |
| 1502 * Return `true` if this variable was declared with the 'final' modifier. Vari
ables that are | 1566 * Return `true` if this variable was declared with the 'final' modifier. Vari
ables that are |
| 1503 * declared with the 'const' modifier will return `false` even though they are
implicitly | 1567 * declared with the 'const' modifier will return `false` even though they are
implicitly |
| 1504 * final. | 1568 * final. |
| 1505 * | 1569 * |
| 1506 * @return `true` if this variable was declared with the 'final' modifier | 1570 * @return `true` if this variable was declared with the 'final' modifier |
| 1507 */ | 1571 */ |
| 1508 bool get isFinal; | 1572 bool get isFinal; |
| 1509 } | 1573 } |
| 1574 |
| 1510 /** | 1575 /** |
| 1511 * Instances of the class `GeneralizingElementVisitor` implement an element visi
tor that will | 1576 * Instances of the class `GeneralizingElementVisitor` implement an element visi
tor that will |
| 1512 * recursively visit all of the elements in an element model (like instances of
the class | 1577 * recursively visit all of the elements in an element model (like instances of
the class |
| 1513 * [RecursiveElementVisitor]). In addition, when an element of a specific type i
s visited not | 1578 * [RecursiveElementVisitor]). In addition, when an element of a specific type i
s visited not |
| 1514 * only will the visit method for that specific type of element be invoked, but
additional methods | 1579 * only will the visit method for that specific type of element be invoked, but
additional methods |
| 1515 * for the supertypes of that element will also be invoked. For example, using a
n instance of this | 1580 * for the supertypes of that element will also be invoked. For example, using a
n instance of this |
| 1516 * class to visit a [MethodElement] will cause the method | 1581 * class to visit a [MethodElement] will cause the method |
| 1517 * [visitMethodElement] to be invoked but will also cause the methods | 1582 * [visitMethodElement] to be invoked but will also cause the methods |
| 1518 * [visitExecutableElement] and [visitElement] to be | 1583 * [visitExecutableElement] and [visitElement] to be |
| 1519 * subsequently invoked. This allows visitors to be written that visit all execu
table elements | 1584 * subsequently invoked. This allows visitors to be written that visit all execu
table elements |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 * | 1624 * |
| 1560 * Subclasses that override a visit method must either invoke the overridden vis
it method or | 1625 * Subclasses that override a visit method must either invoke the overridden vis
it method or |
| 1561 * explicitly invoke the more general visit method. Failure to do so will cause
the visit methods | 1626 * explicitly invoke the more general visit method. Failure to do so will cause
the visit methods |
| 1562 * for superclasses of the element to not be invoked and will cause the children
of the visited node | 1627 * for superclasses of the element to not be invoked and will cause the children
of the visited node |
| 1563 * to not be visited. | 1628 * to not be visited. |
| 1564 * | 1629 * |
| 1565 * @coverage dart.engine.element | 1630 * @coverage dart.engine.element |
| 1566 */ | 1631 */ |
| 1567 class GeneralizingElementVisitor<R> implements ElementVisitor<R> { | 1632 class GeneralizingElementVisitor<R> implements ElementVisitor<R> { |
| 1568 R visitClassElement(ClassElement element) => visitElement(element); | 1633 R visitClassElement(ClassElement element) => visitElement(element); |
| 1634 |
| 1569 R visitCompilationUnitElement(CompilationUnitElement element) => visitElement(
element); | 1635 R visitCompilationUnitElement(CompilationUnitElement element) => visitElement(
element); |
| 1636 |
| 1570 R visitConstructorElement(ConstructorElement element) => visitExecutableElemen
t(element); | 1637 R visitConstructorElement(ConstructorElement element) => visitExecutableElemen
t(element); |
| 1638 |
| 1571 R visitElement(Element element) { | 1639 R visitElement(Element element) { |
| 1572 element.visitChildren(this); | 1640 element.visitChildren(this); |
| 1573 return null; | 1641 return null; |
| 1574 } | 1642 } |
| 1643 |
| 1575 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => visitHt
mlScriptElement(element); | 1644 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => visitHt
mlScriptElement(element); |
| 1645 |
| 1576 R visitExecutableElement(ExecutableElement element) => visitElement(element); | 1646 R visitExecutableElement(ExecutableElement element) => visitElement(element); |
| 1647 |
| 1577 R visitExportElement(ExportElement element) => visitElement(element); | 1648 R visitExportElement(ExportElement element) => visitElement(element); |
| 1649 |
| 1578 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => visitHt
mlScriptElement(element); | 1650 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => visitHt
mlScriptElement(element); |
| 1651 |
| 1579 R visitFieldElement(FieldElement element) => visitPropertyInducingElement(elem
ent); | 1652 R visitFieldElement(FieldElement element) => visitPropertyInducingElement(elem
ent); |
| 1653 |
| 1580 R visitFieldFormalParameterElement(FieldFormalParameterElement element) => vis
itParameterElement(element); | 1654 R visitFieldFormalParameterElement(FieldFormalParameterElement element) => vis
itParameterElement(element); |
| 1655 |
| 1581 R visitFunctionElement(FunctionElement element) => visitLocalElement(element); | 1656 R visitFunctionElement(FunctionElement element) => visitLocalElement(element); |
| 1657 |
| 1582 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => visitElem
ent(element); | 1658 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => visitElem
ent(element); |
| 1659 |
| 1583 R visitHtmlElement(HtmlElement element) => visitElement(element); | 1660 R visitHtmlElement(HtmlElement element) => visitElement(element); |
| 1661 |
| 1584 R visitHtmlScriptElement(HtmlScriptElement element) => visitElement(element); | 1662 R visitHtmlScriptElement(HtmlScriptElement element) => visitElement(element); |
| 1663 |
| 1585 R visitImportElement(ImportElement element) => visitElement(element); | 1664 R visitImportElement(ImportElement element) => visitElement(element); |
| 1665 |
| 1586 R visitLabelElement(LabelElement element) => visitElement(element); | 1666 R visitLabelElement(LabelElement element) => visitElement(element); |
| 1667 |
| 1587 R visitLibraryElement(LibraryElement element) => visitElement(element); | 1668 R visitLibraryElement(LibraryElement element) => visitElement(element); |
| 1669 |
| 1588 R visitLocalElement(LocalElement element) { | 1670 R visitLocalElement(LocalElement element) { |
| 1589 if (element is LocalVariableElement) { | 1671 if (element is LocalVariableElement) { |
| 1590 return visitVariableElement(element as LocalVariableElement); | 1672 return visitVariableElement(element as LocalVariableElement); |
| 1591 } else if (element is ParameterElement) { | 1673 } else if (element is ParameterElement) { |
| 1592 return visitVariableElement(element as ParameterElement); | 1674 return visitVariableElement(element as ParameterElement); |
| 1593 } else if (element is FunctionElement) { | 1675 } else if (element is FunctionElement) { |
| 1594 return visitExecutableElement(element as FunctionElement); | 1676 return visitExecutableElement(element as FunctionElement); |
| 1595 } | 1677 } |
| 1596 return null; | 1678 return null; |
| 1597 } | 1679 } |
| 1680 |
| 1598 R visitLocalVariableElement(LocalVariableElement element) => visitLocalElement
(element); | 1681 R visitLocalVariableElement(LocalVariableElement element) => visitLocalElement
(element); |
| 1682 |
| 1599 R visitMethodElement(MethodElement element) => visitExecutableElement(element)
; | 1683 R visitMethodElement(MethodElement element) => visitExecutableElement(element)
; |
| 1684 |
| 1600 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(
element); | 1685 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(
element); |
| 1686 |
| 1601 R visitParameterElement(ParameterElement element) => visitLocalElement(element
); | 1687 R visitParameterElement(ParameterElement element) => visitLocalElement(element
); |
| 1688 |
| 1602 R visitPrefixElement(PrefixElement element) => visitElement(element); | 1689 R visitPrefixElement(PrefixElement element) => visitElement(element); |
| 1690 |
| 1603 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut
ableElement(element); | 1691 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut
ableElement(element); |
| 1692 |
| 1604 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab
leElement(element); | 1693 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab
leElement(element); |
| 1694 |
| 1605 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper
tyInducingElement(element); | 1695 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper
tyInducingElement(element); |
| 1696 |
| 1606 R visitTypeParameterElement(TypeParameterElement element) => visitElement(elem
ent); | 1697 R visitTypeParameterElement(TypeParameterElement element) => visitElement(elem
ent); |
| 1698 |
| 1607 R visitVariableElement(VariableElement element) => visitElement(element); | 1699 R visitVariableElement(VariableElement element) => visitElement(element); |
| 1608 } | 1700 } |
| 1701 |
| 1609 /** | 1702 /** |
| 1610 * Instances of the class `RecursiveElementVisitor` implement an element visitor
that will | 1703 * Instances of the class `RecursiveElementVisitor` implement an element visitor
that will |
| 1611 * recursively visit all of the element in an element model. For example, using
an instance of this | 1704 * recursively visit all of the element in an element model. For example, using
an instance of this |
| 1612 * class to visit a [CompilationUnitElement] will also cause all of the types in
the | 1705 * class to visit a [CompilationUnitElement] will also cause all of the types in
the |
| 1613 * compilation unit to be visited. | 1706 * compilation unit to be visited. |
| 1614 * | 1707 * |
| 1615 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 1708 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
| 1616 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the | 1709 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the |
| 1617 * children of the visited element to not be visited. | 1710 * children of the visited element to not be visited. |
| 1618 * | 1711 * |
| 1619 * @coverage dart.engine.element | 1712 * @coverage dart.engine.element |
| 1620 */ | 1713 */ |
| 1621 class RecursiveElementVisitor<R> implements ElementVisitor<R> { | 1714 class RecursiveElementVisitor<R> implements ElementVisitor<R> { |
| 1622 R visitClassElement(ClassElement element) { | 1715 R visitClassElement(ClassElement element) { |
| 1623 element.visitChildren(this); | 1716 element.visitChildren(this); |
| 1624 return null; | 1717 return null; |
| 1625 } | 1718 } |
| 1719 |
| 1626 R visitCompilationUnitElement(CompilationUnitElement element) { | 1720 R visitCompilationUnitElement(CompilationUnitElement element) { |
| 1627 element.visitChildren(this); | 1721 element.visitChildren(this); |
| 1628 return null; | 1722 return null; |
| 1629 } | 1723 } |
| 1724 |
| 1630 R visitConstructorElement(ConstructorElement element) { | 1725 R visitConstructorElement(ConstructorElement element) { |
| 1631 element.visitChildren(this); | 1726 element.visitChildren(this); |
| 1632 return null; | 1727 return null; |
| 1633 } | 1728 } |
| 1729 |
| 1634 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) { | 1730 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) { |
| 1635 element.visitChildren(this); | 1731 element.visitChildren(this); |
| 1636 return null; | 1732 return null; |
| 1637 } | 1733 } |
| 1734 |
| 1638 R visitExportElement(ExportElement element) { | 1735 R visitExportElement(ExportElement element) { |
| 1639 element.visitChildren(this); | 1736 element.visitChildren(this); |
| 1640 return null; | 1737 return null; |
| 1641 } | 1738 } |
| 1739 |
| 1642 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) { | 1740 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) { |
| 1643 element.visitChildren(this); | 1741 element.visitChildren(this); |
| 1644 return null; | 1742 return null; |
| 1645 } | 1743 } |
| 1744 |
| 1646 R visitFieldElement(FieldElement element) { | 1745 R visitFieldElement(FieldElement element) { |
| 1647 element.visitChildren(this); | 1746 element.visitChildren(this); |
| 1648 return null; | 1747 return null; |
| 1649 } | 1748 } |
| 1749 |
| 1650 R visitFieldFormalParameterElement(FieldFormalParameterElement element) { | 1750 R visitFieldFormalParameterElement(FieldFormalParameterElement element) { |
| 1651 element.visitChildren(this); | 1751 element.visitChildren(this); |
| 1652 return null; | 1752 return null; |
| 1653 } | 1753 } |
| 1754 |
| 1654 R visitFunctionElement(FunctionElement element) { | 1755 R visitFunctionElement(FunctionElement element) { |
| 1655 element.visitChildren(this); | 1756 element.visitChildren(this); |
| 1656 return null; | 1757 return null; |
| 1657 } | 1758 } |
| 1759 |
| 1658 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { | 1760 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { |
| 1659 element.visitChildren(this); | 1761 element.visitChildren(this); |
| 1660 return null; | 1762 return null; |
| 1661 } | 1763 } |
| 1764 |
| 1662 R visitHtmlElement(HtmlElement element) { | 1765 R visitHtmlElement(HtmlElement element) { |
| 1663 element.visitChildren(this); | 1766 element.visitChildren(this); |
| 1664 return null; | 1767 return null; |
| 1665 } | 1768 } |
| 1769 |
| 1666 R visitImportElement(ImportElement element) { | 1770 R visitImportElement(ImportElement element) { |
| 1667 element.visitChildren(this); | 1771 element.visitChildren(this); |
| 1668 return null; | 1772 return null; |
| 1669 } | 1773 } |
| 1774 |
| 1670 R visitLabelElement(LabelElement element) { | 1775 R visitLabelElement(LabelElement element) { |
| 1671 element.visitChildren(this); | 1776 element.visitChildren(this); |
| 1672 return null; | 1777 return null; |
| 1673 } | 1778 } |
| 1779 |
| 1674 R visitLibraryElement(LibraryElement element) { | 1780 R visitLibraryElement(LibraryElement element) { |
| 1675 element.visitChildren(this); | 1781 element.visitChildren(this); |
| 1676 return null; | 1782 return null; |
| 1677 } | 1783 } |
| 1784 |
| 1678 R visitLocalVariableElement(LocalVariableElement element) { | 1785 R visitLocalVariableElement(LocalVariableElement element) { |
| 1679 element.visitChildren(this); | 1786 element.visitChildren(this); |
| 1680 return null; | 1787 return null; |
| 1681 } | 1788 } |
| 1789 |
| 1682 R visitMethodElement(MethodElement element) { | 1790 R visitMethodElement(MethodElement element) { |
| 1683 element.visitChildren(this); | 1791 element.visitChildren(this); |
| 1684 return null; | 1792 return null; |
| 1685 } | 1793 } |
| 1794 |
| 1686 R visitMultiplyDefinedElement(MultiplyDefinedElement element) { | 1795 R visitMultiplyDefinedElement(MultiplyDefinedElement element) { |
| 1687 element.visitChildren(this); | 1796 element.visitChildren(this); |
| 1688 return null; | 1797 return null; |
| 1689 } | 1798 } |
| 1799 |
| 1690 R visitParameterElement(ParameterElement element) { | 1800 R visitParameterElement(ParameterElement element) { |
| 1691 element.visitChildren(this); | 1801 element.visitChildren(this); |
| 1692 return null; | 1802 return null; |
| 1693 } | 1803 } |
| 1804 |
| 1694 R visitPrefixElement(PrefixElement element) { | 1805 R visitPrefixElement(PrefixElement element) { |
| 1695 element.visitChildren(this); | 1806 element.visitChildren(this); |
| 1696 return null; | 1807 return null; |
| 1697 } | 1808 } |
| 1809 |
| 1698 R visitPropertyAccessorElement(PropertyAccessorElement element) { | 1810 R visitPropertyAccessorElement(PropertyAccessorElement element) { |
| 1699 element.visitChildren(this); | 1811 element.visitChildren(this); |
| 1700 return null; | 1812 return null; |
| 1701 } | 1813 } |
| 1814 |
| 1702 R visitTopLevelVariableElement(TopLevelVariableElement element) { | 1815 R visitTopLevelVariableElement(TopLevelVariableElement element) { |
| 1703 element.visitChildren(this); | 1816 element.visitChildren(this); |
| 1704 return null; | 1817 return null; |
| 1705 } | 1818 } |
| 1819 |
| 1706 R visitTypeParameterElement(TypeParameterElement element) { | 1820 R visitTypeParameterElement(TypeParameterElement element) { |
| 1707 element.visitChildren(this); | 1821 element.visitChildren(this); |
| 1708 return null; | 1822 return null; |
| 1709 } | 1823 } |
| 1710 } | 1824 } |
| 1825 |
| 1711 /** | 1826 /** |
| 1712 * Instances of the class `SimpleElementVisitor` implement an element visitor th
at will do | 1827 * Instances of the class `SimpleElementVisitor` implement an element visitor th
at will do |
| 1713 * nothing when visiting an element. It is intended to be a superclass for class
es that use the | 1828 * nothing when visiting an element. It is intended to be a superclass for class
es that use the |
| 1714 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a | 1829 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a |
| 1715 * whole structure) and that only need to visit a small number of element types. | 1830 * whole structure) and that only need to visit a small number of element types. |
| 1716 * | 1831 * |
| 1717 * @coverage dart.engine.element | 1832 * @coverage dart.engine.element |
| 1718 */ | 1833 */ |
| 1719 class SimpleElementVisitor<R> implements ElementVisitor<R> { | 1834 class SimpleElementVisitor<R> implements ElementVisitor<R> { |
| 1720 R visitClassElement(ClassElement element) => null; | 1835 R visitClassElement(ClassElement element) => null; |
| 1836 |
| 1721 R visitCompilationUnitElement(CompilationUnitElement element) => null; | 1837 R visitCompilationUnitElement(CompilationUnitElement element) => null; |
| 1838 |
| 1722 R visitConstructorElement(ConstructorElement element) => null; | 1839 R visitConstructorElement(ConstructorElement element) => null; |
| 1840 |
| 1723 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null; | 1841 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null; |
| 1842 |
| 1724 R visitExportElement(ExportElement element) => null; | 1843 R visitExportElement(ExportElement element) => null; |
| 1844 |
| 1725 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => null; | 1845 R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => null; |
| 1846 |
| 1726 R visitFieldElement(FieldElement element) => null; | 1847 R visitFieldElement(FieldElement element) => null; |
| 1848 |
| 1727 R visitFieldFormalParameterElement(FieldFormalParameterElement element) => nul
l; | 1849 R visitFieldFormalParameterElement(FieldFormalParameterElement element) => nul
l; |
| 1850 |
| 1728 R visitFunctionElement(FunctionElement element) => null; | 1851 R visitFunctionElement(FunctionElement element) => null; |
| 1852 |
| 1729 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null; | 1853 R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null; |
| 1854 |
| 1730 R visitHtmlElement(HtmlElement element) => null; | 1855 R visitHtmlElement(HtmlElement element) => null; |
| 1856 |
| 1731 R visitImportElement(ImportElement element) => null; | 1857 R visitImportElement(ImportElement element) => null; |
| 1858 |
| 1732 R visitLabelElement(LabelElement element) => null; | 1859 R visitLabelElement(LabelElement element) => null; |
| 1860 |
| 1733 R visitLibraryElement(LibraryElement element) => null; | 1861 R visitLibraryElement(LibraryElement element) => null; |
| 1862 |
| 1734 R visitLocalVariableElement(LocalVariableElement element) => null; | 1863 R visitLocalVariableElement(LocalVariableElement element) => null; |
| 1864 |
| 1735 R visitMethodElement(MethodElement element) => null; | 1865 R visitMethodElement(MethodElement element) => null; |
| 1866 |
| 1736 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; | 1867 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; |
| 1868 |
| 1737 R visitParameterElement(ParameterElement element) => null; | 1869 R visitParameterElement(ParameterElement element) => null; |
| 1870 |
| 1738 R visitPrefixElement(PrefixElement element) => null; | 1871 R visitPrefixElement(PrefixElement element) => null; |
| 1872 |
| 1739 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; | 1873 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; |
| 1874 |
| 1740 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; | 1875 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; |
| 1876 |
| 1741 R visitTypeParameterElement(TypeParameterElement element) => null; | 1877 R visitTypeParameterElement(TypeParameterElement element) => null; |
| 1742 } | 1878 } |
| 1879 |
| 1743 /** | 1880 /** |
| 1744 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and | 1881 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and |
| 1745 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an | 1882 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an |
| 1746 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved | 1883 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved |
| 1747 * using propagated type information, this class is a wrapper for a pair of | 1884 * using propagated type information, this class is a wrapper for a pair of |
| 1748 * [ExecutableElement]s, not just a single [ExecutableElement]. | 1885 * [ExecutableElement]s, not just a single [ExecutableElement]. |
| 1749 */ | 1886 */ |
| 1750 class AuxiliaryElements { | 1887 class AuxiliaryElements { |
| 1751 | |
| 1752 /** | 1888 /** |
| 1753 * The element based on propagated type information, or `null` if the AST stru
cture has not | 1889 * The element based on propagated type information, or `null` if the AST stru
cture has not |
| 1754 * been resolved or if this identifier could not be resolved. | 1890 * been resolved or if this identifier could not be resolved. |
| 1755 */ | 1891 */ |
| 1756 ExecutableElement propagatedElement; | 1892 ExecutableElement propagatedElement; |
| 1757 | 1893 |
| 1758 /** | 1894 /** |
| 1759 * The element associated with this identifier based on static type informatio
n, or `null` | 1895 * The element associated with this identifier based on static type informatio
n, or `null` |
| 1760 * if the AST structure has not been resolved or if this identifier could not
be resolved. | 1896 * if the AST structure has not been resolved or if this identifier could not
be resolved. |
| 1761 */ | 1897 */ |
| 1762 ExecutableElement staticElement; | 1898 ExecutableElement staticElement; |
| 1763 | 1899 |
| 1764 /** | 1900 /** |
| 1765 * Create the [AuxiliaryElements] with a static and propagated [ExecutableElem
ent]. | 1901 * Create the [AuxiliaryElements] with a static and propagated [ExecutableElem
ent]. |
| 1766 * | 1902 * |
| 1767 * @param staticElement the static element | 1903 * @param staticElement the static element |
| 1768 * @param propagatedElement the propagated element | 1904 * @param propagatedElement the propagated element |
| 1769 */ | 1905 */ |
| 1770 AuxiliaryElements(ExecutableElement staticElement, ExecutableElement propagate
dElement) { | 1906 AuxiliaryElements(ExecutableElement staticElement, ExecutableElement propagate
dElement) { |
| 1771 this.staticElement = staticElement; | 1907 this.staticElement = staticElement; |
| 1772 this.propagatedElement = propagatedElement; | 1908 this.propagatedElement = propagatedElement; |
| 1773 } | 1909 } |
| 1774 } | 1910 } |
| 1911 |
| 1775 /** | 1912 /** |
| 1776 * Instances of the class `ClassElementImpl` implement a `ClassElement`. | 1913 * Instances of the class `ClassElementImpl` implement a `ClassElement`. |
| 1777 * | 1914 * |
| 1778 * @coverage dart.engine.element | 1915 * @coverage dart.engine.element |
| 1779 */ | 1916 */ |
| 1780 class ClassElementImpl extends ElementImpl implements ClassElement { | 1917 class ClassElementImpl extends ElementImpl implements ClassElement { |
| 1781 | |
| 1782 /** | 1918 /** |
| 1783 * An array containing all of the accessors (getters and setters) contained in
this class. | 1919 * An array containing all of the accessors (getters and setters) contained in
this class. |
| 1784 */ | 1920 */ |
| 1785 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; | 1921 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; |
| 1786 | 1922 |
| 1787 /** | 1923 /** |
| 1788 * An array containing all of the constructors contained in this class. | 1924 * An array containing all of the constructors contained in this class. |
| 1789 */ | 1925 */ |
| 1790 List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; | 1926 List<ConstructorElement> _constructors = ConstructorElementImpl.EMPTY_ARRAY; |
| 1791 | 1927 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 * An empty array of type elements. | 1965 * An empty array of type elements. |
| 1830 */ | 1966 */ |
| 1831 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); | 1967 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); |
| 1832 | 1968 |
| 1833 /** | 1969 /** |
| 1834 * Initialize a newly created class element to have the given name. | 1970 * Initialize a newly created class element to have the given name. |
| 1835 * | 1971 * |
| 1836 * @param name the name of this element | 1972 * @param name the name of this element |
| 1837 */ | 1973 */ |
| 1838 ClassElementImpl(Identifier name) : super.con1(name); | 1974 ClassElementImpl(Identifier name) : super.con1(name); |
| 1975 |
| 1839 accept(ElementVisitor visitor) => visitor.visitClassElement(this); | 1976 accept(ElementVisitor visitor) => visitor.visitClassElement(this); |
| 1977 |
| 1840 List<PropertyAccessorElement> get accessors => _accessors; | 1978 List<PropertyAccessorElement> get accessors => _accessors; |
| 1979 |
| 1841 List<InterfaceType> get allSupertypes { | 1980 List<InterfaceType> get allSupertypes { |
| 1842 List<InterfaceType> list = new List<InterfaceType>(); | 1981 List<InterfaceType> list = new List<InterfaceType>(); |
| 1843 collectAllSupertypes(list); | 1982 collectAllSupertypes(list); |
| 1844 return new List.from(list); | 1983 return new List.from(list); |
| 1845 } | 1984 } |
| 1985 |
| 1846 ElementImpl getChild(String identifier) { | 1986 ElementImpl getChild(String identifier) { |
| 1847 for (PropertyAccessorElement accessor in _accessors) { | 1987 for (PropertyAccessorElement accessor in _accessors) { |
| 1848 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier)
{ | 1988 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { |
| 1849 return accessor as PropertyAccessorElementImpl; | 1989 return accessor as PropertyAccessorElementImpl; |
| 1850 } | 1990 } |
| 1851 } | 1991 } |
| 1852 for (ConstructorElement constructor in _constructors) { | 1992 for (ConstructorElement constructor in _constructors) { |
| 1853 if (((constructor as ConstructorElementImpl)).identifier == identifier) { | 1993 if ((constructor as ConstructorElementImpl).identifier == identifier) { |
| 1854 return constructor as ConstructorElementImpl; | 1994 return constructor as ConstructorElementImpl; |
| 1855 } | 1995 } |
| 1856 } | 1996 } |
| 1857 for (FieldElement field in _fields) { | 1997 for (FieldElement field in _fields) { |
| 1858 if (((field as FieldElementImpl)).identifier == identifier) { | 1998 if ((field as FieldElementImpl).identifier == identifier) { |
| 1859 return field as FieldElementImpl; | 1999 return field as FieldElementImpl; |
| 1860 } | 2000 } |
| 1861 } | 2001 } |
| 1862 for (MethodElement method in _methods) { | 2002 for (MethodElement method in _methods) { |
| 1863 if (((method as MethodElementImpl)).identifier == identifier) { | 2003 if ((method as MethodElementImpl).identifier == identifier) { |
| 1864 return method as MethodElementImpl; | 2004 return method as MethodElementImpl; |
| 1865 } | 2005 } |
| 1866 } | 2006 } |
| 1867 for (TypeParameterElement typeParameter in _typeParameters) { | 2007 for (TypeParameterElement typeParameter in _typeParameters) { |
| 1868 if (((typeParameter as TypeParameterElementImpl)).identifier == identifier
) { | 2008 if ((typeParameter as TypeParameterElementImpl).identifier == identifier)
{ |
| 1869 return typeParameter as TypeParameterElementImpl; | 2009 return typeParameter as TypeParameterElementImpl; |
| 1870 } | 2010 } |
| 1871 } | 2011 } |
| 1872 return null; | 2012 return null; |
| 1873 } | 2013 } |
| 2014 |
| 1874 List<ConstructorElement> get constructors => _constructors; | 2015 List<ConstructorElement> get constructors => _constructors; |
| 1875 | 2016 |
| 1876 /** | 2017 /** |
| 1877 * Given some name, this returns the [FieldElement] with the matching name, if
there is no | 2018 * Given some name, this returns the [FieldElement] with the matching name, if
there is no |
| 1878 * such field, then `null` is returned. | 2019 * such field, then `null` is returned. |
| 1879 * | 2020 * |
| 1880 * @param name some name to lookup a field element with | 2021 * @param name some name to lookup a field element with |
| 1881 * @return the matching field element, or `null` if no such element was found | 2022 * @return the matching field element, or `null` if no such element was found |
| 1882 */ | 2023 */ |
| 1883 FieldElement getField(String name) { | 2024 FieldElement getField(String name) { |
| 1884 for (FieldElement fieldElement in _fields) { | 2025 for (FieldElement fieldElement in _fields) { |
| 1885 if (name == fieldElement.name) { | 2026 if (name == fieldElement.name) { |
| 1886 return fieldElement; | 2027 return fieldElement; |
| 1887 } | 2028 } |
| 1888 } | 2029 } |
| 1889 return null; | 2030 return null; |
| 1890 } | 2031 } |
| 2032 |
| 1891 List<FieldElement> get fields => _fields; | 2033 List<FieldElement> get fields => _fields; |
| 2034 |
| 1892 PropertyAccessorElement getGetter(String getterName) { | 2035 PropertyAccessorElement getGetter(String getterName) { |
| 1893 for (PropertyAccessorElement accessor in _accessors) { | 2036 for (PropertyAccessorElement accessor in _accessors) { |
| 1894 if (accessor.isGetter && accessor.name == getterName) { | 2037 if (accessor.isGetter && accessor.name == getterName) { |
| 1895 return accessor; | 2038 return accessor; |
| 1896 } | 2039 } |
| 1897 } | 2040 } |
| 1898 return null; | 2041 return null; |
| 1899 } | 2042 } |
| 2043 |
| 1900 List<InterfaceType> get interfaces => _interfaces; | 2044 List<InterfaceType> get interfaces => _interfaces; |
| 2045 |
| 1901 ElementKind get kind => ElementKind.CLASS; | 2046 ElementKind get kind => ElementKind.CLASS; |
| 2047 |
| 1902 MethodElement getMethod(String methodName) { | 2048 MethodElement getMethod(String methodName) { |
| 1903 for (MethodElement method in _methods) { | 2049 for (MethodElement method in _methods) { |
| 1904 if (method.name == methodName) { | 2050 if (method.name == methodName) { |
| 1905 return method; | 2051 return method; |
| 1906 } | 2052 } |
| 1907 } | 2053 } |
| 1908 return null; | 2054 return null; |
| 1909 } | 2055 } |
| 2056 |
| 1910 List<MethodElement> get methods => _methods; | 2057 List<MethodElement> get methods => _methods; |
| 2058 |
| 1911 List<InterfaceType> get mixins => _mixins; | 2059 List<InterfaceType> get mixins => _mixins; |
| 2060 |
| 1912 ConstructorElement getNamedConstructor(String name) { | 2061 ConstructorElement getNamedConstructor(String name) { |
| 1913 for (ConstructorElement element in constructors) { | 2062 for (ConstructorElement element in constructors) { |
| 1914 String elementName = element.name; | 2063 String elementName = element.name; |
| 1915 if (elementName != null && elementName == name) { | 2064 if (elementName != null && elementName == name) { |
| 1916 return element; | 2065 return element; |
| 1917 } | 2066 } |
| 1918 } | 2067 } |
| 1919 return null; | 2068 return null; |
| 1920 } | 2069 } |
| 2070 |
| 1921 PropertyAccessorElement getSetter(String setterName) { | 2071 PropertyAccessorElement getSetter(String setterName) { |
| 1922 if (!setterName.endsWith("=")) { | 2072 if (!setterName.endsWith("=")) { |
| 1923 setterName += '='; | 2073 setterName += '='; |
| 1924 } | 2074 } |
| 1925 for (PropertyAccessorElement accessor in _accessors) { | 2075 for (PropertyAccessorElement accessor in _accessors) { |
| 1926 if (accessor.isSetter && accessor.name == setterName) { | 2076 if (accessor.isSetter && accessor.name == setterName) { |
| 1927 return accessor; | 2077 return accessor; |
| 1928 } | 2078 } |
| 1929 } | 2079 } |
| 1930 return null; | 2080 return null; |
| 1931 } | 2081 } |
| 2082 |
| 1932 InterfaceType get supertype => _supertype; | 2083 InterfaceType get supertype => _supertype; |
| 2084 |
| 1933 InterfaceType get type => _type; | 2085 InterfaceType get type => _type; |
| 2086 |
| 1934 List<TypeParameterElement> get typeParameters => _typeParameters; | 2087 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 2088 |
| 1935 ConstructorElement get unnamedConstructor { | 2089 ConstructorElement get unnamedConstructor { |
| 1936 for (ConstructorElement element in constructors) { | 2090 for (ConstructorElement element in constructors) { |
| 1937 String name = element.displayName; | 2091 String name = element.displayName; |
| 1938 if (name == null || name.isEmpty) { | 2092 if (name == null || name.isEmpty) { |
| 1939 return element; | 2093 return element; |
| 1940 } | 2094 } |
| 1941 } | 2095 } |
| 1942 return null; | 2096 return null; |
| 1943 } | 2097 } |
| 2098 |
| 1944 bool hasNonFinalField() { | 2099 bool hasNonFinalField() { |
| 1945 List<ClassElement> classesToVisit = new List<ClassElement>(); | 2100 List<ClassElement> classesToVisit = new List<ClassElement>(); |
| 1946 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 2101 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 1947 classesToVisit.add(this); | 2102 classesToVisit.add(this); |
| 1948 while (!classesToVisit.isEmpty) { | 2103 while (!classesToVisit.isEmpty) { |
| 1949 ClassElement currentElement = classesToVisit.removeAt(0); | 2104 ClassElement currentElement = classesToVisit.removeAt(0); |
| 1950 if (javaSetAdd(visitedClasses, currentElement)) { | 2105 if (javaSetAdd(visitedClasses, currentElement)) { |
| 1951 for (FieldElement field in currentElement.fields) { | 2106 for (FieldElement field in currentElement.fields) { |
| 1952 if (!field.isFinal && !field.isConst && !field.isStatic && !field.isSy
nthetic) { | 2107 if (!field.isFinal && !field.isConst && !field.isStatic && !field.isSy
nthetic) { |
| 1953 return true; | 2108 return true; |
| 1954 } | 2109 } |
| 1955 } | 2110 } |
| 1956 for (InterfaceType mixinType in currentElement.mixins) { | 2111 for (InterfaceType mixinType in currentElement.mixins) { |
| 1957 ClassElement mixinElement = mixinType.element; | 2112 ClassElement mixinElement = mixinType.element; |
| 1958 classesToVisit.add(mixinElement); | 2113 classesToVisit.add(mixinElement); |
| 1959 } | 2114 } |
| 1960 InterfaceType supertype = currentElement.supertype; | 2115 InterfaceType supertype = currentElement.supertype; |
| 1961 if (supertype != null) { | 2116 if (supertype != null) { |
| 1962 ClassElement superElement = supertype.element; | 2117 ClassElement superElement = supertype.element; |
| 1963 if (superElement != null) { | 2118 if (superElement != null) { |
| 1964 classesToVisit.add(superElement); | 2119 classesToVisit.add(superElement); |
| 1965 } | 2120 } |
| 1966 } | 2121 } |
| 1967 } | 2122 } |
| 1968 } | 2123 } |
| 1969 return false; | 2124 return false; |
| 1970 } | 2125 } |
| 2126 |
| 1971 bool hasReferenceToSuper() => hasModifier(Modifier.REFERENCES_SUPER); | 2127 bool hasReferenceToSuper() => hasModifier(Modifier.REFERENCES_SUPER); |
| 2128 |
| 1972 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 2129 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 2130 |
| 1973 bool get isTypedef => hasModifier(Modifier.TYPEDEF); | 2131 bool get isTypedef => hasModifier(Modifier.TYPEDEF); |
| 2132 |
| 1974 bool get isValidMixin => hasModifier(Modifier.MIXIN); | 2133 bool get isValidMixin => hasModifier(Modifier.MIXIN); |
| 2134 |
| 1975 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { | 2135 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { |
| 1976 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 2136 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 1977 ClassElement currentElement = this; | 2137 ClassElement currentElement = this; |
| 1978 while (currentElement != null && !visitedClasses.contains(currentElement)) { | 2138 while (currentElement != null && !visitedClasses.contains(currentElement)) { |
| 1979 javaSetAdd(visitedClasses, currentElement); | 2139 javaSetAdd(visitedClasses, currentElement); |
| 1980 PropertyAccessorElement element = currentElement.getGetter(getterName); | 2140 PropertyAccessorElement element = currentElement.getGetter(getterName); |
| 1981 if (element != null && element.isAccessibleIn(library)) { | 2141 if (element != null && element.isAccessibleIn(library)) { |
| 1982 return element; | 2142 return element; |
| 1983 } | 2143 } |
| 1984 for (InterfaceType mixin in currentElement.mixins) { | 2144 for (InterfaceType mixin in currentElement.mixins) { |
| 1985 ClassElement mixinElement = mixin.element; | 2145 ClassElement mixinElement = mixin.element; |
| 1986 if (mixinElement != null) { | 2146 if (mixinElement != null) { |
| 1987 element = mixinElement.getGetter(getterName); | 2147 element = mixinElement.getGetter(getterName); |
| 1988 if (element != null && element.isAccessibleIn(library)) { | 2148 if (element != null && element.isAccessibleIn(library)) { |
| 1989 return element; | 2149 return element; |
| 1990 } | 2150 } |
| 1991 } | 2151 } |
| 1992 } | 2152 } |
| 1993 InterfaceType supertype = currentElement.supertype; | 2153 InterfaceType supertype = currentElement.supertype; |
| 1994 if (supertype == null) { | 2154 if (supertype == null) { |
| 1995 return null; | 2155 return null; |
| 1996 } | 2156 } |
| 1997 currentElement = supertype.element; | 2157 currentElement = supertype.element; |
| 1998 } | 2158 } |
| 1999 return null; | 2159 return null; |
| 2000 } | 2160 } |
| 2161 |
| 2001 MethodElement lookUpMethod(String methodName, LibraryElement library) { | 2162 MethodElement lookUpMethod(String methodName, LibraryElement library) { |
| 2002 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 2163 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 2003 ClassElement currentElement = this; | 2164 ClassElement currentElement = this; |
| 2004 while (currentElement != null && !visitedClasses.contains(currentElement)) { | 2165 while (currentElement != null && !visitedClasses.contains(currentElement)) { |
| 2005 javaSetAdd(visitedClasses, currentElement); | 2166 javaSetAdd(visitedClasses, currentElement); |
| 2006 MethodElement element = currentElement.getMethod(methodName); | 2167 MethodElement element = currentElement.getMethod(methodName); |
| 2007 if (element != null && element.isAccessibleIn(library)) { | 2168 if (element != null && element.isAccessibleIn(library)) { |
| 2008 return element; | 2169 return element; |
| 2009 } | 2170 } |
| 2010 for (InterfaceType mixin in currentElement.mixins) { | 2171 for (InterfaceType mixin in currentElement.mixins) { |
| 2011 ClassElement mixinElement = mixin.element; | 2172 ClassElement mixinElement = mixin.element; |
| 2012 if (mixinElement != null) { | 2173 if (mixinElement != null) { |
| 2013 element = mixinElement.getMethod(methodName); | 2174 element = mixinElement.getMethod(methodName); |
| 2014 if (element != null && element.isAccessibleIn(library)) { | 2175 if (element != null && element.isAccessibleIn(library)) { |
| 2015 return element; | 2176 return element; |
| 2016 } | 2177 } |
| 2017 } | 2178 } |
| 2018 } | 2179 } |
| 2019 InterfaceType supertype = currentElement.supertype; | 2180 InterfaceType supertype = currentElement.supertype; |
| 2020 if (supertype == null) { | 2181 if (supertype == null) { |
| 2021 return null; | 2182 return null; |
| 2022 } | 2183 } |
| 2023 currentElement = supertype.element; | 2184 currentElement = supertype.element; |
| 2024 } | 2185 } |
| 2025 return null; | 2186 return null; |
| 2026 } | 2187 } |
| 2188 |
| 2027 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { | 2189 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { |
| 2028 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 2190 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 2029 ClassElement currentElement = this; | 2191 ClassElement currentElement = this; |
| 2030 while (currentElement != null && !visitedClasses.contains(currentElement)) { | 2192 while (currentElement != null && !visitedClasses.contains(currentElement)) { |
| 2031 javaSetAdd(visitedClasses, currentElement); | 2193 javaSetAdd(visitedClasses, currentElement); |
| 2032 PropertyAccessorElement element = currentElement.getSetter(setterName); | 2194 PropertyAccessorElement element = currentElement.getSetter(setterName); |
| 2033 if (element != null && element.isAccessibleIn(library)) { | 2195 if (element != null && element.isAccessibleIn(library)) { |
| 2034 return element; | 2196 return element; |
| 2035 } | 2197 } |
| 2036 for (InterfaceType mixin in currentElement.mixins) { | 2198 for (InterfaceType mixin in currentElement.mixins) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2060 setModifier(Modifier.ABSTRACT, isAbstract); | 2222 setModifier(Modifier.ABSTRACT, isAbstract); |
| 2061 } | 2223 } |
| 2062 | 2224 |
| 2063 /** | 2225 /** |
| 2064 * Set the accessors contained in this class to the given accessors. | 2226 * Set the accessors contained in this class to the given accessors. |
| 2065 * | 2227 * |
| 2066 * @param accessors the accessors contained in this class | 2228 * @param accessors the accessors contained in this class |
| 2067 */ | 2229 */ |
| 2068 void set accessors(List<PropertyAccessorElement> accessors) { | 2230 void set accessors(List<PropertyAccessorElement> accessors) { |
| 2069 for (PropertyAccessorElement accessor in accessors) { | 2231 for (PropertyAccessorElement accessor in accessors) { |
| 2070 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; | 2232 (accessor as PropertyAccessorElementImpl).enclosingElement = this; |
| 2071 } | 2233 } |
| 2072 this._accessors = accessors; | 2234 this._accessors = accessors; |
| 2073 } | 2235 } |
| 2074 | 2236 |
| 2075 /** | 2237 /** |
| 2076 * Set the constructors contained in this class to the given constructors. | 2238 * Set the constructors contained in this class to the given constructors. |
| 2077 * | 2239 * |
| 2078 * @param constructors the constructors contained in this class | 2240 * @param constructors the constructors contained in this class |
| 2079 */ | 2241 */ |
| 2080 void set constructors(List<ConstructorElement> constructors) { | 2242 void set constructors(List<ConstructorElement> constructors) { |
| 2081 for (ConstructorElement constructor in constructors) { | 2243 for (ConstructorElement constructor in constructors) { |
| 2082 ((constructor as ConstructorElementImpl)).enclosingElement = this; | 2244 (constructor as ConstructorElementImpl).enclosingElement = this; |
| 2083 } | 2245 } |
| 2084 this._constructors = constructors; | 2246 this._constructors = constructors; |
| 2085 } | 2247 } |
| 2086 | 2248 |
| 2087 /** | 2249 /** |
| 2088 * Set the fields contained in this class to the given fields. | 2250 * Set the fields contained in this class to the given fields. |
| 2089 * | 2251 * |
| 2090 * @param fields the fields contained in this class | 2252 * @param fields the fields contained in this class |
| 2091 */ | 2253 */ |
| 2092 void set fields(List<FieldElement> fields) { | 2254 void set fields(List<FieldElement> fields) { |
| 2093 for (FieldElement field in fields) { | 2255 for (FieldElement field in fields) { |
| 2094 ((field as FieldElementImpl)).enclosingElement = this; | 2256 (field as FieldElementImpl).enclosingElement = this; |
| 2095 } | 2257 } |
| 2096 this._fields = fields; | 2258 this._fields = fields; |
| 2097 } | 2259 } |
| 2098 | 2260 |
| 2099 /** | 2261 /** |
| 2100 * Set whether this class references 'super' to the given value. | 2262 * Set whether this class references 'super' to the given value. |
| 2101 * | 2263 * |
| 2102 * @param isReferencedSuper `true` references 'super' | 2264 * @param isReferencedSuper `true` references 'super' |
| 2103 */ | 2265 */ |
| 2104 void set hasReferenceToSuper2(bool isReferencedSuper) { | 2266 void set hasReferenceToSuper2(bool isReferencedSuper) { |
| 2105 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); | 2267 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
| 2106 } | 2268 } |
| 2107 | 2269 |
| 2108 /** | 2270 /** |
| 2109 * Set the interfaces that are implemented by this class to the given types. | 2271 * Set the interfaces that are implemented by this class to the given types. |
| 2110 * | 2272 * |
| 2111 * @param the interfaces that are implemented by this class | 2273 * @param the interfaces that are implemented by this class |
| 2112 */ | 2274 */ |
| 2113 void set interfaces(List<InterfaceType> interfaces) { | 2275 void set interfaces(List<InterfaceType> interfaces) { |
| 2114 this._interfaces = interfaces; | 2276 this._interfaces = interfaces; |
| 2115 } | 2277 } |
| 2116 | 2278 |
| 2117 /** | 2279 /** |
| 2118 * Set the methods contained in this class to the given methods. | 2280 * Set the methods contained in this class to the given methods. |
| 2119 * | 2281 * |
| 2120 * @param methods the methods contained in this class | 2282 * @param methods the methods contained in this class |
| 2121 */ | 2283 */ |
| 2122 void set methods(List<MethodElement> methods) { | 2284 void set methods(List<MethodElement> methods) { |
| 2123 for (MethodElement method in methods) { | 2285 for (MethodElement method in methods) { |
| 2124 ((method as MethodElementImpl)).enclosingElement = this; | 2286 (method as MethodElementImpl).enclosingElement = this; |
| 2125 } | 2287 } |
| 2126 this._methods = methods; | 2288 this._methods = methods; |
| 2127 } | 2289 } |
| 2128 | 2290 |
| 2129 /** | 2291 /** |
| 2130 * Set the mixins that are applied to the class being extended in order to der
ive the superclass | 2292 * Set the mixins that are applied to the class being extended in order to der
ive the superclass |
| 2131 * of this class to the given types. | 2293 * of this class to the given types. |
| 2132 * | 2294 * |
| 2133 * @param mixins the mixins that are applied to derive the superclass of this
class | 2295 * @param mixins the mixins that are applied to derive the superclass of this
class |
| 2134 */ | 2296 */ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2163 setModifier(Modifier.TYPEDEF, isTypedef); | 2325 setModifier(Modifier.TYPEDEF, isTypedef); |
| 2164 } | 2326 } |
| 2165 | 2327 |
| 2166 /** | 2328 /** |
| 2167 * Set the type parameters defined for this class to the given type parameters
. | 2329 * Set the type parameters defined for this class to the given type parameters
. |
| 2168 * | 2330 * |
| 2169 * @param typeParameters the type parameters defined for this class | 2331 * @param typeParameters the type parameters defined for this class |
| 2170 */ | 2332 */ |
| 2171 void set typeParameters(List<TypeParameterElement> typeParameters) { | 2333 void set typeParameters(List<TypeParameterElement> typeParameters) { |
| 2172 for (TypeParameterElement typeParameter in typeParameters) { | 2334 for (TypeParameterElement typeParameter in typeParameters) { |
| 2173 ((typeParameter as TypeParameterElementImpl)).enclosingElement = this; | 2335 (typeParameter as TypeParameterElementImpl).enclosingElement = this; |
| 2174 } | 2336 } |
| 2175 this._typeParameters = typeParameters; | 2337 this._typeParameters = typeParameters; |
| 2176 } | 2338 } |
| 2177 | 2339 |
| 2178 /** | 2340 /** |
| 2179 * Set whether this class is a valid mixin to correspond to the given value. | 2341 * Set whether this class is a valid mixin to correspond to the given value. |
| 2180 * | 2342 * |
| 2181 * @param isValidMixin `true` if this class can be used as a mixin | 2343 * @param isValidMixin `true` if this class can be used as a mixin |
| 2182 */ | 2344 */ |
| 2183 void set validMixin(bool isValidMixin) { | 2345 void set validMixin(bool isValidMixin) { |
| 2184 setModifier(Modifier.MIXIN, isValidMixin); | 2346 setModifier(Modifier.MIXIN, isValidMixin); |
| 2185 } | 2347 } |
| 2348 |
| 2186 void visitChildren(ElementVisitor visitor) { | 2349 void visitChildren(ElementVisitor visitor) { |
| 2187 super.visitChildren(visitor); | 2350 super.visitChildren(visitor); |
| 2188 safelyVisitChildren(_accessors, visitor); | 2351 safelyVisitChildren(_accessors, visitor); |
| 2189 safelyVisitChildren(_constructors, visitor); | 2352 safelyVisitChildren(_constructors, visitor); |
| 2190 safelyVisitChildren(_fields, visitor); | 2353 safelyVisitChildren(_fields, visitor); |
| 2191 safelyVisitChildren(_methods, visitor); | 2354 safelyVisitChildren(_methods, visitor); |
| 2192 safelyVisitChildren(_typeParameters, visitor); | 2355 safelyVisitChildren(_typeParameters, visitor); |
| 2193 } | 2356 } |
| 2357 |
| 2194 void appendTo(JavaStringBuilder builder) { | 2358 void appendTo(JavaStringBuilder builder) { |
| 2195 String name = displayName; | 2359 String name = displayName; |
| 2196 if (name == null) { | 2360 if (name == null) { |
| 2197 builder.append("{unnamed class}"); | 2361 builder.append("{unnamed class}"); |
| 2198 } else { | 2362 } else { |
| 2199 builder.append(name); | 2363 builder.append(name); |
| 2200 } | 2364 } |
| 2201 int variableCount = _typeParameters.length; | 2365 int variableCount = _typeParameters.length; |
| 2202 if (variableCount > 0) { | 2366 if (variableCount > 0) { |
| 2203 builder.append("<"); | 2367 builder.append("<"); |
| 2204 for (int i = 0; i < variableCount; i++) { | 2368 for (int i = 0; i < variableCount; i++) { |
| 2205 if (i > 0) { | 2369 if (i > 0) { |
| 2206 builder.append(", "); | 2370 builder.append(", "); |
| 2207 } | 2371 } |
| 2208 ((_typeParameters[i] as TypeParameterElementImpl)).appendTo(builder); | 2372 (_typeParameters[i] as TypeParameterElementImpl).appendTo(builder); |
| 2209 } | 2373 } |
| 2210 builder.append(">"); | 2374 builder.append(">"); |
| 2211 } | 2375 } |
| 2212 } | 2376 } |
| 2377 |
| 2213 void collectAllSupertypes(List<InterfaceType> supertypes) { | 2378 void collectAllSupertypes(List<InterfaceType> supertypes) { |
| 2214 List<InterfaceType> typesToVisit = new List<InterfaceType>(); | 2379 List<InterfaceType> typesToVisit = new List<InterfaceType>(); |
| 2215 List<ClassElement> visitedClasses = new List<ClassElement>(); | 2380 List<ClassElement> visitedClasses = new List<ClassElement>(); |
| 2216 typesToVisit.add(this.type); | 2381 typesToVisit.add(this.type); |
| 2217 while (!typesToVisit.isEmpty) { | 2382 while (!typesToVisit.isEmpty) { |
| 2218 InterfaceType currentType = typesToVisit.removeAt(0); | 2383 InterfaceType currentType = typesToVisit.removeAt(0); |
| 2219 ClassElement currentElement = currentType.element; | 2384 ClassElement currentElement = currentType.element; |
| 2220 if (!visitedClasses.contains(currentElement)) { | 2385 if (!visitedClasses.contains(currentElement)) { |
| 2221 visitedClasses.add(currentElement); | 2386 visitedClasses.add(currentElement); |
| 2222 if (currentType != this.type) { | 2387 if (currentType != this.type) { |
| 2223 supertypes.add(currentType); | 2388 supertypes.add(currentType); |
| 2224 } | 2389 } |
| 2225 InterfaceType supertype = currentType.superclass; | 2390 InterfaceType supertype = currentType.superclass; |
| 2226 if (supertype != null) { | 2391 if (supertype != null) { |
| 2227 typesToVisit.add(supertype); | 2392 typesToVisit.add(supertype); |
| 2228 } | 2393 } |
| 2229 for (InterfaceType type in currentElement.interfaces) { | 2394 for (InterfaceType type in currentElement.interfaces) { |
| 2230 typesToVisit.add(type); | 2395 typesToVisit.add(type); |
| 2231 } | 2396 } |
| 2232 for (InterfaceType type in currentElement.mixins) { | 2397 for (InterfaceType type in currentElement.mixins) { |
| 2233 ClassElement element = type.element; | 2398 ClassElement element = type.element; |
| 2234 if (!visitedClasses.contains(element)) { | 2399 if (!visitedClasses.contains(element)) { |
| 2235 supertypes.add(type); | 2400 supertypes.add(type); |
| 2236 } | 2401 } |
| 2237 } | 2402 } |
| 2238 } | 2403 } |
| 2239 } | 2404 } |
| 2240 } | 2405 } |
| 2241 } | 2406 } |
| 2407 |
| 2242 /** | 2408 /** |
| 2243 * Instances of the class `CompilationUnitElementImpl` implement a | 2409 * Instances of the class `CompilationUnitElementImpl` implement a |
| 2244 * [CompilationUnitElement]. | 2410 * [CompilationUnitElement]. |
| 2245 * | 2411 * |
| 2246 * @coverage dart.engine.element | 2412 * @coverage dart.engine.element |
| 2247 */ | 2413 */ |
| 2248 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
lement { | 2414 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
lement { |
| 2249 | |
| 2250 /** | 2415 /** |
| 2251 * An empty array of compilation unit elements. | 2416 * An empty array of compilation unit elements. |
| 2252 */ | 2417 */ |
| 2253 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem
ent>(0); | 2418 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem
ent>(0); |
| 2254 | 2419 |
| 2255 /** | 2420 /** |
| 2256 * An array containing all of the top-level accessors (getters and setters) co
ntained in this | 2421 * An array containing all of the top-level accessors (getters and setters) co
ntained in this |
| 2257 * compilation unit. | 2422 * compilation unit. |
| 2258 */ | 2423 */ |
| 2259 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; | 2424 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A
RRAY; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2288 * this is the defining compilation unit of a library. | 2453 * this is the defining compilation unit of a library. |
| 2289 */ | 2454 */ |
| 2290 String _uri; | 2455 String _uri; |
| 2291 | 2456 |
| 2292 /** | 2457 /** |
| 2293 * Initialize a newly created compilation unit element to have the given name. | 2458 * Initialize a newly created compilation unit element to have the given name. |
| 2294 * | 2459 * |
| 2295 * @param name the name of this element | 2460 * @param name the name of this element |
| 2296 */ | 2461 */ |
| 2297 CompilationUnitElementImpl(String name) : super.con2(name, -1); | 2462 CompilationUnitElementImpl(String name) : super.con2(name, -1); |
| 2463 |
| 2298 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); | 2464 accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); |
| 2299 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _source == ((object as CompilationUnitElementImpl)).source; | 2465 |
| 2466 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _source == (object as CompilationUnitElementImpl).source; |
| 2467 |
| 2300 List<PropertyAccessorElement> get accessors => _accessors; | 2468 List<PropertyAccessorElement> get accessors => _accessors; |
| 2469 |
| 2301 ElementImpl getChild(String identifier) { | 2470 ElementImpl getChild(String identifier) { |
| 2302 for (PropertyAccessorElement accessor in _accessors) { | 2471 for (PropertyAccessorElement accessor in _accessors) { |
| 2303 if (((accessor as PropertyAccessorElementImpl)).identifier == identifier)
{ | 2472 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { |
| 2304 return accessor as PropertyAccessorElementImpl; | 2473 return accessor as PropertyAccessorElementImpl; |
| 2305 } | 2474 } |
| 2306 } | 2475 } |
| 2307 for (VariableElement variable in _variables) { | 2476 for (VariableElement variable in _variables) { |
| 2308 if (((variable as VariableElementImpl)).identifier == identifier) { | 2477 if ((variable as VariableElementImpl).identifier == identifier) { |
| 2309 return variable as VariableElementImpl; | 2478 return variable as VariableElementImpl; |
| 2310 } | 2479 } |
| 2311 } | 2480 } |
| 2312 for (ExecutableElement function in _functions) { | 2481 for (ExecutableElement function in _functions) { |
| 2313 if (((function as ExecutableElementImpl)).identifier == identifier) { | 2482 if ((function as ExecutableElementImpl).identifier == identifier) { |
| 2314 return function as ExecutableElementImpl; | 2483 return function as ExecutableElementImpl; |
| 2315 } | 2484 } |
| 2316 } | 2485 } |
| 2317 for (FunctionTypeAliasElement typeAlias in _typeAliases) { | 2486 for (FunctionTypeAliasElement typeAlias in _typeAliases) { |
| 2318 if (((typeAlias as FunctionTypeAliasElementImpl)).identifier == identifier
) { | 2487 if ((typeAlias as FunctionTypeAliasElementImpl).identifier == identifier)
{ |
| 2319 return typeAlias as FunctionTypeAliasElementImpl; | 2488 return typeAlias as FunctionTypeAliasElementImpl; |
| 2320 } | 2489 } |
| 2321 } | 2490 } |
| 2322 for (ClassElement type in _types) { | 2491 for (ClassElement type in _types) { |
| 2323 if (((type as ClassElementImpl)).identifier == identifier) { | 2492 if ((type as ClassElementImpl).identifier == identifier) { |
| 2324 return type as ClassElementImpl; | 2493 return type as ClassElementImpl; |
| 2325 } | 2494 } |
| 2326 } | 2495 } |
| 2327 return null; | 2496 return null; |
| 2328 } | 2497 } |
| 2498 |
| 2329 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; | 2499 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; |
| 2500 |
| 2330 List<FunctionElement> get functions => _functions; | 2501 List<FunctionElement> get functions => _functions; |
| 2502 |
| 2331 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; | 2503 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; |
| 2504 |
| 2332 ElementKind get kind => ElementKind.COMPILATION_UNIT; | 2505 ElementKind get kind => ElementKind.COMPILATION_UNIT; |
| 2506 |
| 2333 Source get source => _source; | 2507 Source get source => _source; |
| 2508 |
| 2334 List<TopLevelVariableElement> get topLevelVariables => _variables; | 2509 List<TopLevelVariableElement> get topLevelVariables => _variables; |
| 2510 |
| 2335 ClassElement getType(String className) { | 2511 ClassElement getType(String className) { |
| 2336 for (ClassElement type in _types) { | 2512 for (ClassElement type in _types) { |
| 2337 if (type.name == className) { | 2513 if (type.name == className) { |
| 2338 return type; | 2514 return type; |
| 2339 } | 2515 } |
| 2340 } | 2516 } |
| 2341 return null; | 2517 return null; |
| 2342 } | 2518 } |
| 2519 |
| 2343 List<ClassElement> get types => _types; | 2520 List<ClassElement> get types => _types; |
| 2521 |
| 2344 String get uri => _uri; | 2522 String get uri => _uri; |
| 2523 |
| 2345 int get hashCode => _source.hashCode; | 2524 int get hashCode => _source.hashCode; |
| 2346 | 2525 |
| 2347 /** | 2526 /** |
| 2348 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the | 2527 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the |
| 2349 * given accessors. | 2528 * given accessors. |
| 2350 * | 2529 * |
| 2351 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit | 2530 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit |
| 2352 */ | 2531 */ |
| 2353 void set accessors(List<PropertyAccessorElement> accessors) { | 2532 void set accessors(List<PropertyAccessorElement> accessors) { |
| 2354 for (PropertyAccessorElement accessor in accessors) { | 2533 for (PropertyAccessorElement accessor in accessors) { |
| 2355 ((accessor as PropertyAccessorElementImpl)).enclosingElement = this; | 2534 (accessor as PropertyAccessorElementImpl).enclosingElement = this; |
| 2356 } | 2535 } |
| 2357 this._accessors = accessors; | 2536 this._accessors = accessors; |
| 2358 } | 2537 } |
| 2359 | 2538 |
| 2360 /** | 2539 /** |
| 2361 * Set the top-level functions contained in this compilation unit to the given
functions. | 2540 * Set the top-level functions contained in this compilation unit to the given
functions. |
| 2362 * | 2541 * |
| 2363 * @param functions the top-level functions contained in this compilation unit | 2542 * @param functions the top-level functions contained in this compilation unit |
| 2364 */ | 2543 */ |
| 2365 void set functions(List<FunctionElement> functions) { | 2544 void set functions(List<FunctionElement> functions) { |
| 2366 for (FunctionElement function in functions) { | 2545 for (FunctionElement function in functions) { |
| 2367 ((function as FunctionElementImpl)).enclosingElement = this; | 2546 (function as FunctionElementImpl).enclosingElement = this; |
| 2368 } | 2547 } |
| 2369 this._functions = functions; | 2548 this._functions = functions; |
| 2370 } | 2549 } |
| 2371 | 2550 |
| 2372 /** | 2551 /** |
| 2373 * Set the source that corresponds to this compilation unit to the given sourc
e. | 2552 * Set the source that corresponds to this compilation unit to the given sourc
e. |
| 2374 * | 2553 * |
| 2375 * @param source the source that corresponds to this compilation unit | 2554 * @param source the source that corresponds to this compilation unit |
| 2376 */ | 2555 */ |
| 2377 void set source(Source source) { | 2556 void set source(Source source) { |
| 2378 this._source = source; | 2557 this._source = source; |
| 2379 } | 2558 } |
| 2380 | 2559 |
| 2381 /** | 2560 /** |
| 2382 * Set the top-level variables contained in this compilation unit to the given
variables. | 2561 * Set the top-level variables contained in this compilation unit to the given
variables. |
| 2383 * | 2562 * |
| 2384 * @param variables the top-level variables contained in this compilation unit | 2563 * @param variables the top-level variables contained in this compilation unit |
| 2385 */ | 2564 */ |
| 2386 void set topLevelVariables(List<TopLevelVariableElement> variables) { | 2565 void set topLevelVariables(List<TopLevelVariableElement> variables) { |
| 2387 for (TopLevelVariableElement field in variables) { | 2566 for (TopLevelVariableElement field in variables) { |
| 2388 ((field as TopLevelVariableElementImpl)).enclosingElement = this; | 2567 (field as TopLevelVariableElementImpl).enclosingElement = this; |
| 2389 } | 2568 } |
| 2390 this._variables = variables; | 2569 this._variables = variables; |
| 2391 } | 2570 } |
| 2392 | 2571 |
| 2393 /** | 2572 /** |
| 2394 * Set the function type aliases contained in this compilation unit to the giv
en type aliases. | 2573 * Set the function type aliases contained in this compilation unit to the giv
en type aliases. |
| 2395 * | 2574 * |
| 2396 * @param typeAliases the function type aliases contained in this compilation
unit | 2575 * @param typeAliases the function type aliases contained in this compilation
unit |
| 2397 */ | 2576 */ |
| 2398 void set typeAliases(List<FunctionTypeAliasElement> typeAliases) { | 2577 void set typeAliases(List<FunctionTypeAliasElement> typeAliases) { |
| 2399 for (FunctionTypeAliasElement typeAlias in typeAliases) { | 2578 for (FunctionTypeAliasElement typeAlias in typeAliases) { |
| 2400 ((typeAlias as FunctionTypeAliasElementImpl)).enclosingElement = this; | 2579 (typeAlias as FunctionTypeAliasElementImpl).enclosingElement = this; |
| 2401 } | 2580 } |
| 2402 this._typeAliases = typeAliases; | 2581 this._typeAliases = typeAliases; |
| 2403 } | 2582 } |
| 2404 | 2583 |
| 2405 /** | 2584 /** |
| 2406 * Set the types contained in this compilation unit to the given types. | 2585 * Set the types contained in this compilation unit to the given types. |
| 2407 * | 2586 * |
| 2408 * @param types types contained in this compilation unit | 2587 * @param types types contained in this compilation unit |
| 2409 */ | 2588 */ |
| 2410 void set types(List<ClassElement> types) { | 2589 void set types(List<ClassElement> types) { |
| 2411 for (ClassElement type in types) { | 2590 for (ClassElement type in types) { |
| 2412 ((type as ClassElementImpl)).enclosingElement = this; | 2591 (type as ClassElementImpl).enclosingElement = this; |
| 2413 } | 2592 } |
| 2414 this._types = types; | 2593 this._types = types; |
| 2415 } | 2594 } |
| 2416 | 2595 |
| 2417 /** | 2596 /** |
| 2418 * Set the URI that is specified by the "part" directive in the enclosing libr
ary. | 2597 * Set the URI that is specified by the "part" directive in the enclosing libr
ary. |
| 2419 * | 2598 * |
| 2420 * @param uri the URI that is specified by the "part" directive in the enclosi
ng library. | 2599 * @param uri the URI that is specified by the "part" directive in the enclosi
ng library. |
| 2421 */ | 2600 */ |
| 2422 void set uri(String uri) { | 2601 void set uri(String uri) { |
| 2423 this._uri = uri; | 2602 this._uri = uri; |
| 2424 } | 2603 } |
| 2604 |
| 2425 void visitChildren(ElementVisitor visitor) { | 2605 void visitChildren(ElementVisitor visitor) { |
| 2426 super.visitChildren(visitor); | 2606 super.visitChildren(visitor); |
| 2427 safelyVisitChildren(_accessors, visitor); | 2607 safelyVisitChildren(_accessors, visitor); |
| 2428 safelyVisitChildren(_functions, visitor); | 2608 safelyVisitChildren(_functions, visitor); |
| 2429 safelyVisitChildren(_typeAliases, visitor); | 2609 safelyVisitChildren(_typeAliases, visitor); |
| 2430 safelyVisitChildren(_types, visitor); | 2610 safelyVisitChildren(_types, visitor); |
| 2431 safelyVisitChildren(_variables, visitor); | 2611 safelyVisitChildren(_variables, visitor); |
| 2432 } | 2612 } |
| 2613 |
| 2433 void appendTo(JavaStringBuilder builder) { | 2614 void appendTo(JavaStringBuilder builder) { |
| 2434 if (_source == null) { | 2615 if (_source == null) { |
| 2435 builder.append("{compilation unit}"); | 2616 builder.append("{compilation unit}"); |
| 2436 } else { | 2617 } else { |
| 2437 builder.append(_source.fullName); | 2618 builder.append(_source.fullName); |
| 2438 } | 2619 } |
| 2439 } | 2620 } |
| 2621 |
| 2440 String get identifier => source.encoding; | 2622 String get identifier => source.encoding; |
| 2441 } | 2623 } |
| 2624 |
| 2442 /** | 2625 /** |
| 2443 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for
a | 2626 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for
a |
| 2444 * 'const' field that has an initializer. | 2627 * 'const' field that has an initializer. |
| 2445 */ | 2628 */ |
| 2446 class ConstFieldElementImpl extends FieldElementImpl { | 2629 class ConstFieldElementImpl extends FieldElementImpl { |
| 2447 | |
| 2448 /** | 2630 /** |
| 2449 * The result of evaluating this variable's initializer. | 2631 * The result of evaluating this variable's initializer. |
| 2450 */ | 2632 */ |
| 2451 EvaluationResultImpl _result; | 2633 EvaluationResultImpl _result; |
| 2452 | 2634 |
| 2453 /** | 2635 /** |
| 2454 * Initialize a newly created field element to have the given name. | 2636 * Initialize a newly created field element to have the given name. |
| 2455 * | 2637 * |
| 2456 * @param name the name of this element | 2638 * @param name the name of this element |
| 2457 */ | 2639 */ |
| 2458 ConstFieldElementImpl(Identifier name) : super.con1(name); | 2640 ConstFieldElementImpl(Identifier name) : super.con1(name); |
| 2641 |
| 2459 EvaluationResultImpl get evaluationResult => _result; | 2642 EvaluationResultImpl get evaluationResult => _result; |
| 2643 |
| 2460 void set evaluationResult(EvaluationResultImpl result) { | 2644 void set evaluationResult(EvaluationResultImpl result) { |
| 2461 this._result = result; | 2645 this._result = result; |
| 2462 } | 2646 } |
| 2463 } | 2647 } |
| 2648 |
| 2464 /** | 2649 /** |
| 2465 * Instances of the class `ConstLocalVariableElementImpl` implement a | 2650 * Instances of the class `ConstLocalVariableElementImpl` implement a |
| 2466 * `LocalVariableElement` for a local 'const' variable that has an initializer. | 2651 * `LocalVariableElement` for a local 'const' variable that has an initializer. |
| 2467 * | 2652 * |
| 2468 * @coverage dart.engine.element | 2653 * @coverage dart.engine.element |
| 2469 */ | 2654 */ |
| 2470 class ConstLocalVariableElementImpl extends LocalVariableElementImpl { | 2655 class ConstLocalVariableElementImpl extends LocalVariableElementImpl { |
| 2471 | |
| 2472 /** | 2656 /** |
| 2473 * The result of evaluating this variable's initializer. | 2657 * The result of evaluating this variable's initializer. |
| 2474 */ | 2658 */ |
| 2475 EvaluationResultImpl _result; | 2659 EvaluationResultImpl _result; |
| 2476 | 2660 |
| 2477 /** | 2661 /** |
| 2478 * Initialize a newly created local variable element to have the given name. | 2662 * Initialize a newly created local variable element to have the given name. |
| 2479 * | 2663 * |
| 2480 * @param name the name of this element | 2664 * @param name the name of this element |
| 2481 */ | 2665 */ |
| 2482 ConstLocalVariableElementImpl(Identifier name) : super(name); | 2666 ConstLocalVariableElementImpl(Identifier name) : super(name); |
| 2667 |
| 2483 EvaluationResultImpl get evaluationResult => _result; | 2668 EvaluationResultImpl get evaluationResult => _result; |
| 2669 |
| 2484 void set evaluationResult(EvaluationResultImpl result) { | 2670 void set evaluationResult(EvaluationResultImpl result) { |
| 2485 this._result = result; | 2671 this._result = result; |
| 2486 } | 2672 } |
| 2487 } | 2673 } |
| 2674 |
| 2488 /** | 2675 /** |
| 2489 * Instances of the class `ConstTopLevelVariableElementImpl` implement a | 2676 * Instances of the class `ConstTopLevelVariableElementImpl` implement a |
| 2490 * `TopLevelVariableElement` for a top-level 'const' variable that has an initia
lizer. | 2677 * `TopLevelVariableElement` for a top-level 'const' variable that has an initia
lizer. |
| 2491 */ | 2678 */ |
| 2492 class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl { | 2679 class ConstTopLevelVariableElementImpl extends TopLevelVariableElementImpl { |
| 2493 | |
| 2494 /** | 2680 /** |
| 2495 * The result of evaluating this variable's initializer. | 2681 * The result of evaluating this variable's initializer. |
| 2496 */ | 2682 */ |
| 2497 EvaluationResultImpl _result; | 2683 EvaluationResultImpl _result; |
| 2498 | 2684 |
| 2499 /** | 2685 /** |
| 2500 * Initialize a newly created top-level variable element to have the given nam
e. | 2686 * Initialize a newly created top-level variable element to have the given nam
e. |
| 2501 * | 2687 * |
| 2502 * @param name the name of this element | 2688 * @param name the name of this element |
| 2503 */ | 2689 */ |
| 2504 ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name); | 2690 ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name); |
| 2691 |
| 2505 EvaluationResultImpl get evaluationResult => _result; | 2692 EvaluationResultImpl get evaluationResult => _result; |
| 2693 |
| 2506 void set evaluationResult(EvaluationResultImpl result) { | 2694 void set evaluationResult(EvaluationResultImpl result) { |
| 2507 this._result = result; | 2695 this._result = result; |
| 2508 } | 2696 } |
| 2509 } | 2697 } |
| 2698 |
| 2510 /** | 2699 /** |
| 2511 * Instances of the class `ConstructorElementImpl` implement a `ConstructorEleme
nt`. | 2700 * Instances of the class `ConstructorElementImpl` implement a `ConstructorEleme
nt`. |
| 2512 * | 2701 * |
| 2513 * @coverage dart.engine.element | 2702 * @coverage dart.engine.element |
| 2514 */ | 2703 */ |
| 2515 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
rElement { | 2704 class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
rElement { |
| 2516 | |
| 2517 /** | 2705 /** |
| 2518 * An empty array of constructor elements. | 2706 * An empty array of constructor elements. |
| 2519 */ | 2707 */ |
| 2520 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); | 2708 static List<ConstructorElement> EMPTY_ARRAY = new List<ConstructorElement>(0); |
| 2521 | 2709 |
| 2522 /** | 2710 /** |
| 2523 * The constructor to which this constructor is redirecting. | 2711 * The constructor to which this constructor is redirecting. |
| 2524 */ | 2712 */ |
| 2525 ConstructorElement _redirectedConstructor; | 2713 ConstructorElement _redirectedConstructor; |
| 2526 | 2714 |
| 2527 /** | 2715 /** |
| 2528 * Initialize a newly created constructor element to have the given name. | 2716 * Initialize a newly created constructor element to have the given name. |
| 2529 * | 2717 * |
| 2530 * @param name the name of this element | 2718 * @param name the name of this element |
| 2531 */ | 2719 */ |
| 2532 ConstructorElementImpl(Identifier name) : super.con1(name); | 2720 ConstructorElementImpl(Identifier name) : super.con1(name); |
| 2721 |
| 2533 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 2722 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 2723 |
| 2534 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 2724 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| 2725 |
| 2535 ElementKind get kind => ElementKind.CONSTRUCTOR; | 2726 ElementKind get kind => ElementKind.CONSTRUCTOR; |
| 2727 |
| 2536 ConstructorElement get redirectedConstructor => _redirectedConstructor; | 2728 ConstructorElement get redirectedConstructor => _redirectedConstructor; |
| 2729 |
| 2537 bool get isConst => hasModifier(Modifier.CONST); | 2730 bool get isConst => hasModifier(Modifier.CONST); |
| 2731 |
| 2538 bool get isDefaultConstructor { | 2732 bool get isDefaultConstructor { |
| 2539 String name = this.name; | 2733 String name = this.name; |
| 2540 if (name != null && name.length != 0) { | 2734 if (name != null && name.length != 0) { |
| 2541 return false; | 2735 return false; |
| 2542 } | 2736 } |
| 2543 for (ParameterElement parameter in parameters) { | 2737 for (ParameterElement parameter in parameters) { |
| 2544 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { | 2738 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { |
| 2545 return false; | 2739 return false; |
| 2546 } | 2740 } |
| 2547 } | 2741 } |
| 2548 return true; | 2742 return true; |
| 2549 } | 2743 } |
| 2744 |
| 2550 bool get isFactory => hasModifier(Modifier.FACTORY); | 2745 bool get isFactory => hasModifier(Modifier.FACTORY); |
| 2746 |
| 2551 bool get isStatic => false; | 2747 bool get isStatic => false; |
| 2552 | 2748 |
| 2553 /** | 2749 /** |
| 2554 * Set whether this constructor represents a 'const' constructor to the given
value. | 2750 * Set whether this constructor represents a 'const' constructor to the given
value. |
| 2555 * | 2751 * |
| 2556 * @param isConst `true` if this constructor represents a 'const' constructor | 2752 * @param isConst `true` if this constructor represents a 'const' constructor |
| 2557 */ | 2753 */ |
| 2558 void set const2(bool isConst) { | 2754 void set const2(bool isConst) { |
| 2559 setModifier(Modifier.CONST, isConst); | 2755 setModifier(Modifier.CONST, isConst); |
| 2560 } | 2756 } |
| 2561 | 2757 |
| 2562 /** | 2758 /** |
| 2563 * Set whether this constructor represents a factory method to the given value
. | 2759 * Set whether this constructor represents a factory method to the given value
. |
| 2564 * | 2760 * |
| 2565 * @param isFactory `true` if this constructor represents a factory method | 2761 * @param isFactory `true` if this constructor represents a factory method |
| 2566 */ | 2762 */ |
| 2567 void set factory(bool isFactory) { | 2763 void set factory(bool isFactory) { |
| 2568 setModifier(Modifier.FACTORY, isFactory); | 2764 setModifier(Modifier.FACTORY, isFactory); |
| 2569 } | 2765 } |
| 2570 | 2766 |
| 2571 /** | 2767 /** |
| 2572 * Sets the constructor to which this constructor is redirecting. | 2768 * Sets the constructor to which this constructor is redirecting. |
| 2573 * | 2769 * |
| 2574 * @param redirectedConstructor the constructor to which this constructor is r
edirecting | 2770 * @param redirectedConstructor the constructor to which this constructor is r
edirecting |
| 2575 */ | 2771 */ |
| 2576 void set redirectedConstructor(ConstructorElement redirectedConstructor) { | 2772 void set redirectedConstructor(ConstructorElement redirectedConstructor) { |
| 2577 this._redirectedConstructor = redirectedConstructor; | 2773 this._redirectedConstructor = redirectedConstructor; |
| 2578 } | 2774 } |
| 2775 |
| 2579 void appendTo(JavaStringBuilder builder) { | 2776 void appendTo(JavaStringBuilder builder) { |
| 2580 builder.append(enclosingElement.displayName); | 2777 builder.append(enclosingElement.displayName); |
| 2581 String name = displayName; | 2778 String name = displayName; |
| 2582 if (name != null && !name.isEmpty) { | 2779 if (name != null && !name.isEmpty) { |
| 2583 builder.append("."); | 2780 builder.append("."); |
| 2584 builder.append(name); | 2781 builder.append(name); |
| 2585 } | 2782 } |
| 2586 super.appendTo(builder); | 2783 super.appendTo(builder); |
| 2587 } | 2784 } |
| 2588 } | 2785 } |
| 2786 |
| 2589 /** | 2787 /** |
| 2590 * Instances of the class `DefaultFieldFormalParameterElementImpl` implement a | 2788 * Instances of the class `DefaultFieldFormalParameterElementImpl` implement a |
| 2591 * `FieldFormalParameterElementImpl` for parameters that have an initializer. | 2789 * `FieldFormalParameterElementImpl` for parameters that have an initializer. |
| 2592 * | 2790 * |
| 2593 * @coverage dart.engine.element | 2791 * @coverage dart.engine.element |
| 2594 */ | 2792 */ |
| 2595 class DefaultFieldFormalParameterElementImpl extends FieldFormalParameterElement
Impl { | 2793 class DefaultFieldFormalParameterElementImpl extends FieldFormalParameterElement
Impl { |
| 2596 | |
| 2597 /** | 2794 /** |
| 2598 * The result of evaluating this variable's initializer. | 2795 * The result of evaluating this variable's initializer. |
| 2599 */ | 2796 */ |
| 2600 EvaluationResultImpl _result; | 2797 EvaluationResultImpl _result; |
| 2601 | 2798 |
| 2602 /** | 2799 /** |
| 2603 * Initialize a newly created parameter element to have the given name. | 2800 * Initialize a newly created parameter element to have the given name. |
| 2604 * | 2801 * |
| 2605 * @param name the name of this element | 2802 * @param name the name of this element |
| 2606 */ | 2803 */ |
| 2607 DefaultFieldFormalParameterElementImpl(Identifier name) : super(name); | 2804 DefaultFieldFormalParameterElementImpl(Identifier name) : super(name); |
| 2805 |
| 2608 EvaluationResultImpl get evaluationResult => _result; | 2806 EvaluationResultImpl get evaluationResult => _result; |
| 2807 |
| 2609 void set evaluationResult(EvaluationResultImpl result) { | 2808 void set evaluationResult(EvaluationResultImpl result) { |
| 2610 this._result = result; | 2809 this._result = result; |
| 2611 } | 2810 } |
| 2612 } | 2811 } |
| 2812 |
| 2613 /** | 2813 /** |
| 2614 * Instances of the class `DefaultParameterElementImpl` implement a `ParameterEl
ement` | 2814 * Instances of the class `DefaultParameterElementImpl` implement a `ParameterEl
ement` |
| 2615 * for parameters that have an initializer. | 2815 * for parameters that have an initializer. |
| 2616 * | 2816 * |
| 2617 * @coverage dart.engine.element | 2817 * @coverage dart.engine.element |
| 2618 */ | 2818 */ |
| 2619 class DefaultParameterElementImpl extends ParameterElementImpl { | 2819 class DefaultParameterElementImpl extends ParameterElementImpl { |
| 2620 | |
| 2621 /** | 2820 /** |
| 2622 * The result of evaluating this variable's initializer. | 2821 * The result of evaluating this variable's initializer. |
| 2623 */ | 2822 */ |
| 2624 EvaluationResultImpl _result; | 2823 EvaluationResultImpl _result; |
| 2625 | 2824 |
| 2626 /** | 2825 /** |
| 2627 * Initialize a newly created parameter element to have the given name. | 2826 * Initialize a newly created parameter element to have the given name. |
| 2628 * | 2827 * |
| 2629 * @param name the name of this element | 2828 * @param name the name of this element |
| 2630 */ | 2829 */ |
| 2631 DefaultParameterElementImpl(Identifier name) : super.con1(name); | 2830 DefaultParameterElementImpl(Identifier name) : super.con1(name); |
| 2831 |
| 2632 EvaluationResultImpl get evaluationResult => _result; | 2832 EvaluationResultImpl get evaluationResult => _result; |
| 2833 |
| 2633 void set evaluationResult(EvaluationResultImpl result) { | 2834 void set evaluationResult(EvaluationResultImpl result) { |
| 2634 this._result = result; | 2835 this._result = result; |
| 2635 } | 2836 } |
| 2636 } | 2837 } |
| 2838 |
| 2637 /** | 2839 /** |
| 2638 * Instances of the class `DynamicElementImpl` represent the synthetic element r
epresenting | 2840 * Instances of the class `DynamicElementImpl` represent the synthetic element r
epresenting |
| 2639 * the declaration of the type `dynamic`. | 2841 * the declaration of the type `dynamic`. |
| 2640 * | 2842 * |
| 2641 * @coverage dart.engine.element | 2843 * @coverage dart.engine.element |
| 2642 */ | 2844 */ |
| 2643 class DynamicElementImpl extends ElementImpl { | 2845 class DynamicElementImpl extends ElementImpl { |
| 2644 | |
| 2645 /** | 2846 /** |
| 2646 * Return the unique instance of this class. | 2847 * Return the unique instance of this class. |
| 2647 * | 2848 * |
| 2648 * @return the unique instance of this class | 2849 * @return the unique instance of this class |
| 2649 */ | 2850 */ |
| 2650 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as
DynamicElementImpl; | 2851 static DynamicElementImpl get instance => DynamicTypeImpl.instance.element as
DynamicElementImpl; |
| 2651 | 2852 |
| 2652 /** | 2853 /** |
| 2653 * The type defined by this element. | 2854 * The type defined by this element. |
| 2654 */ | 2855 */ |
| 2655 DynamicTypeImpl type; | 2856 DynamicTypeImpl type; |
| 2656 | 2857 |
| 2657 /** | 2858 /** |
| 2658 * Initialize a newly created instance of this class. Instances of this class
should <b>not</b> be | 2859 * Initialize a newly created instance of this class. Instances of this class
should <b>not</b> be |
| 2659 * created except as part of creating the type associated with this element. T
he single instance | 2860 * created except as part of creating the type associated with this element. T
he single instance |
| 2660 * of this class should be accessed through the method [getInstance]. | 2861 * of this class should be accessed through the method [getInstance]. |
| 2661 */ | 2862 */ |
| 2662 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { | 2863 DynamicElementImpl() : super.con2(Keyword.DYNAMIC.syntax, -1) { |
| 2663 setModifier(Modifier.SYNTHETIC, true); | 2864 setModifier(Modifier.SYNTHETIC, true); |
| 2664 } | 2865 } |
| 2866 |
| 2665 accept(ElementVisitor visitor) => null; | 2867 accept(ElementVisitor visitor) => null; |
| 2868 |
| 2666 ElementKind get kind => ElementKind.DYNAMIC; | 2869 ElementKind get kind => ElementKind.DYNAMIC; |
| 2667 } | 2870 } |
| 2871 |
| 2668 /** | 2872 /** |
| 2669 * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotatio
n]. | 2873 * Instances of the class `ElementAnnotationImpl` implement an [ElementAnnotatio
n]. |
| 2670 * | 2874 * |
| 2671 * @coverage dart.engine.element | 2875 * @coverage dart.engine.element |
| 2672 */ | 2876 */ |
| 2673 class ElementAnnotationImpl implements ElementAnnotation { | 2877 class ElementAnnotationImpl implements ElementAnnotation { |
| 2674 | |
| 2675 /** | 2878 /** |
| 2676 * The element representing the field, variable, or constructor being used as
an annotation. | 2879 * The element representing the field, variable, or constructor being used as
an annotation. |
| 2677 */ | 2880 */ |
| 2678 Element _element; | 2881 Element _element; |
| 2679 | 2882 |
| 2680 /** | 2883 /** |
| 2681 * An empty array of annotations. | 2884 * An empty array of annotations. |
| 2682 */ | 2885 */ |
| 2683 static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImp
l>(0); | 2886 static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImp
l>(0); |
| 2684 | 2887 |
| 2685 /** | 2888 /** |
| 2686 * Initialize a newly created annotation. | 2889 * Initialize a newly created annotation. |
| 2687 * | 2890 * |
| 2688 * @param element the element representing the field, variable, or constructor
being used as an | 2891 * @param element the element representing the field, variable, or constructor
being used as an |
| 2689 * annotation | 2892 * annotation |
| 2690 */ | 2893 */ |
| 2691 ElementAnnotationImpl(Element element) { | 2894 ElementAnnotationImpl(Element element) { |
| 2692 this._element = element; | 2895 this._element = element; |
| 2693 } | 2896 } |
| 2897 |
| 2694 Element get element => _element; | 2898 Element get element => _element; |
| 2899 |
| 2695 String toString() => "@${_element.toString()}"; | 2900 String toString() => "@${_element.toString()}"; |
| 2696 } | 2901 } |
| 2902 |
| 2697 /** | 2903 /** |
| 2698 * The abstract class `ElementImpl` implements the behavior common to objects th
at implement | 2904 * The abstract class `ElementImpl` implements the behavior common to objects th
at implement |
| 2699 * an [Element]. | 2905 * an [Element]. |
| 2700 * | 2906 * |
| 2701 * @coverage dart.engine.element | 2907 * @coverage dart.engine.element |
| 2702 */ | 2908 */ |
| 2703 abstract class ElementImpl implements Element { | 2909 abstract class ElementImpl implements Element { |
| 2704 | |
| 2705 /** | 2910 /** |
| 2706 * The enclosing element of this element, or `null` if this element is at the
root of the | 2911 * The enclosing element of this element, or `null` if this element is at the
root of the |
| 2707 * element structure. | 2912 * element structure. |
| 2708 */ | 2913 */ |
| 2709 ElementImpl _enclosingElement; | 2914 ElementImpl _enclosingElement; |
| 2710 | 2915 |
| 2711 /** | 2916 /** |
| 2712 * The name of this element. | 2917 * The name of this element. |
| 2713 */ | 2918 */ |
| 2714 String _name; | 2919 String _name; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2745 * Initialize a newly created element to have the given name. | 2950 * Initialize a newly created element to have the given name. |
| 2746 * | 2951 * |
| 2747 * @param name the name of this element | 2952 * @param name the name of this element |
| 2748 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 2953 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 2749 * declaration of this element | 2954 * declaration of this element |
| 2750 */ | 2955 */ |
| 2751 ElementImpl.con2(String name, int nameOffset) { | 2956 ElementImpl.con2(String name, int nameOffset) { |
| 2752 this._name = StringUtilities.intern(name); | 2957 this._name = StringUtilities.intern(name); |
| 2753 this._nameOffset = nameOffset; | 2958 this._nameOffset = nameOffset; |
| 2754 } | 2959 } |
| 2960 |
| 2755 String computeDocumentationComment() { | 2961 String computeDocumentationComment() { |
| 2756 AnalysisContext context = this.context; | 2962 AnalysisContext context = this.context; |
| 2757 if (context == null) { | 2963 if (context == null) { |
| 2758 return null; | 2964 return null; |
| 2759 } | 2965 } |
| 2760 return context.computeDocumentationComment(this); | 2966 return context.computeDocumentationComment(this); |
| 2761 } | 2967 } |
| 2968 |
| 2762 bool operator ==(Object object) { | 2969 bool operator ==(Object object) { |
| 2763 if (identical(this, object)) { | 2970 if (identical(this, object)) { |
| 2764 return true; | 2971 return true; |
| 2765 } | 2972 } |
| 2766 if (object == null || hashCode != object.hashCode) { | 2973 if (object == null || hashCode != object.hashCode) { |
| 2767 return false; | 2974 return false; |
| 2768 } | 2975 } |
| 2769 return object.runtimeType == runtimeType && ((object as Element)).location =
= location; | 2976 return object.runtimeType == runtimeType && (object as Element).location ==
location; |
| 2770 } | 2977 } |
| 2978 |
| 2771 Element getAncestor(Type elementClass) { | 2979 Element getAncestor(Type elementClass) { |
| 2772 Element ancestor = _enclosingElement; | 2980 Element ancestor = _enclosingElement; |
| 2773 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { | 2981 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { |
| 2774 ancestor = ancestor.enclosingElement; | 2982 ancestor = ancestor.enclosingElement; |
| 2775 } | 2983 } |
| 2776 return ancestor as Element; | 2984 return ancestor as Element; |
| 2777 } | 2985 } |
| 2778 | 2986 |
| 2779 /** | 2987 /** |
| 2780 * Return the child of this element that is uniquely identified by the given i
dentifier, or | 2988 * Return the child of this element that is uniquely identified by the given i
dentifier, or |
| 2781 * `null` if there is no such child. | 2989 * `null` if there is no such child. |
| 2782 * | 2990 * |
| 2783 * @param identifier the identifier used to select a child | 2991 * @param identifier the identifier used to select a child |
| 2784 * @return the child of this element with the given identifier | 2992 * @return the child of this element with the given identifier |
| 2785 */ | 2993 */ |
| 2786 ElementImpl getChild(String identifier) => null; | 2994 ElementImpl getChild(String identifier) => null; |
| 2995 |
| 2787 AnalysisContext get context { | 2996 AnalysisContext get context { |
| 2788 if (_enclosingElement == null) { | 2997 if (_enclosingElement == null) { |
| 2789 return null; | 2998 return null; |
| 2790 } | 2999 } |
| 2791 return _enclosingElement.context; | 3000 return _enclosingElement.context; |
| 2792 } | 3001 } |
| 3002 |
| 2793 String get displayName => _name; | 3003 String get displayName => _name; |
| 3004 |
| 2794 Element get enclosingElement => _enclosingElement; | 3005 Element get enclosingElement => _enclosingElement; |
| 3006 |
| 2795 LibraryElement get library => getAncestor(LibraryElement); | 3007 LibraryElement get library => getAncestor(LibraryElement); |
| 3008 |
| 2796 ElementLocation get location => new ElementLocationImpl.con1(this); | 3009 ElementLocation get location => new ElementLocationImpl.con1(this); |
| 3010 |
| 2797 List<ElementAnnotation> get metadata => _metadata; | 3011 List<ElementAnnotation> get metadata => _metadata; |
| 3012 |
| 2798 String get name => _name; | 3013 String get name => _name; |
| 3014 |
| 2799 int get nameOffset => _nameOffset; | 3015 int get nameOffset => _nameOffset; |
| 3016 |
| 2800 Source get source { | 3017 Source get source { |
| 2801 if (_enclosingElement == null) { | 3018 if (_enclosingElement == null) { |
| 2802 return null; | 3019 return null; |
| 2803 } | 3020 } |
| 2804 return _enclosingElement.source; | 3021 return _enclosingElement.source; |
| 2805 } | 3022 } |
| 3023 |
| 2806 int get hashCode { | 3024 int get hashCode { |
| 2807 if (_cachedHashCode == 0) { | 3025 if (_cachedHashCode == 0) { |
| 2808 _cachedHashCode = location.hashCode; | 3026 _cachedHashCode = location.hashCode; |
| 2809 } | 3027 } |
| 2810 return _cachedHashCode; | 3028 return _cachedHashCode; |
| 2811 } | 3029 } |
| 3030 |
| 2812 bool isAccessibleIn(LibraryElement library) { | 3031 bool isAccessibleIn(LibraryElement library) { |
| 2813 if (Identifier.isPrivateName(_name)) { | 3032 if (Identifier.isPrivateName(_name)) { |
| 2814 return library == this.library; | 3033 return library == this.library; |
| 2815 } | 3034 } |
| 2816 return true; | 3035 return true; |
| 2817 } | 3036 } |
| 3037 |
| 3038 bool get isDeprecated { |
| 3039 for (ElementAnnotation annotation in _metadata) { |
| 3040 Element element = annotation.element; |
| 3041 if (element != null) { |
| 3042 LibraryElement lib = element.library; |
| 3043 if (lib != null && lib.isDartCore) { |
| 3044 if (element is ConstructorElement) { |
| 3045 ConstructorElement constructorElement = element as ConstructorElemen
t; |
| 3046 if (constructorElement.enclosingElement.name == "Deprecated") { |
| 3047 return true; |
| 3048 } |
| 3049 } else if (element is PropertyAccessorElement && element.name == "depr
ecated") { |
| 3050 return true; |
| 3051 } |
| 3052 } |
| 3053 } |
| 3054 } |
| 3055 return false; |
| 3056 } |
| 3057 |
| 2818 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); | 3058 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); |
| 2819 | 3059 |
| 2820 /** | 3060 /** |
| 2821 * Set the metadata associate with this element to the given array of annotati
ons. | 3061 * Set the metadata associate with this element to the given array of annotati
ons. |
| 2822 * | 3062 * |
| 2823 * @param metadata the metadata to be associated with this element | 3063 * @param metadata the metadata to be associated with this element |
| 2824 */ | 3064 */ |
| 2825 void set metadata(List<ElementAnnotation> metadata) { | 3065 void set metadata(List<ElementAnnotation> metadata) { |
| 2826 this._metadata = metadata; | 3066 this._metadata = metadata; |
| 2827 } | 3067 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2838 } | 3078 } |
| 2839 | 3079 |
| 2840 /** | 3080 /** |
| 2841 * Set whether this element is synthetic to correspond to the given value. | 3081 * Set whether this element is synthetic to correspond to the given value. |
| 2842 * | 3082 * |
| 2843 * @param isSynthetic `true` if the element is synthetic | 3083 * @param isSynthetic `true` if the element is synthetic |
| 2844 */ | 3084 */ |
| 2845 void set synthetic(bool isSynthetic) { | 3085 void set synthetic(bool isSynthetic) { |
| 2846 setModifier(Modifier.SYNTHETIC, isSynthetic); | 3086 setModifier(Modifier.SYNTHETIC, isSynthetic); |
| 2847 } | 3087 } |
| 3088 |
| 2848 String toString() { | 3089 String toString() { |
| 2849 JavaStringBuilder builder = new JavaStringBuilder(); | 3090 JavaStringBuilder builder = new JavaStringBuilder(); |
| 2850 appendTo(builder); | 3091 appendTo(builder); |
| 2851 return builder.toString(); | 3092 return builder.toString(); |
| 2852 } | 3093 } |
| 3094 |
| 2853 void visitChildren(ElementVisitor visitor) { | 3095 void visitChildren(ElementVisitor visitor) { |
| 2854 } | 3096 } |
| 2855 | 3097 |
| 2856 /** | 3098 /** |
| 2857 * Append a textual representation of this type to the given builder. | 3099 * Append a textual representation of this type to the given builder. |
| 2858 * | 3100 * |
| 2859 * @param builder the builder to which the text is to be appended | 3101 * @param builder the builder to which the text is to be appended |
| 2860 */ | 3102 */ |
| 2861 void appendTo(JavaStringBuilder builder) { | 3103 void appendTo(JavaStringBuilder builder) { |
| 2862 if (_name == null) { | 3104 if (_name == null) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2923 * Set whether the given modifier is associated with this element to correspon
d to the given | 3165 * Set whether the given modifier is associated with this element to correspon
d to the given |
| 2924 * value. | 3166 * value. |
| 2925 * | 3167 * |
| 2926 * @param modifier the modifier to be set | 3168 * @param modifier the modifier to be set |
| 2927 * @param value `true` if the modifier is to be associated with this element | 3169 * @param value `true` if the modifier is to be associated with this element |
| 2928 */ | 3170 */ |
| 2929 void setModifier(Modifier modifier, bool value) { | 3171 void setModifier(Modifier modifier, bool value) { |
| 2930 _modifiers = BooleanArray.set(_modifiers, modifier, value); | 3172 _modifiers = BooleanArray.set(_modifiers, modifier, value); |
| 2931 } | 3173 } |
| 2932 } | 3174 } |
| 3175 |
| 2933 /** | 3176 /** |
| 2934 * Instances of the class `ElementLocationImpl` implement an [ElementLocation]. | 3177 * Instances of the class `ElementLocationImpl` implement an [ElementLocation]. |
| 2935 * | 3178 * |
| 2936 * @coverage dart.engine.element | 3179 * @coverage dart.engine.element |
| 2937 */ | 3180 */ |
| 2938 class ElementLocationImpl implements ElementLocation { | 3181 class ElementLocationImpl implements ElementLocation { |
| 2939 | |
| 2940 /** | 3182 /** |
| 2941 * The path to the element whose location is represented by this object. | 3183 * The path to the element whose location is represented by this object. |
| 2942 */ | 3184 */ |
| 2943 List<String> components; | 3185 List<String> components; |
| 2944 | 3186 |
| 2945 /** | 3187 /** |
| 2946 * The character used to separate components in the encoded form. | 3188 * The character used to separate components in the encoded form. |
| 2947 */ | 3189 */ |
| 2948 static int _SEPARATOR_CHAR = 0x3B; | 3190 static int _SEPARATOR_CHAR = 0x3B; |
| 2949 | 3191 |
| 2950 /** | 3192 /** |
| 2951 * Initialize a newly created location to represent the given element. | 3193 * Initialize a newly created location to represent the given element. |
| 2952 * | 3194 * |
| 2953 * @param element the element whose location is being represented | 3195 * @param element the element whose location is being represented |
| 2954 */ | 3196 */ |
| 2955 ElementLocationImpl.con1(Element element) { | 3197 ElementLocationImpl.con1(Element element) { |
| 2956 List<String> components = new List<String>(); | 3198 List<String> components = new List<String>(); |
| 2957 Element ancestor = element; | 3199 Element ancestor = element; |
| 2958 while (ancestor != null) { | 3200 while (ancestor != null) { |
| 2959 components.insert(0, ((ancestor as ElementImpl)).identifier); | 3201 components.insert(0, (ancestor as ElementImpl).identifier); |
| 2960 ancestor = ancestor.enclosingElement; | 3202 ancestor = ancestor.enclosingElement; |
| 2961 } | 3203 } |
| 2962 this.components = new List.from(components); | 3204 this.components = new List.from(components); |
| 2963 } | 3205 } |
| 2964 | 3206 |
| 2965 /** | 3207 /** |
| 2966 * Initialize a newly created location from the given encoded form. | 3208 * Initialize a newly created location from the given encoded form. |
| 2967 * | 3209 * |
| 2968 * @param encoding the encoded form of a location | 3210 * @param encoding the encoded form of a location |
| 2969 */ | 3211 */ |
| 2970 ElementLocationImpl.con2(String encoding) { | 3212 ElementLocationImpl.con2(String encoding) { |
| 2971 this.components = decode(encoding); | 3213 this.components = decode(encoding); |
| 2972 } | 3214 } |
| 3215 |
| 2973 bool operator ==(Object object) { | 3216 bool operator ==(Object object) { |
| 2974 if (identical(this, object)) { | 3217 if (identical(this, object)) { |
| 2975 return true; | 3218 return true; |
| 2976 } | 3219 } |
| 2977 if (object is! ElementLocationImpl) { | 3220 if (object is! ElementLocationImpl) { |
| 2978 return false; | 3221 return false; |
| 2979 } | 3222 } |
| 2980 ElementLocationImpl location = object as ElementLocationImpl; | 3223 ElementLocationImpl location = object as ElementLocationImpl; |
| 2981 List<String> otherComponents = location.components; | 3224 List<String> otherComponents = location.components; |
| 2982 int length = components.length; | 3225 int length = components.length; |
| 2983 if (otherComponents.length != length) { | 3226 if (otherComponents.length != length) { |
| 2984 return false; | 3227 return false; |
| 2985 } | 3228 } |
| 2986 for (int i = length - 1; i >= 2; i--) { | 3229 for (int i = length - 1; i >= 2; i--) { |
| 2987 if (components[i] != otherComponents[i]) { | 3230 if (components[i] != otherComponents[i]) { |
| 2988 return false; | 3231 return false; |
| 2989 } | 3232 } |
| 2990 } | 3233 } |
| 2991 if (length > 1 && !equalSourceComponents(components[1], otherComponents[1]))
{ | 3234 if (length > 1 && !equalSourceComponents(components[1], otherComponents[1]))
{ |
| 2992 return false; | 3235 return false; |
| 2993 } | 3236 } |
| 2994 if (length > 0 && !equalSourceComponents(components[0], otherComponents[0]))
{ | 3237 if (length > 0 && !equalSourceComponents(components[0], otherComponents[0]))
{ |
| 2995 return false; | 3238 return false; |
| 2996 } | 3239 } |
| 2997 return true; | 3240 return true; |
| 2998 } | 3241 } |
| 3242 |
| 2999 String get encoding { | 3243 String get encoding { |
| 3000 JavaStringBuilder builder = new JavaStringBuilder(); | 3244 JavaStringBuilder builder = new JavaStringBuilder(); |
| 3001 int length = components.length; | 3245 int length = components.length; |
| 3002 for (int i = 0; i < length; i++) { | 3246 for (int i = 0; i < length; i++) { |
| 3003 if (i > 0) { | 3247 if (i > 0) { |
| 3004 builder.appendChar(_SEPARATOR_CHAR); | 3248 builder.appendChar(_SEPARATOR_CHAR); |
| 3005 } | 3249 } |
| 3006 encode(builder, components[i]); | 3250 encode(builder, components[i]); |
| 3007 } | 3251 } |
| 3008 return builder.toString(); | 3252 return builder.toString(); |
| 3009 } | 3253 } |
| 3254 |
| 3010 int get hashCode { | 3255 int get hashCode { |
| 3011 int result = 1; | 3256 int result = 1; |
| 3012 for (int i = 0; i < components.length; i++) { | 3257 for (int i = 0; i < components.length; i++) { |
| 3013 String component = components[i]; | 3258 String component = components[i]; |
| 3014 int componentHash; | 3259 int componentHash; |
| 3015 if (i <= 1) { | 3260 if (i <= 1) { |
| 3016 componentHash = hashSourceComponent(component); | 3261 componentHash = hashSourceComponent(component); |
| 3017 } else { | 3262 } else { |
| 3018 componentHash = component.hashCode; | 3263 componentHash = component.hashCode; |
| 3019 } | 3264 } |
| 3020 result = 31 * result + componentHash; | 3265 result = 31 * result + componentHash; |
| 3021 } | 3266 } |
| 3022 return result; | 3267 return result; |
| 3023 } | 3268 } |
| 3269 |
| 3024 String toString() => encoding; | 3270 String toString() => encoding; |
| 3025 | 3271 |
| 3026 /** | 3272 /** |
| 3027 * Decode the encoded form of a location into an array of components. | 3273 * Decode the encoded form of a location into an array of components. |
| 3028 * | 3274 * |
| 3029 * @param encoding the encoded form of a location | 3275 * @param encoding the encoded form of a location |
| 3030 * @return the components that were encoded | 3276 * @return the components that were encoded |
| 3031 */ | 3277 */ |
| 3032 List<String> decode(String encoding) { | 3278 List<String> decode(String encoding) { |
| 3033 List<String> components = new List<String>(); | 3279 List<String> components = new List<String>(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3103 * @param sourceComponent the component to compute a hash code | 3349 * @param sourceComponent the component to compute a hash code |
| 3104 * @return the hash code of the given encoded source component | 3350 * @return the hash code of the given encoded source component |
| 3105 */ | 3351 */ |
| 3106 int hashSourceComponent(String sourceComponent) { | 3352 int hashSourceComponent(String sourceComponent) { |
| 3107 if (sourceComponent.length <= 1) { | 3353 if (sourceComponent.length <= 1) { |
| 3108 return sourceComponent.hashCode; | 3354 return sourceComponent.hashCode; |
| 3109 } | 3355 } |
| 3110 return sourceComponent.substring(1).hashCode; | 3356 return sourceComponent.substring(1).hashCode; |
| 3111 } | 3357 } |
| 3112 } | 3358 } |
| 3359 |
| 3113 /** | 3360 /** |
| 3114 * Instances of the class `EmbeddedHtmlScriptElementImpl` implement an | 3361 * Instances of the class `EmbeddedHtmlScriptElementImpl` implement an |
| 3115 * [EmbeddedHtmlScriptElement]. | 3362 * [EmbeddedHtmlScriptElement]. |
| 3116 * | 3363 * |
| 3117 * @coverage dart.engine.element | 3364 * @coverage dart.engine.element |
| 3118 */ | 3365 */ |
| 3119 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb
eddedHtmlScriptElement { | 3366 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb
eddedHtmlScriptElement { |
| 3120 | |
| 3121 /** | 3367 /** |
| 3122 * The library defined by the script tag's content. | 3368 * The library defined by the script tag's content. |
| 3123 */ | 3369 */ |
| 3124 LibraryElement _scriptLibrary; | 3370 LibraryElement _scriptLibrary; |
| 3125 | 3371 |
| 3126 /** | 3372 /** |
| 3127 * Initialize a newly created script element to have the specified tag name an
d offset. | 3373 * Initialize a newly created script element to have the specified tag name an
d offset. |
| 3128 * | 3374 * |
| 3129 * @param node the XML node from which this element is derived (not `null`) | 3375 * @param node the XML node from which this element is derived (not `null`) |
| 3130 */ | 3376 */ |
| 3131 EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node); | 3377 EmbeddedHtmlScriptElementImpl(XmlTagNode node) : super(node); |
| 3378 |
| 3132 accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this)
; | 3379 accept(ElementVisitor visitor) => visitor.visitEmbeddedHtmlScriptElement(this)
; |
| 3380 |
| 3133 ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT; | 3381 ElementKind get kind => ElementKind.EMBEDDED_HTML_SCRIPT; |
| 3382 |
| 3134 LibraryElement get scriptLibrary => _scriptLibrary; | 3383 LibraryElement get scriptLibrary => _scriptLibrary; |
| 3135 | 3384 |
| 3136 /** | 3385 /** |
| 3137 * Set the script library defined by the script tag's content. | 3386 * Set the script library defined by the script tag's content. |
| 3138 * | 3387 * |
| 3139 * @param scriptLibrary the library or `null` if none | 3388 * @param scriptLibrary the library or `null` if none |
| 3140 */ | 3389 */ |
| 3141 void set scriptLibrary(LibraryElementImpl scriptLibrary) { | 3390 void set scriptLibrary(LibraryElementImpl scriptLibrary) { |
| 3142 scriptLibrary.enclosingElement = this; | 3391 scriptLibrary.enclosingElement = this; |
| 3143 this._scriptLibrary = scriptLibrary; | 3392 this._scriptLibrary = scriptLibrary; |
| 3144 } | 3393 } |
| 3394 |
| 3145 void visitChildren(ElementVisitor visitor) { | 3395 void visitChildren(ElementVisitor visitor) { |
| 3146 safelyVisitChild(_scriptLibrary, visitor); | 3396 safelyVisitChild(_scriptLibrary, visitor); |
| 3147 } | 3397 } |
| 3148 } | 3398 } |
| 3399 |
| 3149 /** | 3400 /** |
| 3150 * The abstract class `ExecutableElementImpl` implements the behavior common to | 3401 * The abstract class `ExecutableElementImpl` implements the behavior common to |
| 3151 * `ExecutableElement`s. | 3402 * `ExecutableElement`s. |
| 3152 * | 3403 * |
| 3153 * @coverage dart.engine.element | 3404 * @coverage dart.engine.element |
| 3154 */ | 3405 */ |
| 3155 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl
ement { | 3406 abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl
ement { |
| 3156 | |
| 3157 /** | 3407 /** |
| 3158 * An array containing all of the functions defined within this executable ele
ment. | 3408 * An array containing all of the functions defined within this executable ele
ment. |
| 3159 */ | 3409 */ |
| 3160 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; | 3410 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; |
| 3161 | 3411 |
| 3162 /** | 3412 /** |
| 3163 * An array containing all of the labels defined within this executable elemen
t. | 3413 * An array containing all of the labels defined within this executable elemen
t. |
| 3164 */ | 3414 */ |
| 3165 List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY; | 3415 List<LabelElement> _labels = LabelElementImpl.EMPTY_ARRAY; |
| 3166 | 3416 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3197 ExecutableElementImpl.con1(Identifier name) : super.con1(name); | 3447 ExecutableElementImpl.con1(Identifier name) : super.con1(name); |
| 3198 | 3448 |
| 3199 /** | 3449 /** |
| 3200 * Initialize a newly created executable element to have the given name. | 3450 * Initialize a newly created executable element to have the given name. |
| 3201 * | 3451 * |
| 3202 * @param name the name of this element | 3452 * @param name the name of this element |
| 3203 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 3453 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 3204 * declaration of this element | 3454 * declaration of this element |
| 3205 */ | 3455 */ |
| 3206 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam
eOffset); | 3456 ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nam
eOffset); |
| 3457 |
| 3207 ElementImpl getChild(String identifier) { | 3458 ElementImpl getChild(String identifier) { |
| 3208 for (ExecutableElement function in _functions) { | 3459 for (ExecutableElement function in _functions) { |
| 3209 if (((function as ExecutableElementImpl)).identifier == identifier) { | 3460 if ((function as ExecutableElementImpl).identifier == identifier) { |
| 3210 return function as ExecutableElementImpl; | 3461 return function as ExecutableElementImpl; |
| 3211 } | 3462 } |
| 3212 } | 3463 } |
| 3213 for (LabelElement label in _labels) { | 3464 for (LabelElement label in _labels) { |
| 3214 if (((label as LabelElementImpl)).identifier == identifier) { | 3465 if ((label as LabelElementImpl).identifier == identifier) { |
| 3215 return label as LabelElementImpl; | 3466 return label as LabelElementImpl; |
| 3216 } | 3467 } |
| 3217 } | 3468 } |
| 3218 for (VariableElement variable in _localVariables) { | 3469 for (VariableElement variable in _localVariables) { |
| 3219 if (((variable as VariableElementImpl)).identifier == identifier) { | 3470 if ((variable as VariableElementImpl).identifier == identifier) { |
| 3220 return variable as VariableElementImpl; | 3471 return variable as VariableElementImpl; |
| 3221 } | 3472 } |
| 3222 } | 3473 } |
| 3223 for (ParameterElement parameter in _parameters) { | 3474 for (ParameterElement parameter in _parameters) { |
| 3224 if (((parameter as ParameterElementImpl)).identifier == identifier) { | 3475 if ((parameter as ParameterElementImpl).identifier == identifier) { |
| 3225 return parameter as ParameterElementImpl; | 3476 return parameter as ParameterElementImpl; |
| 3226 } | 3477 } |
| 3227 } | 3478 } |
| 3228 return null; | 3479 return null; |
| 3229 } | 3480 } |
| 3481 |
| 3230 List<FunctionElement> get functions => _functions; | 3482 List<FunctionElement> get functions => _functions; |
| 3483 |
| 3231 List<LabelElement> get labels => _labels; | 3484 List<LabelElement> get labels => _labels; |
| 3485 |
| 3232 List<LocalVariableElement> get localVariables => _localVariables; | 3486 List<LocalVariableElement> get localVariables => _localVariables; |
| 3487 |
| 3233 List<ParameterElement> get parameters => _parameters; | 3488 List<ParameterElement> get parameters => _parameters; |
| 3489 |
| 3234 Type2 get returnType => _returnType; | 3490 Type2 get returnType => _returnType; |
| 3491 |
| 3235 FunctionType get type => _type; | 3492 FunctionType get type => _type; |
| 3493 |
| 3236 bool get isOperator => false; | 3494 bool get isOperator => false; |
| 3237 | 3495 |
| 3238 /** | 3496 /** |
| 3239 * Set the functions defined within this executable element to the given funct
ions. | 3497 * Set the functions defined within this executable element to the given funct
ions. |
| 3240 * | 3498 * |
| 3241 * @param functions the functions defined within this executable element | 3499 * @param functions the functions defined within this executable element |
| 3242 */ | 3500 */ |
| 3243 void set functions(List<FunctionElement> functions) { | 3501 void set functions(List<FunctionElement> functions) { |
| 3244 for (FunctionElement function in functions) { | 3502 for (FunctionElement function in functions) { |
| 3245 ((function as FunctionElementImpl)).enclosingElement = this; | 3503 (function as FunctionElementImpl).enclosingElement = this; |
| 3246 } | 3504 } |
| 3247 this._functions = functions; | 3505 this._functions = functions; |
| 3248 } | 3506 } |
| 3249 | 3507 |
| 3250 /** | 3508 /** |
| 3251 * Set the labels defined within this executable element to the given labels. | 3509 * Set the labels defined within this executable element to the given labels. |
| 3252 * | 3510 * |
| 3253 * @param labels the labels defined within this executable element | 3511 * @param labels the labels defined within this executable element |
| 3254 */ | 3512 */ |
| 3255 void set labels(List<LabelElement> labels) { | 3513 void set labels(List<LabelElement> labels) { |
| 3256 for (LabelElement label in labels) { | 3514 for (LabelElement label in labels) { |
| 3257 ((label as LabelElementImpl)).enclosingElement = this; | 3515 (label as LabelElementImpl).enclosingElement = this; |
| 3258 } | 3516 } |
| 3259 this._labels = labels; | 3517 this._labels = labels; |
| 3260 } | 3518 } |
| 3261 | 3519 |
| 3262 /** | 3520 /** |
| 3263 * Set the local variables defined within this executable element to the given
variables. | 3521 * Set the local variables defined within this executable element to the given
variables. |
| 3264 * | 3522 * |
| 3265 * @param localVariables the local variables defined within this executable el
ement | 3523 * @param localVariables the local variables defined within this executable el
ement |
| 3266 */ | 3524 */ |
| 3267 void set localVariables(List<LocalVariableElement> localVariables) { | 3525 void set localVariables(List<LocalVariableElement> localVariables) { |
| 3268 for (LocalVariableElement variable in localVariables) { | 3526 for (LocalVariableElement variable in localVariables) { |
| 3269 ((variable as LocalVariableElementImpl)).enclosingElement = this; | 3527 (variable as LocalVariableElementImpl).enclosingElement = this; |
| 3270 } | 3528 } |
| 3271 this._localVariables = localVariables; | 3529 this._localVariables = localVariables; |
| 3272 } | 3530 } |
| 3273 | 3531 |
| 3274 /** | 3532 /** |
| 3275 * Set the parameters defined by this executable element to the given paramete
rs. | 3533 * Set the parameters defined by this executable element to the given paramete
rs. |
| 3276 * | 3534 * |
| 3277 * @param parameters the parameters defined by this executable element | 3535 * @param parameters the parameters defined by this executable element |
| 3278 */ | 3536 */ |
| 3279 void set parameters(List<ParameterElement> parameters) { | 3537 void set parameters(List<ParameterElement> parameters) { |
| 3280 for (ParameterElement parameter in parameters) { | 3538 for (ParameterElement parameter in parameters) { |
| 3281 ((parameter as ParameterElementImpl)).enclosingElement = this; | 3539 (parameter as ParameterElementImpl).enclosingElement = this; |
| 3282 } | 3540 } |
| 3283 this._parameters = parameters; | 3541 this._parameters = parameters; |
| 3284 } | 3542 } |
| 3285 | 3543 |
| 3286 /** | 3544 /** |
| 3287 * Set the return type defined by this executable element. | 3545 * Set the return type defined by this executable element. |
| 3288 * | 3546 * |
| 3289 * @param returnType the return type defined by this executable element | 3547 * @param returnType the return type defined by this executable element |
| 3290 */ | 3548 */ |
| 3291 void set returnType(Type2 returnType) { | 3549 void set returnType(Type2 returnType) { |
| 3292 this._returnType = returnType; | 3550 this._returnType = returnType; |
| 3293 } | 3551 } |
| 3294 | 3552 |
| 3295 /** | 3553 /** |
| 3296 * Set the type of function defined by this executable element to the given ty
pe. | 3554 * Set the type of function defined by this executable element to the given ty
pe. |
| 3297 * | 3555 * |
| 3298 * @param type the type of function defined by this executable element | 3556 * @param type the type of function defined by this executable element |
| 3299 */ | 3557 */ |
| 3300 void set type(FunctionType type) { | 3558 void set type(FunctionType type) { |
| 3301 this._type = type; | 3559 this._type = type; |
| 3302 } | 3560 } |
| 3561 |
| 3303 void visitChildren(ElementVisitor visitor) { | 3562 void visitChildren(ElementVisitor visitor) { |
| 3304 super.visitChildren(visitor); | 3563 super.visitChildren(visitor); |
| 3305 safelyVisitChildren(_functions, visitor); | 3564 safelyVisitChildren(_functions, visitor); |
| 3306 safelyVisitChildren(_labels, visitor); | 3565 safelyVisitChildren(_labels, visitor); |
| 3307 safelyVisitChildren(_localVariables, visitor); | 3566 safelyVisitChildren(_localVariables, visitor); |
| 3308 safelyVisitChildren(_parameters, visitor); | 3567 safelyVisitChildren(_parameters, visitor); |
| 3309 } | 3568 } |
| 3569 |
| 3310 void appendTo(JavaStringBuilder builder) { | 3570 void appendTo(JavaStringBuilder builder) { |
| 3311 builder.append("("); | 3571 builder.append("("); |
| 3312 int parameterCount = _parameters.length; | 3572 int parameterCount = _parameters.length; |
| 3313 for (int i = 0; i < parameterCount; i++) { | 3573 for (int i = 0; i < parameterCount; i++) { |
| 3314 if (i > 0) { | 3574 if (i > 0) { |
| 3315 builder.append(", "); | 3575 builder.append(", "); |
| 3316 } | 3576 } |
| 3317 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); | 3577 (_parameters[i] as ParameterElementImpl).appendTo(builder); |
| 3318 } | 3578 } |
| 3319 builder.append(")"); | 3579 builder.append(")"); |
| 3320 if (_type != null) { | 3580 if (_type != null) { |
| 3321 builder.append(" -> "); | 3581 builder.append(" -> "); |
| 3322 builder.append(_type.returnType); | 3582 builder.append(_type.returnType); |
| 3323 } | 3583 } |
| 3324 } | 3584 } |
| 3325 } | 3585 } |
| 3586 |
| 3326 /** | 3587 /** |
| 3327 * Instances of the class `ExportElementImpl` implement an [ExportElement]. | 3588 * Instances of the class `ExportElementImpl` implement an [ExportElement]. |
| 3328 * | 3589 * |
| 3329 * @coverage dart.engine.element | 3590 * @coverage dart.engine.element |
| 3330 */ | 3591 */ |
| 3331 class ExportElementImpl extends ElementImpl implements ExportElement { | 3592 class ExportElementImpl extends ElementImpl implements ExportElement { |
| 3332 | |
| 3333 /** | 3593 /** |
| 3334 * The URI that is specified by this directive. | 3594 * The URI that is specified by this directive. |
| 3335 */ | 3595 */ |
| 3336 String _uri; | 3596 String _uri; |
| 3337 | 3597 |
| 3338 /** | 3598 /** |
| 3339 * The library that is exported from this library by this export directive. | 3599 * The library that is exported from this library by this export directive. |
| 3340 */ | 3600 */ |
| 3341 LibraryElement _exportedLibrary; | 3601 LibraryElement _exportedLibrary; |
| 3342 | 3602 |
| 3343 /** | 3603 /** |
| 3344 * The combinators that were specified as part of the export directive in the
order in which they | 3604 * The combinators that were specified as part of the export directive in the
order in which they |
| 3345 * were specified. | 3605 * were specified. |
| 3346 */ | 3606 */ |
| 3347 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; | 3607 List<NamespaceCombinator> _combinators = NamespaceCombinator.EMPTY_ARRAY; |
| 3348 | 3608 |
| 3349 /** | 3609 /** |
| 3350 * Initialize a newly created export element. | 3610 * Initialize a newly created export element. |
| 3351 */ | 3611 */ |
| 3352 ExportElementImpl() : super.con1(null); | 3612 ExportElementImpl() : super.con1(null); |
| 3613 |
| 3353 accept(ElementVisitor visitor) => visitor.visitExportElement(this); | 3614 accept(ElementVisitor visitor) => visitor.visitExportElement(this); |
| 3615 |
| 3354 List<NamespaceCombinator> get combinators => _combinators; | 3616 List<NamespaceCombinator> get combinators => _combinators; |
| 3617 |
| 3355 LibraryElement get exportedLibrary => _exportedLibrary; | 3618 LibraryElement get exportedLibrary => _exportedLibrary; |
| 3619 |
| 3356 ElementKind get kind => ElementKind.EXPORT; | 3620 ElementKind get kind => ElementKind.EXPORT; |
| 3621 |
| 3357 String get uri => _uri; | 3622 String get uri => _uri; |
| 3358 | 3623 |
| 3359 /** | 3624 /** |
| 3360 * Set the combinators that were specified as part of the export directive to
the given array of | 3625 * Set the combinators that were specified as part of the export directive to
the given array of |
| 3361 * combinators. | 3626 * combinators. |
| 3362 * | 3627 * |
| 3363 * @param combinators the combinators that were specified as part of the expor
t directive | 3628 * @param combinators the combinators that were specified as part of the expor
t directive |
| 3364 */ | 3629 */ |
| 3365 void set combinators(List<NamespaceCombinator> combinators) { | 3630 void set combinators(List<NamespaceCombinator> combinators) { |
| 3366 this._combinators = combinators; | 3631 this._combinators = combinators; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3377 } | 3642 } |
| 3378 | 3643 |
| 3379 /** | 3644 /** |
| 3380 * Set the URI that is specified by this directive. | 3645 * Set the URI that is specified by this directive. |
| 3381 * | 3646 * |
| 3382 * @param uri the URI that is specified by this directive. | 3647 * @param uri the URI that is specified by this directive. |
| 3383 */ | 3648 */ |
| 3384 void set uri(String uri) { | 3649 void set uri(String uri) { |
| 3385 this._uri = uri; | 3650 this._uri = uri; |
| 3386 } | 3651 } |
| 3652 |
| 3387 void appendTo(JavaStringBuilder builder) { | 3653 void appendTo(JavaStringBuilder builder) { |
| 3388 builder.append("export "); | 3654 builder.append("export "); |
| 3389 ((_exportedLibrary as LibraryElementImpl)).appendTo(builder); | 3655 (_exportedLibrary as LibraryElementImpl).appendTo(builder); |
| 3390 } | 3656 } |
| 3657 |
| 3391 String get identifier => _exportedLibrary.name; | 3658 String get identifier => _exportedLibrary.name; |
| 3392 } | 3659 } |
| 3660 |
| 3393 /** | 3661 /** |
| 3394 * Instances of the class `ExternalHtmlScriptElementImpl` implement an | 3662 * Instances of the class `ExternalHtmlScriptElementImpl` implement an |
| 3395 * [ExternalHtmlScriptElement]. | 3663 * [ExternalHtmlScriptElement]. |
| 3396 * | 3664 * |
| 3397 * @coverage dart.engine.element | 3665 * @coverage dart.engine.element |
| 3398 */ | 3666 */ |
| 3399 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext
ernalHtmlScriptElement { | 3667 class ExternalHtmlScriptElementImpl extends HtmlScriptElementImpl implements Ext
ernalHtmlScriptElement { |
| 3400 | |
| 3401 /** | 3668 /** |
| 3402 * The source specified in the `source` attribute or `null` if unspecified. | 3669 * The source specified in the `source` attribute or `null` if unspecified. |
| 3403 */ | 3670 */ |
| 3404 Source _scriptSource; | 3671 Source _scriptSource; |
| 3405 | 3672 |
| 3406 /** | 3673 /** |
| 3407 * Initialize a newly created script element to have the specified tag name an
d offset. | 3674 * Initialize a newly created script element to have the specified tag name an
d offset. |
| 3408 * | 3675 * |
| 3409 * @param node the XML node from which this element is derived (not `null`) | 3676 * @param node the XML node from which this element is derived (not `null`) |
| 3410 */ | 3677 */ |
| 3411 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node); | 3678 ExternalHtmlScriptElementImpl(XmlTagNode node) : super(node); |
| 3679 |
| 3412 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this)
; | 3680 accept(ElementVisitor visitor) => visitor.visitExternalHtmlScriptElement(this)
; |
| 3681 |
| 3413 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; | 3682 ElementKind get kind => ElementKind.EXTERNAL_HTML_SCRIPT; |
| 3683 |
| 3414 Source get scriptSource => _scriptSource; | 3684 Source get scriptSource => _scriptSource; |
| 3415 | 3685 |
| 3416 /** | 3686 /** |
| 3417 * Set the source specified in the `source` attribute. | 3687 * Set the source specified in the `source` attribute. |
| 3418 * | 3688 * |
| 3419 * @param scriptSource the script source or `null` if unspecified | 3689 * @param scriptSource the script source or `null` if unspecified |
| 3420 */ | 3690 */ |
| 3421 void set scriptSource(Source scriptSource) { | 3691 void set scriptSource(Source scriptSource) { |
| 3422 this._scriptSource = scriptSource; | 3692 this._scriptSource = scriptSource; |
| 3423 } | 3693 } |
| 3424 } | 3694 } |
| 3695 |
| 3425 /** | 3696 /** |
| 3426 * Instances of the class `FieldElementImpl` implement a `FieldElement`. | 3697 * Instances of the class `FieldElementImpl` implement a `FieldElement`. |
| 3427 * | 3698 * |
| 3428 * @coverage dart.engine.element | 3699 * @coverage dart.engine.element |
| 3429 */ | 3700 */ |
| 3430 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme
nt { | 3701 class FieldElementImpl extends PropertyInducingElementImpl implements FieldEleme
nt { |
| 3431 | |
| 3432 /** | 3702 /** |
| 3433 * An empty array of field elements. | 3703 * An empty array of field elements. |
| 3434 */ | 3704 */ |
| 3435 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); | 3705 static List<FieldElement> EMPTY_ARRAY = new List<FieldElement>(0); |
| 3436 | 3706 |
| 3437 /** | 3707 /** |
| 3438 * Initialize a newly created field element to have the given name. | 3708 * Initialize a newly created field element to have the given name. |
| 3439 * | 3709 * |
| 3440 * @param name the name of this element | 3710 * @param name the name of this element |
| 3441 */ | 3711 */ |
| 3442 FieldElementImpl.con1(Identifier name) : super.con1(name); | 3712 FieldElementImpl.con1(Identifier name) : super.con1(name); |
| 3443 | 3713 |
| 3444 /** | 3714 /** |
| 3445 * Initialize a newly created synthetic field element to have the given name. | 3715 * Initialize a newly created synthetic field element to have the given name. |
| 3446 * | 3716 * |
| 3447 * @param name the name of this element | 3717 * @param name the name of this element |
| 3448 */ | 3718 */ |
| 3449 FieldElementImpl.con2(String name) : super.con2(name); | 3719 FieldElementImpl.con2(String name) : super.con2(name); |
| 3720 |
| 3450 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 3721 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
| 3722 |
| 3451 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 3723 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| 3724 |
| 3452 ElementKind get kind => ElementKind.FIELD; | 3725 ElementKind get kind => ElementKind.FIELD; |
| 3726 |
| 3453 bool get isStatic => hasModifier(Modifier.STATIC); | 3727 bool get isStatic => hasModifier(Modifier.STATIC); |
| 3454 | 3728 |
| 3455 /** | 3729 /** |
| 3456 * Set whether this field is static to correspond to the given value. | 3730 * Set whether this field is static to correspond to the given value. |
| 3457 * | 3731 * |
| 3458 * @param isStatic `true` if the field is static | 3732 * @param isStatic `true` if the field is static |
| 3459 */ | 3733 */ |
| 3460 void set static(bool isStatic) { | 3734 void set static(bool isStatic) { |
| 3461 setModifier(Modifier.STATIC, isStatic); | 3735 setModifier(Modifier.STATIC, isStatic); |
| 3462 } | 3736 } |
| 3463 } | 3737 } |
| 3738 |
| 3464 /** | 3739 /** |
| 3465 * Instances of the class `FieldFormalParameterElementImpl` extend | 3740 * Instances of the class `FieldFormalParameterElementImpl` extend |
| 3466 * [ParameterElementImpl] to provide the additional information of the [FieldEle
ment] | 3741 * [ParameterElementImpl] to provide the additional information of the [FieldEle
ment] |
| 3467 * associated with the parameter. | 3742 * associated with the parameter. |
| 3468 * | 3743 * |
| 3469 * @coverage dart.engine.element | 3744 * @coverage dart.engine.element |
| 3470 */ | 3745 */ |
| 3471 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi
eldFormalParameterElement { | 3746 class FieldFormalParameterElementImpl extends ParameterElementImpl implements Fi
eldFormalParameterElement { |
| 3472 | |
| 3473 /** | 3747 /** |
| 3474 * The field associated with this field formal parameter. | 3748 * The field associated with this field formal parameter. |
| 3475 */ | 3749 */ |
| 3476 FieldElement _field; | 3750 FieldElement _field; |
| 3477 | 3751 |
| 3478 /** | 3752 /** |
| 3479 * Initialize a newly created parameter element to have the given name. | 3753 * Initialize a newly created parameter element to have the given name. |
| 3480 * | 3754 * |
| 3481 * @param name the name of this element | 3755 * @param name the name of this element |
| 3482 */ | 3756 */ |
| 3483 FieldFormalParameterElementImpl(Identifier name) : super.con1(name); | 3757 FieldFormalParameterElementImpl(Identifier name) : super.con1(name); |
| 3758 |
| 3484 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi
s); | 3759 accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(thi
s); |
| 3760 |
| 3485 FieldElement get field => _field; | 3761 FieldElement get field => _field; |
| 3762 |
| 3486 bool get isInitializingFormal => true; | 3763 bool get isInitializingFormal => true; |
| 3487 | 3764 |
| 3488 /** | 3765 /** |
| 3489 * Set the field element associated with this field formal parameter to the gi
ven element. | 3766 * Set the field element associated with this field formal parameter to the gi
ven element. |
| 3490 * | 3767 * |
| 3491 * @param field the new field element | 3768 * @param field the new field element |
| 3492 */ | 3769 */ |
| 3493 void set field(FieldElement field) { | 3770 void set field(FieldElement field) { |
| 3494 this._field = field; | 3771 this._field = field; |
| 3495 } | 3772 } |
| 3496 } | 3773 } |
| 3774 |
| 3497 /** | 3775 /** |
| 3498 * Instances of the class `FunctionElementImpl` implement a `FunctionElement`. | 3776 * Instances of the class `FunctionElementImpl` implement a `FunctionElement`. |
| 3499 * | 3777 * |
| 3500 * @coverage dart.engine.element | 3778 * @coverage dart.engine.element |
| 3501 */ | 3779 */ |
| 3502 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
nt { | 3780 class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
nt { |
| 3503 | |
| 3504 /** | 3781 /** |
| 3505 * The offset to the beginning of the visible range for this element. | 3782 * The offset to the beginning of the visible range for this element. |
| 3506 */ | 3783 */ |
| 3507 int _visibleRangeOffset = 0; | 3784 int _visibleRangeOffset = 0; |
| 3508 | 3785 |
| 3509 /** | 3786 /** |
| 3510 * The length of the visible range for this element, or `-1` if this element d
oes not have a | 3787 * The length of the visible range for this element, or `-1` if this element d
oes not have a |
| 3511 * visible range. | 3788 * visible range. |
| 3512 */ | 3789 */ |
| 3513 int _visibleRangeLength = -1; | 3790 int _visibleRangeLength = -1; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3532 FunctionElementImpl.con1(Identifier name) : super.con1(name); | 3809 FunctionElementImpl.con1(Identifier name) : super.con1(name); |
| 3533 | 3810 |
| 3534 /** | 3811 /** |
| 3535 * Initialize a newly created function element to have no name and the given o
ffset. This is used | 3812 * Initialize a newly created function element to have no name and the given o
ffset. This is used |
| 3536 * for function expressions, which have no name. | 3813 * for function expressions, which have no name. |
| 3537 * | 3814 * |
| 3538 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 3815 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 3539 * declaration of this element | 3816 * declaration of this element |
| 3540 */ | 3817 */ |
| 3541 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); | 3818 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); |
| 3819 |
| 3542 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); | 3820 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
| 3821 |
| 3543 ElementKind get kind => ElementKind.FUNCTION; | 3822 ElementKind get kind => ElementKind.FUNCTION; |
| 3823 |
| 3544 SourceRange get visibleRange { | 3824 SourceRange get visibleRange { |
| 3545 if (_visibleRangeLength < 0) { | 3825 if (_visibleRangeLength < 0) { |
| 3546 return null; | 3826 return null; |
| 3547 } | 3827 } |
| 3548 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 3828 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 3549 } | 3829 } |
| 3830 |
| 3550 bool get isStatic => enclosingElement is CompilationUnitElement; | 3831 bool get isStatic => enclosingElement is CompilationUnitElement; |
| 3551 | 3832 |
| 3552 /** | 3833 /** |
| 3553 * Set the visible range for this element to the range starting at the given o
ffset with the given | 3834 * Set the visible range for this element to the range starting at the given o
ffset with the given |
| 3554 * length. | 3835 * length. |
| 3555 * | 3836 * |
| 3556 * @param offset the offset to the beginning of the visible range for this ele
ment | 3837 * @param offset the offset to the beginning of the visible range for this ele
ment |
| 3557 * @param length the length of the visible range for this element, or `-1` if
this element | 3838 * @param length the length of the visible range for this element, or `-1` if
this element |
| 3558 * does not have a visible range | 3839 * does not have a visible range |
| 3559 */ | 3840 */ |
| 3560 void setVisibleRange(int offset, int length) { | 3841 void setVisibleRange(int offset, int length) { |
| 3561 _visibleRangeOffset = offset; | 3842 _visibleRangeOffset = offset; |
| 3562 _visibleRangeLength = length; | 3843 _visibleRangeLength = length; |
| 3563 } | 3844 } |
| 3845 |
| 3564 void appendTo(JavaStringBuilder builder) { | 3846 void appendTo(JavaStringBuilder builder) { |
| 3565 String name = displayName; | 3847 String name = displayName; |
| 3566 if (name != null) { | 3848 if (name != null) { |
| 3567 builder.append(name); | 3849 builder.append(name); |
| 3568 } | 3850 } |
| 3569 super.appendTo(builder); | 3851 super.appendTo(builder); |
| 3570 } | 3852 } |
| 3853 |
| 3571 String get identifier => "${name}@${nameOffset}"; | 3854 String get identifier => "${name}@${nameOffset}"; |
| 3572 } | 3855 } |
| 3856 |
| 3573 /** | 3857 /** |
| 3574 * Instances of the class `FunctionTypeAliasElementImpl` implement a | 3858 * Instances of the class `FunctionTypeAliasElementImpl` implement a |
| 3575 * `FunctionTypeAliasElement`. | 3859 * `FunctionTypeAliasElement`. |
| 3576 * | 3860 * |
| 3577 * @coverage dart.engine.element | 3861 * @coverage dart.engine.element |
| 3578 */ | 3862 */ |
| 3579 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { | 3863 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { |
| 3580 | |
| 3581 /** | 3864 /** |
| 3582 * An array containing all of the parameters defined by this type alias. | 3865 * An array containing all of the parameters defined by this type alias. |
| 3583 */ | 3866 */ |
| 3584 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 3867 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 3585 | 3868 |
| 3586 /** | 3869 /** |
| 3587 * The return type defined by this type alias. | 3870 * The return type defined by this type alias. |
| 3588 */ | 3871 */ |
| 3589 Type2 _returnType; | 3872 Type2 _returnType; |
| 3590 | 3873 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3602 * An empty array of type alias elements. | 3885 * An empty array of type alias elements. |
| 3603 */ | 3886 */ |
| 3604 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); | 3887 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); |
| 3605 | 3888 |
| 3606 /** | 3889 /** |
| 3607 * Initialize a newly created type alias element to have the given name. | 3890 * Initialize a newly created type alias element to have the given name. |
| 3608 * | 3891 * |
| 3609 * @param name the name of this element | 3892 * @param name the name of this element |
| 3610 */ | 3893 */ |
| 3611 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name); | 3894 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name); |
| 3895 |
| 3612 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); | 3896 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); |
| 3897 |
| 3613 ElementImpl getChild(String identifier) { | 3898 ElementImpl getChild(String identifier) { |
| 3614 for (VariableElement parameter in _parameters) { | 3899 for (VariableElement parameter in _parameters) { |
| 3615 if (((parameter as VariableElementImpl)).identifier == identifier) { | 3900 if ((parameter as VariableElementImpl).identifier == identifier) { |
| 3616 return parameter as VariableElementImpl; | 3901 return parameter as VariableElementImpl; |
| 3617 } | 3902 } |
| 3618 } | 3903 } |
| 3619 for (TypeParameterElement typeParameter in _typeParameters) { | 3904 for (TypeParameterElement typeParameter in _typeParameters) { |
| 3620 if (((typeParameter as TypeParameterElementImpl)).identifier == identifier
) { | 3905 if ((typeParameter as TypeParameterElementImpl).identifier == identifier)
{ |
| 3621 return typeParameter as TypeParameterElementImpl; | 3906 return typeParameter as TypeParameterElementImpl; |
| 3622 } | 3907 } |
| 3623 } | 3908 } |
| 3624 return null; | 3909 return null; |
| 3625 } | 3910 } |
| 3911 |
| 3626 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; | 3912 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; |
| 3913 |
| 3627 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; | 3914 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
| 3915 |
| 3628 List<ParameterElement> get parameters => _parameters; | 3916 List<ParameterElement> get parameters => _parameters; |
| 3917 |
| 3629 Type2 get returnType => _returnType; | 3918 Type2 get returnType => _returnType; |
| 3919 |
| 3630 FunctionType get type => _type; | 3920 FunctionType get type => _type; |
| 3921 |
| 3631 List<TypeParameterElement> get typeParameters => _typeParameters; | 3922 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 3632 | 3923 |
| 3633 /** | 3924 /** |
| 3634 * Set the parameters defined by this type alias to the given parameters. | 3925 * Set the parameters defined by this type alias to the given parameters. |
| 3635 * | 3926 * |
| 3636 * @param parameters the parameters defined by this type alias | 3927 * @param parameters the parameters defined by this type alias |
| 3637 */ | 3928 */ |
| 3638 void set parameters(List<ParameterElement> parameters) { | 3929 void set parameters(List<ParameterElement> parameters) { |
| 3639 if (parameters != null) { | 3930 if (parameters != null) { |
| 3640 for (ParameterElement parameter in parameters) { | 3931 for (ParameterElement parameter in parameters) { |
| 3641 ((parameter as ParameterElementImpl)).enclosingElement = this; | 3932 (parameter as ParameterElementImpl).enclosingElement = this; |
| 3642 } | 3933 } |
| 3643 } | 3934 } |
| 3644 this._parameters = parameters; | 3935 this._parameters = parameters; |
| 3645 } | 3936 } |
| 3646 | 3937 |
| 3647 /** | 3938 /** |
| 3648 * Set the return type defined by this type alias. | 3939 * Set the return type defined by this type alias. |
| 3649 * | 3940 * |
| 3650 * @param returnType the return type defined by this type alias | 3941 * @param returnType the return type defined by this type alias |
| 3651 */ | 3942 */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3662 this._type = type; | 3953 this._type = type; |
| 3663 } | 3954 } |
| 3664 | 3955 |
| 3665 /** | 3956 /** |
| 3666 * Set the type parameters defined for this type to the given parameters. | 3957 * Set the type parameters defined for this type to the given parameters. |
| 3667 * | 3958 * |
| 3668 * @param typeParameters the type parameters defined for this type | 3959 * @param typeParameters the type parameters defined for this type |
| 3669 */ | 3960 */ |
| 3670 void set typeParameters(List<TypeParameterElement> typeParameters) { | 3961 void set typeParameters(List<TypeParameterElement> typeParameters) { |
| 3671 for (TypeParameterElement typeParameter in typeParameters) { | 3962 for (TypeParameterElement typeParameter in typeParameters) { |
| 3672 ((typeParameter as TypeParameterElementImpl)).enclosingElement = this; | 3963 (typeParameter as TypeParameterElementImpl).enclosingElement = this; |
| 3673 } | 3964 } |
| 3674 this._typeParameters = typeParameters; | 3965 this._typeParameters = typeParameters; |
| 3675 } | 3966 } |
| 3676 | 3967 |
| 3677 /** | 3968 /** |
| 3678 * Set the parameters defined by this type alias to the given parameters witho
ut becoming the | 3969 * Set the parameters defined by this type alias to the given parameters witho
ut becoming the |
| 3679 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when | 3970 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when |
| 3680 * creating a synthetic type alias. | 3971 * creating a synthetic type alias. |
| 3681 * | 3972 * |
| 3682 * @param parameters the parameters defined by this type alias | 3973 * @param parameters the parameters defined by this type alias |
| 3683 */ | 3974 */ |
| 3684 void shareParameters(List<ParameterElement> parameters) { | 3975 void shareParameters(List<ParameterElement> parameters) { |
| 3685 this._parameters = parameters; | 3976 this._parameters = parameters; |
| 3686 } | 3977 } |
| 3687 | 3978 |
| 3688 /** | 3979 /** |
| 3689 * Set the type parameters defined for this type to the given parameters witho
ut becoming the | 3980 * Set the type parameters defined for this type to the given parameters witho
ut becoming the |
| 3690 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when | 3981 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when |
| 3691 * creating a synthetic type alias. | 3982 * creating a synthetic type alias. |
| 3692 * | 3983 * |
| 3693 * @param typeParameters the type parameters defined for this type | 3984 * @param typeParameters the type parameters defined for this type |
| 3694 */ | 3985 */ |
| 3695 void shareTypeParameters(List<TypeParameterElement> typeParameters) { | 3986 void shareTypeParameters(List<TypeParameterElement> typeParameters) { |
| 3696 this._typeParameters = typeParameters; | 3987 this._typeParameters = typeParameters; |
| 3697 } | 3988 } |
| 3989 |
| 3698 void visitChildren(ElementVisitor visitor) { | 3990 void visitChildren(ElementVisitor visitor) { |
| 3699 super.visitChildren(visitor); | 3991 super.visitChildren(visitor); |
| 3700 safelyVisitChildren(_parameters, visitor); | 3992 safelyVisitChildren(_parameters, visitor); |
| 3701 safelyVisitChildren(_typeParameters, visitor); | 3993 safelyVisitChildren(_typeParameters, visitor); |
| 3702 } | 3994 } |
| 3995 |
| 3703 void appendTo(JavaStringBuilder builder) { | 3996 void appendTo(JavaStringBuilder builder) { |
| 3704 builder.append("typedef "); | 3997 builder.append("typedef "); |
| 3705 builder.append(displayName); | 3998 builder.append(displayName); |
| 3706 int typeParameterCount = _typeParameters.length; | 3999 int typeParameterCount = _typeParameters.length; |
| 3707 if (typeParameterCount > 0) { | 4000 if (typeParameterCount > 0) { |
| 3708 builder.append("<"); | 4001 builder.append("<"); |
| 3709 for (int i = 0; i < typeParameterCount; i++) { | 4002 for (int i = 0; i < typeParameterCount; i++) { |
| 3710 if (i > 0) { | 4003 if (i > 0) { |
| 3711 builder.append(", "); | 4004 builder.append(", "); |
| 3712 } | 4005 } |
| 3713 ((_typeParameters[i] as TypeParameterElementImpl)).appendTo(builder); | 4006 (_typeParameters[i] as TypeParameterElementImpl).appendTo(builder); |
| 3714 } | 4007 } |
| 3715 builder.append(">"); | 4008 builder.append(">"); |
| 3716 } | 4009 } |
| 3717 builder.append("("); | 4010 builder.append("("); |
| 3718 int parameterCount = _parameters.length; | 4011 int parameterCount = _parameters.length; |
| 3719 for (int i = 0; i < parameterCount; i++) { | 4012 for (int i = 0; i < parameterCount; i++) { |
| 3720 if (i > 0) { | 4013 if (i > 0) { |
| 3721 builder.append(", "); | 4014 builder.append(", "); |
| 3722 } | 4015 } |
| 3723 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); | 4016 (_parameters[i] as ParameterElementImpl).appendTo(builder); |
| 3724 } | 4017 } |
| 3725 builder.append(")"); | 4018 builder.append(")"); |
| 3726 if (_type != null) { | 4019 if (_type != null) { |
| 3727 builder.append(" -> "); | 4020 builder.append(" -> "); |
| 3728 builder.append(_type.returnType); | 4021 builder.append(_type.returnType); |
| 3729 } | 4022 } |
| 3730 } | 4023 } |
| 3731 } | 4024 } |
| 4025 |
| 3732 /** | 4026 /** |
| 3733 * Instances of the class `HideElementCombinatorImpl` implement a | 4027 * Instances of the class `HideElementCombinatorImpl` implement a |
| 3734 * [HideElementCombinator]. | 4028 * [HideElementCombinator]. |
| 3735 * | 4029 * |
| 3736 * @coverage dart.engine.element | 4030 * @coverage dart.engine.element |
| 3737 */ | 4031 */ |
| 3738 class HideElementCombinatorImpl implements HideElementCombinator { | 4032 class HideElementCombinatorImpl implements HideElementCombinator { |
| 3739 | |
| 3740 /** | 4033 /** |
| 3741 * The names that are not to be made visible in the importing library even if
they are defined in | 4034 * The names that are not to be made visible in the importing library even if
they are defined in |
| 3742 * the imported library. | 4035 * the imported library. |
| 3743 */ | 4036 */ |
| 3744 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; | 4037 List<String> _hiddenNames = StringUtilities.EMPTY_ARRAY; |
| 4038 |
| 3745 List<String> get hiddenNames => _hiddenNames; | 4039 List<String> get hiddenNames => _hiddenNames; |
| 3746 | 4040 |
| 3747 /** | 4041 /** |
| 3748 * Set the names that are not to be made visible in the importing library even
if they are defined | 4042 * Set the names that are not to be made visible in the importing library even
if they are defined |
| 3749 * in the imported library to the given names. | 4043 * in the imported library to the given names. |
| 3750 * | 4044 * |
| 3751 * @param hiddenNames the names that are not to be made visible in the importi
ng library | 4045 * @param hiddenNames the names that are not to be made visible in the importi
ng library |
| 3752 */ | 4046 */ |
| 3753 void set hiddenNames(List<String> hiddenNames) { | 4047 void set hiddenNames(List<String> hiddenNames) { |
| 3754 this._hiddenNames = hiddenNames; | 4048 this._hiddenNames = hiddenNames; |
| 3755 } | 4049 } |
| 4050 |
| 3756 String toString() { | 4051 String toString() { |
| 3757 JavaStringBuilder builder = new JavaStringBuilder(); | 4052 JavaStringBuilder builder = new JavaStringBuilder(); |
| 3758 builder.append("show "); | 4053 builder.append("show "); |
| 3759 int count = _hiddenNames.length; | 4054 int count = _hiddenNames.length; |
| 3760 for (int i = 0; i < count; i++) { | 4055 for (int i = 0; i < count; i++) { |
| 3761 if (i > 0) { | 4056 if (i > 0) { |
| 3762 builder.append(", "); | 4057 builder.append(", "); |
| 3763 } | 4058 } |
| 3764 builder.append(_hiddenNames[i]); | 4059 builder.append(_hiddenNames[i]); |
| 3765 } | 4060 } |
| 3766 return builder.toString(); | 4061 return builder.toString(); |
| 3767 } | 4062 } |
| 3768 } | 4063 } |
| 4064 |
| 3769 /** | 4065 /** |
| 3770 * Instances of the class `HtmlElementImpl` implement an [HtmlElement]. | 4066 * Instances of the class `HtmlElementImpl` implement an [HtmlElement]. |
| 3771 * | 4067 * |
| 3772 * @coverage dart.engine.element | 4068 * @coverage dart.engine.element |
| 3773 */ | 4069 */ |
| 3774 class HtmlElementImpl extends ElementImpl implements HtmlElement { | 4070 class HtmlElementImpl extends ElementImpl implements HtmlElement { |
| 3775 | |
| 3776 /** | 4071 /** |
| 3777 * An empty array of HTML file elements. | 4072 * An empty array of HTML file elements. |
| 3778 */ | 4073 */ |
| 3779 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); | 4074 static List<HtmlElement> EMPTY_ARRAY = new List<HtmlElement>(0); |
| 3780 | 4075 |
| 3781 /** | 4076 /** |
| 3782 * The analysis context in which this library is defined. | 4077 * The analysis context in which this library is defined. |
| 3783 */ | 4078 */ |
| 3784 AnalysisContext _context; | 4079 AnalysisContext _context; |
| 3785 | 4080 |
| 3786 /** | 4081 /** |
| 3787 * The scripts contained in or referenced from script tags in the HTML file. | 4082 * The scripts contained in or referenced from script tags in the HTML file. |
| 3788 */ | 4083 */ |
| 3789 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; | 4084 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; |
| 3790 | 4085 |
| 3791 /** | 4086 /** |
| 3792 * The source that corresponds to this HTML file. | 4087 * The source that corresponds to this HTML file. |
| 3793 */ | 4088 */ |
| 3794 Source _source; | 4089 Source _source; |
| 3795 | 4090 |
| 3796 /** | 4091 /** |
| 3797 * Initialize a newly created HTML element to have the given name. | 4092 * Initialize a newly created HTML element to have the given name. |
| 3798 * | 4093 * |
| 3799 * @param context the analysis context in which the HTML file is defined | 4094 * @param context the analysis context in which the HTML file is defined |
| 3800 * @param name the name of this element | 4095 * @param name the name of this element |
| 3801 */ | 4096 */ |
| 3802 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { | 4097 HtmlElementImpl(AnalysisContext context, String name) : super.con2(name, -1) { |
| 3803 this._context = context; | 4098 this._context = context; |
| 3804 } | 4099 } |
| 4100 |
| 3805 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); | 4101 accept(ElementVisitor visitor) => visitor.visitHtmlElement(this); |
| 3806 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc
e == ((object as CompilationUnitElementImpl)).source; | 4102 |
| 4103 bool operator ==(Object object) => runtimeType == object.runtimeType && _sourc
e == (object as CompilationUnitElementImpl).source; |
| 4104 |
| 3807 AnalysisContext get context => _context; | 4105 AnalysisContext get context => _context; |
| 4106 |
| 3808 ElementKind get kind => ElementKind.HTML; | 4107 ElementKind get kind => ElementKind.HTML; |
| 4108 |
| 3809 List<HtmlScriptElement> get scripts => _scripts; | 4109 List<HtmlScriptElement> get scripts => _scripts; |
| 4110 |
| 3810 Source get source => _source; | 4111 Source get source => _source; |
| 4112 |
| 3811 int get hashCode => _source.hashCode; | 4113 int get hashCode => _source.hashCode; |
| 3812 | 4114 |
| 3813 /** | 4115 /** |
| 3814 * Set the scripts contained in the HTML file to the given scripts. | 4116 * Set the scripts contained in the HTML file to the given scripts. |
| 3815 * | 4117 * |
| 3816 * @param scripts the scripts | 4118 * @param scripts the scripts |
| 3817 */ | 4119 */ |
| 3818 void set scripts(List<HtmlScriptElement> scripts) { | 4120 void set scripts(List<HtmlScriptElement> scripts) { |
| 3819 if (scripts.length == 0) { | 4121 if (scripts.length == 0) { |
| 3820 scripts = HtmlScriptElementImpl.EMPTY_ARRAY; | 4122 scripts = HtmlScriptElementImpl.EMPTY_ARRAY; |
| 3821 } | 4123 } |
| 3822 for (HtmlScriptElement script in scripts) { | 4124 for (HtmlScriptElement script in scripts) { |
| 3823 ((script as HtmlScriptElementImpl)).enclosingElement = this; | 4125 (script as HtmlScriptElementImpl).enclosingElement = this; |
| 3824 } | 4126 } |
| 3825 this._scripts = scripts; | 4127 this._scripts = scripts; |
| 3826 } | 4128 } |
| 3827 | 4129 |
| 3828 /** | 4130 /** |
| 3829 * Set the source that corresponds to this HTML file to the given source. | 4131 * Set the source that corresponds to this HTML file to the given source. |
| 3830 * | 4132 * |
| 3831 * @param source the source that corresponds to this HTML file | 4133 * @param source the source that corresponds to this HTML file |
| 3832 */ | 4134 */ |
| 3833 void set source(Source source) { | 4135 void set source(Source source) { |
| 3834 this._source = source; | 4136 this._source = source; |
| 3835 } | 4137 } |
| 4138 |
| 3836 void visitChildren(ElementVisitor visitor) { | 4139 void visitChildren(ElementVisitor visitor) { |
| 3837 super.visitChildren(visitor); | 4140 super.visitChildren(visitor); |
| 3838 safelyVisitChildren(_scripts, visitor); | 4141 safelyVisitChildren(_scripts, visitor); |
| 3839 } | 4142 } |
| 4143 |
| 3840 void appendTo(JavaStringBuilder builder) { | 4144 void appendTo(JavaStringBuilder builder) { |
| 3841 if (_source == null) { | 4145 if (_source == null) { |
| 3842 builder.append("{HTML file}"); | 4146 builder.append("{HTML file}"); |
| 3843 } else { | 4147 } else { |
| 3844 builder.append(_source.fullName); | 4148 builder.append(_source.fullName); |
| 3845 } | 4149 } |
| 3846 } | 4150 } |
| 3847 } | 4151 } |
| 4152 |
| 3848 /** | 4153 /** |
| 3849 * Instances of the class `HtmlScriptElementImpl` implement an [HtmlScriptElemen
t]. | 4154 * Instances of the class `HtmlScriptElementImpl` implement an [HtmlScriptElemen
t]. |
| 3850 * | 4155 * |
| 3851 * @coverage dart.engine.element | 4156 * @coverage dart.engine.element |
| 3852 */ | 4157 */ |
| 3853 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl
ement { | 4158 abstract class HtmlScriptElementImpl extends ElementImpl implements HtmlScriptEl
ement { |
| 3854 | |
| 3855 /** | 4159 /** |
| 3856 * An empty array of HTML script elements. | 4160 * An empty array of HTML script elements. |
| 3857 */ | 4161 */ |
| 3858 static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0); | 4162 static List<HtmlScriptElement> EMPTY_ARRAY = new List<HtmlScriptElement>(0); |
| 3859 | 4163 |
| 3860 /** | 4164 /** |
| 3861 * Initialize a newly created script element to have the specified tag name an
d offset. | 4165 * Initialize a newly created script element to have the specified tag name an
d offset. |
| 3862 * | 4166 * |
| 3863 * @param node the XML node from which this element is derived (not `null`) | 4167 * @param node the XML node from which this element is derived (not `null`) |
| 3864 */ | 4168 */ |
| 3865 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag.
offset); | 4169 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag.
offset); |
| 3866 } | 4170 } |
| 4171 |
| 3867 /** | 4172 /** |
| 3868 * Instances of the class `ImportElementImpl` implement an [ImportElement]. | 4173 * Instances of the class `ImportElementImpl` implement an [ImportElement]. |
| 3869 * | 4174 * |
| 3870 * @coverage dart.engine.element | 4175 * @coverage dart.engine.element |
| 3871 */ | 4176 */ |
| 3872 class ImportElementImpl extends ElementImpl implements ImportElement { | 4177 class ImportElementImpl extends ElementImpl implements ImportElement { |
| 3873 | |
| 3874 /** | 4178 /** |
| 3875 * The offset of this directive, may be `-1` if synthetic. | 4179 * The offset of this directive, may be `-1` if synthetic. |
| 3876 */ | 4180 */ |
| 3877 int _offset = -1; | 4181 int _offset = -1; |
| 3878 | 4182 |
| 3879 /** | 4183 /** |
| 3880 * The offset of the character immediately following the last character of thi
s node's URI, may be | 4184 * The offset of the character immediately following the last character of thi
s node's URI, may be |
| 3881 * `-1` if synthetic. | 4185 * `-1` if synthetic. |
| 3882 */ | 4186 */ |
| 3883 int _uriEnd = -1; | 4187 int _uriEnd = -1; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3907 /** | 4211 /** |
| 3908 * The prefix that was specified as part of the import directive, or `null` if
there was no | 4212 * The prefix that was specified as part of the import directive, or `null` if
there was no |
| 3909 * prefix specified. | 4213 * prefix specified. |
| 3910 */ | 4214 */ |
| 3911 PrefixElement _prefix; | 4215 PrefixElement _prefix; |
| 3912 | 4216 |
| 3913 /** | 4217 /** |
| 3914 * Initialize a newly created import element. | 4218 * Initialize a newly created import element. |
| 3915 */ | 4219 */ |
| 3916 ImportElementImpl() : super.con1(null); | 4220 ImportElementImpl() : super.con1(null); |
| 4221 |
| 3917 accept(ElementVisitor visitor) => visitor.visitImportElement(this); | 4222 accept(ElementVisitor visitor) => visitor.visitImportElement(this); |
| 4223 |
| 3918 List<NamespaceCombinator> get combinators => _combinators; | 4224 List<NamespaceCombinator> get combinators => _combinators; |
| 4225 |
| 3919 LibraryElement get importedLibrary => _importedLibrary; | 4226 LibraryElement get importedLibrary => _importedLibrary; |
| 4227 |
| 3920 ElementKind get kind => ElementKind.IMPORT; | 4228 ElementKind get kind => ElementKind.IMPORT; |
| 4229 |
| 3921 PrefixElement get prefix => _prefix; | 4230 PrefixElement get prefix => _prefix; |
| 4231 |
| 3922 int get prefixOffset => _prefixOffset; | 4232 int get prefixOffset => _prefixOffset; |
| 4233 |
| 3923 String get uri => _uri; | 4234 String get uri => _uri; |
| 4235 |
| 3924 int get uriEnd => _uriEnd; | 4236 int get uriEnd => _uriEnd; |
| 3925 | 4237 |
| 3926 /** | 4238 /** |
| 3927 * Set the combinators that were specified as part of the import directive to
the given array of | 4239 * Set the combinators that were specified as part of the import directive to
the given array of |
| 3928 * combinators. | 4240 * combinators. |
| 3929 * | 4241 * |
| 3930 * @param combinators the combinators that were specified as part of the impor
t directive | 4242 * @param combinators the combinators that were specified as part of the impor
t directive |
| 3931 */ | 4243 */ |
| 3932 void set combinators(List<NamespaceCombinator> combinators) { | 4244 void set combinators(List<NamespaceCombinator> combinators) { |
| 3933 this._combinators = combinators; | 4245 this._combinators = combinators; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3976 this._uri = uri; | 4288 this._uri = uri; |
| 3977 } | 4289 } |
| 3978 | 4290 |
| 3979 /** | 4291 /** |
| 3980 * Set the the offset of the character immediately following the last characte
r of this node's | 4292 * Set the the offset of the character immediately following the last characte
r of this node's |
| 3981 * URI. `-1` for synthetic import. | 4293 * URI. `-1` for synthetic import. |
| 3982 */ | 4294 */ |
| 3983 void set uriEnd(int uriEnd) { | 4295 void set uriEnd(int uriEnd) { |
| 3984 this._uriEnd = uriEnd; | 4296 this._uriEnd = uriEnd; |
| 3985 } | 4297 } |
| 4298 |
| 3986 void visitChildren(ElementVisitor visitor) { | 4299 void visitChildren(ElementVisitor visitor) { |
| 3987 super.visitChildren(visitor); | 4300 super.visitChildren(visitor); |
| 3988 safelyVisitChild(_prefix, visitor); | 4301 safelyVisitChild(_prefix, visitor); |
| 3989 } | 4302 } |
| 4303 |
| 3990 void appendTo(JavaStringBuilder builder) { | 4304 void appendTo(JavaStringBuilder builder) { |
| 3991 builder.append("import "); | 4305 builder.append("import "); |
| 3992 ((_importedLibrary as LibraryElementImpl)).appendTo(builder); | 4306 (_importedLibrary as LibraryElementImpl).appendTo(builder); |
| 3993 } | 4307 } |
| 3994 String get identifier => "${((_importedLibrary as LibraryElementImpl)).identif
ier}@${_offset}"; | 4308 |
| 4309 String get identifier => "${(_importedLibrary as LibraryElementImpl).identifie
r}@${_offset}"; |
| 3995 } | 4310 } |
| 4311 |
| 3996 /** | 4312 /** |
| 3997 * Instances of the class `LabelElementImpl` implement a `LabelElement`. | 4313 * Instances of the class `LabelElementImpl` implement a `LabelElement`. |
| 3998 * | 4314 * |
| 3999 * @coverage dart.engine.element | 4315 * @coverage dart.engine.element |
| 4000 */ | 4316 */ |
| 4001 class LabelElementImpl extends ElementImpl implements LabelElement { | 4317 class LabelElementImpl extends ElementImpl implements LabelElement { |
| 4002 | |
| 4003 /** | 4318 /** |
| 4004 * A flag indicating whether this label is associated with a `switch` statemen
t. | 4319 * A flag indicating whether this label is associated with a `switch` statemen
t. |
| 4005 */ | 4320 */ |
| 4006 bool isOnSwitchStatement = false; | 4321 bool isOnSwitchStatement = false; |
| 4007 | 4322 |
| 4008 /** | 4323 /** |
| 4009 * A flag indicating whether this label is associated with a `switch` member (
`case` | 4324 * A flag indicating whether this label is associated with a `switch` member (
`case` |
| 4010 * or `default`). | 4325 * or `default`). |
| 4011 */ | 4326 */ |
| 4012 bool isOnSwitchMember = false; | 4327 bool isOnSwitchMember = false; |
| 4013 | 4328 |
| 4014 /** | 4329 /** |
| 4015 * An empty array of label elements. | 4330 * An empty array of label elements. |
| 4016 */ | 4331 */ |
| 4017 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); | 4332 static List<LabelElement> EMPTY_ARRAY = new List<LabelElement>(0); |
| 4018 | 4333 |
| 4019 /** | 4334 /** |
| 4020 * Initialize a newly created label element to have the given name. | 4335 * Initialize a newly created label element to have the given name. |
| 4021 * | 4336 * |
| 4022 * @param name the name of this element | 4337 * @param name the name of this element |
| 4023 * @param onSwitchStatement `true` if this label is associated with a `switch` | 4338 * @param onSwitchStatement `true` if this label is associated with a `switch` |
| 4024 * statement | 4339 * statement |
| 4025 * @param onSwitchMember `true` if this label is associated with a `switch` me
mber | 4340 * @param onSwitchMember `true` if this label is associated with a `switch` me
mber |
| 4026 */ | 4341 */ |
| 4027 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember)
: super.con1(name) { | 4342 LabelElementImpl(Identifier name, bool onSwitchStatement, bool onSwitchMember)
: super.con1(name) { |
| 4028 this.isOnSwitchStatement = onSwitchStatement; | 4343 this.isOnSwitchStatement = onSwitchStatement; |
| 4029 this.isOnSwitchMember = onSwitchMember; | 4344 this.isOnSwitchMember = onSwitchMember; |
| 4030 } | 4345 } |
| 4346 |
| 4031 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); | 4347 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); |
| 4348 |
| 4032 ExecutableElement get enclosingElement => super.enclosingElement as Executable
Element; | 4349 ExecutableElement get enclosingElement => super.enclosingElement as Executable
Element; |
| 4350 |
| 4033 ElementKind get kind => ElementKind.LABEL; | 4351 ElementKind get kind => ElementKind.LABEL; |
| 4034 } | 4352 } |
| 4353 |
| 4035 /** | 4354 /** |
| 4036 * Instances of the class `LibraryElementImpl` implement a `LibraryElement`. | 4355 * Instances of the class `LibraryElementImpl` implement a `LibraryElement`. |
| 4037 * | 4356 * |
| 4038 * @coverage dart.engine.element | 4357 * @coverage dart.engine.element |
| 4039 */ | 4358 */ |
| 4040 class LibraryElementImpl extends ElementImpl implements LibraryElement { | 4359 class LibraryElementImpl extends ElementImpl implements LibraryElement { |
| 4041 | |
| 4042 /** | 4360 /** |
| 4043 * An empty array of library elements. | 4361 * An empty array of library elements. |
| 4044 */ | 4362 */ |
| 4045 static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0); | 4363 static List<LibraryElement> EMPTY_ARRAY = new List<LibraryElement>(0); |
| 4046 | 4364 |
| 4047 /** | 4365 /** |
| 4048 * Determine if the given library is up to date with respect to the given time
stamp. | 4366 * Determine if the given library is up to date with respect to the given time
stamp. |
| 4049 * | 4367 * |
| 4050 * @param library the library to process | 4368 * @param library the library to process |
| 4051 * @param timeStamp the time stamp to check against | 4369 * @param timeStamp the time stamp to check against |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4109 | 4427 |
| 4110 /** | 4428 /** |
| 4111 * Initialize a newly created library element to have the given name. | 4429 * Initialize a newly created library element to have the given name. |
| 4112 * | 4430 * |
| 4113 * @param context the analysis context in which the library is defined | 4431 * @param context the analysis context in which the library is defined |
| 4114 * @param name the name of this element | 4432 * @param name the name of this element |
| 4115 */ | 4433 */ |
| 4116 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co
n1(name) { | 4434 LibraryElementImpl(AnalysisContext context, LibraryIdentifier name) : super.co
n1(name) { |
| 4117 this._context = context; | 4435 this._context = context; |
| 4118 } | 4436 } |
| 4437 |
| 4119 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); | 4438 accept(ElementVisitor visitor) => visitor.visitLibraryElement(this); |
| 4120 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definin
gCompilationUnit; | 4439 |
| 4440 bool operator ==(Object object) => object != null && runtimeType == object.run
timeType && _definingCompilationUnit == (object as LibraryElementImpl).definingC
ompilationUnit; |
| 4441 |
| 4121 ElementImpl getChild(String identifier) { | 4442 ElementImpl getChild(String identifier) { |
| 4122 if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier ==
identifier) { | 4443 if ((_definingCompilationUnit as CompilationUnitElementImpl).identifier == i
dentifier) { |
| 4123 return _definingCompilationUnit as CompilationUnitElementImpl; | 4444 return _definingCompilationUnit as CompilationUnitElementImpl; |
| 4124 } | 4445 } |
| 4125 for (CompilationUnitElement part in _parts) { | 4446 for (CompilationUnitElement part in _parts) { |
| 4126 if (((part as CompilationUnitElementImpl)).identifier == identifier) { | 4447 if ((part as CompilationUnitElementImpl).identifier == identifier) { |
| 4127 return part as CompilationUnitElementImpl; | 4448 return part as CompilationUnitElementImpl; |
| 4128 } | 4449 } |
| 4129 } | 4450 } |
| 4130 for (ImportElement importElement in _imports) { | 4451 for (ImportElement importElement in _imports) { |
| 4131 if (((importElement as ImportElementImpl)).identifier == identifier) { | 4452 if ((importElement as ImportElementImpl).identifier == identifier) { |
| 4132 return importElement as ImportElementImpl; | 4453 return importElement as ImportElementImpl; |
| 4133 } | 4454 } |
| 4134 } | 4455 } |
| 4135 for (ExportElement exportElement in _exports) { | 4456 for (ExportElement exportElement in _exports) { |
| 4136 if (((exportElement as ExportElementImpl)).identifier == identifier) { | 4457 if ((exportElement as ExportElementImpl).identifier == identifier) { |
| 4137 return exportElement as ExportElementImpl; | 4458 return exportElement as ExportElementImpl; |
| 4138 } | 4459 } |
| 4139 } | 4460 } |
| 4140 return null; | 4461 return null; |
| 4141 } | 4462 } |
| 4463 |
| 4142 AnalysisContext get context => _context; | 4464 AnalysisContext get context => _context; |
| 4465 |
| 4143 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit
; | 4466 CompilationUnitElement get definingCompilationUnit => _definingCompilationUnit
; |
| 4467 |
| 4144 FunctionElement get entryPoint => _entryPoint; | 4468 FunctionElement get entryPoint => _entryPoint; |
| 4469 |
| 4145 List<LibraryElement> get exportedLibraries { | 4470 List<LibraryElement> get exportedLibraries { |
| 4146 Set<LibraryElement> libraries = new Set<LibraryElement>(); | 4471 Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| 4147 for (ExportElement element in _exports) { | 4472 for (ExportElement element in _exports) { |
| 4148 LibraryElement library = element.exportedLibrary; | 4473 LibraryElement library = element.exportedLibrary; |
| 4149 if (library != null) { | 4474 if (library != null) { |
| 4150 javaSetAdd(libraries, library); | 4475 javaSetAdd(libraries, library); |
| 4151 } | 4476 } |
| 4152 } | 4477 } |
| 4153 return new List.from(libraries); | 4478 return new List.from(libraries); |
| 4154 } | 4479 } |
| 4480 |
| 4155 List<ExportElement> get exports => _exports; | 4481 List<ExportElement> get exports => _exports; |
| 4482 |
| 4156 List<LibraryElement> get importedLibraries { | 4483 List<LibraryElement> get importedLibraries { |
| 4157 Set<LibraryElement> libraries = new Set<LibraryElement>(); | 4484 Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| 4158 for (ImportElement element in _imports) { | 4485 for (ImportElement element in _imports) { |
| 4159 LibraryElement library = element.importedLibrary; | 4486 LibraryElement library = element.importedLibrary; |
| 4160 if (library != null) { | 4487 if (library != null) { |
| 4161 javaSetAdd(libraries, library); | 4488 javaSetAdd(libraries, library); |
| 4162 } | 4489 } |
| 4163 } | 4490 } |
| 4164 return new List.from(libraries); | 4491 return new List.from(libraries); |
| 4165 } | 4492 } |
| 4493 |
| 4166 List<ImportElement> get imports => _imports; | 4494 List<ImportElement> get imports => _imports; |
| 4495 |
| 4167 ElementKind get kind => ElementKind.LIBRARY; | 4496 ElementKind get kind => ElementKind.LIBRARY; |
| 4497 |
| 4168 LibraryElement get library => this; | 4498 LibraryElement get library => this; |
| 4499 |
| 4169 List<CompilationUnitElement> get parts => _parts; | 4500 List<CompilationUnitElement> get parts => _parts; |
| 4501 |
| 4170 List<PrefixElement> get prefixes { | 4502 List<PrefixElement> get prefixes { |
| 4171 Set<PrefixElement> prefixes = new Set<PrefixElement>(); | 4503 Set<PrefixElement> prefixes = new Set<PrefixElement>(); |
| 4172 for (ImportElement element in _imports) { | 4504 for (ImportElement element in _imports) { |
| 4173 PrefixElement prefix = element.prefix; | 4505 PrefixElement prefix = element.prefix; |
| 4174 if (prefix != null) { | 4506 if (prefix != null) { |
| 4175 javaSetAdd(prefixes, prefix); | 4507 javaSetAdd(prefixes, prefix); |
| 4176 } | 4508 } |
| 4177 } | 4509 } |
| 4178 return new List.from(prefixes); | 4510 return new List.from(prefixes); |
| 4179 } | 4511 } |
| 4512 |
| 4180 Source get source { | 4513 Source get source { |
| 4181 if (_definingCompilationUnit == null) { | 4514 if (_definingCompilationUnit == null) { |
| 4182 return null; | 4515 return null; |
| 4183 } | 4516 } |
| 4184 return _definingCompilationUnit.source; | 4517 return _definingCompilationUnit.source; |
| 4185 } | 4518 } |
| 4519 |
| 4186 ClassElement getType(String className) { | 4520 ClassElement getType(String className) { |
| 4187 ClassElement type = _definingCompilationUnit.getType(className); | 4521 ClassElement type = _definingCompilationUnit.getType(className); |
| 4188 if (type != null) { | 4522 if (type != null) { |
| 4189 return type; | 4523 return type; |
| 4190 } | 4524 } |
| 4191 for (CompilationUnitElement part in _parts) { | 4525 for (CompilationUnitElement part in _parts) { |
| 4192 type = part.getType(className); | 4526 type = part.getType(className); |
| 4193 if (type != null) { | 4527 if (type != null) { |
| 4194 return type; | 4528 return type; |
| 4195 } | 4529 } |
| 4196 } | 4530 } |
| 4197 return null; | 4531 return null; |
| 4198 } | 4532 } |
| 4533 |
| 4199 int get hashCode => _definingCompilationUnit.hashCode; | 4534 int get hashCode => _definingCompilationUnit.hashCode; |
| 4535 |
| 4200 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr
ary; | 4536 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr
ary; |
| 4537 |
| 4201 bool get isDartCore => name == "dart.core"; | 4538 bool get isDartCore => name == "dart.core"; |
| 4539 |
| 4202 bool get isInSdk => name.startsWith("dart."); | 4540 bool get isInSdk => name.startsWith("dart."); |
| 4541 |
| 4203 bool isUpToDate2(int timeStamp) { | 4542 bool isUpToDate2(int timeStamp) { |
| 4204 Set<LibraryElement> visitedLibraries = new Set(); | 4543 Set<LibraryElement> visitedLibraries = new Set(); |
| 4205 return isUpToDate(this, timeStamp, visitedLibraries); | 4544 return isUpToDate(this, timeStamp, visitedLibraries); |
| 4206 } | 4545 } |
| 4207 | 4546 |
| 4208 /** | 4547 /** |
| 4209 * Set the compilation unit that defines this library to the given compilation
unit. | 4548 * Set the compilation unit that defines this library to the given compilation
unit. |
| 4210 * | 4549 * |
| 4211 * @param definingCompilationUnit the compilation unit that defines this libra
ry | 4550 * @param definingCompilationUnit the compilation unit that defines this libra
ry |
| 4212 */ | 4551 */ |
| 4213 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni
t) { | 4552 void set definingCompilationUnit(CompilationUnitElement definingCompilationUni
t) { |
| 4214 ((definingCompilationUnit as CompilationUnitElementImpl)).enclosingElement =
this; | 4553 (definingCompilationUnit as CompilationUnitElementImpl).enclosingElement = t
his; |
| 4215 this._definingCompilationUnit = definingCompilationUnit; | 4554 this._definingCompilationUnit = definingCompilationUnit; |
| 4216 } | 4555 } |
| 4217 | 4556 |
| 4218 /** | 4557 /** |
| 4219 * Set the entry point for this library to the given function. | 4558 * Set the entry point for this library to the given function. |
| 4220 * | 4559 * |
| 4221 * @param entryPoint the entry point for this library | 4560 * @param entryPoint the entry point for this library |
| 4222 */ | 4561 */ |
| 4223 void set entryPoint(FunctionElement entryPoint) { | 4562 void set entryPoint(FunctionElement entryPoint) { |
| 4224 this._entryPoint = entryPoint; | 4563 this._entryPoint = entryPoint; |
| 4225 } | 4564 } |
| 4226 | 4565 |
| 4227 /** | 4566 /** |
| 4228 * Set the specifications of all of the exports defined in this library to the
given array. | 4567 * Set the specifications of all of the exports defined in this library to the
given array. |
| 4229 * | 4568 * |
| 4230 * @param exports the specifications of all of the exports defined in this lib
rary | 4569 * @param exports the specifications of all of the exports defined in this lib
rary |
| 4231 */ | 4570 */ |
| 4232 void set exports(List<ExportElement> exports) { | 4571 void set exports(List<ExportElement> exports) { |
| 4233 for (ExportElement exportElement in exports) { | 4572 for (ExportElement exportElement in exports) { |
| 4234 ((exportElement as ExportElementImpl)).enclosingElement = this; | 4573 (exportElement as ExportElementImpl).enclosingElement = this; |
| 4235 } | 4574 } |
| 4236 this._exports = exports; | 4575 this._exports = exports; |
| 4237 } | 4576 } |
| 4238 | 4577 |
| 4239 /** | 4578 /** |
| 4240 * Set the specifications of all of the imports defined in this library to the
given array. | 4579 * Set the specifications of all of the imports defined in this library to the
given array. |
| 4241 * | 4580 * |
| 4242 * @param imports the specifications of all of the imports defined in this lib
rary | 4581 * @param imports the specifications of all of the imports defined in this lib
rary |
| 4243 */ | 4582 */ |
| 4244 void set imports(List<ImportElement> imports) { | 4583 void set imports(List<ImportElement> imports) { |
| 4245 for (ImportElement importElement in imports) { | 4584 for (ImportElement importElement in imports) { |
| 4246 ((importElement as ImportElementImpl)).enclosingElement = this; | 4585 (importElement as ImportElementImpl).enclosingElement = this; |
| 4247 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; | 4586 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; |
| 4248 if (prefix != null) { | 4587 if (prefix != null) { |
| 4249 prefix.enclosingElement = this; | 4588 prefix.enclosingElement = this; |
| 4250 } | 4589 } |
| 4251 } | 4590 } |
| 4252 this._imports = imports; | 4591 this._imports = imports; |
| 4253 } | 4592 } |
| 4254 | 4593 |
| 4255 /** | 4594 /** |
| 4256 * Set the compilation units that are included in this library using a `part`
directive. | 4595 * Set the compilation units that are included in this library using a `part`
directive. |
| 4257 * | 4596 * |
| 4258 * @param parts the compilation units that are included in this library using
a `part` | 4597 * @param parts the compilation units that are included in this library using
a `part` |
| 4259 * directive | 4598 * directive |
| 4260 */ | 4599 */ |
| 4261 void set parts(List<CompilationUnitElement> parts) { | 4600 void set parts(List<CompilationUnitElement> parts) { |
| 4262 for (CompilationUnitElement compilationUnit in parts) { | 4601 for (CompilationUnitElement compilationUnit in parts) { |
| 4263 ((compilationUnit as CompilationUnitElementImpl)).enclosingElement = this; | 4602 (compilationUnit as CompilationUnitElementImpl).enclosingElement = this; |
| 4264 } | 4603 } |
| 4265 this._parts = parts; | 4604 this._parts = parts; |
| 4266 } | 4605 } |
| 4606 |
| 4267 void visitChildren(ElementVisitor visitor) { | 4607 void visitChildren(ElementVisitor visitor) { |
| 4268 super.visitChildren(visitor); | 4608 super.visitChildren(visitor); |
| 4269 safelyVisitChild(_definingCompilationUnit, visitor); | 4609 safelyVisitChild(_definingCompilationUnit, visitor); |
| 4270 safelyVisitChildren(_exports, visitor); | 4610 safelyVisitChildren(_exports, visitor); |
| 4271 safelyVisitChildren(_imports, visitor); | 4611 safelyVisitChildren(_imports, visitor); |
| 4272 safelyVisitChildren(_parts, visitor); | 4612 safelyVisitChildren(_parts, visitor); |
| 4273 } | 4613 } |
| 4614 |
| 4274 String get identifier => _definingCompilationUnit.source.encoding; | 4615 String get identifier => _definingCompilationUnit.source.encoding; |
| 4275 | 4616 |
| 4276 /** | 4617 /** |
| 4277 * Answer `true` if the receiver directly or indirectly imports the dart:html
libraries. | 4618 * Answer `true` if the receiver directly or indirectly imports the dart:html
libraries. |
| 4278 * | 4619 * |
| 4279 * @return `true` if the receiver directly or indirectly imports the dart:html
libraries | 4620 * @return `true` if the receiver directly or indirectly imports the dart:html
libraries |
| 4280 */ | 4621 */ |
| 4281 bool get isOrImportsBrowserLibrary { | 4622 bool get isOrImportsBrowserLibrary { |
| 4282 List<LibraryElement> visited = new List<LibraryElement>(); | 4623 List<LibraryElement> visited = new List<LibraryElement>(); |
| 4283 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); | 4624 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4295 } | 4636 } |
| 4296 for (LibraryElement exportedLibrary in library.exportedLibraries) { | 4637 for (LibraryElement exportedLibrary in library.exportedLibraries) { |
| 4297 if (!visited.contains(exportedLibrary)) { | 4638 if (!visited.contains(exportedLibrary)) { |
| 4298 visited.add(exportedLibrary); | 4639 visited.add(exportedLibrary); |
| 4299 } | 4640 } |
| 4300 } | 4641 } |
| 4301 } | 4642 } |
| 4302 return false; | 4643 return false; |
| 4303 } | 4644 } |
| 4304 } | 4645 } |
| 4646 |
| 4305 /** | 4647 /** |
| 4306 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE
lement`. | 4648 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE
lement`. |
| 4307 * | 4649 * |
| 4308 * @coverage dart.engine.element | 4650 * @coverage dart.engine.element |
| 4309 */ | 4651 */ |
| 4310 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { | 4652 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { |
| 4311 | |
| 4312 /** | 4653 /** |
| 4313 * Is `true` if this variable is potentially mutated somewhere in its scope. | 4654 * Is `true` if this variable is potentially mutated somewhere in its scope. |
| 4314 */ | 4655 */ |
| 4315 bool _isPotentiallyMutatedInScope2 = false; | 4656 bool _isPotentiallyMutatedInScope2 = false; |
| 4316 | 4657 |
| 4317 /** | 4658 /** |
| 4318 * Is `true` if this variable is potentially mutated somewhere in closure. | 4659 * Is `true` if this variable is potentially mutated somewhere in closure. |
| 4319 */ | 4660 */ |
| 4320 bool _isPotentiallyMutatedInClosure2 = false; | 4661 bool _isPotentiallyMutatedInClosure2 = false; |
| 4321 | 4662 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4334 * An empty array of field elements. | 4675 * An empty array of field elements. |
| 4335 */ | 4676 */ |
| 4336 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); | 4677 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); |
| 4337 | 4678 |
| 4338 /** | 4679 /** |
| 4339 * Initialize a newly created local variable element to have the given name. | 4680 * Initialize a newly created local variable element to have the given name. |
| 4340 * | 4681 * |
| 4341 * @param name the name of this element | 4682 * @param name the name of this element |
| 4342 */ | 4683 */ |
| 4343 LocalVariableElementImpl(Identifier name) : super.con1(name); | 4684 LocalVariableElementImpl(Identifier name) : super.con1(name); |
| 4685 |
| 4344 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); | 4686 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); |
| 4687 |
| 4345 ElementKind get kind => ElementKind.LOCAL_VARIABLE; | 4688 ElementKind get kind => ElementKind.LOCAL_VARIABLE; |
| 4689 |
| 4346 SourceRange get visibleRange { | 4690 SourceRange get visibleRange { |
| 4347 if (_visibleRangeLength < 0) { | 4691 if (_visibleRangeLength < 0) { |
| 4348 return null; | 4692 return null; |
| 4349 } | 4693 } |
| 4350 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4694 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 4351 } | 4695 } |
| 4696 |
| 4352 bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure2; | 4697 bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure2; |
| 4698 |
| 4353 bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope2; | 4699 bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope2; |
| 4354 | 4700 |
| 4355 /** | 4701 /** |
| 4356 * Specifies that this variable is potentially mutated somewhere in closure. | 4702 * Specifies that this variable is potentially mutated somewhere in closure. |
| 4357 */ | 4703 */ |
| 4358 void markPotentiallyMutatedInClosure() { | 4704 void markPotentiallyMutatedInClosure() { |
| 4359 _isPotentiallyMutatedInClosure2 = true; | 4705 _isPotentiallyMutatedInClosure2 = true; |
| 4360 } | 4706 } |
| 4361 | 4707 |
| 4362 /** | 4708 /** |
| 4363 * Specifies that this variable is potentially mutated somewhere in its scope. | 4709 * Specifies that this variable is potentially mutated somewhere in its scope. |
| 4364 */ | 4710 */ |
| 4365 void markPotentiallyMutatedInScope() { | 4711 void markPotentiallyMutatedInScope() { |
| 4366 _isPotentiallyMutatedInScope2 = true; | 4712 _isPotentiallyMutatedInScope2 = true; |
| 4367 } | 4713 } |
| 4368 | 4714 |
| 4369 /** | 4715 /** |
| 4370 * Set the visible range for this element to the range starting at the given o
ffset with the given | 4716 * Set the visible range for this element to the range starting at the given o
ffset with the given |
| 4371 * length. | 4717 * length. |
| 4372 * | 4718 * |
| 4373 * @param offset the offset to the beginning of the visible range for this ele
ment | 4719 * @param offset the offset to the beginning of the visible range for this ele
ment |
| 4374 * @param length the length of the visible range for this element, or `-1` if
this element | 4720 * @param length the length of the visible range for this element, or `-1` if
this element |
| 4375 * does not have a visible range | 4721 * does not have a visible range |
| 4376 */ | 4722 */ |
| 4377 void setVisibleRange(int offset, int length) { | 4723 void setVisibleRange(int offset, int length) { |
| 4378 _visibleRangeOffset = offset; | 4724 _visibleRangeOffset = offset; |
| 4379 _visibleRangeLength = length; | 4725 _visibleRangeLength = length; |
| 4380 } | 4726 } |
| 4727 |
| 4381 void appendTo(JavaStringBuilder builder) { | 4728 void appendTo(JavaStringBuilder builder) { |
| 4382 builder.append(type); | 4729 builder.append(type); |
| 4383 builder.append(" "); | 4730 builder.append(" "); |
| 4384 builder.append(displayName); | 4731 builder.append(displayName); |
| 4385 } | 4732 } |
| 4733 |
| 4386 String get identifier => "${super.identifier}@${nameOffset}"; | 4734 String get identifier => "${super.identifier}@${nameOffset}"; |
| 4387 } | 4735 } |
| 4736 |
| 4388 /** | 4737 /** |
| 4389 * Instances of the class `MethodElementImpl` implement a `MethodElement`. | 4738 * Instances of the class `MethodElementImpl` implement a `MethodElement`. |
| 4390 * | 4739 * |
| 4391 * @coverage dart.engine.element | 4740 * @coverage dart.engine.element |
| 4392 */ | 4741 */ |
| 4393 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { | 4742 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { |
| 4394 | |
| 4395 /** | 4743 /** |
| 4396 * An empty array of method elements. | 4744 * An empty array of method elements. |
| 4397 */ | 4745 */ |
| 4398 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); | 4746 static List<MethodElement> EMPTY_ARRAY = new List<MethodElement>(0); |
| 4399 | 4747 |
| 4400 /** | 4748 /** |
| 4401 * Initialize a newly created method element to have the given name. | 4749 * Initialize a newly created method element to have the given name. |
| 4402 * | 4750 * |
| 4403 * @param name the name of this element | 4751 * @param name the name of this element |
| 4404 */ | 4752 */ |
| 4405 MethodElementImpl.con1(Identifier name) : super.con1(name); | 4753 MethodElementImpl.con1(Identifier name) : super.con1(name); |
| 4406 | 4754 |
| 4407 /** | 4755 /** |
| 4408 * Initialize a newly created method element to have the given name. | 4756 * Initialize a newly created method element to have the given name. |
| 4409 * | 4757 * |
| 4410 * @param name the name of this element | 4758 * @param name the name of this element |
| 4411 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 4759 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 4412 * declaration of this element | 4760 * declaration of this element |
| 4413 */ | 4761 */ |
| 4414 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff
set); | 4762 MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOff
set); |
| 4763 |
| 4415 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 4764 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
| 4765 |
| 4416 ClassElement get enclosingElement => super.enclosingElement as ClassElement; | 4766 ClassElement get enclosingElement => super.enclosingElement as ClassElement; |
| 4767 |
| 4417 ElementKind get kind => ElementKind.METHOD; | 4768 ElementKind get kind => ElementKind.METHOD; |
| 4769 |
| 4418 String get name { | 4770 String get name { |
| 4419 String name = super.name; | 4771 String name = super.name; |
| 4420 if (isOperator && name == "-") { | 4772 if (isOperator && name == "-") { |
| 4421 if (parameters.length == 0) { | 4773 if (parameters.length == 0) { |
| 4422 return "unary-"; | 4774 return "unary-"; |
| 4423 } | 4775 } |
| 4424 } | 4776 } |
| 4425 return super.name; | 4777 return super.name; |
| 4426 } | 4778 } |
| 4779 |
| 4427 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 4780 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 4781 |
| 4428 bool get isOperator { | 4782 bool get isOperator { |
| 4429 String name = displayName; | 4783 String name = displayName; |
| 4430 if (name.isEmpty) { | 4784 if (name.isEmpty) { |
| 4431 return false; | 4785 return false; |
| 4432 } | 4786 } |
| 4433 int first = name.codeUnitAt(0); | 4787 int first = name.codeUnitAt(0); |
| 4434 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A
) || first == 0x5F || first == 0x24); | 4788 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A
) || first == 0x5F || first == 0x24); |
| 4435 } | 4789 } |
| 4790 |
| 4436 bool get isStatic => hasModifier(Modifier.STATIC); | 4791 bool get isStatic => hasModifier(Modifier.STATIC); |
| 4437 | 4792 |
| 4438 /** | 4793 /** |
| 4439 * Set whether this method is abstract to correspond to the given value. | 4794 * Set whether this method is abstract to correspond to the given value. |
| 4440 * | 4795 * |
| 4441 * @param isAbstract `true` if the method is abstract | 4796 * @param isAbstract `true` if the method is abstract |
| 4442 */ | 4797 */ |
| 4443 void set abstract(bool isAbstract) { | 4798 void set abstract(bool isAbstract) { |
| 4444 setModifier(Modifier.ABSTRACT, isAbstract); | 4799 setModifier(Modifier.ABSTRACT, isAbstract); |
| 4445 } | 4800 } |
| 4446 | 4801 |
| 4447 /** | 4802 /** |
| 4448 * Set whether this method is static to correspond to the given value. | 4803 * Set whether this method is static to correspond to the given value. |
| 4449 * | 4804 * |
| 4450 * @param isStatic `true` if the method is static | 4805 * @param isStatic `true` if the method is static |
| 4451 */ | 4806 */ |
| 4452 void set static(bool isStatic) { | 4807 void set static(bool isStatic) { |
| 4453 setModifier(Modifier.STATIC, isStatic); | 4808 setModifier(Modifier.STATIC, isStatic); |
| 4454 } | 4809 } |
| 4810 |
| 4455 void appendTo(JavaStringBuilder builder) { | 4811 void appendTo(JavaStringBuilder builder) { |
| 4456 builder.append(enclosingElement.displayName); | 4812 builder.append(enclosingElement.displayName); |
| 4457 builder.append("."); | 4813 builder.append("."); |
| 4458 builder.append(displayName); | 4814 builder.append(displayName); |
| 4459 super.appendTo(builder); | 4815 super.appendTo(builder); |
| 4460 } | 4816 } |
| 4461 } | 4817 } |
| 4818 |
| 4462 /** | 4819 /** |
| 4463 * The enumeration `Modifier` defines constants for all of the modifiers defined
by the Dart | 4820 * The enumeration `Modifier` defines constants for all of the modifiers defined
by the Dart |
| 4464 * language and for a few additional flags that are useful. | 4821 * language and for a few additional flags that are useful. |
| 4465 * | 4822 * |
| 4466 * @coverage dart.engine.element | 4823 * @coverage dart.engine.element |
| 4467 */ | 4824 */ |
| 4468 class Modifier extends Enum<Modifier> { | 4825 class Modifier extends Enum<Modifier> { |
| 4469 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); | 4826 static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0); |
| 4827 |
| 4470 static final Modifier CONST = new Modifier('CONST', 1); | 4828 static final Modifier CONST = new Modifier('CONST', 1); |
| 4829 |
| 4471 static final Modifier FACTORY = new Modifier('FACTORY', 2); | 4830 static final Modifier FACTORY = new Modifier('FACTORY', 2); |
| 4831 |
| 4472 static final Modifier FINAL = new Modifier('FINAL', 3); | 4832 static final Modifier FINAL = new Modifier('FINAL', 3); |
| 4833 |
| 4473 static final Modifier GETTER = new Modifier('GETTER', 4); | 4834 static final Modifier GETTER = new Modifier('GETTER', 4); |
| 4835 |
| 4474 static final Modifier MIXIN = new Modifier('MIXIN', 5); | 4836 static final Modifier MIXIN = new Modifier('MIXIN', 5); |
| 4837 |
| 4475 static final Modifier REFERENCES_SUPER = new Modifier('REFERENCES_SUPER', 6); | 4838 static final Modifier REFERENCES_SUPER = new Modifier('REFERENCES_SUPER', 6); |
| 4839 |
| 4476 static final Modifier SETTER = new Modifier('SETTER', 7); | 4840 static final Modifier SETTER = new Modifier('SETTER', 7); |
| 4841 |
| 4477 static final Modifier STATIC = new Modifier('STATIC', 8); | 4842 static final Modifier STATIC = new Modifier('STATIC', 8); |
| 4843 |
| 4478 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 9); | 4844 static final Modifier SYNTHETIC = new Modifier('SYNTHETIC', 9); |
| 4845 |
| 4479 static final Modifier TYPEDEF = new Modifier('TYPEDEF', 10); | 4846 static final Modifier TYPEDEF = new Modifier('TYPEDEF', 10); |
| 4847 |
| 4480 static final List<Modifier> values = [ | 4848 static final List<Modifier> values = [ |
| 4481 ABSTRACT, | 4849 ABSTRACT, |
| 4482 CONST, | 4850 CONST, |
| 4483 FACTORY, | 4851 FACTORY, |
| 4484 FINAL, | 4852 FINAL, |
| 4485 GETTER, | 4853 GETTER, |
| 4486 MIXIN, | 4854 MIXIN, |
| 4487 REFERENCES_SUPER, | 4855 REFERENCES_SUPER, |
| 4488 SETTER, | 4856 SETTER, |
| 4489 STATIC, | 4857 STATIC, |
| 4490 SYNTHETIC, | 4858 SYNTHETIC, |
| 4491 TYPEDEF]; | 4859 TYPEDEF]; |
| 4860 |
| 4492 Modifier(String name, int ordinal) : super(name, ordinal); | 4861 Modifier(String name, int ordinal) : super(name, ordinal); |
| 4493 } | 4862 } |
| 4863 |
| 4494 /** | 4864 /** |
| 4495 * Instances of the class `MultiplyDefinedElementImpl` represent a collection of
elements that | 4865 * Instances of the class `MultiplyDefinedElementImpl` represent a collection of
elements that |
| 4496 * have the same name within the same scope. | 4866 * have the same name within the same scope. |
| 4497 * | 4867 * |
| 4498 * @coverage dart.engine.element | 4868 * @coverage dart.engine.element |
| 4499 */ | 4869 */ |
| 4500 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { | 4870 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
| 4501 | |
| 4502 /** | 4871 /** |
| 4503 * Return an element that represents the given conflicting elements. | 4872 * Return an element that represents the given conflicting elements. |
| 4504 * | 4873 * |
| 4505 * @param context the analysis context in which the multiply defined elements
are defined | 4874 * @param context the analysis context in which the multiply defined elements
are defined |
| 4506 * @param firstElement the first element that conflicts | 4875 * @param firstElement the first element that conflicts |
| 4507 * @param secondElement the second element that conflicts | 4876 * @param secondElement the second element that conflicts |
| 4508 */ | 4877 */ |
| 4509 static Element fromElements(AnalysisContext context, Element firstElement, Ele
ment secondElement) { | 4878 static Element fromElements(AnalysisContext context, Element firstElement, Ele
ment secondElement) { |
| 4510 List<Element> conflictingElements = computeConflictingElements(firstElement,
secondElement); | 4879 List<Element> conflictingElements = computeConflictingElements(firstElement,
secondElement); |
| 4511 int length = conflictingElements.length; | 4880 int length = conflictingElements.length; |
| 4512 if (length == 0) { | 4881 if (length == 0) { |
| 4513 return null; | 4882 return null; |
| 4514 } else if (length == 1) { | 4883 } else if (length == 1) { |
| 4515 return conflictingElements[0]; | 4884 return conflictingElements[0]; |
| 4516 } | 4885 } |
| 4517 return new MultiplyDefinedElementImpl(context, conflictingElements); | 4886 return new MultiplyDefinedElementImpl(context, conflictingElements); |
| 4518 } | 4887 } |
| 4519 | 4888 |
| 4520 /** | 4889 /** |
| 4521 * Add the given element to the list of elements. If the element is a multiply
-defined element, | 4890 * Add the given element to the list of elements. If the element is a multiply
-defined element, |
| 4522 * add all of the conflicting elements that it represents. | 4891 * add all of the conflicting elements that it represents. |
| 4523 * | 4892 * |
| 4524 * @param elements the list to which the element(s) are to be added | 4893 * @param elements the list to which the element(s) are to be added |
| 4525 * @param element the element(s) to be added | 4894 * @param element the element(s) to be added |
| 4526 */ | 4895 */ |
| 4527 static void add(Set<Element> elements, Element element) { | 4896 static void add(Set<Element> elements, Element element) { |
| 4528 if (element is MultiplyDefinedElementImpl) { | 4897 if (element is MultiplyDefinedElementImpl) { |
| 4529 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl
))._conflictingElements) { | 4898 for (Element conflictingElement in (element as MultiplyDefinedElementImpl)
._conflictingElements) { |
| 4530 javaSetAdd(elements, conflictingElement); | 4899 javaSetAdd(elements, conflictingElement); |
| 4531 } | 4900 } |
| 4532 } else { | 4901 } else { |
| 4533 javaSetAdd(elements, element); | 4902 javaSetAdd(elements, element); |
| 4534 } | 4903 } |
| 4535 } | 4904 } |
| 4536 | 4905 |
| 4537 /** | 4906 /** |
| 4538 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given | 4907 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given |
| 4539 * elements are multiply-defined elements then the conflicting elements they r
epresent will be | 4908 * elements are multiply-defined elements then the conflicting elements they r
epresent will be |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4569 * Initialize a newly created element to represent a list of conflicting eleme
nts. | 4938 * Initialize a newly created element to represent a list of conflicting eleme
nts. |
| 4570 * | 4939 * |
| 4571 * @param context the analysis context in which the multiply defined elements
are defined | 4940 * @param context the analysis context in which the multiply defined elements
are defined |
| 4572 * @param conflictingElements the elements that conflict | 4941 * @param conflictingElements the elements that conflict |
| 4573 */ | 4942 */ |
| 4574 MultiplyDefinedElementImpl(AnalysisContext context, List<Element> conflictingE
lements) { | 4943 MultiplyDefinedElementImpl(AnalysisContext context, List<Element> conflictingE
lements) { |
| 4575 this._context = context; | 4944 this._context = context; |
| 4576 _name = conflictingElements[0].name; | 4945 _name = conflictingElements[0].name; |
| 4577 this._conflictingElements = conflictingElements; | 4946 this._conflictingElements = conflictingElements; |
| 4578 } | 4947 } |
| 4948 |
| 4579 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 4949 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
| 4950 |
| 4580 String computeDocumentationComment() => null; | 4951 String computeDocumentationComment() => null; |
| 4952 |
| 4581 Element getAncestor(Type elementClass) => null; | 4953 Element getAncestor(Type elementClass) => null; |
| 4954 |
| 4582 List<Element> get conflictingElements => _conflictingElements; | 4955 List<Element> get conflictingElements => _conflictingElements; |
| 4956 |
| 4583 AnalysisContext get context => _context; | 4957 AnalysisContext get context => _context; |
| 4958 |
| 4584 String get displayName => _name; | 4959 String get displayName => _name; |
| 4960 |
| 4585 Element get enclosingElement => null; | 4961 Element get enclosingElement => null; |
| 4962 |
| 4586 ElementKind get kind => ElementKind.ERROR; | 4963 ElementKind get kind => ElementKind.ERROR; |
| 4964 |
| 4587 LibraryElement get library => null; | 4965 LibraryElement get library => null; |
| 4966 |
| 4588 ElementLocation get location => null; | 4967 ElementLocation get location => null; |
| 4968 |
| 4589 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY; | 4969 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY; |
| 4970 |
| 4590 String get name => _name; | 4971 String get name => _name; |
| 4972 |
| 4591 int get nameOffset => -1; | 4973 int get nameOffset => -1; |
| 4974 |
| 4592 Source get source => null; | 4975 Source get source => null; |
| 4976 |
| 4593 Type2 get type => DynamicTypeImpl.instance; | 4977 Type2 get type => DynamicTypeImpl.instance; |
| 4978 |
| 4594 bool isAccessibleIn(LibraryElement library) { | 4979 bool isAccessibleIn(LibraryElement library) { |
| 4595 for (Element element in _conflictingElements) { | 4980 for (Element element in _conflictingElements) { |
| 4596 if (element.isAccessibleIn(library)) { | 4981 if (element.isAccessibleIn(library)) { |
| 4597 return true; | 4982 return true; |
| 4598 } | 4983 } |
| 4599 } | 4984 } |
| 4600 return false; | 4985 return false; |
| 4601 } | 4986 } |
| 4987 |
| 4988 bool get isDeprecated => false; |
| 4989 |
| 4602 bool get isSynthetic => true; | 4990 bool get isSynthetic => true; |
| 4991 |
| 4603 String toString() { | 4992 String toString() { |
| 4604 JavaStringBuilder builder = new JavaStringBuilder(); | 4993 JavaStringBuilder builder = new JavaStringBuilder(); |
| 4605 builder.append("["); | 4994 builder.append("["); |
| 4606 int count = _conflictingElements.length; | 4995 int count = _conflictingElements.length; |
| 4607 for (int i = 0; i < count; i++) { | 4996 for (int i = 0; i < count; i++) { |
| 4608 if (i > 0) { | 4997 if (i > 0) { |
| 4609 builder.append(", "); | 4998 builder.append(", "); |
| 4610 } | 4999 } |
| 4611 ((_conflictingElements[i] as ElementImpl)).appendTo(builder); | 5000 (_conflictingElements[i] as ElementImpl).appendTo(builder); |
| 4612 } | 5001 } |
| 4613 builder.append("]"); | 5002 builder.append("]"); |
| 4614 return builder.toString(); | 5003 return builder.toString(); |
| 4615 } | 5004 } |
| 5005 |
| 4616 void visitChildren(ElementVisitor visitor) { | 5006 void visitChildren(ElementVisitor visitor) { |
| 4617 } | 5007 } |
| 4618 } | 5008 } |
| 5009 |
| 4619 /** | 5010 /** |
| 4620 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. | 5011 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. |
| 4621 * | 5012 * |
| 4622 * @coverage dart.engine.element | 5013 * @coverage dart.engine.element |
| 4623 */ | 5014 */ |
| 4624 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { | 5015 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { |
| 4625 | |
| 4626 /** | 5016 /** |
| 4627 * Is `true` if this variable is potentially mutated somewhere in its scope. | 5017 * Is `true` if this variable is potentially mutated somewhere in its scope. |
| 4628 */ | 5018 */ |
| 4629 bool _isPotentiallyMutatedInScope3 = false; | 5019 bool _isPotentiallyMutatedInScope3 = false; |
| 4630 | 5020 |
| 4631 /** | 5021 /** |
| 4632 * Is `true` if this variable is potentially mutated somewhere in closure. | 5022 * Is `true` if this variable is potentially mutated somewhere in closure. |
| 4633 */ | 5023 */ |
| 4634 bool _isPotentiallyMutatedInClosure3 = false; | 5024 bool _isPotentiallyMutatedInClosure3 = false; |
| 4635 | 5025 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4679 ParameterElementImpl.con1(Identifier name) : super.con1(name); | 5069 ParameterElementImpl.con1(Identifier name) : super.con1(name); |
| 4680 | 5070 |
| 4681 /** | 5071 /** |
| 4682 * Initialize a newly created parameter element to have the given name. | 5072 * Initialize a newly created parameter element to have the given name. |
| 4683 * | 5073 * |
| 4684 * @param name the name of this element | 5074 * @param name the name of this element |
| 4685 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 5075 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 4686 * declaration of this element | 5076 * declaration of this element |
| 4687 */ | 5077 */ |
| 4688 ParameterElementImpl.con2(String name, int nameOffset) : super.con2(name, name
Offset); | 5078 ParameterElementImpl.con2(String name, int nameOffset) : super.con2(name, name
Offset); |
| 5079 |
| 4689 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); | 5080 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
| 5081 |
| 4690 SourceRange get defaultValueRange { | 5082 SourceRange get defaultValueRange { |
| 4691 if (_defaultValueRangeLength < 0) { | 5083 if (_defaultValueRangeLength < 0) { |
| 4692 return null; | 5084 return null; |
| 4693 } | 5085 } |
| 4694 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength); | 5086 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength); |
| 4695 } | 5087 } |
| 5088 |
| 4696 ElementKind get kind => ElementKind.PARAMETER; | 5089 ElementKind get kind => ElementKind.PARAMETER; |
| 5090 |
| 4697 ParameterKind get parameterKind => _parameterKind; | 5091 ParameterKind get parameterKind => _parameterKind; |
| 5092 |
| 4698 List<ParameterElement> get parameters => _parameters; | 5093 List<ParameterElement> get parameters => _parameters; |
| 5094 |
| 4699 SourceRange get visibleRange { | 5095 SourceRange get visibleRange { |
| 4700 if (_visibleRangeLength < 0) { | 5096 if (_visibleRangeLength < 0) { |
| 4701 return null; | 5097 return null; |
| 4702 } | 5098 } |
| 4703 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 5099 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 4704 } | 5100 } |
| 5101 |
| 4705 bool get isInitializingFormal => false; | 5102 bool get isInitializingFormal => false; |
| 5103 |
| 4706 bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure3; | 5104 bool get isPotentiallyMutatedInClosure => _isPotentiallyMutatedInClosure3; |
| 5105 |
| 4707 bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope3; | 5106 bool get isPotentiallyMutatedInScope => _isPotentiallyMutatedInScope3; |
| 4708 | 5107 |
| 4709 /** | 5108 /** |
| 4710 * Specifies that this variable is potentially mutated somewhere in closure. | 5109 * Specifies that this variable is potentially mutated somewhere in closure. |
| 4711 */ | 5110 */ |
| 4712 void markPotentiallyMutatedInClosure() { | 5111 void markPotentiallyMutatedInClosure() { |
| 4713 _isPotentiallyMutatedInClosure3 = true; | 5112 _isPotentiallyMutatedInClosure3 = true; |
| 4714 } | 5113 } |
| 4715 | 5114 |
| 4716 /** | 5115 /** |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4742 this._parameterKind = parameterKind; | 5141 this._parameterKind = parameterKind; |
| 4743 } | 5142 } |
| 4744 | 5143 |
| 4745 /** | 5144 /** |
| 4746 * Set the parameters defined by this executable element to the given paramete
rs. | 5145 * Set the parameters defined by this executable element to the given paramete
rs. |
| 4747 * | 5146 * |
| 4748 * @param parameters the parameters defined by this executable element | 5147 * @param parameters the parameters defined by this executable element |
| 4749 */ | 5148 */ |
| 4750 void set parameters(List<ParameterElement> parameters) { | 5149 void set parameters(List<ParameterElement> parameters) { |
| 4751 for (ParameterElement parameter in parameters) { | 5150 for (ParameterElement parameter in parameters) { |
| 4752 ((parameter as ParameterElementImpl)).enclosingElement = this; | 5151 (parameter as ParameterElementImpl).enclosingElement = this; |
| 4753 } | 5152 } |
| 4754 this._parameters = parameters; | 5153 this._parameters = parameters; |
| 4755 } | 5154 } |
| 4756 | 5155 |
| 4757 /** | 5156 /** |
| 4758 * Set the visible range for this element to the range starting at the given o
ffset with the given | 5157 * Set the visible range for this element to the range starting at the given o
ffset with the given |
| 4759 * length. | 5158 * length. |
| 4760 * | 5159 * |
| 4761 * @param offset the offset to the beginning of the visible range for this ele
ment | 5160 * @param offset the offset to the beginning of the visible range for this ele
ment |
| 4762 * @param length the length of the visible range for this element, or `-1` if
this element | 5161 * @param length the length of the visible range for this element, or `-1` if
this element |
| 4763 * does not have a visible range | 5162 * does not have a visible range |
| 4764 */ | 5163 */ |
| 4765 void setVisibleRange(int offset, int length) { | 5164 void setVisibleRange(int offset, int length) { |
| 4766 _visibleRangeOffset = offset; | 5165 _visibleRangeOffset = offset; |
| 4767 _visibleRangeLength = length; | 5166 _visibleRangeLength = length; |
| 4768 } | 5167 } |
| 5168 |
| 4769 void visitChildren(ElementVisitor visitor) { | 5169 void visitChildren(ElementVisitor visitor) { |
| 4770 super.visitChildren(visitor); | 5170 super.visitChildren(visitor); |
| 4771 safelyVisitChildren(_parameters, visitor); | 5171 safelyVisitChildren(_parameters, visitor); |
| 4772 } | 5172 } |
| 5173 |
| 4773 void appendTo(JavaStringBuilder builder) { | 5174 void appendTo(JavaStringBuilder builder) { |
| 4774 String left = ""; | 5175 String left = ""; |
| 4775 String right = ""; | 5176 String right = ""; |
| 4776 while (true) { | 5177 while (true) { |
| 4777 if (parameterKind == ParameterKind.NAMED) { | 5178 if (parameterKind == ParameterKind.NAMED) { |
| 4778 left = "{"; | 5179 left = "{"; |
| 4779 right = "}"; | 5180 right = "}"; |
| 4780 } else if (parameterKind == ParameterKind.POSITIONAL) { | 5181 } else if (parameterKind == ParameterKind.POSITIONAL) { |
| 4781 left = "["; | 5182 left = "["; |
| 4782 right = "]"; | 5183 right = "]"; |
| 4783 } | 5184 } |
| 4784 break; | 5185 break; |
| 4785 } | 5186 } |
| 4786 builder.append(left); | 5187 builder.append(left); |
| 4787 builder.append(type); | 5188 builder.append(type); |
| 4788 builder.append(" "); | 5189 builder.append(" "); |
| 4789 builder.append(displayName); | 5190 builder.append(displayName); |
| 4790 builder.append(right); | 5191 builder.append(right); |
| 4791 } | 5192 } |
| 4792 } | 5193 } |
| 5194 |
| 4793 /** | 5195 /** |
| 4794 * Instances of the class `PrefixElementImpl` implement a `PrefixElement`. | 5196 * Instances of the class `PrefixElementImpl` implement a `PrefixElement`. |
| 4795 * | 5197 * |
| 4796 * @coverage dart.engine.element | 5198 * @coverage dart.engine.element |
| 4797 */ | 5199 */ |
| 4798 class PrefixElementImpl extends ElementImpl implements PrefixElement { | 5200 class PrefixElementImpl extends ElementImpl implements PrefixElement { |
| 4799 | |
| 4800 /** | 5201 /** |
| 4801 * An array containing all of the libraries that are imported using this prefi
x. | 5202 * An array containing all of the libraries that are imported using this prefi
x. |
| 4802 */ | 5203 */ |
| 4803 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; | 5204 List<LibraryElement> _importedLibraries = LibraryElementImpl.EMPTY_ARRAY; |
| 4804 | 5205 |
| 4805 /** | 5206 /** |
| 4806 * An empty array of prefix elements. | 5207 * An empty array of prefix elements. |
| 4807 */ | 5208 */ |
| 4808 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); | 5209 static List<PrefixElement> EMPTY_ARRAY = new List<PrefixElement>(0); |
| 4809 | 5210 |
| 4810 /** | 5211 /** |
| 4811 * Initialize a newly created prefix element to have the given name. | 5212 * Initialize a newly created prefix element to have the given name. |
| 4812 * | 5213 * |
| 4813 * @param name the name of this element | 5214 * @param name the name of this element |
| 4814 */ | 5215 */ |
| 4815 PrefixElementImpl(Identifier name) : super.con1(name); | 5216 PrefixElementImpl(Identifier name) : super.con1(name); |
| 5217 |
| 4816 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); | 5218 accept(ElementVisitor visitor) => visitor.visitPrefixElement(this); |
| 5219 |
| 4817 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; | 5220 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; |
| 5221 |
| 4818 List<LibraryElement> get importedLibraries => _importedLibraries; | 5222 List<LibraryElement> get importedLibraries => _importedLibraries; |
| 5223 |
| 4819 ElementKind get kind => ElementKind.PREFIX; | 5224 ElementKind get kind => ElementKind.PREFIX; |
| 4820 | 5225 |
| 4821 /** | 5226 /** |
| 4822 * Set the libraries that are imported using this prefix to the given librarie
s. | 5227 * Set the libraries that are imported using this prefix to the given librarie
s. |
| 4823 * | 5228 * |
| 4824 * @param importedLibraries the libraries that are imported using this prefix | 5229 * @param importedLibraries the libraries that are imported using this prefix |
| 4825 */ | 5230 */ |
| 4826 void set importedLibraries(List<LibraryElement> importedLibraries) { | 5231 void set importedLibraries(List<LibraryElement> importedLibraries) { |
| 4827 for (LibraryElement library in importedLibraries) { | 5232 for (LibraryElement library in importedLibraries) { |
| 4828 ((library as LibraryElementImpl)).enclosingElement = this; | 5233 (library as LibraryElementImpl).enclosingElement = this; |
| 4829 } | 5234 } |
| 4830 this._importedLibraries = importedLibraries; | 5235 this._importedLibraries = importedLibraries; |
| 4831 } | 5236 } |
| 5237 |
| 4832 void appendTo(JavaStringBuilder builder) { | 5238 void appendTo(JavaStringBuilder builder) { |
| 4833 builder.append("as "); | 5239 builder.append("as "); |
| 4834 super.appendTo(builder); | 5240 super.appendTo(builder); |
| 4835 } | 5241 } |
| 5242 |
| 4836 String get identifier => "_${super.identifier}"; | 5243 String get identifier => "_${super.identifier}"; |
| 4837 } | 5244 } |
| 5245 |
| 4838 /** | 5246 /** |
| 4839 * Instances of the class `PropertyAccessorElementImpl` implement a | 5247 * Instances of the class `PropertyAccessorElementImpl` implement a |
| 4840 * `PropertyAccessorElement`. | 5248 * `PropertyAccessorElement`. |
| 4841 * | 5249 * |
| 4842 * @coverage dart.engine.element | 5250 * @coverage dart.engine.element |
| 4843 */ | 5251 */ |
| 4844 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
rtyAccessorElement { | 5252 class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
rtyAccessorElement { |
| 4845 | |
| 4846 /** | 5253 /** |
| 4847 * The variable associated with this accessor. | 5254 * The variable associated with this accessor. |
| 4848 */ | 5255 */ |
| 4849 PropertyInducingElement _variable; | 5256 PropertyInducingElement _variable; |
| 4850 | 5257 |
| 4851 /** | 5258 /** |
| 4852 * An empty array of property accessor elements. | 5259 * An empty array of property accessor elements. |
| 4853 */ | 5260 */ |
| 4854 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl
ement>(0); | 5261 static List<PropertyAccessorElement> EMPTY_ARRAY = new List<PropertyAccessorEl
ement>(0); |
| 4855 | 5262 |
| 4856 /** | 5263 /** |
| 4857 * Initialize a newly created property accessor element to have the given name
. | 5264 * Initialize a newly created property accessor element to have the given name
. |
| 4858 * | 5265 * |
| 4859 * @param name the name of this element | 5266 * @param name the name of this element |
| 4860 */ | 5267 */ |
| 4861 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name); | 5268 PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name); |
| 4862 | 5269 |
| 4863 /** | 5270 /** |
| 4864 * Initialize a newly created synthetic property accessor element to be associ
ated with the given | 5271 * Initialize a newly created synthetic property accessor element to be associ
ated with the given |
| 4865 * variable. | 5272 * variable. |
| 4866 * | 5273 * |
| 4867 * @param variable the variable with which this access is associated | 5274 * @param variable the variable with which this access is associated |
| 4868 */ | 5275 */ |
| 4869 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable) : super
.con2(variable.name, variable.nameOffset) { | 5276 PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable) : super
.con2(variable.name, variable.nameOffset) { |
| 4870 this._variable = variable; | 5277 this._variable = variable; |
| 4871 synthetic = true; | 5278 synthetic = true; |
| 4872 } | 5279 } |
| 5280 |
| 4873 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 5281 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
| 4874 bool operator ==(Object object) => super == object && identical(isGetter, ((ob
ject as PropertyAccessorElement)).isGetter); | 5282 |
| 5283 bool operator ==(Object object) => super == object && identical(isGetter, (obj
ect as PropertyAccessorElement).isGetter); |
| 5284 |
| 4875 PropertyAccessorElement get correspondingGetter { | 5285 PropertyAccessorElement get correspondingGetter { |
| 4876 if (isGetter || _variable == null) { | 5286 if (isGetter || _variable == null) { |
| 4877 return null; | 5287 return null; |
| 4878 } | 5288 } |
| 4879 return _variable.getter; | 5289 return _variable.getter; |
| 4880 } | 5290 } |
| 5291 |
| 4881 PropertyAccessorElement get correspondingSetter { | 5292 PropertyAccessorElement get correspondingSetter { |
| 4882 if (isSetter || _variable == null) { | 5293 if (isSetter || _variable == null) { |
| 4883 return null; | 5294 return null; |
| 4884 } | 5295 } |
| 4885 return _variable.setter; | 5296 return _variable.setter; |
| 4886 } | 5297 } |
| 5298 |
| 4887 ElementKind get kind { | 5299 ElementKind get kind { |
| 4888 if (isGetter) { | 5300 if (isGetter) { |
| 4889 return ElementKind.GETTER; | 5301 return ElementKind.GETTER; |
| 4890 } | 5302 } |
| 4891 return ElementKind.SETTER; | 5303 return ElementKind.SETTER; |
| 4892 } | 5304 } |
| 5305 |
| 4893 String get name { | 5306 String get name { |
| 4894 if (isSetter) { | 5307 if (isSetter) { |
| 4895 return "${super.name}="; | 5308 return "${super.name}="; |
| 4896 } | 5309 } |
| 4897 return super.name; | 5310 return super.name; |
| 4898 } | 5311 } |
| 5312 |
| 4899 PropertyInducingElement get variable => _variable; | 5313 PropertyInducingElement get variable => _variable; |
| 5314 |
| 4900 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 5315 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 5316 |
| 4901 bool get isGetter => hasModifier(Modifier.GETTER); | 5317 bool get isGetter => hasModifier(Modifier.GETTER); |
| 5318 |
| 4902 bool get isSetter => hasModifier(Modifier.SETTER); | 5319 bool get isSetter => hasModifier(Modifier.SETTER); |
| 5320 |
| 4903 bool get isStatic => hasModifier(Modifier.STATIC); | 5321 bool get isStatic => hasModifier(Modifier.STATIC); |
| 4904 | 5322 |
| 4905 /** | 5323 /** |
| 4906 * Set whether this accessor is abstract to correspond to the given value. | 5324 * Set whether this accessor is abstract to correspond to the given value. |
| 4907 * | 5325 * |
| 4908 * @param isAbstract `true` if the accessor is abstract | 5326 * @param isAbstract `true` if the accessor is abstract |
| 4909 */ | 5327 */ |
| 4910 void set abstract(bool isAbstract) { | 5328 void set abstract(bool isAbstract) { |
| 4911 setModifier(Modifier.ABSTRACT, isAbstract); | 5329 setModifier(Modifier.ABSTRACT, isAbstract); |
| 4912 } | 5330 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4939 } | 5357 } |
| 4940 | 5358 |
| 4941 /** | 5359 /** |
| 4942 * Set the variable associated with this accessor to the given variable. | 5360 * Set the variable associated with this accessor to the given variable. |
| 4943 * | 5361 * |
| 4944 * @param variable the variable associated with this accessor | 5362 * @param variable the variable associated with this accessor |
| 4945 */ | 5363 */ |
| 4946 void set variable(PropertyInducingElement variable) { | 5364 void set variable(PropertyInducingElement variable) { |
| 4947 this._variable = variable; | 5365 this._variable = variable; |
| 4948 } | 5366 } |
| 5367 |
| 4949 void appendTo(JavaStringBuilder builder) { | 5368 void appendTo(JavaStringBuilder builder) { |
| 4950 builder.append(isGetter ? "get " : "set "); | 5369 builder.append(isGetter ? "get " : "set "); |
| 4951 builder.append(variable.displayName); | 5370 builder.append(variable.displayName); |
| 4952 super.appendTo(builder); | 5371 super.appendTo(builder); |
| 4953 } | 5372 } |
| 4954 } | 5373 } |
| 5374 |
| 4955 /** | 5375 /** |
| 4956 * Instances of the class `PropertyInducingElementImpl` implement a | 5376 * Instances of the class `PropertyInducingElementImpl` implement a |
| 4957 * `PropertyInducingElement`. | 5377 * `PropertyInducingElement`. |
| 4958 * | 5378 * |
| 4959 * @coverage dart.engine.element | 5379 * @coverage dart.engine.element |
| 4960 */ | 5380 */ |
| 4961 abstract class PropertyInducingElementImpl extends VariableElementImpl implement
s PropertyInducingElement { | 5381 abstract class PropertyInducingElementImpl extends VariableElementImpl implement
s PropertyInducingElement { |
| 4962 | |
| 4963 /** | 5382 /** |
| 4964 * The getter associated with this element. | 5383 * The getter associated with this element. |
| 4965 */ | 5384 */ |
| 4966 PropertyAccessorElement _getter; | 5385 PropertyAccessorElement _getter; |
| 4967 | 5386 |
| 4968 /** | 5387 /** |
| 4969 * The setter associated with this element, or `null` if the element is effect
ively | 5388 * The setter associated with this element, or `null` if the element is effect
ively |
| 4970 * `final` and therefore does not have a setter associated with it. | 5389 * `final` and therefore does not have a setter associated with it. |
| 4971 */ | 5390 */ |
| 4972 PropertyAccessorElement _setter; | 5391 PropertyAccessorElement _setter; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4984 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name); | 5403 PropertyInducingElementImpl.con1(Identifier name) : super.con1(name); |
| 4985 | 5404 |
| 4986 /** | 5405 /** |
| 4987 * Initialize a newly created synthetic element to have the given name. | 5406 * Initialize a newly created synthetic element to have the given name. |
| 4988 * | 5407 * |
| 4989 * @param name the name of this element | 5408 * @param name the name of this element |
| 4990 */ | 5409 */ |
| 4991 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { | 5410 PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) { |
| 4992 synthetic = true; | 5411 synthetic = true; |
| 4993 } | 5412 } |
| 5413 |
| 4994 PropertyAccessorElement get getter => _getter; | 5414 PropertyAccessorElement get getter => _getter; |
| 5415 |
| 4995 PropertyAccessorElement get setter => _setter; | 5416 PropertyAccessorElement get setter => _setter; |
| 4996 | 5417 |
| 4997 /** | 5418 /** |
| 4998 * Set the getter associated with this element to the given accessor. | 5419 * Set the getter associated with this element to the given accessor. |
| 4999 * | 5420 * |
| 5000 * @param getter the getter associated with this element | 5421 * @param getter the getter associated with this element |
| 5001 */ | 5422 */ |
| 5002 void set getter(PropertyAccessorElement getter) { | 5423 void set getter(PropertyAccessorElement getter) { |
| 5003 this._getter = getter; | 5424 this._getter = getter; |
| 5004 } | 5425 } |
| 5005 | 5426 |
| 5006 /** | 5427 /** |
| 5007 * Set the setter associated with this element to the given accessor. | 5428 * Set the setter associated with this element to the given accessor. |
| 5008 * | 5429 * |
| 5009 * @param setter the setter associated with this element | 5430 * @param setter the setter associated with this element |
| 5010 */ | 5431 */ |
| 5011 void set setter(PropertyAccessorElement setter) { | 5432 void set setter(PropertyAccessorElement setter) { |
| 5012 this._setter = setter; | 5433 this._setter = setter; |
| 5013 } | 5434 } |
| 5014 } | 5435 } |
| 5436 |
| 5015 /** | 5437 /** |
| 5016 * Instances of the class `ShowElementCombinatorImpl` implement a | 5438 * Instances of the class `ShowElementCombinatorImpl` implement a |
| 5017 * [ShowElementCombinator]. | 5439 * [ShowElementCombinator]. |
| 5018 * | 5440 * |
| 5019 * @coverage dart.engine.element | 5441 * @coverage dart.engine.element |
| 5020 */ | 5442 */ |
| 5021 class ShowElementCombinatorImpl implements ShowElementCombinator { | 5443 class ShowElementCombinatorImpl implements ShowElementCombinator { |
| 5022 | |
| 5023 /** | 5444 /** |
| 5024 * The names that are to be made visible in the importing library if they are
defined in the | 5445 * The names that are to be made visible in the importing library if they are
defined in the |
| 5025 * imported library. | 5446 * imported library. |
| 5026 */ | 5447 */ |
| 5027 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; | 5448 List<String> _shownNames = StringUtilities.EMPTY_ARRAY; |
| 5028 | 5449 |
| 5029 /** | 5450 /** |
| 5030 * The offset of the character immediately following the last character of thi
s node. | 5451 * The offset of the character immediately following the last character of thi
s node. |
| 5031 */ | 5452 */ |
| 5032 int _end = -1; | 5453 int _end = -1; |
| 5033 | 5454 |
| 5034 /** | 5455 /** |
| 5035 * The offset of the 'show' keyword of this element. | 5456 * The offset of the 'show' keyword of this element. |
| 5036 */ | 5457 */ |
| 5037 int _offset = 0; | 5458 int _offset = 0; |
| 5459 |
| 5038 int get end => _end; | 5460 int get end => _end; |
| 5461 |
| 5039 int get offset => _offset; | 5462 int get offset => _offset; |
| 5463 |
| 5040 List<String> get shownNames => _shownNames; | 5464 List<String> get shownNames => _shownNames; |
| 5041 | 5465 |
| 5042 /** | 5466 /** |
| 5043 * Set the the offset of the character immediately following the last characte
r of this node. | 5467 * Set the the offset of the character immediately following the last characte
r of this node. |
| 5044 */ | 5468 */ |
| 5045 void set end(int endOffset) { | 5469 void set end(int endOffset) { |
| 5046 this._end = endOffset; | 5470 this._end = endOffset; |
| 5047 } | 5471 } |
| 5048 | 5472 |
| 5049 /** | 5473 /** |
| 5050 * Sets the offset of the 'show' keyword of this directive. | 5474 * Sets the offset of the 'show' keyword of this directive. |
| 5051 */ | 5475 */ |
| 5052 void set offset(int offset) { | 5476 void set offset(int offset) { |
| 5053 this._offset = offset; | 5477 this._offset = offset; |
| 5054 } | 5478 } |
| 5055 | 5479 |
| 5056 /** | 5480 /** |
| 5057 * Set the names that are to be made visible in the importing library if they
are defined in the | 5481 * Set the names that are to be made visible in the importing library if they
are defined in the |
| 5058 * imported library to the given names. | 5482 * imported library to the given names. |
| 5059 * | 5483 * |
| 5060 * @param shownNames the names that are to be made visible in the importing li
brary | 5484 * @param shownNames the names that are to be made visible in the importing li
brary |
| 5061 */ | 5485 */ |
| 5062 void set shownNames(List<String> shownNames) { | 5486 void set shownNames(List<String> shownNames) { |
| 5063 this._shownNames = shownNames; | 5487 this._shownNames = shownNames; |
| 5064 } | 5488 } |
| 5489 |
| 5065 String toString() { | 5490 String toString() { |
| 5066 JavaStringBuilder builder = new JavaStringBuilder(); | 5491 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5067 builder.append("show "); | 5492 builder.append("show "); |
| 5068 int count = _shownNames.length; | 5493 int count = _shownNames.length; |
| 5069 for (int i = 0; i < count; i++) { | 5494 for (int i = 0; i < count; i++) { |
| 5070 if (i > 0) { | 5495 if (i > 0) { |
| 5071 builder.append(", "); | 5496 builder.append(", "); |
| 5072 } | 5497 } |
| 5073 builder.append(_shownNames[i]); | 5498 builder.append(_shownNames[i]); |
| 5074 } | 5499 } |
| 5075 return builder.toString(); | 5500 return builder.toString(); |
| 5076 } | 5501 } |
| 5077 } | 5502 } |
| 5503 |
| 5078 /** | 5504 /** |
| 5079 * Instances of the class `TopLevelVariableElementImpl` implement a | 5505 * Instances of the class `TopLevelVariableElementImpl` implement a |
| 5080 * `TopLevelVariableElement`. | 5506 * `TopLevelVariableElement`. |
| 5081 * | 5507 * |
| 5082 * @coverage dart.engine.element | 5508 * @coverage dart.engine.element |
| 5083 */ | 5509 */ |
| 5084 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements
TopLevelVariableElement { | 5510 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements
TopLevelVariableElement { |
| 5085 | |
| 5086 /** | 5511 /** |
| 5087 * An empty array of top-level variable elements. | 5512 * An empty array of top-level variable elements. |
| 5088 */ | 5513 */ |
| 5089 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl
ement>(0); | 5514 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl
ement>(0); |
| 5090 | 5515 |
| 5091 /** | 5516 /** |
| 5092 * Initialize a newly created top-level variable element to have the given nam
e. | 5517 * Initialize a newly created top-level variable element to have the given nam
e. |
| 5093 * | 5518 * |
| 5094 * @param name the name of this element | 5519 * @param name the name of this element |
| 5095 */ | 5520 */ |
| 5096 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name); | 5521 TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name); |
| 5097 | 5522 |
| 5098 /** | 5523 /** |
| 5099 * Initialize a newly created synthetic top-level variable element to have the
given name. | 5524 * Initialize a newly created synthetic top-level variable element to have the
given name. |
| 5100 * | 5525 * |
| 5101 * @param name the name of this element | 5526 * @param name the name of this element |
| 5102 */ | 5527 */ |
| 5103 TopLevelVariableElementImpl.con2(String name) : super.con2(name); | 5528 TopLevelVariableElementImpl.con2(String name) : super.con2(name); |
| 5529 |
| 5104 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); | 5530 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); |
| 5531 |
| 5105 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; | 5532 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; |
| 5533 |
| 5106 bool get isStatic => true; | 5534 bool get isStatic => true; |
| 5107 } | 5535 } |
| 5536 |
| 5108 /** | 5537 /** |
| 5109 * Instances of the class `TypeParameterElementImpl` implement a [TypeParameterE
lement]. | 5538 * Instances of the class `TypeParameterElementImpl` implement a [TypeParameterE
lement]. |
| 5110 * | 5539 * |
| 5111 * @coverage dart.engine.element | 5540 * @coverage dart.engine.element |
| 5112 */ | 5541 */ |
| 5113 class TypeParameterElementImpl extends ElementImpl implements TypeParameterEleme
nt { | 5542 class TypeParameterElementImpl extends ElementImpl implements TypeParameterEleme
nt { |
| 5114 | |
| 5115 /** | 5543 /** |
| 5116 * The type defined by this type parameter. | 5544 * The type defined by this type parameter. |
| 5117 */ | 5545 */ |
| 5118 TypeParameterType _type; | 5546 TypeParameterType _type; |
| 5119 | 5547 |
| 5120 /** | 5548 /** |
| 5121 * The type representing the bound associated with this parameter, or `null` i
f this | 5549 * The type representing the bound associated with this parameter, or `null` i
f this |
| 5122 * parameter does not have an explicit bound. | 5550 * parameter does not have an explicit bound. |
| 5123 */ | 5551 */ |
| 5124 Type2 _bound; | 5552 Type2 _bound; |
| 5125 | 5553 |
| 5126 /** | 5554 /** |
| 5127 * An empty array of type parameter elements. | 5555 * An empty array of type parameter elements. |
| 5128 */ | 5556 */ |
| 5129 static List<TypeParameterElement> EMPTY_ARRAY = new List<TypeParameterElement>
(0); | 5557 static List<TypeParameterElement> EMPTY_ARRAY = new List<TypeParameterElement>
(0); |
| 5130 | 5558 |
| 5131 /** | 5559 /** |
| 5132 * Initialize a newly created type parameter element to have the given name. | 5560 * Initialize a newly created type parameter element to have the given name. |
| 5133 * | 5561 * |
| 5134 * @param name the name of this element | 5562 * @param name the name of this element |
| 5135 */ | 5563 */ |
| 5136 TypeParameterElementImpl(Identifier name) : super.con1(name); | 5564 TypeParameterElementImpl(Identifier name) : super.con1(name); |
| 5565 |
| 5137 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); | 5566 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); |
| 5567 |
| 5138 Type2 get bound => _bound; | 5568 Type2 get bound => _bound; |
| 5569 |
| 5139 ElementKind get kind => ElementKind.TYPE_PARAMETER; | 5570 ElementKind get kind => ElementKind.TYPE_PARAMETER; |
| 5571 |
| 5140 TypeParameterType get type => _type; | 5572 TypeParameterType get type => _type; |
| 5141 | 5573 |
| 5142 /** | 5574 /** |
| 5143 * Set the type representing the bound associated with this parameter to the g
iven type. | 5575 * Set the type representing the bound associated with this parameter to the g
iven type. |
| 5144 * | 5576 * |
| 5145 * @param bound the type representing the bound associated with this parameter | 5577 * @param bound the type representing the bound associated with this parameter |
| 5146 */ | 5578 */ |
| 5147 void set bound(Type2 bound) { | 5579 void set bound(Type2 bound) { |
| 5148 this._bound = bound; | 5580 this._bound = bound; |
| 5149 } | 5581 } |
| 5150 | 5582 |
| 5151 /** | 5583 /** |
| 5152 * Set the type defined by this type parameter to the given type | 5584 * Set the type defined by this type parameter to the given type |
| 5153 * | 5585 * |
| 5154 * @param type the type defined by this type parameter | 5586 * @param type the type defined by this type parameter |
| 5155 */ | 5587 */ |
| 5156 void set type(TypeParameterType type) { | 5588 void set type(TypeParameterType type) { |
| 5157 this._type = type; | 5589 this._type = type; |
| 5158 } | 5590 } |
| 5591 |
| 5159 void appendTo(JavaStringBuilder builder) { | 5592 void appendTo(JavaStringBuilder builder) { |
| 5160 builder.append(displayName); | 5593 builder.append(displayName); |
| 5161 if (_bound != null) { | 5594 if (_bound != null) { |
| 5162 builder.append(" extends "); | 5595 builder.append(" extends "); |
| 5163 builder.append(_bound); | 5596 builder.append(_bound); |
| 5164 } | 5597 } |
| 5165 } | 5598 } |
| 5166 } | 5599 } |
| 5600 |
| 5167 /** | 5601 /** |
| 5168 * Instances of the class `VariableElementImpl` implement a `VariableElement`. | 5602 * Instances of the class `VariableElementImpl` implement a `VariableElement`. |
| 5169 * | 5603 * |
| 5170 * @coverage dart.engine.element | 5604 * @coverage dart.engine.element |
| 5171 */ | 5605 */ |
| 5172 abstract class VariableElementImpl extends ElementImpl implements VariableElemen
t { | 5606 abstract class VariableElementImpl extends ElementImpl implements VariableElemen
t { |
| 5173 | |
| 5174 /** | 5607 /** |
| 5175 * The declared type of this variable. | 5608 * The declared type of this variable. |
| 5176 */ | 5609 */ |
| 5177 Type2 _type; | 5610 Type2 _type; |
| 5178 | 5611 |
| 5179 /** | 5612 /** |
| 5180 * A synthetic function representing this variable's initializer, or `null` if
this variable | 5613 * A synthetic function representing this variable's initializer, or `null` if
this variable |
| 5181 * does not have an initializer. | 5614 * does not have an initializer. |
| 5182 */ | 5615 */ |
| 5183 FunctionElement _initializer; | 5616 FunctionElement _initializer; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5204 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO
ffset); | 5637 VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameO
ffset); |
| 5205 | 5638 |
| 5206 /** | 5639 /** |
| 5207 * Return the result of evaluating this variable's initializer as a compile-ti
me constant | 5640 * Return the result of evaluating this variable's initializer as a compile-ti
me constant |
| 5208 * expression, or `null` if this variable is not a 'const' variable or does no
t have an | 5641 * expression, or `null` if this variable is not a 'const' variable or does no
t have an |
| 5209 * initializer. | 5642 * initializer. |
| 5210 * | 5643 * |
| 5211 * @return the result of evaluating this variable's initializer | 5644 * @return the result of evaluating this variable's initializer |
| 5212 */ | 5645 */ |
| 5213 EvaluationResultImpl get evaluationResult => null; | 5646 EvaluationResultImpl get evaluationResult => null; |
| 5647 |
| 5214 FunctionElement get initializer => _initializer; | 5648 FunctionElement get initializer => _initializer; |
| 5649 |
| 5215 Type2 get type => _type; | 5650 Type2 get type => _type; |
| 5651 |
| 5216 bool get isConst => hasModifier(Modifier.CONST); | 5652 bool get isConst => hasModifier(Modifier.CONST); |
| 5653 |
| 5217 bool get isFinal => hasModifier(Modifier.FINAL); | 5654 bool get isFinal => hasModifier(Modifier.FINAL); |
| 5218 | 5655 |
| 5219 /** | 5656 /** |
| 5220 * Return `true` if this variable is potentially mutated somewhere in closure.
This | 5657 * Return `true` if this variable is potentially mutated somewhere in closure.
This |
| 5221 * information is only available for local variables (including parameters). | 5658 * information is only available for local variables (including parameters). |
| 5222 * | 5659 * |
| 5223 * @return `true` if this variable is potentially mutated somewhere in closure | 5660 * @return `true` if this variable is potentially mutated somewhere in closure |
| 5224 */ | 5661 */ |
| 5225 bool get isPotentiallyMutatedInClosure => false; | 5662 bool get isPotentiallyMutatedInClosure => false; |
| 5226 | 5663 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5260 setModifier(Modifier.FINAL, isFinal); | 5697 setModifier(Modifier.FINAL, isFinal); |
| 5261 } | 5698 } |
| 5262 | 5699 |
| 5263 /** | 5700 /** |
| 5264 * Set the function representing this variable's initializer to the given func
tion. | 5701 * Set the function representing this variable's initializer to the given func
tion. |
| 5265 * | 5702 * |
| 5266 * @param initializer the function representing this variable's initializer | 5703 * @param initializer the function representing this variable's initializer |
| 5267 */ | 5704 */ |
| 5268 void set initializer(FunctionElement initializer) { | 5705 void set initializer(FunctionElement initializer) { |
| 5269 if (initializer != null) { | 5706 if (initializer != null) { |
| 5270 ((initializer as FunctionElementImpl)).enclosingElement = this; | 5707 (initializer as FunctionElementImpl).enclosingElement = this; |
| 5271 } | 5708 } |
| 5272 this._initializer = initializer; | 5709 this._initializer = initializer; |
| 5273 } | 5710 } |
| 5274 | 5711 |
| 5275 /** | 5712 /** |
| 5276 * Set the declared type of this variable to the given type. | 5713 * Set the declared type of this variable to the given type. |
| 5277 * | 5714 * |
| 5278 * @param type the declared type of this variable | 5715 * @param type the declared type of this variable |
| 5279 */ | 5716 */ |
| 5280 void set type(Type2 type) { | 5717 void set type(Type2 type) { |
| 5281 this._type = type; | 5718 this._type = type; |
| 5282 } | 5719 } |
| 5720 |
| 5283 void visitChildren(ElementVisitor visitor) { | 5721 void visitChildren(ElementVisitor visitor) { |
| 5284 super.visitChildren(visitor); | 5722 super.visitChildren(visitor); |
| 5285 safelyVisitChild(_initializer, visitor); | 5723 safelyVisitChild(_initializer, visitor); |
| 5286 } | 5724 } |
| 5725 |
| 5287 void appendTo(JavaStringBuilder builder) { | 5726 void appendTo(JavaStringBuilder builder) { |
| 5288 builder.append(type); | 5727 builder.append(type); |
| 5289 builder.append(" "); | 5728 builder.append(" "); |
| 5290 builder.append(displayName); | 5729 builder.append(displayName); |
| 5291 } | 5730 } |
| 5292 } | 5731 } |
| 5732 |
| 5293 /** | 5733 /** |
| 5294 * Instances of the class `ConstructorMember` represent a constructor element de
fined in a | 5734 * Instances of the class `ConstructorMember` represent a constructor element de
fined in a |
| 5295 * parameterized type where the values of the type parameters are known. | 5735 * parameterized type where the values of the type parameters are known. |
| 5296 */ | 5736 */ |
| 5297 class ConstructorMember extends ExecutableMember implements ConstructorElement { | 5737 class ConstructorMember extends ExecutableMember implements ConstructorElement { |
| 5298 | |
| 5299 /** | 5738 /** |
| 5300 * If the given constructor's type is different when any type parameters from
the defining type's | 5739 * If the given constructor's type is different when any type parameters from
the defining type's |
| 5301 * declaration are replaced with the actual type arguments from the defining t
ype, create a | 5740 * declaration are replaced with the actual type arguments from the defining t
ype, create a |
| 5302 * constructor member representing the given constructor. Return the member th
at was created, or | 5741 * constructor member representing the given constructor. Return the member th
at was created, or |
| 5303 * the base constructor if no member was created. | 5742 * the base constructor if no member was created. |
| 5304 * | 5743 * |
| 5305 * @param baseConstructor the base constructor for which a member might be cre
ated | 5744 * @param baseConstructor the base constructor for which a member might be cre
ated |
| 5306 * @param definingType the type defining the parameters and arguments to be us
ed in the | 5745 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 5307 * substitution | 5746 * substitution |
| 5308 * @return the constructor element that will return the correctly substituted
types | 5747 * @return the constructor element that will return the correctly substituted
types |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5324 return new ConstructorMember(baseConstructor, definingType); | 5763 return new ConstructorMember(baseConstructor, definingType); |
| 5325 } | 5764 } |
| 5326 | 5765 |
| 5327 /** | 5766 /** |
| 5328 * Initialize a newly created element to represent a constructor of the given
parameterized type. | 5767 * Initialize a newly created element to represent a constructor of the given
parameterized type. |
| 5329 * | 5768 * |
| 5330 * @param baseElement the element on which the parameterized element was creat
ed | 5769 * @param baseElement the element on which the parameterized element was creat
ed |
| 5331 * @param definingType the type in which the element is defined | 5770 * @param definingType the type in which the element is defined |
| 5332 */ | 5771 */ |
| 5333 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType)
: super(baseElement, definingType); | 5772 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType)
: super(baseElement, definingType); |
| 5773 |
| 5334 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 5774 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 5775 |
| 5335 ConstructorElement get baseElement => super.baseElement as ConstructorElement; | 5776 ConstructorElement get baseElement => super.baseElement as ConstructorElement; |
| 5777 |
| 5336 ClassElement get enclosingElement => baseElement.enclosingElement; | 5778 ClassElement get enclosingElement => baseElement.enclosingElement; |
| 5779 |
| 5337 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon
structor, definingType); | 5780 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon
structor, definingType); |
| 5781 |
| 5338 bool get isConst => baseElement.isConst; | 5782 bool get isConst => baseElement.isConst; |
| 5783 |
| 5339 bool get isDefaultConstructor => baseElement.isDefaultConstructor; | 5784 bool get isDefaultConstructor => baseElement.isDefaultConstructor; |
| 5785 |
| 5340 bool get isFactory => baseElement.isFactory; | 5786 bool get isFactory => baseElement.isFactory; |
| 5787 |
| 5341 String toString() { | 5788 String toString() { |
| 5342 ConstructorElement baseElement = this.baseElement; | 5789 ConstructorElement baseElement = this.baseElement; |
| 5343 List<ParameterElement> parameters = this.parameters; | 5790 List<ParameterElement> parameters = this.parameters; |
| 5344 FunctionType type = this.type; | 5791 FunctionType type = this.type; |
| 5345 JavaStringBuilder builder = new JavaStringBuilder(); | 5792 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5346 builder.append(baseElement.enclosingElement.displayName); | 5793 builder.append(baseElement.enclosingElement.displayName); |
| 5347 String name = displayName; | 5794 String name = displayName; |
| 5348 if (name != null && !name.isEmpty) { | 5795 if (name != null && !name.isEmpty) { |
| 5349 builder.append("."); | 5796 builder.append("."); |
| 5350 builder.append(name); | 5797 builder.append(name); |
| 5351 } | 5798 } |
| 5352 builder.append("("); | 5799 builder.append("("); |
| 5353 int parameterCount = parameters.length; | 5800 int parameterCount = parameters.length; |
| 5354 for (int i = 0; i < parameterCount; i++) { | 5801 for (int i = 0; i < parameterCount; i++) { |
| 5355 if (i > 0) { | 5802 if (i > 0) { |
| 5356 builder.append(", "); | 5803 builder.append(", "); |
| 5357 } | 5804 } |
| 5358 builder.append(parameters[i]).toString(); | 5805 builder.append(parameters[i]).toString(); |
| 5359 } | 5806 } |
| 5360 builder.append(")"); | 5807 builder.append(")"); |
| 5361 if (type != null) { | 5808 if (type != null) { |
| 5362 builder.append(" -> "); | 5809 builder.append(" -> "); |
| 5363 builder.append(type.returnType); | 5810 builder.append(type.returnType); |
| 5364 } | 5811 } |
| 5365 return builder.toString(); | 5812 return builder.toString(); |
| 5366 } | 5813 } |
| 5814 |
| 5367 InterfaceType get definingType => super.definingType as InterfaceType; | 5815 InterfaceType get definingType => super.definingType as InterfaceType; |
| 5368 } | 5816 } |
| 5817 |
| 5369 /** | 5818 /** |
| 5370 * The abstract class `ExecutableMember` defines the behavior common to members
that represent | 5819 * The abstract class `ExecutableMember` defines the behavior common to members
that represent |
| 5371 * an executable element defined in a parameterized type where the values of the
type parameters are | 5820 * an executable element defined in a parameterized type where the values of the
type parameters are |
| 5372 * known. | 5821 * known. |
| 5373 */ | 5822 */ |
| 5374 abstract class ExecutableMember extends Member implements ExecutableElement { | 5823 abstract class ExecutableMember extends Member implements ExecutableElement { |
| 5375 | |
| 5376 /** | 5824 /** |
| 5377 * Initialize a newly created element to represent an executable element of th
e given | 5825 * Initialize a newly created element to represent an executable element of th
e given |
| 5378 * parameterized type. | 5826 * parameterized type. |
| 5379 * | 5827 * |
| 5380 * @param baseElement the element on which the parameterized element was creat
ed | 5828 * @param baseElement the element on which the parameterized element was creat
ed |
| 5381 * @param definingType the type in which the element is defined | 5829 * @param definingType the type in which the element is defined |
| 5382 */ | 5830 */ |
| 5383 ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) :
super(baseElement, definingType); | 5831 ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) :
super(baseElement, definingType); |
| 5832 |
| 5384 ExecutableElement get baseElement => super.baseElement as ExecutableElement; | 5833 ExecutableElement get baseElement => super.baseElement as ExecutableElement; |
| 5834 |
| 5385 List<FunctionElement> get functions { | 5835 List<FunctionElement> get functions { |
| 5386 throw new UnsupportedOperationException(); | 5836 throw new UnsupportedOperationException(); |
| 5387 } | 5837 } |
| 5838 |
| 5388 List<LabelElement> get labels => baseElement.labels; | 5839 List<LabelElement> get labels => baseElement.labels; |
| 5840 |
| 5389 List<LocalVariableElement> get localVariables { | 5841 List<LocalVariableElement> get localVariables { |
| 5390 throw new UnsupportedOperationException(); | 5842 throw new UnsupportedOperationException(); |
| 5391 } | 5843 } |
| 5844 |
| 5392 List<ParameterElement> get parameters { | 5845 List<ParameterElement> get parameters { |
| 5393 List<ParameterElement> baseParameters = baseElement.parameters; | 5846 List<ParameterElement> baseParameters = baseElement.parameters; |
| 5394 int parameterCount = baseParameters.length; | 5847 int parameterCount = baseParameters.length; |
| 5395 if (parameterCount == 0) { | 5848 if (parameterCount == 0) { |
| 5396 return baseParameters; | 5849 return baseParameters; |
| 5397 } | 5850 } |
| 5398 List<ParameterElement> parameterizedParameters = new List<ParameterElement>(
parameterCount); | 5851 List<ParameterElement> parameterizedParameters = new List<ParameterElement>(
parameterCount); |
| 5399 for (int i = 0; i < parameterCount; i++) { | 5852 for (int i = 0; i < parameterCount; i++) { |
| 5400 parameterizedParameters[i] = ParameterMember.from(baseParameters[i], defin
ingType); | 5853 parameterizedParameters[i] = ParameterMember.from(baseParameters[i], defin
ingType); |
| 5401 } | 5854 } |
| 5402 return parameterizedParameters; | 5855 return parameterizedParameters; |
| 5403 } | 5856 } |
| 5857 |
| 5404 Type2 get returnType => substituteFor(baseElement.returnType); | 5858 Type2 get returnType => substituteFor(baseElement.returnType); |
| 5859 |
| 5405 FunctionType get type => substituteFor(baseElement.type); | 5860 FunctionType get type => substituteFor(baseElement.type); |
| 5861 |
| 5406 bool get isOperator => baseElement.isOperator; | 5862 bool get isOperator => baseElement.isOperator; |
| 5863 |
| 5407 bool get isStatic => baseElement.isStatic; | 5864 bool get isStatic => baseElement.isStatic; |
| 5865 |
| 5408 void visitChildren(ElementVisitor visitor) { | 5866 void visitChildren(ElementVisitor visitor) { |
| 5409 super.visitChildren(visitor); | 5867 super.visitChildren(visitor); |
| 5410 safelyVisitChildren(baseElement.functions, visitor); | 5868 safelyVisitChildren(baseElement.functions, visitor); |
| 5411 safelyVisitChildren(labels, visitor); | 5869 safelyVisitChildren(labels, visitor); |
| 5412 safelyVisitChildren(baseElement.localVariables, visitor); | 5870 safelyVisitChildren(baseElement.localVariables, visitor); |
| 5413 safelyVisitChildren(parameters, visitor); | 5871 safelyVisitChildren(parameters, visitor); |
| 5414 } | 5872 } |
| 5415 } | 5873 } |
| 5874 |
| 5416 /** | 5875 /** |
| 5417 * Instances of the class `FieldMember` represent a field element defined in a p
arameterized | 5876 * Instances of the class `FieldMember` represent a field element defined in a p
arameterized |
| 5418 * type where the values of the type parameters are known. | 5877 * type where the values of the type parameters are known. |
| 5419 */ | 5878 */ |
| 5420 class FieldMember extends VariableMember implements FieldElement { | 5879 class FieldMember extends VariableMember implements FieldElement { |
| 5421 | |
| 5422 /** | 5880 /** |
| 5423 * If the given field's type is different when any type parameters from the de
fining type's | 5881 * If the given field's type is different when any type parameters from the de
fining type's |
| 5424 * declaration are replaced with the actual type arguments from the defining t
ype, create a field | 5882 * declaration are replaced with the actual type arguments from the defining t
ype, create a field |
| 5425 * member representing the given field. Return the member that was created, or
the base field if | 5883 * member representing the given field. Return the member that was created, or
the base field if |
| 5426 * no member was created. | 5884 * no member was created. |
| 5427 * | 5885 * |
| 5428 * @param baseField the base field for which a member might be created | 5886 * @param baseField the base field for which a member might be created |
| 5429 * @param definingType the type defining the parameters and arguments to be us
ed in the | 5887 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 5430 * substitution | 5888 * substitution |
| 5431 * @return the field element that will return the correctly substituted types | 5889 * @return the field element that will return the correctly substituted types |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5447 return new FieldMember(baseField, definingType); | 5905 return new FieldMember(baseField, definingType); |
| 5448 } | 5906 } |
| 5449 | 5907 |
| 5450 /** | 5908 /** |
| 5451 * Initialize a newly created element to represent a field of the given parame
terized type. | 5909 * Initialize a newly created element to represent a field of the given parame
terized type. |
| 5452 * | 5910 * |
| 5453 * @param baseElement the element on which the parameterized element was creat
ed | 5911 * @param baseElement the element on which the parameterized element was creat
ed |
| 5454 * @param definingType the type in which the element is defined | 5912 * @param definingType the type in which the element is defined |
| 5455 */ | 5913 */ |
| 5456 FieldMember(FieldElement baseElement, InterfaceType definingType) : super(base
Element, definingType); | 5914 FieldMember(FieldElement baseElement, InterfaceType definingType) : super(base
Element, definingType); |
| 5915 |
| 5457 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 5916 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
| 5917 |
| 5458 FieldElement get baseElement => super.baseElement as FieldElement; | 5918 FieldElement get baseElement => super.baseElement as FieldElement; |
| 5919 |
| 5459 ClassElement get enclosingElement => baseElement.enclosingElement; | 5920 ClassElement get enclosingElement => baseElement.enclosingElement; |
| 5921 |
| 5460 PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement.
getter, definingType); | 5922 PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement.
getter, definingType); |
| 5923 |
| 5461 PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement.
setter, definingType); | 5924 PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement.
setter, definingType); |
| 5925 |
| 5462 bool get isStatic => baseElement.isStatic; | 5926 bool get isStatic => baseElement.isStatic; |
| 5927 |
| 5463 InterfaceType get definingType => super.definingType as InterfaceType; | 5928 InterfaceType get definingType => super.definingType as InterfaceType; |
| 5464 } | 5929 } |
| 5930 |
| 5465 /** | 5931 /** |
| 5466 * The abstract class `Member` defines the behavior common to elements that repr
esent members | 5932 * The abstract class `Member` defines the behavior common to elements that repr
esent members |
| 5467 * of parameterized types. | 5933 * of parameterized types. |
| 5468 */ | 5934 */ |
| 5469 abstract class Member implements Element { | 5935 abstract class Member implements Element { |
| 5470 | |
| 5471 /** | 5936 /** |
| 5472 * The element on which the parameterized element was created. | 5937 * The element on which the parameterized element was created. |
| 5473 */ | 5938 */ |
| 5474 Element _baseElement; | 5939 Element _baseElement; |
| 5475 | 5940 |
| 5476 /** | 5941 /** |
| 5477 * The type in which the element is defined. | 5942 * The type in which the element is defined. |
| 5478 */ | 5943 */ |
| 5479 ParameterizedType _definingType; | 5944 ParameterizedType _definingType; |
| 5480 | 5945 |
| 5481 /** | 5946 /** |
| 5482 * Initialize a newly created element to represent the member of the given par
ameterized type. | 5947 * Initialize a newly created element to represent the member of the given par
ameterized type. |
| 5483 * | 5948 * |
| 5484 * @param baseElement the element on which the parameterized element was creat
ed | 5949 * @param baseElement the element on which the parameterized element was creat
ed |
| 5485 * @param definingType the type in which the element is defined | 5950 * @param definingType the type in which the element is defined |
| 5486 */ | 5951 */ |
| 5487 Member(Element baseElement, ParameterizedType definingType) { | 5952 Member(Element baseElement, ParameterizedType definingType) { |
| 5488 this._baseElement = baseElement; | 5953 this._baseElement = baseElement; |
| 5489 this._definingType = definingType; | 5954 this._definingType = definingType; |
| 5490 } | 5955 } |
| 5956 |
| 5491 String computeDocumentationComment() => _baseElement.computeDocumentationComme
nt(); | 5957 String computeDocumentationComment() => _baseElement.computeDocumentationComme
nt(); |
| 5958 |
| 5492 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass
); | 5959 Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass
); |
| 5493 | 5960 |
| 5494 /** | 5961 /** |
| 5495 * Return the element on which the parameterized element was created. | 5962 * Return the element on which the parameterized element was created. |
| 5496 * | 5963 * |
| 5497 * @return the element on which the parameterized element was created | 5964 * @return the element on which the parameterized element was created |
| 5498 */ | 5965 */ |
| 5499 Element get baseElement => _baseElement; | 5966 Element get baseElement => _baseElement; |
| 5967 |
| 5500 AnalysisContext get context => _baseElement.context; | 5968 AnalysisContext get context => _baseElement.context; |
| 5969 |
| 5501 String get displayName => _baseElement.displayName; | 5970 String get displayName => _baseElement.displayName; |
| 5971 |
| 5502 ElementKind get kind => _baseElement.kind; | 5972 ElementKind get kind => _baseElement.kind; |
| 5973 |
| 5503 LibraryElement get library => _baseElement.library; | 5974 LibraryElement get library => _baseElement.library; |
| 5975 |
| 5504 ElementLocation get location => _baseElement.location; | 5976 ElementLocation get location => _baseElement.location; |
| 5977 |
| 5505 List<ElementAnnotation> get metadata => _baseElement.metadata; | 5978 List<ElementAnnotation> get metadata => _baseElement.metadata; |
| 5979 |
| 5506 String get name => _baseElement.name; | 5980 String get name => _baseElement.name; |
| 5981 |
| 5507 int get nameOffset => _baseElement.nameOffset; | 5982 int get nameOffset => _baseElement.nameOffset; |
| 5983 |
| 5508 Source get source => _baseElement.source; | 5984 Source get source => _baseElement.source; |
| 5985 |
| 5509 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib
rary); | 5986 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib
rary); |
| 5987 |
| 5988 bool get isDeprecated => _baseElement.isDeprecated; |
| 5989 |
| 5510 bool get isSynthetic => _baseElement.isSynthetic; | 5990 bool get isSynthetic => _baseElement.isSynthetic; |
| 5991 |
| 5511 void visitChildren(ElementVisitor visitor) { | 5992 void visitChildren(ElementVisitor visitor) { |
| 5512 } | 5993 } |
| 5513 | 5994 |
| 5514 /** | 5995 /** |
| 5515 * Return the type in which the element is defined. | 5996 * Return the type in which the element is defined. |
| 5516 * | 5997 * |
| 5517 * @return the type in which the element is defined | 5998 * @return the type in which the element is defined |
| 5518 */ | 5999 */ |
| 5519 ParameterizedType get definingType => _definingType; | 6000 ParameterizedType get definingType => _definingType; |
| 5520 | 6001 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5566 */ | 6047 */ |
| 5567 List<InterfaceType> substituteFor2(List<InterfaceType> types) { | 6048 List<InterfaceType> substituteFor2(List<InterfaceType> types) { |
| 5568 int count = types.length; | 6049 int count = types.length; |
| 5569 List<InterfaceType> substitutedTypes = new List<InterfaceType>(count); | 6050 List<InterfaceType> substitutedTypes = new List<InterfaceType>(count); |
| 5570 for (int i = 0; i < count; i++) { | 6051 for (int i = 0; i < count; i++) { |
| 5571 substitutedTypes[i] = substituteFor(types[i]); | 6052 substitutedTypes[i] = substituteFor(types[i]); |
| 5572 } | 6053 } |
| 5573 return substitutedTypes; | 6054 return substitutedTypes; |
| 5574 } | 6055 } |
| 5575 } | 6056 } |
| 6057 |
| 5576 /** | 6058 /** |
| 5577 * Instances of the class `MethodMember` represent a method element defined in a
parameterized | 6059 * Instances of the class `MethodMember` represent a method element defined in a
parameterized |
| 5578 * type where the values of the type parameters are known. | 6060 * type where the values of the type parameters are known. |
| 5579 */ | 6061 */ |
| 5580 class MethodMember extends ExecutableMember implements MethodElement { | 6062 class MethodMember extends ExecutableMember implements MethodElement { |
| 5581 | |
| 5582 /** | 6063 /** |
| 5583 * If the given method's type is different when any type parameters from the d
efining type's | 6064 * If the given method's type is different when any type parameters from the d
efining type's |
| 5584 * declaration are replaced with the actual type arguments from the defining t
ype, create a method | 6065 * declaration are replaced with the actual type arguments from the defining t
ype, create a method |
| 5585 * member representing the given method. Return the member that was created, o
r the base method if | 6066 * member representing the given method. Return the member that was created, o
r the base method if |
| 5586 * no member was created. | 6067 * no member was created. |
| 5587 * | 6068 * |
| 5588 * @param baseMethod the base method for which a member might be created | 6069 * @param baseMethod the base method for which a member might be created |
| 5589 * @param definingType the type defining the parameters and arguments to be us
ed in the | 6070 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 5590 * substitution | 6071 * substitution |
| 5591 * @return the method element that will return the correctly substituted types | 6072 * @return the method element that will return the correctly substituted types |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5604 return new MethodMember(baseMethod, definingType); | 6085 return new MethodMember(baseMethod, definingType); |
| 5605 } | 6086 } |
| 5606 | 6087 |
| 5607 /** | 6088 /** |
| 5608 * Initialize a newly created element to represent a method of the given param
eterized type. | 6089 * Initialize a newly created element to represent a method of the given param
eterized type. |
| 5609 * | 6090 * |
| 5610 * @param baseElement the element on which the parameterized element was creat
ed | 6091 * @param baseElement the element on which the parameterized element was creat
ed |
| 5611 * @param definingType the type in which the element is defined | 6092 * @param definingType the type in which the element is defined |
| 5612 */ | 6093 */ |
| 5613 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba
seElement, definingType); | 6094 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba
seElement, definingType); |
| 6095 |
| 5614 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 6096 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
| 6097 |
| 5615 MethodElement get baseElement => super.baseElement as MethodElement; | 6098 MethodElement get baseElement => super.baseElement as MethodElement; |
| 6099 |
| 5616 ClassElement get enclosingElement => baseElement.enclosingElement; | 6100 ClassElement get enclosingElement => baseElement.enclosingElement; |
| 6101 |
| 5617 bool get isAbstract => baseElement.isAbstract; | 6102 bool get isAbstract => baseElement.isAbstract; |
| 6103 |
| 5618 String toString() { | 6104 String toString() { |
| 5619 MethodElement baseElement = this.baseElement; | 6105 MethodElement baseElement = this.baseElement; |
| 5620 List<ParameterElement> parameters = this.parameters; | 6106 List<ParameterElement> parameters = this.parameters; |
| 5621 FunctionType type = this.type; | 6107 FunctionType type = this.type; |
| 5622 JavaStringBuilder builder = new JavaStringBuilder(); | 6108 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5623 builder.append(baseElement.enclosingElement.displayName); | 6109 builder.append(baseElement.enclosingElement.displayName); |
| 5624 builder.append("."); | 6110 builder.append("."); |
| 5625 builder.append(baseElement.displayName); | 6111 builder.append(baseElement.displayName); |
| 5626 builder.append("("); | 6112 builder.append("("); |
| 5627 int parameterCount = parameters.length; | 6113 int parameterCount = parameters.length; |
| 5628 for (int i = 0; i < parameterCount; i++) { | 6114 for (int i = 0; i < parameterCount; i++) { |
| 5629 if (i > 0) { | 6115 if (i > 0) { |
| 5630 builder.append(", "); | 6116 builder.append(", "); |
| 5631 } | 6117 } |
| 5632 builder.append(parameters[i]).toString(); | 6118 builder.append(parameters[i]).toString(); |
| 5633 } | 6119 } |
| 5634 builder.append(")"); | 6120 builder.append(")"); |
| 5635 if (type != null) { | 6121 if (type != null) { |
| 5636 builder.append(" -> "); | 6122 builder.append(" -> "); |
| 5637 builder.append(type.returnType); | 6123 builder.append(type.returnType); |
| 5638 } | 6124 } |
| 5639 return builder.toString(); | 6125 return builder.toString(); |
| 5640 } | 6126 } |
| 5641 } | 6127 } |
| 6128 |
| 5642 /** | 6129 /** |
| 5643 * Instances of the class `ParameterMember` represent a parameter element define
d in a | 6130 * Instances of the class `ParameterMember` represent a parameter element define
d in a |
| 5644 * parameterized type where the values of the type parameters are known. | 6131 * parameterized type where the values of the type parameters are known. |
| 5645 */ | 6132 */ |
| 5646 class ParameterMember extends VariableMember implements ParameterElement { | 6133 class ParameterMember extends VariableMember implements ParameterElement { |
| 5647 | |
| 5648 /** | 6134 /** |
| 5649 * If the given parameter's type is different when any type parameters from th
e defining type's | 6135 * If the given parameter's type is different when any type parameters from th
e defining type's |
| 5650 * declaration are replaced with the actual type arguments from the defining t
ype, create a | 6136 * declaration are replaced with the actual type arguments from the defining t
ype, create a |
| 5651 * parameter member representing the given parameter. Return the member that w
as created, or the | 6137 * parameter member representing the given parameter. Return the member that w
as created, or the |
| 5652 * base parameter if no member was created. | 6138 * base parameter if no member was created. |
| 5653 * | 6139 * |
| 5654 * @param baseParameter the base parameter for which a member might be created | 6140 * @param baseParameter the base parameter for which a member might be created |
| 5655 * @param definingType the type defining the parameters and arguments to be us
ed in the | 6141 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 5656 * substitution | 6142 * substitution |
| 5657 * @return the parameter element that will return the correctly substituted ty
pes | 6143 * @return the parameter element that will return the correctly substituted ty
pes |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5672 return new ParameterMember(baseParameter, definingType); | 6158 return new ParameterMember(baseParameter, definingType); |
| 5673 } | 6159 } |
| 5674 | 6160 |
| 5675 /** | 6161 /** |
| 5676 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. | 6162 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. |
| 5677 * | 6163 * |
| 5678 * @param baseElement the element on which the parameterized element was creat
ed | 6164 * @param baseElement the element on which the parameterized element was creat
ed |
| 5679 * @param definingType the type in which the element is defined | 6165 * @param definingType the type in which the element is defined |
| 5680 */ | 6166 */ |
| 5681 ParameterMember(ParameterElement baseElement, ParameterizedType definingType)
: super(baseElement, definingType); | 6167 ParameterMember(ParameterElement baseElement, ParameterizedType definingType)
: super(baseElement, definingType); |
| 6168 |
| 5682 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); | 6169 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
| 6170 |
| 5683 Element getAncestor(Type elementClass) { | 6171 Element getAncestor(Type elementClass) { |
| 5684 Element element = baseElement.getAncestor(elementClass); | 6172 Element element = baseElement.getAncestor(elementClass); |
| 5685 ParameterizedType definingType = this.definingType; | 6173 ParameterizedType definingType = this.definingType; |
| 5686 if (definingType is InterfaceType) { | 6174 if (definingType is InterfaceType) { |
| 5687 InterfaceType definingInterfaceType = definingType as InterfaceType; | 6175 InterfaceType definingInterfaceType = definingType as InterfaceType; |
| 5688 if (element is ConstructorElement) { | 6176 if (element is ConstructorElement) { |
| 5689 return ConstructorMember.from(element as ConstructorElement, definingInt
erfaceType) as Element; | 6177 return ConstructorMember.from(element as ConstructorElement, definingInt
erfaceType) as Element; |
| 5690 } else if (element is MethodElement) { | 6178 } else if (element is MethodElement) { |
| 5691 return MethodMember.from(element as MethodElement, definingInterfaceType
) as Element; | 6179 return MethodMember.from(element as MethodElement, definingInterfaceType
) as Element; |
| 5692 } else if (element is PropertyAccessorElement) { | 6180 } else if (element is PropertyAccessorElement) { |
| 5693 return PropertyAccessorMember.from(element as PropertyAccessorElement, d
efiningInterfaceType) as Element; | 6181 return PropertyAccessorMember.from(element as PropertyAccessorElement, d
efiningInterfaceType) as Element; |
| 5694 } | 6182 } |
| 5695 } | 6183 } |
| 5696 return element; | 6184 return element; |
| 5697 } | 6185 } |
| 6186 |
| 5698 ParameterElement get baseElement => super.baseElement as ParameterElement; | 6187 ParameterElement get baseElement => super.baseElement as ParameterElement; |
| 6188 |
| 5699 SourceRange get defaultValueRange => baseElement.defaultValueRange; | 6189 SourceRange get defaultValueRange => baseElement.defaultValueRange; |
| 6190 |
| 5700 Element get enclosingElement => baseElement.enclosingElement; | 6191 Element get enclosingElement => baseElement.enclosingElement; |
| 6192 |
| 5701 ParameterKind get parameterKind => baseElement.parameterKind; | 6193 ParameterKind get parameterKind => baseElement.parameterKind; |
| 6194 |
| 5702 List<ParameterElement> get parameters { | 6195 List<ParameterElement> get parameters { |
| 5703 List<ParameterElement> baseParameters = baseElement.parameters; | 6196 List<ParameterElement> baseParameters = baseElement.parameters; |
| 5704 int parameterCount = baseParameters.length; | 6197 int parameterCount = baseParameters.length; |
| 5705 if (parameterCount == 0) { | 6198 if (parameterCount == 0) { |
| 5706 return baseParameters; | 6199 return baseParameters; |
| 5707 } | 6200 } |
| 5708 List<ParameterElement> parameterizedParameters = new List<ParameterElement>(
parameterCount); | 6201 List<ParameterElement> parameterizedParameters = new List<ParameterElement>(
parameterCount); |
| 5709 for (int i = 0; i < parameterCount; i++) { | 6202 for (int i = 0; i < parameterCount; i++) { |
| 5710 parameterizedParameters[i] = ParameterMember.from(baseParameters[i], defin
ingType); | 6203 parameterizedParameters[i] = ParameterMember.from(baseParameters[i], defin
ingType); |
| 5711 } | 6204 } |
| 5712 return parameterizedParameters; | 6205 return parameterizedParameters; |
| 5713 } | 6206 } |
| 6207 |
| 5714 SourceRange get visibleRange => baseElement.visibleRange; | 6208 SourceRange get visibleRange => baseElement.visibleRange; |
| 6209 |
| 5715 bool get isInitializingFormal => baseElement.isInitializingFormal; | 6210 bool get isInitializingFormal => baseElement.isInitializingFormal; |
| 6211 |
| 5716 String toString() { | 6212 String toString() { |
| 5717 ParameterElement baseElement = this.baseElement; | 6213 ParameterElement baseElement = this.baseElement; |
| 5718 String left = ""; | 6214 String left = ""; |
| 5719 String right = ""; | 6215 String right = ""; |
| 5720 while (true) { | 6216 while (true) { |
| 5721 if (baseElement.parameterKind == ParameterKind.NAMED) { | 6217 if (baseElement.parameterKind == ParameterKind.NAMED) { |
| 5722 left = "{"; | 6218 left = "{"; |
| 5723 right = "}"; | 6219 right = "}"; |
| 5724 } else if (baseElement.parameterKind == ParameterKind.POSITIONAL) { | 6220 } else if (baseElement.parameterKind == ParameterKind.POSITIONAL) { |
| 5725 left = "["; | 6221 left = "["; |
| 5726 right = "]"; | 6222 right = "]"; |
| 5727 } | 6223 } |
| 5728 break; | 6224 break; |
| 5729 } | 6225 } |
| 5730 JavaStringBuilder builder = new JavaStringBuilder(); | 6226 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5731 builder.append(left); | 6227 builder.append(left); |
| 5732 builder.append(type); | 6228 builder.append(type); |
| 5733 builder.append(" "); | 6229 builder.append(" "); |
| 5734 builder.append(baseElement.displayName); | 6230 builder.append(baseElement.displayName); |
| 5735 builder.append(right); | 6231 builder.append(right); |
| 5736 return builder.toString(); | 6232 return builder.toString(); |
| 5737 } | 6233 } |
| 6234 |
| 5738 void visitChildren(ElementVisitor visitor) { | 6235 void visitChildren(ElementVisitor visitor) { |
| 5739 super.visitChildren(visitor); | 6236 super.visitChildren(visitor); |
| 5740 safelyVisitChildren(parameters, visitor); | 6237 safelyVisitChildren(parameters, visitor); |
| 5741 } | 6238 } |
| 5742 } | 6239 } |
| 6240 |
| 5743 /** | 6241 /** |
| 5744 * Instances of the class `PropertyAccessorMember` represent a property accessor
element | 6242 * Instances of the class `PropertyAccessorMember` represent a property accessor
element |
| 5745 * defined in a parameterized type where the values of the type parameters are k
nown. | 6243 * defined in a parameterized type where the values of the type parameters are k
nown. |
| 5746 */ | 6244 */ |
| 5747 class PropertyAccessorMember extends ExecutableMember implements PropertyAccesso
rElement { | 6245 class PropertyAccessorMember extends ExecutableMember implements PropertyAccesso
rElement { |
| 5748 | |
| 5749 /** | 6246 /** |
| 5750 * If the given property accessor's type is different when any type parameters
from the defining | 6247 * If the given property accessor's type is different when any type parameters
from the defining |
| 5751 * type's declaration are replaced with the actual type arguments from the def
ining type, create a | 6248 * type's declaration are replaced with the actual type arguments from the def
ining type, create a |
| 5752 * property accessor member representing the given property accessor. Return t
he member that was | 6249 * property accessor member representing the given property accessor. Return t
he member that was |
| 5753 * created, or the base accessor if no member was created. | 6250 * created, or the base accessor if no member was created. |
| 5754 * | 6251 * |
| 5755 * @param baseAccessor the base property accessor for which a member might be
created | 6252 * @param baseAccessor the base property accessor for which a member might be
created |
| 5756 * @param definingType the type defining the parameters and arguments to be us
ed in the | 6253 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 5757 * substitution | 6254 * substitution |
| 5758 * @return the property accessor element that will return the correctly substi
tuted types | 6255 * @return the property accessor element that will return the correctly substi
tuted types |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5772 } | 6269 } |
| 5773 | 6270 |
| 5774 /** | 6271 /** |
| 5775 * Initialize a newly created element to represent a property accessor of the
given parameterized | 6272 * Initialize a newly created element to represent a property accessor of the
given parameterized |
| 5776 * type. | 6273 * type. |
| 5777 * | 6274 * |
| 5778 * @param baseElement the element on which the parameterized element was creat
ed | 6275 * @param baseElement the element on which the parameterized element was creat
ed |
| 5779 * @param definingType the type in which the element is defined | 6276 * @param definingType the type in which the element is defined |
| 5780 */ | 6277 */ |
| 5781 PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType defi
ningType) : super(baseElement, definingType); | 6278 PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType defi
ningType) : super(baseElement, definingType); |
| 6279 |
| 5782 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 6280 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
| 6281 |
| 5783 PropertyAccessorElement get baseElement => super.baseElement as PropertyAccess
orElement; | 6282 PropertyAccessorElement get baseElement => super.baseElement as PropertyAccess
orElement; |
| 6283 |
| 5784 PropertyAccessorElement get correspondingGetter => from(baseElement.correspond
ingGetter, definingType); | 6284 PropertyAccessorElement get correspondingGetter => from(baseElement.correspond
ingGetter, definingType); |
| 6285 |
| 5785 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond
ingSetter, definingType); | 6286 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond
ingSetter, definingType); |
| 6287 |
| 5786 Element get enclosingElement => baseElement.enclosingElement; | 6288 Element get enclosingElement => baseElement.enclosingElement; |
| 6289 |
| 5787 PropertyInducingElement get variable { | 6290 PropertyInducingElement get variable { |
| 5788 PropertyInducingElement variable = baseElement.variable; | 6291 PropertyInducingElement variable = baseElement.variable; |
| 5789 if (variable is FieldElement) { | 6292 if (variable is FieldElement) { |
| 5790 return FieldMember.from(variable as FieldElement, definingType); | 6293 return FieldMember.from(variable as FieldElement, definingType); |
| 5791 } | 6294 } |
| 5792 return variable; | 6295 return variable; |
| 5793 } | 6296 } |
| 6297 |
| 5794 bool get isAbstract => baseElement.isAbstract; | 6298 bool get isAbstract => baseElement.isAbstract; |
| 6299 |
| 5795 bool get isGetter => baseElement.isGetter; | 6300 bool get isGetter => baseElement.isGetter; |
| 6301 |
| 5796 bool get isSetter => baseElement.isSetter; | 6302 bool get isSetter => baseElement.isSetter; |
| 6303 |
| 5797 String toString() { | 6304 String toString() { |
| 5798 PropertyAccessorElement baseElement = this.baseElement; | 6305 PropertyAccessorElement baseElement = this.baseElement; |
| 5799 List<ParameterElement> parameters = this.parameters; | 6306 List<ParameterElement> parameters = this.parameters; |
| 5800 FunctionType type = this.type; | 6307 FunctionType type = this.type; |
| 5801 JavaStringBuilder builder = new JavaStringBuilder(); | 6308 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5802 if (isGetter) { | 6309 if (isGetter) { |
| 5803 builder.append("get "); | 6310 builder.append("get "); |
| 5804 } else { | 6311 } else { |
| 5805 builder.append("set "); | 6312 builder.append("set "); |
| 5806 } | 6313 } |
| 5807 builder.append(baseElement.enclosingElement.displayName); | 6314 builder.append(baseElement.enclosingElement.displayName); |
| 5808 builder.append("."); | 6315 builder.append("."); |
| 5809 builder.append(baseElement.displayName); | 6316 builder.append(baseElement.displayName); |
| 5810 builder.append("("); | 6317 builder.append("("); |
| 5811 int parameterCount = parameters.length; | 6318 int parameterCount = parameters.length; |
| 5812 for (int i = 0; i < parameterCount; i++) { | 6319 for (int i = 0; i < parameterCount; i++) { |
| 5813 if (i > 0) { | 6320 if (i > 0) { |
| 5814 builder.append(", "); | 6321 builder.append(", "); |
| 5815 } | 6322 } |
| 5816 builder.append(parameters[i]).toString(); | 6323 builder.append(parameters[i]).toString(); |
| 5817 } | 6324 } |
| 5818 builder.append(")"); | 6325 builder.append(")"); |
| 5819 if (type != null) { | 6326 if (type != null) { |
| 5820 builder.append(" -> "); | 6327 builder.append(" -> "); |
| 5821 builder.append(type.returnType); | 6328 builder.append(type.returnType); |
| 5822 } | 6329 } |
| 5823 return builder.toString(); | 6330 return builder.toString(); |
| 5824 } | 6331 } |
| 6332 |
| 5825 InterfaceType get definingType => super.definingType as InterfaceType; | 6333 InterfaceType get definingType => super.definingType as InterfaceType; |
| 5826 } | 6334 } |
| 6335 |
| 5827 /** | 6336 /** |
| 5828 * The abstract class `VariableMember` defines the behavior common to members th
at represent a | 6337 * The abstract class `VariableMember` defines the behavior common to members th
at represent a |
| 5829 * variable element defined in a parameterized type where the values of the type
parameters are | 6338 * variable element defined in a parameterized type where the values of the type
parameters are |
| 5830 * known. | 6339 * known. |
| 5831 */ | 6340 */ |
| 5832 abstract class VariableMember extends Member implements VariableElement { | 6341 abstract class VariableMember extends Member implements VariableElement { |
| 5833 | |
| 5834 /** | 6342 /** |
| 5835 * Initialize a newly created element to represent an executable element of th
e given | 6343 * Initialize a newly created element to represent an executable element of th
e given |
| 5836 * parameterized type. | 6344 * parameterized type. |
| 5837 * | 6345 * |
| 5838 * @param baseElement the element on which the parameterized element was creat
ed | 6346 * @param baseElement the element on which the parameterized element was creat
ed |
| 5839 * @param definingType the type in which the element is defined | 6347 * @param definingType the type in which the element is defined |
| 5840 */ | 6348 */ |
| 5841 VariableMember(VariableElement baseElement, ParameterizedType definingType) :
super(baseElement, definingType); | 6349 VariableMember(VariableElement baseElement, ParameterizedType definingType) :
super(baseElement, definingType); |
| 6350 |
| 5842 VariableElement get baseElement => super.baseElement as VariableElement; | 6351 VariableElement get baseElement => super.baseElement as VariableElement; |
| 6352 |
| 5843 FunctionElement get initializer { | 6353 FunctionElement get initializer { |
| 5844 throw new UnsupportedOperationException(); | 6354 throw new UnsupportedOperationException(); |
| 5845 } | 6355 } |
| 6356 |
| 5846 Type2 get type => substituteFor(baseElement.type); | 6357 Type2 get type => substituteFor(baseElement.type); |
| 6358 |
| 5847 bool get isConst => baseElement.isConst; | 6359 bool get isConst => baseElement.isConst; |
| 6360 |
| 5848 bool get isFinal => baseElement.isFinal; | 6361 bool get isFinal => baseElement.isFinal; |
| 6362 |
| 5849 void visitChildren(ElementVisitor visitor) { | 6363 void visitChildren(ElementVisitor visitor) { |
| 5850 super.visitChildren(visitor); | 6364 super.visitChildren(visitor); |
| 5851 safelyVisitChild(baseElement.initializer, visitor); | 6365 safelyVisitChild(baseElement.initializer, visitor); |
| 5852 } | 6366 } |
| 5853 } | 6367 } |
| 6368 |
| 5854 /** | 6369 /** |
| 5855 * The unique instance of the class `BottomTypeImpl` implements the type `bottom
`. | 6370 * The unique instance of the class `BottomTypeImpl` implements the type `bottom
`. |
| 5856 * | 6371 * |
| 5857 * @coverage dart.engine.type | 6372 * @coverage dart.engine.type |
| 5858 */ | 6373 */ |
| 5859 class BottomTypeImpl extends TypeImpl { | 6374 class BottomTypeImpl extends TypeImpl { |
| 5860 | |
| 5861 /** | 6375 /** |
| 5862 * The unique instance of this class. | 6376 * The unique instance of this class. |
| 5863 */ | 6377 */ |
| 5864 static final BottomTypeImpl instance = new BottomTypeImpl(); | 6378 static final BottomTypeImpl instance = new BottomTypeImpl(); |
| 5865 | 6379 |
| 5866 /** | 6380 /** |
| 5867 * Prevent the creation of instances of this class. | 6381 * Prevent the creation of instances of this class. |
| 5868 */ | 6382 */ |
| 5869 BottomTypeImpl() : super(null, "<bottom>"); | 6383 BottomTypeImpl() : super(null, "<bottom>"); |
| 6384 |
| 5870 bool operator ==(Object object) => identical(object, this); | 6385 bool operator ==(Object object) => identical(object, this); |
| 6386 |
| 5871 bool get isBottom => true; | 6387 bool get isBottom => true; |
| 6388 |
| 5872 bool isMoreSpecificThan3(Type2 type, bool withDynamic) => true; | 6389 bool isMoreSpecificThan3(Type2 type, bool withDynamic) => true; |
| 6390 |
| 5873 bool isSubtypeOf(Type2 type) => true; | 6391 bool isSubtypeOf(Type2 type) => true; |
| 6392 |
| 5874 bool isSupertypeOf(Type2 type) => false; | 6393 bool isSupertypeOf(Type2 type) => false; |
| 6394 |
| 5875 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp
es) => this; | 6395 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp
es) => this; |
| 5876 } | 6396 } |
| 6397 |
| 5877 /** | 6398 /** |
| 5878 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam
ic`. | 6399 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam
ic`. |
| 5879 * | 6400 * |
| 5880 * @coverage dart.engine.type | 6401 * @coverage dart.engine.type |
| 5881 */ | 6402 */ |
| 5882 class DynamicTypeImpl extends TypeImpl { | 6403 class DynamicTypeImpl extends TypeImpl { |
| 5883 | |
| 5884 /** | 6404 /** |
| 5885 * The unique instance of this class. | 6405 * The unique instance of this class. |
| 5886 */ | 6406 */ |
| 5887 static final DynamicTypeImpl instance = new DynamicTypeImpl(); | 6407 static final DynamicTypeImpl instance = new DynamicTypeImpl(); |
| 5888 | 6408 |
| 5889 /** | 6409 /** |
| 5890 * Prevent the creation of instances of this class. | 6410 * Prevent the creation of instances of this class. |
| 5891 */ | 6411 */ |
| 5892 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { | 6412 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { |
| 5893 ((element as DynamicElementImpl)).type = this; | 6413 (element as DynamicElementImpl).type = this; |
| 5894 } | 6414 } |
| 6415 |
| 5895 bool operator ==(Object object) => object is DynamicTypeImpl; | 6416 bool operator ==(Object object) => object is DynamicTypeImpl; |
| 6417 |
| 5896 bool get isDynamic => true; | 6418 bool get isDynamic => true; |
| 6419 |
| 5897 bool isMoreSpecificThan3(Type2 type, bool withDynamic) { | 6420 bool isMoreSpecificThan3(Type2 type, bool withDynamic) { |
| 5898 if (identical(this, type)) { | 6421 if (identical(this, type)) { |
| 5899 return true; | 6422 return true; |
| 5900 } | 6423 } |
| 5901 return withDynamic; | 6424 return withDynamic; |
| 5902 } | 6425 } |
| 6426 |
| 5903 bool isSubtypeOf(Type2 type) => true; | 6427 bool isSubtypeOf(Type2 type) => true; |
| 6428 |
| 5904 bool isSupertypeOf(Type2 type) => true; | 6429 bool isSupertypeOf(Type2 type) => true; |
| 6430 |
| 5905 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { | 6431 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { |
| 5906 int length = parameterTypes.length; | 6432 int length = parameterTypes.length; |
| 5907 for (int i = 0; i < length; i++) { | 6433 for (int i = 0; i < length; i++) { |
| 5908 if (parameterTypes[i] == this) { | 6434 if (parameterTypes[i] == this) { |
| 5909 return argumentTypes[i]; | 6435 return argumentTypes[i]; |
| 5910 } | 6436 } |
| 5911 } | 6437 } |
| 5912 return this; | 6438 return this; |
| 5913 } | 6439 } |
| 5914 } | 6440 } |
| 6441 |
| 5915 /** | 6442 /** |
| 5916 * Instances of the class `FunctionTypeImpl` defines the behavior common to obje
cts | 6443 * Instances of the class `FunctionTypeImpl` defines the behavior common to obje
cts |
| 5917 * representing the type of a function, method, constructor, getter, or setter. | 6444 * representing the type of a function, method, constructor, getter, or setter. |
| 5918 * | 6445 * |
| 5919 * @coverage dart.engine.type | 6446 * @coverage dart.engine.type |
| 5920 */ | 6447 */ |
| 5921 class FunctionTypeImpl extends TypeImpl implements FunctionType { | 6448 class FunctionTypeImpl extends TypeImpl implements FunctionType { |
| 5922 | |
| 5923 /** | 6449 /** |
| 5924 * Return `true` if all of the name/type pairs in the first map are equal to t
he | 6450 * Return `true` if all of the name/type pairs in the first map are equal to t
he |
| 5925 * corresponding name/type pairs in the second map. The maps are expected to i
terate over their | 6451 * corresponding name/type pairs in the second map. The maps are expected to i
terate over their |
| 5926 * entries in the same order in which those entries were added to the map. | 6452 * entries in the same order in which those entries were added to the map. |
| 5927 * | 6453 * |
| 5928 * @param firstTypes the first map of name/type pairs being compared | 6454 * @param firstTypes the first map of name/type pairs being compared |
| 5929 * @param secondTypes the second map of name/type pairs being compared | 6455 * @param secondTypes the second map of name/type pairs being compared |
| 5930 * @return `true` if all of the name/type pairs in the first map are equal to
the | 6456 * @return `true` if all of the name/type pairs in the first map are equal to
the |
| 5931 * corresponding name/type pairs in the second map | 6457 * corresponding name/type pairs in the second map |
| 5932 */ | 6458 */ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5959 */ | 6485 */ |
| 5960 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n
ull ? null : element.name); | 6486 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n
ull ? null : element.name); |
| 5961 | 6487 |
| 5962 /** | 6488 /** |
| 5963 * Initialize a newly created function type to be declared by the given elemen
t and to have the | 6489 * Initialize a newly created function type to be declared by the given elemen
t and to have the |
| 5964 * given name. | 6490 * given name. |
| 5965 * | 6491 * |
| 5966 * @param element the element representing the declaration of the function typ
e | 6492 * @param element the element representing the declaration of the function typ
e |
| 5967 */ | 6493 */ |
| 5968 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme
nt == null ? null : element.name); | 6494 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme
nt == null ? null : element.name); |
| 6495 |
| 5969 bool operator ==(Object object) { | 6496 bool operator ==(Object object) { |
| 5970 if (object is! FunctionTypeImpl) { | 6497 if (object is! FunctionTypeImpl) { |
| 5971 return false; | 6498 return false; |
| 5972 } | 6499 } |
| 5973 FunctionTypeImpl otherType = object as FunctionTypeImpl; | 6500 FunctionTypeImpl otherType = object as FunctionTypeImpl; |
| 5974 return (element == otherType.element) && JavaArrays.equals(normalParameterTy
pes, otherType.normalParameterTypes) && JavaArrays.equals(optionalParameterTypes
, otherType.optionalParameterTypes) && equals2(namedParameterTypes, otherType.na
medParameterTypes) && (returnType == otherType.returnType); | 6501 return (element == otherType.element) && JavaArrays.equals(normalParameterTy
pes, otherType.normalParameterTypes) && JavaArrays.equals(optionalParameterTypes
, otherType.optionalParameterTypes) && equals2(namedParameterTypes, otherType.na
medParameterTypes) && (returnType == otherType.returnType); |
| 5975 } | 6502 } |
| 6503 |
| 5976 String get displayName { | 6504 String get displayName { |
| 5977 String name = this.name; | 6505 String name = this.name; |
| 5978 if (name == null || name.length == 0) { | 6506 if (name == null || name.length == 0) { |
| 5979 List<Type2> normalParameterTypes = this.normalParameterTypes; | 6507 List<Type2> normalParameterTypes = this.normalParameterTypes; |
| 5980 List<Type2> optionalParameterTypes = this.optionalParameterTypes; | 6508 List<Type2> optionalParameterTypes = this.optionalParameterTypes; |
| 5981 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; | 6509 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; |
| 5982 Type2 returnType = this.returnType; | 6510 Type2 returnType = this.returnType; |
| 5983 JavaStringBuilder builder = new JavaStringBuilder(); | 6511 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5984 builder.append("("); | 6512 builder.append("("); |
| 5985 bool needsComma = false; | 6513 bool needsComma = false; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6032 builder.append(") -> "); | 6560 builder.append(") -> "); |
| 6033 if (returnType == null) { | 6561 if (returnType == null) { |
| 6034 builder.append("null"); | 6562 builder.append("null"); |
| 6035 } else { | 6563 } else { |
| 6036 builder.append(returnType.displayName); | 6564 builder.append(returnType.displayName); |
| 6037 } | 6565 } |
| 6038 name = builder.toString(); | 6566 name = builder.toString(); |
| 6039 } | 6567 } |
| 6040 return name; | 6568 return name; |
| 6041 } | 6569 } |
| 6570 |
| 6042 Map<String, Type2> get namedParameterTypes { | 6571 Map<String, Type2> get namedParameterTypes { |
| 6043 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 6572 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 6044 List<ParameterElement> parameters = baseParameters; | 6573 List<ParameterElement> parameters = baseParameters; |
| 6045 if (parameters.length == 0) { | 6574 if (parameters.length == 0) { |
| 6046 return namedParameterTypes; | 6575 return namedParameterTypes; |
| 6047 } | 6576 } |
| 6048 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); | 6577 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 6049 for (ParameterElement parameter in parameters) { | 6578 for (ParameterElement parameter in parameters) { |
| 6050 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { | 6579 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { |
| 6051 namedParameterTypes[parameter.name] = parameter.type.substitute2(_typeAr
guments, typeParameters); | 6580 namedParameterTypes[parameter.name] = parameter.type.substitute2(_typeAr
guments, typeParameters); |
| 6052 } | 6581 } |
| 6053 } | 6582 } |
| 6054 return namedParameterTypes; | 6583 return namedParameterTypes; |
| 6055 } | 6584 } |
| 6585 |
| 6056 List<Type2> get normalParameterTypes { | 6586 List<Type2> get normalParameterTypes { |
| 6057 List<ParameterElement> parameters = baseParameters; | 6587 List<ParameterElement> parameters = baseParameters; |
| 6058 if (parameters.length == 0) { | 6588 if (parameters.length == 0) { |
| 6059 return TypeImpl.EMPTY_ARRAY; | 6589 return TypeImpl.EMPTY_ARRAY; |
| 6060 } | 6590 } |
| 6061 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); | 6591 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 6062 List<Type2> types = new List<Type2>(); | 6592 List<Type2> types = new List<Type2>(); |
| 6063 for (ParameterElement parameter in parameters) { | 6593 for (ParameterElement parameter in parameters) { |
| 6064 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { | 6594 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { |
| 6065 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); | 6595 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); |
| 6066 } | 6596 } |
| 6067 } | 6597 } |
| 6068 return new List.from(types); | 6598 return new List.from(types); |
| 6069 } | 6599 } |
| 6600 |
| 6070 List<Type2> get optionalParameterTypes { | 6601 List<Type2> get optionalParameterTypes { |
| 6071 List<ParameterElement> parameters = baseParameters; | 6602 List<ParameterElement> parameters = baseParameters; |
| 6072 if (parameters.length == 0) { | 6603 if (parameters.length == 0) { |
| 6073 return TypeImpl.EMPTY_ARRAY; | 6604 return TypeImpl.EMPTY_ARRAY; |
| 6074 } | 6605 } |
| 6075 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); | 6606 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 6076 List<Type2> types = new List<Type2>(); | 6607 List<Type2> types = new List<Type2>(); |
| 6077 for (ParameterElement parameter in parameters) { | 6608 for (ParameterElement parameter in parameters) { |
| 6078 if (identical(parameter.parameterKind, ParameterKind.POSITIONAL)) { | 6609 if (identical(parameter.parameterKind, ParameterKind.POSITIONAL)) { |
| 6079 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); | 6610 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); |
| 6080 } | 6611 } |
| 6081 } | 6612 } |
| 6082 return new List.from(types); | 6613 return new List.from(types); |
| 6083 } | 6614 } |
| 6615 |
| 6084 List<ParameterElement> get parameters { | 6616 List<ParameterElement> get parameters { |
| 6085 List<ParameterElement> baseParameters = this.baseParameters; | 6617 List<ParameterElement> baseParameters = this.baseParameters; |
| 6086 int parameterCount = baseParameters.length; | 6618 int parameterCount = baseParameters.length; |
| 6087 if (parameterCount == 0) { | 6619 if (parameterCount == 0) { |
| 6088 return baseParameters; | 6620 return baseParameters; |
| 6089 } | 6621 } |
| 6090 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); | 6622 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); |
| 6091 for (int i = 0; i < parameterCount; i++) { | 6623 for (int i = 0; i < parameterCount; i++) { |
| 6092 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); | 6624 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); |
| 6093 } | 6625 } |
| 6094 return specializedParameters; | 6626 return specializedParameters; |
| 6095 } | 6627 } |
| 6628 |
| 6096 Type2 get returnType { | 6629 Type2 get returnType { |
| 6097 Type2 baseReturnType = this.baseReturnType; | 6630 Type2 baseReturnType = this.baseReturnType; |
| 6098 if (baseReturnType == null) { | 6631 if (baseReturnType == null) { |
| 6099 return DynamicTypeImpl.instance; | 6632 return DynamicTypeImpl.instance; |
| 6100 } | 6633 } |
| 6101 return baseReturnType.substitute2(_typeArguments, TypeParameterTypeImpl.getT
ypes(typeParameters)); | 6634 return baseReturnType.substitute2(_typeArguments, TypeParameterTypeImpl.getT
ypes(typeParameters)); |
| 6102 } | 6635 } |
| 6636 |
| 6103 List<Type2> get typeArguments => _typeArguments; | 6637 List<Type2> get typeArguments => _typeArguments; |
| 6638 |
| 6104 List<TypeParameterElement> get typeParameters { | 6639 List<TypeParameterElement> get typeParameters { |
| 6105 Element element = this.element; | 6640 Element element = this.element; |
| 6106 if (element is FunctionTypeAliasElement) { | 6641 if (element is FunctionTypeAliasElement) { |
| 6107 return ((element as FunctionTypeAliasElement)).typeParameters; | 6642 return (element as FunctionTypeAliasElement).typeParameters; |
| 6108 } | 6643 } |
| 6109 ClassElement definingClass = element.getAncestor(ClassElement); | 6644 ClassElement definingClass = element.getAncestor(ClassElement); |
| 6110 if (definingClass != null) { | 6645 if (definingClass != null) { |
| 6111 return definingClass.typeParameters; | 6646 return definingClass.typeParameters; |
| 6112 } | 6647 } |
| 6113 return TypeParameterElementImpl.EMPTY_ARRAY; | 6648 return TypeParameterElementImpl.EMPTY_ARRAY; |
| 6114 } | 6649 } |
| 6650 |
| 6115 int get hashCode { | 6651 int get hashCode { |
| 6116 Element element = this.element; | 6652 Element element = this.element; |
| 6117 if (element == null) { | 6653 if (element == null) { |
| 6118 return 0; | 6654 return 0; |
| 6119 } | 6655 } |
| 6120 return element.hashCode; | 6656 return element.hashCode; |
| 6121 } | 6657 } |
| 6658 |
| 6122 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); | 6659 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); |
| 6660 |
| 6123 bool isMoreSpecificThan3(Type2 type, bool withDynamic) { | 6661 bool isMoreSpecificThan3(Type2 type, bool withDynamic) { |
| 6124 if (type == null) { | 6662 if (type == null) { |
| 6125 return false; | 6663 return false; |
| 6126 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { | 6664 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { |
| 6127 return true; | 6665 return true; |
| 6128 } else if (type is! FunctionType) { | 6666 } else if (type is! FunctionType) { |
| 6129 return false; | 6667 return false; |
| 6130 } else if (this == type) { | 6668 } else if (this == type) { |
| 6131 return true; | 6669 return true; |
| 6132 } | 6670 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6198 if (!tAllTypes[i].isMoreSpecificThan3(sAllTypes[i], withDynamic)) { | 6736 if (!tAllTypes[i].isMoreSpecificThan3(sAllTypes[i], withDynamic)) { |
| 6199 return false; | 6737 return false; |
| 6200 } | 6738 } |
| 6201 } | 6739 } |
| 6202 } | 6740 } |
| 6203 } | 6741 } |
| 6204 Type2 tRetType = t.returnType; | 6742 Type2 tRetType = t.returnType; |
| 6205 Type2 sRetType = s.returnType; | 6743 Type2 sRetType = s.returnType; |
| 6206 return sRetType.isVoid || tRetType.isMoreSpecificThan3(sRetType, withDynamic
); | 6744 return sRetType.isVoid || tRetType.isMoreSpecificThan3(sRetType, withDynamic
); |
| 6207 } | 6745 } |
| 6746 |
| 6208 bool isSubtypeOf(Type2 type) { | 6747 bool isSubtypeOf(Type2 type) { |
| 6209 if (type == null) { | 6748 if (type == null) { |
| 6210 return false; | 6749 return false; |
| 6211 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { | 6750 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { |
| 6212 return true; | 6751 return true; |
| 6213 } else if (type is! FunctionType) { | 6752 } else if (type is! FunctionType) { |
| 6214 return false; | 6753 return false; |
| 6215 } else if (this == type) { | 6754 } else if (this == type) { |
| 6216 return true; | 6755 return true; |
| 6217 } | 6756 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6292 } | 6831 } |
| 6293 | 6832 |
| 6294 /** | 6833 /** |
| 6295 * Set the actual types of the type arguments to the given types. | 6834 * Set the actual types of the type arguments to the given types. |
| 6296 * | 6835 * |
| 6297 * @param typeArguments the actual types of the type arguments | 6836 * @param typeArguments the actual types of the type arguments |
| 6298 */ | 6837 */ |
| 6299 void set typeArguments(List<Type2> typeArguments) { | 6838 void set typeArguments(List<Type2> typeArguments) { |
| 6300 this._typeArguments = typeArguments; | 6839 this._typeArguments = typeArguments; |
| 6301 } | 6840 } |
| 6841 |
| 6302 FunctionTypeImpl substitute3(List<Type2> argumentTypes) => substitute2(argumen
tTypes, typeArguments); | 6842 FunctionTypeImpl substitute3(List<Type2> argumentTypes) => substitute2(argumen
tTypes, typeArguments); |
| 6843 |
| 6303 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT
ypes) { | 6844 FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterT
ypes) { |
| 6304 if (argumentTypes.length != parameterTypes.length) { | 6845 if (argumentTypes.length != parameterTypes.length) { |
| 6305 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); | 6846 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); |
| 6306 } | 6847 } |
| 6307 if (argumentTypes.length == 0) { | 6848 if (argumentTypes.length == 0) { |
| 6308 return this; | 6849 return this; |
| 6309 } | 6850 } |
| 6310 Element element = this.element; | 6851 Element element = this.element; |
| 6311 FunctionTypeImpl newType = (element is ExecutableElement) ? new FunctionType
Impl.con1(element as ExecutableElement) : new FunctionTypeImpl.con2(element as F
unctionTypeAliasElement); | 6852 FunctionTypeImpl newType = (element is ExecutableElement) ? new FunctionType
Impl.con1(element as ExecutableElement) : new FunctionTypeImpl.con2(element as F
unctionTypeAliasElement); |
| 6312 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p
arameterTypes); | 6853 newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, p
arameterTypes); |
| 6313 return newType; | 6854 return newType; |
| 6314 } | 6855 } |
| 6856 |
| 6315 void appendTo(JavaStringBuilder builder) { | 6857 void appendTo(JavaStringBuilder builder) { |
| 6316 List<Type2> normalParameterTypes = this.normalParameterTypes; | 6858 List<Type2> normalParameterTypes = this.normalParameterTypes; |
| 6317 List<Type2> optionalParameterTypes = this.optionalParameterTypes; | 6859 List<Type2> optionalParameterTypes = this.optionalParameterTypes; |
| 6318 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; | 6860 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; |
| 6319 Type2 returnType = this.returnType; | 6861 Type2 returnType = this.returnType; |
| 6320 builder.append("("); | 6862 builder.append("("); |
| 6321 bool needsComma = false; | 6863 bool needsComma = false; |
| 6322 if (normalParameterTypes.length > 0) { | 6864 if (normalParameterTypes.length > 0) { |
| 6323 for (Type2 type in normalParameterTypes) { | 6865 for (Type2 type in normalParameterTypes) { |
| 6324 if (needsComma) { | 6866 if (needsComma) { |
| 6325 builder.append(", "); | 6867 builder.append(", "); |
| 6326 } else { | 6868 } else { |
| 6327 needsComma = true; | 6869 needsComma = true; |
| 6328 } | 6870 } |
| 6329 ((type as TypeImpl)).appendTo(builder); | 6871 (type as TypeImpl).appendTo(builder); |
| 6330 } | 6872 } |
| 6331 } | 6873 } |
| 6332 if (optionalParameterTypes.length > 0) { | 6874 if (optionalParameterTypes.length > 0) { |
| 6333 if (needsComma) { | 6875 if (needsComma) { |
| 6334 builder.append(", "); | 6876 builder.append(", "); |
| 6335 needsComma = false; | 6877 needsComma = false; |
| 6336 } | 6878 } |
| 6337 builder.append("["); | 6879 builder.append("["); |
| 6338 for (Type2 type in optionalParameterTypes) { | 6880 for (Type2 type in optionalParameterTypes) { |
| 6339 if (needsComma) { | 6881 if (needsComma) { |
| 6340 builder.append(", "); | 6882 builder.append(", "); |
| 6341 } else { | 6883 } else { |
| 6342 needsComma = true; | 6884 needsComma = true; |
| 6343 } | 6885 } |
| 6344 ((type as TypeImpl)).appendTo(builder); | 6886 (type as TypeImpl).appendTo(builder); |
| 6345 } | 6887 } |
| 6346 builder.append("]"); | 6888 builder.append("]"); |
| 6347 needsComma = true; | 6889 needsComma = true; |
| 6348 } | 6890 } |
| 6349 if (namedParameterTypes.length > 0) { | 6891 if (namedParameterTypes.length > 0) { |
| 6350 if (needsComma) { | 6892 if (needsComma) { |
| 6351 builder.append(", "); | 6893 builder.append(", "); |
| 6352 needsComma = false; | 6894 needsComma = false; |
| 6353 } | 6895 } |
| 6354 builder.append("{"); | 6896 builder.append("{"); |
| 6355 for (MapEntry<String, Type2> entry in getMapEntrySet(namedParameterTypes))
{ | 6897 for (MapEntry<String, Type2> entry in getMapEntrySet(namedParameterTypes))
{ |
| 6356 if (needsComma) { | 6898 if (needsComma) { |
| 6357 builder.append(", "); | 6899 builder.append(", "); |
| 6358 } else { | 6900 } else { |
| 6359 needsComma = true; | 6901 needsComma = true; |
| 6360 } | 6902 } |
| 6361 builder.append(entry.getKey()); | 6903 builder.append(entry.getKey()); |
| 6362 builder.append(": "); | 6904 builder.append(": "); |
| 6363 ((entry.getValue() as TypeImpl)).appendTo(builder); | 6905 (entry.getValue() as TypeImpl).appendTo(builder); |
| 6364 } | 6906 } |
| 6365 builder.append("}"); | 6907 builder.append("}"); |
| 6366 needsComma = true; | 6908 needsComma = true; |
| 6367 } | 6909 } |
| 6368 builder.append(") -> "); | 6910 builder.append(") -> "); |
| 6369 if (returnType == null) { | 6911 if (returnType == null) { |
| 6370 builder.append("null"); | 6912 builder.append("null"); |
| 6371 } else { | 6913 } else { |
| 6372 ((returnType as TypeImpl)).appendTo(builder); | 6914 (returnType as TypeImpl).appendTo(builder); |
| 6373 } | 6915 } |
| 6374 } | 6916 } |
| 6375 | 6917 |
| 6376 /** | 6918 /** |
| 6377 * @return the base parameter elements of this function element, not `null`. | 6919 * @return the base parameter elements of this function element, not `null`. |
| 6378 */ | 6920 */ |
| 6379 List<ParameterElement> get baseParameters { | 6921 List<ParameterElement> get baseParameters { |
| 6380 Element element = this.element; | 6922 Element element = this.element; |
| 6381 if (element is ExecutableElement) { | 6923 if (element is ExecutableElement) { |
| 6382 return ((element as ExecutableElement)).parameters; | 6924 return (element as ExecutableElement).parameters; |
| 6383 } else { | 6925 } else { |
| 6384 return ((element as FunctionTypeAliasElement)).parameters; | 6926 return (element as FunctionTypeAliasElement).parameters; |
| 6385 } | 6927 } |
| 6386 } | 6928 } |
| 6387 | 6929 |
| 6388 /** | 6930 /** |
| 6389 * Return the return type defined by this function's element. | 6931 * Return the return type defined by this function's element. |
| 6390 * | 6932 * |
| 6391 * @return the return type defined by this function's element | 6933 * @return the return type defined by this function's element |
| 6392 */ | 6934 */ |
| 6393 Type2 get baseReturnType { | 6935 Type2 get baseReturnType { |
| 6394 Element element = this.element; | 6936 Element element = this.element; |
| 6395 if (element is ExecutableElement) { | 6937 if (element is ExecutableElement) { |
| 6396 return ((element as ExecutableElement)).returnType; | 6938 return (element as ExecutableElement).returnType; |
| 6397 } else { | 6939 } else { |
| 6398 return ((element as FunctionTypeAliasElement)).returnType; | 6940 return (element as FunctionTypeAliasElement).returnType; |
| 6399 } | 6941 } |
| 6400 } | 6942 } |
| 6401 } | 6943 } |
| 6944 |
| 6402 /** | 6945 /** |
| 6403 * Instances of the class `InterfaceTypeImpl` defines the behavior common to obj
ects | 6946 * Instances of the class `InterfaceTypeImpl` defines the behavior common to obj
ects |
| 6404 * representing the type introduced by either a class or an interface, or a refe
rence to such a | 6947 * representing the type introduced by either a class or an interface, or a refe
rence to such a |
| 6405 * type. | 6948 * type. |
| 6406 * | 6949 * |
| 6407 * @coverage dart.engine.type | 6950 * @coverage dart.engine.type |
| 6408 */ | 6951 */ |
| 6409 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { | 6952 class InterfaceTypeImpl extends TypeImpl implements InterfaceType { |
| 6410 | |
| 6411 /** | 6953 /** |
| 6412 * An empty array of types. | 6954 * An empty array of types. |
| 6413 */ | 6955 */ |
| 6414 static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0); | 6956 static List<InterfaceType> EMPTY_ARRAY = new List<InterfaceType>(0); |
| 6415 | 6957 |
| 6416 /** | 6958 /** |
| 6417 * This method computes the longest inheritance path from some passed [Type] t
o Object. | 6959 * This method computes the longest inheritance path from some passed [Type] t
o Object. |
| 6418 * | 6960 * |
| 6419 * @param type the [Type] to compute the longest inheritance path of from the
passed | 6961 * @param type the [Type] to compute the longest inheritance path of from the
passed |
| 6420 * [Type] to Object | 6962 * [Type] to Object |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6576 */ | 7118 */ |
| 6577 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame); | 7119 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN
ame); |
| 6578 | 7120 |
| 6579 /** | 7121 /** |
| 6580 * Initialize a newly created type to have the given name. This constructor sh
ould only be used in | 7122 * Initialize a newly created type to have the given name. This constructor sh
ould only be used in |
| 6581 * cases where there is no declaration of the type. | 7123 * cases where there is no declaration of the type. |
| 6582 * | 7124 * |
| 6583 * @param name the name of the type | 7125 * @param name the name of the type |
| 6584 */ | 7126 */ |
| 6585 InterfaceTypeImpl.con2(String name) : super(null, name); | 7127 InterfaceTypeImpl.con2(String name) : super(null, name); |
| 7128 |
| 6586 bool operator ==(Object object) { | 7129 bool operator ==(Object object) { |
| 6587 if (object is! InterfaceTypeImpl) { | 7130 if (object is! InterfaceTypeImpl) { |
| 6588 return false; | 7131 return false; |
| 6589 } | 7132 } |
| 6590 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; | 7133 InterfaceTypeImpl otherType = object as InterfaceTypeImpl; |
| 6591 return (element == otherType.element) && JavaArrays.equals(_typeArguments, o
therType._typeArguments); | 7134 return (element == otherType.element) && JavaArrays.equals(_typeArguments, o
therType._typeArguments); |
| 6592 } | 7135 } |
| 7136 |
| 6593 List<PropertyAccessorElement> get accessors { | 7137 List<PropertyAccessorElement> get accessors { |
| 6594 List<PropertyAccessorElement> accessors = element.accessors; | 7138 List<PropertyAccessorElement> accessors = element.accessors; |
| 6595 List<PropertyAccessorElement> members = new List<PropertyAccessorElement>(ac
cessors.length); | 7139 List<PropertyAccessorElement> members = new List<PropertyAccessorElement>(ac
cessors.length); |
| 6596 for (int i = 0; i < accessors.length; i++) { | 7140 for (int i = 0; i < accessors.length; i++) { |
| 6597 members[i] = PropertyAccessorMember.from(accessors[i], this); | 7141 members[i] = PropertyAccessorMember.from(accessors[i], this); |
| 6598 } | 7142 } |
| 6599 return members; | 7143 return members; |
| 6600 } | 7144 } |
| 7145 |
| 6601 String get displayName { | 7146 String get displayName { |
| 6602 String name = this.name; | 7147 String name = this.name; |
| 6603 List<Type2> typeArguments = this.typeArguments; | 7148 List<Type2> typeArguments = this.typeArguments; |
| 6604 bool allDynamic = true; | 7149 bool allDynamic = true; |
| 6605 for (Type2 type in typeArguments) { | 7150 for (Type2 type in typeArguments) { |
| 6606 if (type != null && !type.isDynamic) { | 7151 if (type != null && !type.isDynamic) { |
| 6607 allDynamic = false; | 7152 allDynamic = false; |
| 6608 break; | 7153 break; |
| 6609 } | 7154 } |
| 6610 } | 7155 } |
| 6611 if (!allDynamic) { | 7156 if (!allDynamic) { |
| 6612 JavaStringBuilder builder = new JavaStringBuilder(); | 7157 JavaStringBuilder builder = new JavaStringBuilder(); |
| 6613 builder.append(name); | 7158 builder.append(name); |
| 6614 builder.append("<"); | 7159 builder.append("<"); |
| 6615 for (int i = 0; i < typeArguments.length; i++) { | 7160 for (int i = 0; i < typeArguments.length; i++) { |
| 6616 if (i != 0) { | 7161 if (i != 0) { |
| 6617 builder.append(", "); | 7162 builder.append(", "); |
| 6618 } | 7163 } |
| 6619 Type2 typeArg = typeArguments[i]; | 7164 Type2 typeArg = typeArguments[i]; |
| 6620 builder.append(typeArg.displayName); | 7165 builder.append(typeArg.displayName); |
| 6621 } | 7166 } |
| 6622 builder.append(">"); | 7167 builder.append(">"); |
| 6623 name = builder.toString(); | 7168 name = builder.toString(); |
| 6624 } | 7169 } |
| 6625 return name; | 7170 return name; |
| 6626 } | 7171 } |
| 7172 |
| 6627 ClassElement get element => super.element as ClassElement; | 7173 ClassElement get element => super.element as ClassElement; |
| 6628 PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getGetter(getterName), this); | 7174 |
| 7175 PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember
.from((element as ClassElementImpl).getGetter(getterName), this); |
| 7176 |
| 6629 List<InterfaceType> get interfaces { | 7177 List<InterfaceType> get interfaces { |
| 6630 ClassElement classElement = element; | 7178 ClassElement classElement = element; |
| 6631 List<InterfaceType> interfaces = classElement.interfaces; | 7179 List<InterfaceType> interfaces = classElement.interfaces; |
| 6632 List<TypeParameterElement> typeParameters = classElement.typeParameters; | 7180 List<TypeParameterElement> typeParameters = classElement.typeParameters; |
| 6633 List<Type2> parameterTypes = classElement.type.typeArguments; | 7181 List<Type2> parameterTypes = classElement.type.typeArguments; |
| 6634 if (typeParameters.length == 0) { | 7182 if (typeParameters.length == 0) { |
| 6635 return interfaces; | 7183 return interfaces; |
| 6636 } | 7184 } |
| 6637 int count = interfaces.length; | 7185 int count = interfaces.length; |
| 6638 List<InterfaceType> typedInterfaces = new List<InterfaceType>(count); | 7186 List<InterfaceType> typedInterfaces = new List<InterfaceType>(count); |
| 6639 for (int i = 0; i < count; i++) { | 7187 for (int i = 0; i < count; i++) { |
| 6640 typedInterfaces[i] = interfaces[i].substitute2(_typeArguments, parameterTy
pes); | 7188 typedInterfaces[i] = interfaces[i].substitute2(_typeArguments, parameterTy
pes); |
| 6641 } | 7189 } |
| 6642 return typedInterfaces; | 7190 return typedInterfaces; |
| 6643 } | 7191 } |
| 7192 |
| 6644 Type2 getLeastUpperBound(Type2 type) { | 7193 Type2 getLeastUpperBound(Type2 type) { |
| 6645 if (identical(type, this)) { | 7194 if (identical(type, this)) { |
| 6646 return this; | 7195 return this; |
| 6647 } | 7196 } |
| 6648 Type2 dynamicType = DynamicTypeImpl.instance; | 7197 Type2 dynamicType = DynamicTypeImpl.instance; |
| 6649 if (identical(this, dynamicType) || identical(type, dynamicType)) { | 7198 if (identical(this, dynamicType) || identical(type, dynamicType)) { |
| 6650 return dynamicType; | 7199 return dynamicType; |
| 6651 } | 7200 } |
| 6652 if (type is! InterfaceType) { | 7201 if (type is! InterfaceType) { |
| 6653 return null; | 7202 return null; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 6675 numberOfTypesAtMaxDepth++; | 7224 numberOfTypesAtMaxDepth++; |
| 6676 indexOfLeastUpperBound = m; | 7225 indexOfLeastUpperBound = m; |
| 6677 } | 7226 } |
| 6678 } | 7227 } |
| 6679 if (numberOfTypesAtMaxDepth == 1) { | 7228 if (numberOfTypesAtMaxDepth == 1) { |
| 6680 return s[indexOfLeastUpperBound]; | 7229 return s[indexOfLeastUpperBound]; |
| 6681 } | 7230 } |
| 6682 } | 7231 } |
| 6683 return null; | 7232 return null; |
| 6684 } | 7233 } |
| 6685 MethodElement getMethod(String methodName) => MethodMember.from(((element as C
lassElementImpl)).getMethod(methodName), this); | 7234 |
| 7235 MethodElement getMethod(String methodName) => MethodMember.from((element as Cl
assElementImpl).getMethod(methodName), this); |
| 7236 |
| 6686 List<MethodElement> get methods { | 7237 List<MethodElement> get methods { |
| 6687 List<MethodElement> methods = element.methods; | 7238 List<MethodElement> methods = element.methods; |
| 6688 List<MethodElement> members = new List<MethodElement>(methods.length); | 7239 List<MethodElement> members = new List<MethodElement>(methods.length); |
| 6689 for (int i = 0; i < methods.length; i++) { | 7240 for (int i = 0; i < methods.length; i++) { |
| 6690 members[i] = MethodMember.from(methods[i], this); | 7241 members[i] = MethodMember.from(methods[i], this); |
| 6691 } | 7242 } |
| 6692 return members; | 7243 return members; |
| 6693 } | 7244 } |
| 7245 |
| 6694 List<InterfaceType> get mixins { | 7246 List<InterfaceType> get mixins { |
| 6695 ClassElement classElement = element; | 7247 ClassElement classElement = element; |
| 6696 List<InterfaceType> mixins = classElement.mixins; | 7248 List<InterfaceType> mixins = classElement.mixins; |
| 6697 List<TypeParameterElement> typeParameters = classElement.typeParameters; | 7249 List<TypeParameterElement> typeParameters = classElement.typeParameters; |
| 6698 List<Type2> parameterTypes = classElement.type.typeArguments; | 7250 List<Type2> parameterTypes = classElement.type.typeArguments; |
| 6699 if (typeParameters.length == 0) { | 7251 if (typeParameters.length == 0) { |
| 6700 return mixins; | 7252 return mixins; |
| 6701 } | 7253 } |
| 6702 int count = mixins.length; | 7254 int count = mixins.length; |
| 6703 List<InterfaceType> typedMixins = new List<InterfaceType>(count); | 7255 List<InterfaceType> typedMixins = new List<InterfaceType>(count); |
| 6704 for (int i = 0; i < count; i++) { | 7256 for (int i = 0; i < count; i++) { |
| 6705 typedMixins[i] = mixins[i].substitute2(_typeArguments, parameterTypes); | 7257 typedMixins[i] = mixins[i].substitute2(_typeArguments, parameterTypes); |
| 6706 } | 7258 } |
| 6707 return typedMixins; | 7259 return typedMixins; |
| 6708 } | 7260 } |
| 6709 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getSetter(setterName), this); | 7261 |
| 7262 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember
.from((element as ClassElementImpl).getSetter(setterName), this); |
| 7263 |
| 6710 InterfaceType get superclass { | 7264 InterfaceType get superclass { |
| 6711 ClassElement classElement = element; | 7265 ClassElement classElement = element; |
| 6712 InterfaceType supertype = classElement.supertype; | 7266 InterfaceType supertype = classElement.supertype; |
| 6713 if (supertype == null) { | 7267 if (supertype == null) { |
| 6714 return null; | 7268 return null; |
| 6715 } | 7269 } |
| 6716 return supertype.substitute2(_typeArguments, classElement.type.typeArguments
); | 7270 return supertype.substitute2(_typeArguments, classElement.type.typeArguments
); |
| 6717 } | 7271 } |
| 7272 |
| 6718 List<Type2> get typeArguments => _typeArguments; | 7273 List<Type2> get typeArguments => _typeArguments; |
| 7274 |
| 6719 List<TypeParameterElement> get typeParameters => element.typeParameters; | 7275 List<TypeParameterElement> get typeParameters => element.typeParameters; |
| 7276 |
| 6720 int get hashCode { | 7277 int get hashCode { |
| 6721 ClassElement element = this.element; | 7278 ClassElement element = this.element; |
| 6722 if (element == null) { | 7279 if (element == null) { |
| 6723 return 0; | 7280 return 0; |
| 6724 } | 7281 } |
| 6725 return element.hashCode; | 7282 return element.hashCode; |
| 6726 } | 7283 } |
| 7284 |
| 6727 bool get isDartCoreFunction { | 7285 bool get isDartCoreFunction { |
| 6728 ClassElement element = this.element; | 7286 ClassElement element = this.element; |
| 6729 if (element == null) { | 7287 if (element == null) { |
| 6730 return false; | 7288 return false; |
| 6731 } | 7289 } |
| 6732 return element.name == "Function" && element.library.isDartCore; | 7290 return element.name == "Function" && element.library.isDartCore; |
| 6733 } | 7291 } |
| 7292 |
| 6734 bool isDirectSupertypeOf(InterfaceType type) { | 7293 bool isDirectSupertypeOf(InterfaceType type) { |
| 6735 InterfaceType i = this; | 7294 InterfaceType i = this; |
| 6736 InterfaceType j = type; | 7295 InterfaceType j = type; |
| 6737 ClassElement jElement = j.element; | 7296 ClassElement jElement = j.element; |
| 6738 InterfaceType supertype = jElement.supertype; | 7297 InterfaceType supertype = jElement.supertype; |
| 6739 if (supertype == null) { | 7298 if (supertype == null) { |
| 6740 return false; | 7299 return false; |
| 6741 } | 7300 } |
| 6742 List<Type2> jArgs = j.typeArguments; | 7301 List<Type2> jArgs = j.typeArguments; |
| 6743 List<Type2> jVars = jElement.type.typeArguments; | 7302 List<Type2> jVars = jElement.type.typeArguments; |
| 6744 supertype = supertype.substitute2(jArgs, jVars); | 7303 supertype = supertype.substitute2(jArgs, jVars); |
| 6745 if (supertype == i) { | 7304 if (supertype == i) { |
| 6746 return true; | 7305 return true; |
| 6747 } | 7306 } |
| 6748 for (InterfaceType interfaceType in jElement.interfaces) { | 7307 for (InterfaceType interfaceType in jElement.interfaces) { |
| 6749 interfaceType = interfaceType.substitute2(jArgs, jVars); | 7308 interfaceType = interfaceType.substitute2(jArgs, jVars); |
| 6750 if (interfaceType == i) { | 7309 if (interfaceType == i) { |
| 6751 return true; | 7310 return true; |
| 6752 } | 7311 } |
| 6753 } | 7312 } |
| 6754 for (InterfaceType mixinType in jElement.mixins) { | 7313 for (InterfaceType mixinType in jElement.mixins) { |
| 6755 mixinType = mixinType.substitute2(jArgs, jVars); | 7314 mixinType = mixinType.substitute2(jArgs, jVars); |
| 6756 if (mixinType == i) { | 7315 if (mixinType == i) { |
| 6757 return true; | 7316 return true; |
| 6758 } | 7317 } |
| 6759 } | 7318 } |
| 6760 return false; | 7319 return false; |
| 6761 } | 7320 } |
| 7321 |
| 6762 bool isMoreSpecificThan3(Type2 type, bool withDynamic) { | 7322 bool isMoreSpecificThan3(Type2 type, bool withDynamic) { |
| 6763 if (identical(type, DynamicTypeImpl.instance)) { | 7323 if (identical(type, DynamicTypeImpl.instance)) { |
| 6764 return true; | 7324 return true; |
| 6765 } else if (type is! InterfaceType) { | 7325 } else if (type is! InterfaceType) { |
| 6766 return false; | 7326 return false; |
| 6767 } | 7327 } |
| 6768 return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>(), w
ithDynamic); | 7328 return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>(), w
ithDynamic); |
| 6769 } | 7329 } |
| 7330 |
| 6770 bool get isObject => element.supertype == null; | 7331 bool get isObject => element.supertype == null; |
| 7332 |
| 6771 bool isSubtypeOf(Type2 type) { | 7333 bool isSubtypeOf(Type2 type) { |
| 6772 if (identical(type, DynamicTypeImpl.instance)) { | 7334 if (identical(type, DynamicTypeImpl.instance)) { |
| 6773 return true; | 7335 return true; |
| 6774 } else if (type is TypeParameterType) { | 7336 } else if (type is TypeParameterType) { |
| 6775 return true; | 7337 return true; |
| 6776 } else if (type is FunctionType) { | 7338 } else if (type is FunctionType) { |
| 6777 ClassElement element = this.element; | 7339 ClassElement element = this.element; |
| 6778 MethodElement callMethod = element.lookUpMethod("call", element.library); | 7340 MethodElement callMethod = element.lookUpMethod("call", element.library); |
| 6779 if (callMethod != null) { | 7341 if (callMethod != null) { |
| 6780 return callMethod.type.isSubtypeOf(type); | 7342 return callMethod.type.isSubtypeOf(type); |
| 6781 } | 7343 } |
| 6782 return false; | 7344 return false; |
| 6783 } else if (type is! InterfaceType) { | 7345 } else if (type is! InterfaceType) { |
| 6784 return false; | 7346 return false; |
| 6785 } else if (this == type) { | 7347 } else if (this == type) { |
| 6786 return true; | 7348 return true; |
| 6787 } | 7349 } |
| 6788 return isSubtypeOf2(type as InterfaceType, new Set<ClassElement>()); | 7350 return isSubtypeOf2(type as InterfaceType, new Set<ClassElement>()); |
| 6789 } | 7351 } |
| 7352 |
| 6790 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li
brary) { | 7353 ConstructorElement lookUpConstructor(String constructorName, LibraryElement li
brary) { |
| 6791 ConstructorElement constructorElement; | 7354 ConstructorElement constructorElement; |
| 6792 if (constructorName == null) { | 7355 if (constructorName == null) { |
| 6793 constructorElement = element.unnamedConstructor; | 7356 constructorElement = element.unnamedConstructor; |
| 6794 } else { | 7357 } else { |
| 6795 constructorElement = element.getNamedConstructor(constructorName); | 7358 constructorElement = element.getNamedConstructor(constructorName); |
| 6796 } | 7359 } |
| 6797 if (constructorElement == null || !constructorElement.isAccessibleIn(library
)) { | 7360 if (constructorElement == null || !constructorElement.isAccessibleIn(library
)) { |
| 6798 return null; | 7361 return null; |
| 6799 } | 7362 } |
| 6800 return ConstructorMember.from(constructorElement, this); | 7363 return ConstructorMember.from(constructorElement, this); |
| 6801 } | 7364 } |
| 7365 |
| 6802 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { | 7366 PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library
) { |
| 6803 PropertyAccessorElement element = getGetter(getterName); | 7367 PropertyAccessorElement element = getGetter(getterName); |
| 6804 if (element != null && element.isAccessibleIn(library)) { | 7368 if (element != null && element.isAccessibleIn(library)) { |
| 6805 return element; | 7369 return element; |
| 6806 } | 7370 } |
| 6807 return lookUpGetterInSuperclass(getterName, library); | 7371 return lookUpGetterInSuperclass(getterName, library); |
| 6808 } | 7372 } |
| 7373 |
| 6809 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryEle
ment library) { | 7374 PropertyAccessorElement lookUpGetterInSuperclass(String getterName, LibraryEle
ment library) { |
| 6810 for (InterfaceType mixin in mixins) { | 7375 for (InterfaceType mixin in mixins) { |
| 6811 PropertyAccessorElement element = mixin.getGetter(getterName); | 7376 PropertyAccessorElement element = mixin.getGetter(getterName); |
| 6812 if (element != null && element.isAccessibleIn(library)) { | 7377 if (element != null && element.isAccessibleIn(library)) { |
| 6813 return element; | 7378 return element; |
| 6814 } | 7379 } |
| 6815 } | 7380 } |
| 6816 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 7381 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 6817 InterfaceType supertype = superclass; | 7382 InterfaceType supertype = superclass; |
| 6818 ClassElement supertypeElement = supertype == null ? null : supertype.element
; | 7383 ClassElement supertypeElement = supertype == null ? null : supertype.element
; |
| 6819 while (supertype != null && !visitedClasses.contains(supertypeElement)) { | 7384 while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
| 6820 javaSetAdd(visitedClasses, supertypeElement); | 7385 javaSetAdd(visitedClasses, supertypeElement); |
| 6821 PropertyAccessorElement element = supertype.getGetter(getterName); | 7386 PropertyAccessorElement element = supertype.getGetter(getterName); |
| 6822 if (element != null && element.isAccessibleIn(library)) { | 7387 if (element != null && element.isAccessibleIn(library)) { |
| 6823 return element; | 7388 return element; |
| 6824 } | 7389 } |
| 6825 for (InterfaceType mixin in supertype.mixins) { | 7390 for (InterfaceType mixin in supertype.mixins) { |
| 6826 element = mixin.getGetter(getterName); | 7391 element = mixin.getGetter(getterName); |
| 6827 if (element != null && element.isAccessibleIn(library)) { | 7392 if (element != null && element.isAccessibleIn(library)) { |
| 6828 return element; | 7393 return element; |
| 6829 } | 7394 } |
| 6830 } | 7395 } |
| 6831 supertype = supertype.superclass; | 7396 supertype = supertype.superclass; |
| 6832 supertypeElement = supertype == null ? null : supertype.element; | 7397 supertypeElement = supertype == null ? null : supertype.element; |
| 6833 } | 7398 } |
| 6834 return null; | 7399 return null; |
| 6835 } | 7400 } |
| 7401 |
| 6836 MethodElement lookUpMethod(String methodName, LibraryElement library) { | 7402 MethodElement lookUpMethod(String methodName, LibraryElement library) { |
| 6837 MethodElement element = getMethod(methodName); | 7403 MethodElement element = getMethod(methodName); |
| 6838 if (element != null && element.isAccessibleIn(library)) { | 7404 if (element != null && element.isAccessibleIn(library)) { |
| 6839 return element; | 7405 return element; |
| 6840 } | 7406 } |
| 6841 return lookUpMethodInSuperclass(methodName, library); | 7407 return lookUpMethodInSuperclass(methodName, library); |
| 6842 } | 7408 } |
| 7409 |
| 6843 MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement libra
ry) { | 7410 MethodElement lookUpMethodInSuperclass(String methodName, LibraryElement libra
ry) { |
| 6844 for (InterfaceType mixin in mixins) { | 7411 for (InterfaceType mixin in mixins) { |
| 6845 MethodElement element = mixin.getMethod(methodName); | 7412 MethodElement element = mixin.getMethod(methodName); |
| 6846 if (element != null && element.isAccessibleIn(library)) { | 7413 if (element != null && element.isAccessibleIn(library)) { |
| 6847 return element; | 7414 return element; |
| 6848 } | 7415 } |
| 6849 } | 7416 } |
| 6850 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 7417 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 6851 InterfaceType supertype = superclass; | 7418 InterfaceType supertype = superclass; |
| 6852 ClassElement supertypeElement = supertype == null ? null : supertype.element
; | 7419 ClassElement supertypeElement = supertype == null ? null : supertype.element
; |
| 6853 while (supertype != null && !visitedClasses.contains(supertypeElement)) { | 7420 while (supertype != null && !visitedClasses.contains(supertypeElement)) { |
| 6854 javaSetAdd(visitedClasses, supertypeElement); | 7421 javaSetAdd(visitedClasses, supertypeElement); |
| 6855 MethodElement element = supertype.getMethod(methodName); | 7422 MethodElement element = supertype.getMethod(methodName); |
| 6856 if (element != null && element.isAccessibleIn(library)) { | 7423 if (element != null && element.isAccessibleIn(library)) { |
| 6857 return element; | 7424 return element; |
| 6858 } | 7425 } |
| 6859 for (InterfaceType mixin in supertype.mixins) { | 7426 for (InterfaceType mixin in supertype.mixins) { |
| 6860 element = mixin.getMethod(methodName); | 7427 element = mixin.getMethod(methodName); |
| 6861 if (element != null && element.isAccessibleIn(library)) { | 7428 if (element != null && element.isAccessibleIn(library)) { |
| 6862 return element; | 7429 return element; |
| 6863 } | 7430 } |
| 6864 } | 7431 } |
| 6865 supertype = supertype.superclass; | 7432 supertype = supertype.superclass; |
| 6866 supertypeElement = supertype == null ? null : supertype.element; | 7433 supertypeElement = supertype == null ? null : supertype.element; |
| 6867 } | 7434 } |
| 6868 return null; | 7435 return null; |
| 6869 } | 7436 } |
| 7437 |
| 6870 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { | 7438 PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library
) { |
| 6871 PropertyAccessorElement element = getSetter(setterName); | 7439 PropertyAccessorElement element = getSetter(setterName); |
| 6872 if (element != null && element.isAccessibleIn(library)) { | 7440 if (element != null && element.isAccessibleIn(library)) { |
| 6873 return element; | 7441 return element; |
| 6874 } | 7442 } |
| 6875 return lookUpSetterInSuperclass(setterName, library); | 7443 return lookUpSetterInSuperclass(setterName, library); |
| 6876 } | 7444 } |
| 7445 |
| 6877 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle
ment library) { | 7446 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle
ment library) { |
| 6878 for (InterfaceType mixin in mixins) { | 7447 for (InterfaceType mixin in mixins) { |
| 6879 PropertyAccessorElement element = mixin.getSetter(setterName); | 7448 PropertyAccessorElement element = mixin.getSetter(setterName); |
| 6880 if (element != null && element.isAccessibleIn(library)) { | 7449 if (element != null && element.isAccessibleIn(library)) { |
| 6881 return element; | 7450 return element; |
| 6882 } | 7451 } |
| 6883 } | 7452 } |
| 6884 Set<ClassElement> visitedClasses = new Set<ClassElement>(); | 7453 Set<ClassElement> visitedClasses = new Set<ClassElement>(); |
| 6885 InterfaceType supertype = superclass; | 7454 InterfaceType supertype = superclass; |
| 6886 ClassElement supertypeElement = supertype == null ? null : supertype.element
; | 7455 ClassElement supertypeElement = supertype == null ? null : supertype.element
; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 6903 } | 7472 } |
| 6904 | 7473 |
| 6905 /** | 7474 /** |
| 6906 * Set the actual types of the type arguments to those in the given array. | 7475 * Set the actual types of the type arguments to those in the given array. |
| 6907 * | 7476 * |
| 6908 * @param typeArguments the actual types of the type arguments | 7477 * @param typeArguments the actual types of the type arguments |
| 6909 */ | 7478 */ |
| 6910 void set typeArguments(List<Type2> typeArguments) { | 7479 void set typeArguments(List<Type2> typeArguments) { |
| 6911 this._typeArguments = typeArguments; | 7480 this._typeArguments = typeArguments; |
| 6912 } | 7481 } |
| 7482 |
| 6913 InterfaceTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argume
ntTypes, typeArguments); | 7483 InterfaceTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argume
ntTypes, typeArguments); |
| 7484 |
| 6914 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter
Types) { | 7485 InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameter
Types) { |
| 6915 if (argumentTypes.length != parameterTypes.length) { | 7486 if (argumentTypes.length != parameterTypes.length) { |
| 6916 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); | 7487 throw new IllegalArgumentException("argumentTypes.length (${argumentTypes.
length}) != parameterTypes.length (${parameterTypes.length})"); |
| 6917 } | 7488 } |
| 6918 if (argumentTypes.length == 0 || _typeArguments.length == 0) { | 7489 if (argumentTypes.length == 0 || _typeArguments.length == 0) { |
| 6919 return this; | 7490 return this; |
| 6920 } | 7491 } |
| 6921 List<Type2> newTypeArguments = TypeImpl.substitute(_typeArguments, argumentT
ypes, parameterTypes); | 7492 List<Type2> newTypeArguments = TypeImpl.substitute(_typeArguments, argumentT
ypes, parameterTypes); |
| 6922 if (JavaArrays.equals(newTypeArguments, _typeArguments)) { | 7493 if (JavaArrays.equals(newTypeArguments, _typeArguments)) { |
| 6923 return this; | 7494 return this; |
| 6924 } | 7495 } |
| 6925 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); | 7496 InterfaceTypeImpl newType = new InterfaceTypeImpl.con1(element); |
| 6926 newType.typeArguments = newTypeArguments; | 7497 newType.typeArguments = newTypeArguments; |
| 6927 return newType; | 7498 return newType; |
| 6928 } | 7499 } |
| 7500 |
| 6929 void appendTo(JavaStringBuilder builder) { | 7501 void appendTo(JavaStringBuilder builder) { |
| 6930 builder.append(name); | 7502 builder.append(name); |
| 6931 int argumentCount = _typeArguments.length; | 7503 int argumentCount = _typeArguments.length; |
| 6932 if (argumentCount > 0) { | 7504 if (argumentCount > 0) { |
| 6933 builder.append("<"); | 7505 builder.append("<"); |
| 6934 for (int i = 0; i < argumentCount; i++) { | 7506 for (int i = 0; i < argumentCount; i++) { |
| 6935 if (i > 0) { | 7507 if (i > 0) { |
| 6936 builder.append(", "); | 7508 builder.append(", "); |
| 6937 } | 7509 } |
| 6938 ((_typeArguments[i] as TypeImpl)).appendTo(builder); | 7510 (_typeArguments[i] as TypeImpl).appendTo(builder); |
| 6939 } | 7511 } |
| 6940 builder.append(">"); | 7512 builder.append(">"); |
| 6941 } | 7513 } |
| 6942 } | 7514 } |
| 7515 |
| 6943 bool isMoreSpecificThan2(InterfaceType s, Set<ClassElement> visitedClasses, bo
ol withDynamic) { | 7516 bool isMoreSpecificThan2(InterfaceType s, Set<ClassElement> visitedClasses, bo
ol withDynamic) { |
| 6944 if (this == s) { | 7517 if (this == s) { |
| 6945 return true; | 7518 return true; |
| 6946 } | 7519 } |
| 6947 if (s.isDirectSupertypeOf(this)) { | 7520 if (s.isDirectSupertypeOf(this)) { |
| 6948 return true; | 7521 return true; |
| 6949 } | 7522 } |
| 6950 ClassElement tElement = this.element; | 7523 ClassElement tElement = this.element; |
| 6951 ClassElement sElement = s.element; | 7524 ClassElement sElement = s.element; |
| 6952 if (tElement == sElement) { | 7525 if (tElement == sElement) { |
| 6953 List<Type2> tArguments = typeArguments; | 7526 List<Type2> tArguments = typeArguments; |
| 6954 List<Type2> sArguments = s.typeArguments; | 7527 List<Type2> sArguments = s.typeArguments; |
| 6955 if (tArguments.length != sArguments.length) { | 7528 if (tArguments.length != sArguments.length) { |
| 6956 return false; | 7529 return false; |
| 6957 } | 7530 } |
| 6958 for (int i = 0; i < tArguments.length; i++) { | 7531 for (int i = 0; i < tArguments.length; i++) { |
| 6959 if (!tArguments[i].isMoreSpecificThan3(sArguments[i], withDynamic)) { | 7532 if (!tArguments[i].isMoreSpecificThan3(sArguments[i], withDynamic)) { |
| 6960 return false; | 7533 return false; |
| 6961 } | 7534 } |
| 6962 } | 7535 } |
| 6963 return true; | 7536 return true; |
| 6964 } | 7537 } |
| 6965 ClassElement element = this.element; | 7538 ClassElement element = this.element; |
| 6966 if (element == null || visitedClasses.contains(element)) { | 7539 if (element == null || visitedClasses.contains(element)) { |
| 6967 return false; | 7540 return false; |
| 6968 } | 7541 } |
| 6969 javaSetAdd(visitedClasses, element); | 7542 javaSetAdd(visitedClasses, element); |
| 6970 InterfaceType supertype = superclass; | 7543 InterfaceType supertype = superclass; |
| 6971 if (supertype != null && ((supertype as InterfaceTypeImpl)).isMoreSpecificTh
an2(s, visitedClasses, withDynamic)) { | 7544 if (supertype != null && (supertype as InterfaceTypeImpl).isMoreSpecificThan
2(s, visitedClasses, withDynamic)) { |
| 6972 return true; | 7545 return true; |
| 6973 } | 7546 } |
| 6974 for (InterfaceType interfaceType in interfaces) { | 7547 for (InterfaceType interfaceType in interfaces) { |
| 6975 if (((interfaceType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedC
lasses, withDynamic)) { | 7548 if ((interfaceType as InterfaceTypeImpl).isMoreSpecificThan2(s, visitedCla
sses, withDynamic)) { |
| 6976 return true; | 7549 return true; |
| 6977 } | 7550 } |
| 6978 } | 7551 } |
| 6979 for (InterfaceType mixinType in mixins) { | 7552 for (InterfaceType mixinType in mixins) { |
| 6980 if (((mixinType as InterfaceTypeImpl)).isMoreSpecificThan2(s, visitedClass
es, withDynamic)) { | 7553 if ((mixinType as InterfaceTypeImpl).isMoreSpecificThan2(s, visitedClasses
, withDynamic)) { |
| 6981 return true; | 7554 return true; |
| 6982 } | 7555 } |
| 6983 } | 7556 } |
| 6984 return false; | 7557 return false; |
| 6985 } | 7558 } |
| 7559 |
| 6986 bool isSubtypeOf2(InterfaceType type, Set<ClassElement> visitedClasses) { | 7560 bool isSubtypeOf2(InterfaceType type, Set<ClassElement> visitedClasses) { |
| 6987 InterfaceType typeT = this; | 7561 InterfaceType typeT = this; |
| 6988 InterfaceType typeS = type; | 7562 InterfaceType typeS = type; |
| 6989 ClassElement elementT = element; | 7563 ClassElement elementT = element; |
| 6990 if (elementT == null || visitedClasses.contains(elementT)) { | 7564 if (elementT == null || visitedClasses.contains(elementT)) { |
| 6991 return false; | 7565 return false; |
| 6992 } | 7566 } |
| 6993 javaSetAdd(visitedClasses, elementT); | 7567 javaSetAdd(visitedClasses, elementT); |
| 6994 if (typeT == typeS) { | 7568 if (typeT == typeS) { |
| 6995 return true; | 7569 return true; |
| 6996 } else if (elementT == typeS.element) { | 7570 } else if (elementT == typeS.element) { |
| 6997 List<Type2> typeTArgs = typeT.typeArguments; | 7571 List<Type2> typeTArgs = typeT.typeArguments; |
| 6998 List<Type2> typeSArgs = typeS.typeArguments; | 7572 List<Type2> typeSArgs = typeS.typeArguments; |
| 6999 if (typeTArgs.length != typeSArgs.length) { | 7573 if (typeTArgs.length != typeSArgs.length) { |
| 7000 return false; | 7574 return false; |
| 7001 } | 7575 } |
| 7002 for (int i = 0; i < typeTArgs.length; i++) { | 7576 for (int i = 0; i < typeTArgs.length; i++) { |
| 7003 if (!typeTArgs[i].isSubtypeOf(typeSArgs[i])) { | 7577 if (!typeTArgs[i].isSubtypeOf(typeSArgs[i])) { |
| 7004 return false; | 7578 return false; |
| 7005 } | 7579 } |
| 7006 } | 7580 } |
| 7007 return true; | 7581 return true; |
| 7008 } else if (typeS.isDartCoreFunction && elementT.getMethod("call") != null) { | 7582 } else if (typeS.isDartCoreFunction && elementT.getMethod("call") != null) { |
| 7009 return true; | 7583 return true; |
| 7010 } | 7584 } |
| 7011 InterfaceType supertype = superclass; | 7585 InterfaceType supertype = superclass; |
| 7012 if (supertype != null && ((supertype as InterfaceTypeImpl)).isSubtypeOf2(typ
eS, visitedClasses)) { | 7586 if (supertype != null && (supertype as InterfaceTypeImpl).isSubtypeOf2(typeS
, visitedClasses)) { |
| 7013 return true; | 7587 return true; |
| 7014 } | 7588 } |
| 7015 List<InterfaceType> interfaceTypes = interfaces; | 7589 List<InterfaceType> interfaceTypes = interfaces; |
| 7016 for (InterfaceType interfaceType in interfaceTypes) { | 7590 for (InterfaceType interfaceType in interfaceTypes) { |
| 7017 if (((interfaceType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClas
ses)) { | 7591 if ((interfaceType as InterfaceTypeImpl).isSubtypeOf2(typeS, visitedClasse
s)) { |
| 7018 return true; | 7592 return true; |
| 7019 } | 7593 } |
| 7020 } | 7594 } |
| 7021 List<InterfaceType> mixinTypes = mixins; | 7595 List<InterfaceType> mixinTypes = mixins; |
| 7022 for (InterfaceType mixinType in mixinTypes) { | 7596 for (InterfaceType mixinType in mixinTypes) { |
| 7023 if (((mixinType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)
) { | 7597 if ((mixinType as InterfaceTypeImpl).isSubtypeOf2(typeS, visitedClasses))
{ |
| 7024 return true; | 7598 return true; |
| 7025 } | 7599 } |
| 7026 } | 7600 } |
| 7027 return false; | 7601 return false; |
| 7028 } | 7602 } |
| 7029 } | 7603 } |
| 7604 |
| 7030 /** | 7605 /** |
| 7031 * The abstract class `TypeImpl` implements the behavior common to objects repre
senting the | 7606 * The abstract class `TypeImpl` implements the behavior common to objects repre
senting the |
| 7032 * declared type of elements in the element model. | 7607 * declared type of elements in the element model. |
| 7033 * | 7608 * |
| 7034 * @coverage dart.engine.type | 7609 * @coverage dart.engine.type |
| 7035 */ | 7610 */ |
| 7036 abstract class TypeImpl implements Type2 { | 7611 abstract class TypeImpl implements Type2 { |
| 7037 | |
| 7038 /** | 7612 /** |
| 7039 * Return an array containing the results of using the given argument types an
d parameter types to | 7613 * Return an array containing the results of using the given argument types an
d parameter types to |
| 7040 * perform a substitution on all of the given types. | 7614 * perform a substitution on all of the given types. |
| 7041 * | 7615 * |
| 7042 * @param types the types on which a substitution is to be performed | 7616 * @param types the types on which a substitution is to be performed |
| 7043 * @param argumentTypes the argument types for the substitution | 7617 * @param argumentTypes the argument types for the substitution |
| 7044 * @param parameterTypes the parameter types for the substitution | 7618 * @param parameterTypes the parameter types for the substitution |
| 7045 * @return the result of performing the substitution on each of the types | 7619 * @return the result of performing the substitution on each of the types |
| 7046 */ | 7620 */ |
| 7047 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li
st<Type2> parameterTypes) { | 7621 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li
st<Type2> parameterTypes) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7075 /** | 7649 /** |
| 7076 * Initialize a newly created type to be declared by the given element and to
have the given name. | 7650 * Initialize a newly created type to be declared by the given element and to
have the given name. |
| 7077 * | 7651 * |
| 7078 * @param element the element representing the declaration of the type | 7652 * @param element the element representing the declaration of the type |
| 7079 * @param name the name of the type | 7653 * @param name the name of the type |
| 7080 */ | 7654 */ |
| 7081 TypeImpl(Element element, String name) { | 7655 TypeImpl(Element element, String name) { |
| 7082 this._element = element; | 7656 this._element = element; |
| 7083 this._name = name; | 7657 this._name = name; |
| 7084 } | 7658 } |
| 7659 |
| 7085 String get displayName => name; | 7660 String get displayName => name; |
| 7661 |
| 7086 Element get element => _element; | 7662 Element get element => _element; |
| 7663 |
| 7087 Type2 getLeastUpperBound(Type2 type) => null; | 7664 Type2 getLeastUpperBound(Type2 type) => null; |
| 7665 |
| 7088 String get name => _name; | 7666 String get name => _name; |
| 7667 |
| 7089 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf(
this); | 7668 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type) || type.isSubtypeOf(
this); |
| 7669 |
| 7090 bool get isBottom => false; | 7670 bool get isBottom => false; |
| 7671 |
| 7091 bool get isDartCoreFunction => false; | 7672 bool get isDartCoreFunction => false; |
| 7673 |
| 7092 bool get isDynamic => false; | 7674 bool get isDynamic => false; |
| 7675 |
| 7093 bool isMoreSpecificThan(Type2 type) => isMoreSpecificThan3(type, false); | 7676 bool isMoreSpecificThan(Type2 type) => isMoreSpecificThan3(type, false); |
| 7677 |
| 7094 bool isMoreSpecificThan3(Type2 type, bool withDynamic) => false; | 7678 bool isMoreSpecificThan3(Type2 type, bool withDynamic) => false; |
| 7679 |
| 7095 bool get isObject => false; | 7680 bool get isObject => false; |
| 7681 |
| 7096 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); | 7682 bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this); |
| 7683 |
| 7097 bool get isVoid => false; | 7684 bool get isVoid => false; |
| 7685 |
| 7098 String toString() { | 7686 String toString() { |
| 7099 JavaStringBuilder builder = new JavaStringBuilder(); | 7687 JavaStringBuilder builder = new JavaStringBuilder(); |
| 7100 appendTo(builder); | 7688 appendTo(builder); |
| 7101 return builder.toString(); | 7689 return builder.toString(); |
| 7102 } | 7690 } |
| 7103 | 7691 |
| 7104 /** | 7692 /** |
| 7105 * Append a textual representation of this type to the given builder. | 7693 * Append a textual representation of this type to the given builder. |
| 7106 * | 7694 * |
| 7107 * @param builder the builder to which the text is to be appended | 7695 * @param builder the builder to which the text is to be appended |
| 7108 */ | 7696 */ |
| 7109 void appendTo(JavaStringBuilder builder) { | 7697 void appendTo(JavaStringBuilder builder) { |
| 7110 if (_name == null) { | 7698 if (_name == null) { |
| 7111 builder.append("<unnamed type>"); | 7699 builder.append("<unnamed type>"); |
| 7112 } else { | 7700 } else { |
| 7113 builder.append(_name); | 7701 builder.append(_name); |
| 7114 } | 7702 } |
| 7115 } | 7703 } |
| 7116 } | 7704 } |
| 7705 |
| 7117 /** | 7706 /** |
| 7118 * Instances of the class `TypeParameterTypeImpl` defines the behavior of object
s representing | 7707 * Instances of the class `TypeParameterTypeImpl` defines the behavior of object
s representing |
| 7119 * the type introduced by a type parameter. | 7708 * the type introduced by a type parameter. |
| 7120 * | 7709 * |
| 7121 * @coverage dart.engine.type | 7710 * @coverage dart.engine.type |
| 7122 */ | 7711 */ |
| 7123 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType { | 7712 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType { |
| 7124 | |
| 7125 /** | 7713 /** |
| 7126 * An empty array of type parameter types. | 7714 * An empty array of type parameter types. |
| 7127 */ | 7715 */ |
| 7128 static List<TypeParameterType> EMPTY_ARRAY = new List<TypeParameterType>(0); | 7716 static List<TypeParameterType> EMPTY_ARRAY = new List<TypeParameterType>(0); |
| 7129 | 7717 |
| 7130 /** | 7718 /** |
| 7131 * Return an array containing the type parameter types defined by the given ar
ray of type | 7719 * Return an array containing the type parameter types defined by the given ar
ray of type |
| 7132 * parameter elements. | 7720 * parameter elements. |
| 7133 * | 7721 * |
| 7134 * @param typeParameters the type parameter elements defining the type paramet
er types to be | 7722 * @param typeParameters the type parameter elements defining the type paramet
er types to be |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7147 return types; | 7735 return types; |
| 7148 } | 7736 } |
| 7149 | 7737 |
| 7150 /** | 7738 /** |
| 7151 * Initialize a newly created type parameter type to be declared by the given
element and to have | 7739 * Initialize a newly created type parameter type to be declared by the given
element and to have |
| 7152 * the given name. | 7740 * the given name. |
| 7153 * | 7741 * |
| 7154 * @param element the element representing the declaration of the type paramet
er | 7742 * @param element the element representing the declaration of the type paramet
er |
| 7155 */ | 7743 */ |
| 7156 TypeParameterTypeImpl(TypeParameterElement element) : super(element, element.n
ame); | 7744 TypeParameterTypeImpl(TypeParameterElement element) : super(element, element.n
ame); |
| 7157 bool operator ==(Object object) => object is TypeParameterTypeImpl && (element
== ((object as TypeParameterTypeImpl)).element); | 7745 |
| 7746 bool operator ==(Object object) => object is TypeParameterTypeImpl && (element
== (object as TypeParameterTypeImpl).element); |
| 7747 |
| 7158 TypeParameterElement get element => super.element as TypeParameterElement; | 7748 TypeParameterElement get element => super.element as TypeParameterElement; |
| 7749 |
| 7159 int get hashCode => element.hashCode; | 7750 int get hashCode => element.hashCode; |
| 7751 |
| 7160 bool isMoreSpecificThan3(Type2 s, bool withDynamic) { | 7752 bool isMoreSpecificThan3(Type2 s, bool withDynamic) { |
| 7161 if (this == s) { | 7753 if (this == s) { |
| 7162 return true; | 7754 return true; |
| 7163 } | 7755 } |
| 7164 if (s.isBottom) { | 7756 if (s.isBottom) { |
| 7165 return true; | 7757 return true; |
| 7166 } | 7758 } |
| 7167 if (s.isDynamic) { | 7759 if (s.isDynamic) { |
| 7168 return true; | 7760 return true; |
| 7169 } | 7761 } |
| 7170 return isMoreSpecificThan4(s, new Set<Type2>(), withDynamic); | 7762 return isMoreSpecificThan4(s, new Set<Type2>(), withDynamic); |
| 7171 } | 7763 } |
| 7764 |
| 7172 bool isSubtypeOf(Type2 s) => isMoreSpecificThan3(s, true); | 7765 bool isSubtypeOf(Type2 s) => isMoreSpecificThan3(s, true); |
| 7766 |
| 7173 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { | 7767 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { |
| 7174 int length = parameterTypes.length; | 7768 int length = parameterTypes.length; |
| 7175 for (int i = 0; i < length; i++) { | 7769 for (int i = 0; i < length; i++) { |
| 7176 if (parameterTypes[i] == this) { | 7770 if (parameterTypes[i] == this) { |
| 7177 return argumentTypes[i]; | 7771 return argumentTypes[i]; |
| 7178 } | 7772 } |
| 7179 } | 7773 } |
| 7180 return this; | 7774 return this; |
| 7181 } | 7775 } |
| 7776 |
| 7182 bool isMoreSpecificThan4(Type2 s, Set<Type2> visitedTypes, bool withDynamic) { | 7777 bool isMoreSpecificThan4(Type2 s, Set<Type2> visitedTypes, bool withDynamic) { |
| 7183 Type2 bound = element.bound; | 7778 Type2 bound = element.bound; |
| 7184 if (s == bound) { | 7779 if (s == bound) { |
| 7185 return true; | 7780 return true; |
| 7186 } | 7781 } |
| 7187 if (s.isObject) { | 7782 if (s.isObject) { |
| 7188 return true; | 7783 return true; |
| 7189 } | 7784 } |
| 7190 if (bound == null) { | 7785 if (bound == null) { |
| 7191 return false; | 7786 return false; |
| 7192 } | 7787 } |
| 7193 if (bound is TypeParameterTypeImpl) { | 7788 if (bound is TypeParameterTypeImpl) { |
| 7194 TypeParameterTypeImpl boundTypeParameter = bound as TypeParameterTypeImpl; | 7789 TypeParameterTypeImpl boundTypeParameter = bound as TypeParameterTypeImpl; |
| 7195 if (visitedTypes.contains(bound)) { | 7790 if (visitedTypes.contains(bound)) { |
| 7196 return false; | 7791 return false; |
| 7197 } | 7792 } |
| 7198 javaSetAdd(visitedTypes, bound); | 7793 javaSetAdd(visitedTypes, bound); |
| 7199 return boundTypeParameter.isMoreSpecificThan4(s, visitedTypes, withDynamic
); | 7794 return boundTypeParameter.isMoreSpecificThan4(s, visitedTypes, withDynamic
); |
| 7200 } | 7795 } |
| 7201 return bound.isMoreSpecificThan3(s, withDynamic); | 7796 return bound.isMoreSpecificThan3(s, withDynamic); |
| 7202 } | 7797 } |
| 7203 } | 7798 } |
| 7799 |
| 7204 /** | 7800 /** |
| 7205 * The unique instance of the class `VoidTypeImpl` implements the type `void`. | 7801 * The unique instance of the class `VoidTypeImpl` implements the type `void`. |
| 7206 * | 7802 * |
| 7207 * @coverage dart.engine.type | 7803 * @coverage dart.engine.type |
| 7208 */ | 7804 */ |
| 7209 class VoidTypeImpl extends TypeImpl implements VoidType { | 7805 class VoidTypeImpl extends TypeImpl implements VoidType { |
| 7210 | |
| 7211 /** | 7806 /** |
| 7212 * The unique instance of this class. | 7807 * The unique instance of this class. |
| 7213 */ | 7808 */ |
| 7214 static final VoidTypeImpl instance = new VoidTypeImpl(); | 7809 static final VoidTypeImpl instance = new VoidTypeImpl(); |
| 7215 | 7810 |
| 7216 /** | 7811 /** |
| 7217 * Prevent the creation of instances of this class. | 7812 * Prevent the creation of instances of this class. |
| 7218 */ | 7813 */ |
| 7219 VoidTypeImpl() : super(null, Keyword.VOID.syntax); | 7814 VoidTypeImpl() : super(null, Keyword.VOID.syntax); |
| 7815 |
| 7220 bool operator ==(Object object) => identical(object, this); | 7816 bool operator ==(Object object) => identical(object, this); |
| 7817 |
| 7818 bool isMoreSpecificThan3(Type2 type, bool withDynamic) => isSubtypeOf(type); |
| 7819 |
| 7221 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam
icTypeImpl.instance); | 7820 bool isSubtypeOf(Type2 type) => identical(type, this) || identical(type, Dynam
icTypeImpl.instance); |
| 7821 |
| 7222 bool get isVoid => true; | 7822 bool get isVoid => true; |
| 7823 |
| 7223 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
) => this; | 7824 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
) => this; |
| 7224 } | 7825 } |
| 7826 |
| 7225 /** | 7827 /** |
| 7226 * The interface `FunctionType` defines the behavior common to objects represent
ing the type | 7828 * The interface `FunctionType` defines the behavior common to objects represent
ing the type |
| 7227 * of a function, method, constructor, getter, or setter. Function types come in
three variations: | 7829 * of a function, method, constructor, getter, or setter. Function types come in
three variations: |
| 7228 * <ol> | 7830 * <ol> |
| 7229 * * The types of functions that only have required parameters. These have the g
eneral form | 7831 * * The types of functions that only have required parameters. These have the g
eneral form |
| 7230 * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>. | 7832 * <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>. |
| 7231 * * The types of functions with optional positional parameters. These have the
general form | 7833 * * The types of functions with optional positional parameters. These have the
general form |
| 7232 * <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub>, …, T<sub
>n+k</sub>]) → | 7834 * <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub>, …, T<sub
>n+k</sub>]) → |
| 7233 * T</i>. | 7835 * T</i>. |
| 7234 * * The types of functions with named parameters. These have the general form <
i>(T<sub>1</sub>, | 7836 * * The types of functions with named parameters. These have the general form <
i>(T<sub>1</sub>, |
| 7235 * …, T<sub>n</sub>, {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) &r
arr; T</i>. | 7837 * …, T<sub>n</sub>, {T<sub>x1</sub> x1, …, T<sub>xk</sub> xk}) &r
arr; T</i>. |
| 7236 * </ol> | 7838 * </ol> |
| 7237 * | 7839 * |
| 7238 * @coverage dart.engine.type | 7840 * @coverage dart.engine.type |
| 7239 */ | 7841 */ |
| 7240 abstract class FunctionType implements ParameterizedType { | 7842 abstract class FunctionType implements ParameterizedType { |
| 7241 | |
| 7242 /** | 7843 /** |
| 7243 * Return a map from the names of named parameters to the types of the named p
arameters of this | 7844 * Return a map from the names of named parameters to the types of the named p
arameters of this |
| 7244 * type of function. The entries in the map will be iterated in the same order
as the order in | 7845 * type of function. The entries in the map will be iterated in the same order
as the order in |
| 7245 * which the named parameters were defined. If there were no named parameters
declared then the | 7846 * which the named parameters were defined. If there were no named parameters
declared then the |
| 7246 * map will be empty. | 7847 * map will be empty. |
| 7247 * | 7848 * |
| 7248 * @return a map from the name to the types of the named parameters of this ty
pe of function | 7849 * @return a map from the name to the types of the named parameters of this ty
pe of function |
| 7249 */ | 7850 */ |
| 7250 Map<String, Type2> get namedParameterTypes; | 7851 Map<String, Type2> get namedParameterTypes; |
| 7251 | 7852 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7350 bool isSubtypeOf(Type2 type); | 7951 bool isSubtypeOf(Type2 type); |
| 7351 | 7952 |
| 7352 /** | 7953 /** |
| 7353 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. | 7954 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. |
| 7354 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())`
. | 7955 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())`
. |
| 7355 * | 7956 * |
| 7356 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters | 7957 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters |
| 7357 * @return the result of performing the substitution | 7958 * @return the result of performing the substitution |
| 7358 */ | 7959 */ |
| 7359 FunctionType substitute3(List<Type2> argumentTypes); | 7960 FunctionType substitute3(List<Type2> argumentTypes); |
| 7961 |
| 7360 FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
); | 7962 FunctionType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes
); |
| 7361 } | 7963 } |
| 7964 |
| 7362 /** | 7965 /** |
| 7363 * The interface `InterfaceType` defines the behavior common to objects represen
ting the type | 7966 * The interface `InterfaceType` defines the behavior common to objects represen
ting the type |
| 7364 * introduced by either a class or an interface, or a reference to such a type. | 7967 * introduced by either a class or an interface, or a reference to such a type. |
| 7365 * | 7968 * |
| 7366 * @coverage dart.engine.type | 7969 * @coverage dart.engine.type |
| 7367 */ | 7970 */ |
| 7368 abstract class InterfaceType implements ParameterizedType { | 7971 abstract class InterfaceType implements ParameterizedType { |
| 7369 | |
| 7370 /** | 7972 /** |
| 7371 * Return an array containing all of the accessors (getters and setters) decla
red in this type. | 7973 * Return an array containing all of the accessors (getters and setters) decla
red in this type. |
| 7372 * | 7974 * |
| 7373 * @return the accessors declared in this type | 7975 * @return the accessors declared in this type |
| 7374 */ | 7976 */ |
| 7375 List<PropertyAccessorElement> get accessors; | 7977 List<PropertyAccessorElement> get accessors; |
| 7978 |
| 7376 ClassElement get element; | 7979 ClassElement get element; |
| 7377 | 7980 |
| 7378 /** | 7981 /** |
| 7379 * Return the element representing the getter with the given name that is decl
ared in this class, | 7982 * Return the element representing the getter with the given name that is decl
ared in this class, |
| 7380 * or `null` if this class does not declare a getter with the given name. | 7983 * or `null` if this class does not declare a getter with the given name. |
| 7381 * | 7984 * |
| 7382 * @param getterName the name of the getter to be returned | 7985 * @param getterName the name of the getter to be returned |
| 7383 * @return the getter declared in this class with the given name | 7986 * @return the getter declared in this class with the given name |
| 7384 */ | 7987 */ |
| 7385 PropertyAccessorElement getGetter(String getterName); | 7988 PropertyAccessorElement getGetter(String getterName); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7652 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle
ment library); | 8255 PropertyAccessorElement lookUpSetterInSuperclass(String setterName, LibraryEle
ment library); |
| 7653 | 8256 |
| 7654 /** | 8257 /** |
| 7655 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. | 8258 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. |
| 7656 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())`
. | 8259 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())`
. |
| 7657 * | 8260 * |
| 7658 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters | 8261 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters |
| 7659 * @return the result of performing the substitution | 8262 * @return the result of performing the substitution |
| 7660 */ | 8263 */ |
| 7661 InterfaceType substitute4(List<Type2> argumentTypes); | 8264 InterfaceType substitute4(List<Type2> argumentTypes); |
| 8265 |
| 7662 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType
s); | 8266 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType
s); |
| 7663 } | 8267 } |
| 8268 |
| 7664 /** | 8269 /** |
| 7665 * The interface `ParameterizedType` defines the behavior common to objects repr
esenting a | 8270 * The interface `ParameterizedType` defines the behavior common to objects repr
esenting a |
| 7666 * type with type parameters, such as a class or function type alias. | 8271 * type with type parameters, such as a class or function type alias. |
| 7667 * | 8272 * |
| 7668 * @coverage dart.engine.type | 8273 * @coverage dart.engine.type |
| 7669 */ | 8274 */ |
| 7670 abstract class ParameterizedType implements Type2 { | 8275 abstract class ParameterizedType implements Type2 { |
| 7671 | |
| 7672 /** | 8276 /** |
| 7673 * Return an array containing the actual types of the type arguments. If this
type's element does | 8277 * Return an array containing the actual types of the type arguments. If this
type's element does |
| 7674 * not have type parameters, then the array should be empty (although it is po
ssible for type | 8278 * not have type parameters, then the array should be empty (although it is po
ssible for type |
| 7675 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type | 8279 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type |
| 7676 * does not explicitly include argument values, then the type "dynamic" will b
e automatically | 8280 * does not explicitly include argument values, then the type "dynamic" will b
e automatically |
| 7677 * provided. | 8281 * provided. |
| 7678 * | 8282 * |
| 7679 * @return the actual types of the type arguments | 8283 * @return the actual types of the type arguments |
| 7680 */ | 8284 */ |
| 7681 List<Type2> get typeArguments; | 8285 List<Type2> get typeArguments; |
| 7682 | 8286 |
| 7683 /** | 8287 /** |
| 7684 * Return an array containing all of the type parameters declared for this typ
e. | 8288 * Return an array containing all of the type parameters declared for this typ
e. |
| 7685 * | 8289 * |
| 7686 * @return the type parameters declared for this type | 8290 * @return the type parameters declared for this type |
| 7687 */ | 8291 */ |
| 7688 List<TypeParameterElement> get typeParameters; | 8292 List<TypeParameterElement> get typeParameters; |
| 7689 } | 8293 } |
| 8294 |
| 7690 /** | 8295 /** |
| 7691 * The interface `Type` defines the behavior of objects representing the declare
d type of | 8296 * The interface `Type` defines the behavior of objects representing the declare
d type of |
| 7692 * elements in the element model. | 8297 * elements in the element model. |
| 7693 * | 8298 * |
| 7694 * @coverage dart.engine.type | 8299 * @coverage dart.engine.type |
| 7695 */ | 8300 */ |
| 7696 abstract class Type2 { | 8301 abstract class Type2 { |
| 7697 | |
| 7698 /** | 8302 /** |
| 7699 * Return the name of this type as it should appear when presented to users in
contexts such as | 8303 * Return the name of this type as it should appear when presented to users in
contexts such as |
| 7700 * error messages. | 8304 * error messages. |
| 7701 * | 8305 * |
| 7702 * @return the name of this type | 8306 * @return the name of this type |
| 7703 */ | 8307 */ |
| 7704 String get displayName; | 8308 String get displayName; |
| 7705 | 8309 |
| 7706 /** | 8310 /** |
| 7707 * Return the element representing the declaration of this type, or `null` if
the type has | 8311 * Return the element representing the declaration of this type, or `null` if
the type has |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7818 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification
, this method will | 8422 * <i>x<sub>i</sub></i>.</blockquote> Note that, contrary to the specification
, this method will |
| 7819 * not create a copy of this type if no substitutions were required, but will
return this type | 8423 * not create a copy of this type if no substitutions were required, but will
return this type |
| 7820 * directly. | 8424 * directly. |
| 7821 * | 8425 * |
| 7822 * @param argumentTypes the actual type arguments being substituted for the pa
rameters | 8426 * @param argumentTypes the actual type arguments being substituted for the pa
rameters |
| 7823 * @param parameterTypes the parameters to be replaced | 8427 * @param parameterTypes the parameters to be replaced |
| 7824 * @return the result of performing the substitution | 8428 * @return the result of performing the substitution |
| 7825 */ | 8429 */ |
| 7826 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 8430 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 7827 } | 8431 } |
| 8432 |
| 7828 /** | 8433 /** |
| 7829 * The interface `TypeParameterType` defines the behavior of objects representin
g the type | 8434 * The interface `TypeParameterType` defines the behavior of objects representin
g the type |
| 7830 * introduced by a type parameter. | 8435 * introduced by a type parameter. |
| 7831 * | 8436 * |
| 7832 * @coverage dart.engine.type | 8437 * @coverage dart.engine.type |
| 7833 */ | 8438 */ |
| 7834 abstract class TypeParameterType implements Type2 { | 8439 abstract class TypeParameterType implements Type2 { |
| 7835 TypeParameterElement get element; | 8440 TypeParameterElement get element; |
| 7836 } | 8441 } |
| 8442 |
| 7837 /** | 8443 /** |
| 7838 * The interface `VoidType` defines the behavior of the unique object representi
ng the type | 8444 * The interface `VoidType` defines the behavior of the unique object representi
ng the type |
| 7839 * `void`. | 8445 * `void`. |
| 7840 * | 8446 * |
| 7841 * @coverage dart.engine.type | 8447 * @coverage dart.engine.type |
| 7842 */ | 8448 */ |
| 7843 abstract class VoidType implements Type2 { | 8449 abstract class VoidType implements Type2 { |
| 7844 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 8450 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 7845 } | 8451 } |
| OLD | NEW |