| 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 library engine.element; | 3 library engine.element; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'utilities_collection.dart'; | 7 import 'utilities_collection.dart'; |
| 8 import 'source.dart'; | 8 import 'source.dart'; |
| 9 import 'scanner.dart' show Keyword; | 9 import 'scanner.dart' show Keyword; |
| 10 import 'ast.dart' show Identifier, LibraryIdentifier; | 10 import 'ast.dart' show Identifier, LibraryIdentifier; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 InterfaceType get supertype; | 132 InterfaceType get supertype; |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * Return the type defined by the class. | 135 * Return the type defined by the class. |
| 136 * | 136 * |
| 137 * @return the type defined by the class | 137 * @return the type defined by the class |
| 138 */ | 138 */ |
| 139 InterfaceType get type; | 139 InterfaceType get type; |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * Return an array containing all of the type variables declared for this clas
s. | 142 * Return an array containing all of the type parameters declared for this cla
ss. |
| 143 * | 143 * |
| 144 * @return the type variables declared for this class | 144 * @return the type parameters declared for this class |
| 145 */ | 145 */ |
| 146 List<TypeVariableElement> get typeVariables; | 146 List<TypeParameterElement> get typeParameters; |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * Return the unnamed constructor declared in this class, or `null` if this cl
ass does not | 149 * Return the unnamed constructor declared in this class, or `null` if this cl
ass does not |
| 150 * declare an unnamed constructor but does declare named constructors. The ret
urned constructor | 150 * declare an unnamed constructor but does declare named constructors. The ret
urned constructor |
| 151 * will be synthetic if this class does not declare any constructors, in which
case it will | 151 * will be synthetic if this class does not declare any constructors, in which
case it will |
| 152 * represent the default constructor for the class. | 152 * represent the default constructor for the class. |
| 153 * | 153 * |
| 154 * @return the unnamed constructor defined in this class | 154 * @return the unnamed constructor defined in this class |
| 155 */ | 155 */ |
| 156 ConstructorElement get unnamedConstructor; | 156 ConstructorElement get unnamedConstructor; |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 static final ElementKind LABEL = new ElementKind('LABEL', 13, "label"); | 587 static final ElementKind LABEL = new ElementKind('LABEL', 13, "label"); |
| 588 static final ElementKind LIBRARY = new ElementKind('LIBRARY', 14, "library"); | 588 static final ElementKind LIBRARY = new ElementKind('LIBRARY', 14, "library"); |
| 589 static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 15
, "local variable"); | 589 static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 15
, "local variable"); |
| 590 static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); | 590 static final ElementKind METHOD = new ElementKind('METHOD', 16, "method"); |
| 591 static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); | 591 static final ElementKind NAME = new ElementKind('NAME', 17, "<name>"); |
| 592 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "paramet
er"); | 592 static final ElementKind PARAMETER = new ElementKind('PARAMETER', 18, "paramet
er"); |
| 593 static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix
"); | 593 static final ElementKind PREFIX = new ElementKind('PREFIX', 19, "import prefix
"); |
| 594 static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); | 594 static final ElementKind SETTER = new ElementKind('SETTER', 20, "setter"); |
| 595 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA
BLE', 21, "top level variable"); | 595 static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIA
BLE', 21, "top level variable"); |
| 596 static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_
ALIAS', 22, "function type alias"); | 596 static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_
ALIAS', 22, "function type alias"); |
| 597 static final ElementKind TYPE_VARIABLE = new ElementKind('TYPE_VARIABLE', 23,
"type variable"); | 597 static final ElementKind TYPE_PARAMETER = new ElementKind('TYPE_PARAMETER', 23
, "type parameter"); |
| 598 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe
>"); | 598 static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 24, "<universe
>"); |
| 599 static final List<ElementKind> values = [ | 599 static final List<ElementKind> values = [ |
| 600 CLASS, | 600 CLASS, |
| 601 COMPILATION_UNIT, | 601 COMPILATION_UNIT, |
| 602 CONSTRUCTOR, | 602 CONSTRUCTOR, |
| 603 DYNAMIC, | 603 DYNAMIC, |
| 604 EMBEDDED_HTML_SCRIPT, | 604 EMBEDDED_HTML_SCRIPT, |
| 605 ERROR, | 605 ERROR, |
| 606 EXPORT, | 606 EXPORT, |
| 607 EXTERNAL_HTML_SCRIPT, | 607 EXTERNAL_HTML_SCRIPT, |
| 608 FIELD, | 608 FIELD, |
| 609 FUNCTION, | 609 FUNCTION, |
| 610 GETTER, | 610 GETTER, |
| 611 HTML, | 611 HTML, |
| 612 IMPORT, | 612 IMPORT, |
| 613 LABEL, | 613 LABEL, |
| 614 LIBRARY, | 614 LIBRARY, |
| 615 LOCAL_VARIABLE, | 615 LOCAL_VARIABLE, |
| 616 METHOD, | 616 METHOD, |
| 617 NAME, | 617 NAME, |
| 618 PARAMETER, | 618 PARAMETER, |
| 619 PREFIX, | 619 PREFIX, |
| 620 SETTER, | 620 SETTER, |
| 621 TOP_LEVEL_VARIABLE, | 621 TOP_LEVEL_VARIABLE, |
| 622 FUNCTION_TYPE_ALIAS, | 622 FUNCTION_TYPE_ALIAS, |
| 623 TYPE_VARIABLE, | 623 TYPE_PARAMETER, |
| 624 UNIVERSE]; | 624 UNIVERSE]; |
| 625 | 625 |
| 626 /** | 626 /** |
| 627 * Return the kind of the given element, or [ERROR] if the element is `null`.
This is | 627 * Return the kind of the given element, or [ERROR] if the element is `null`.
This is |
| 628 * a utility method that can reduce the need for null checks in other places. | 628 * a utility method that can reduce the need for null checks in other places. |
| 629 * | 629 * |
| 630 * @param element the element whose kind is to be returned | 630 * @param element the element whose kind is to be returned |
| 631 * @return the kind of the given element | 631 * @return the kind of the given element |
| 632 */ | 632 */ |
| 633 static ElementKind of(Element element) { | 633 static ElementKind of(Element element) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 R visitImportElement(ImportElement element); | 688 R visitImportElement(ImportElement element); |
| 689 R visitLabelElement(LabelElement element); | 689 R visitLabelElement(LabelElement element); |
| 690 R visitLibraryElement(LibraryElement element); | 690 R visitLibraryElement(LibraryElement element); |
| 691 R visitLocalVariableElement(LocalVariableElement element); | 691 R visitLocalVariableElement(LocalVariableElement element); |
| 692 R visitMethodElement(MethodElement element); | 692 R visitMethodElement(MethodElement element); |
| 693 R visitMultiplyDefinedElement(MultiplyDefinedElement element); | 693 R visitMultiplyDefinedElement(MultiplyDefinedElement element); |
| 694 R visitParameterElement(ParameterElement element); | 694 R visitParameterElement(ParameterElement element); |
| 695 R visitPrefixElement(PrefixElement element); | 695 R visitPrefixElement(PrefixElement element); |
| 696 R visitPropertyAccessorElement(PropertyAccessorElement element); | 696 R visitPropertyAccessorElement(PropertyAccessorElement element); |
| 697 R visitTopLevelVariableElement(TopLevelVariableElement element); | 697 R visitTopLevelVariableElement(TopLevelVariableElement element); |
| 698 R visitTypeVariableElement(TypeVariableElement element); | 698 R visitTypeParameterElement(TypeParameterElement element); |
| 699 } | 699 } |
| 700 /** | 700 /** |
| 701 * The interface `EmbeddedHtmlScriptElement` defines the behavior of elements re
presenting a | 701 * 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. | 702 * script tag in an HTML file having content that defines a Dart library. |
| 703 * | 703 * |
| 704 * @coverage dart.engine.element | 704 * @coverage dart.engine.element |
| 705 */ | 705 */ |
| 706 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { | 706 abstract class EmbeddedHtmlScriptElement implements HtmlScriptElement { |
| 707 | 707 |
| 708 /** | 708 /** |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 Type2 get returnType; | 883 Type2 get returnType; |
| 884 | 884 |
| 885 /** | 885 /** |
| 886 * Return the type of function defined by this type alias. | 886 * Return the type of function defined by this type alias. |
| 887 * | 887 * |
| 888 * @return the type of function defined by this type alias | 888 * @return the type of function defined by this type alias |
| 889 */ | 889 */ |
| 890 FunctionType get type; | 890 FunctionType get type; |
| 891 | 891 |
| 892 /** | 892 /** |
| 893 * Return an array containing all of the type variables defined for this type. | 893 * Return an array containing all of the type parameters defined for this type
. |
| 894 * | 894 * |
| 895 * @return the type variables defined for this type | 895 * @return the type parameters defined for this type |
| 896 */ | 896 */ |
| 897 List<TypeVariableElement> get typeVariables; | 897 List<TypeParameterElement> get typeParameters; |
| 898 } | 898 } |
| 899 /** | 899 /** |
| 900 * The interface `HideElementCombinator` defines the behavior of combinators tha
t cause some | 900 * 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. | 901 * of the names in a namespace to be hidden when being imported. |
| 902 * | 902 * |
| 903 * @coverage dart.engine.element | 903 * @coverage dart.engine.element |
| 904 */ | 904 */ |
| 905 abstract class HideElementCombinator implements NamespaceCombinator { | 905 abstract class HideElementCombinator implements NamespaceCombinator { |
| 906 | 906 |
| 907 /** | 907 /** |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 bool get isBrowserApplication; | 1076 bool get isBrowserApplication; |
| 1077 | 1077 |
| 1078 /** | 1078 /** |
| 1079 * Return `true` if this library is the dart:core library. | 1079 * Return `true` if this library is the dart:core library. |
| 1080 * | 1080 * |
| 1081 * @return `true` if this library is the dart:core library | 1081 * @return `true` if this library is the dart:core library |
| 1082 */ | 1082 */ |
| 1083 bool get isDartCore; | 1083 bool get isDartCore; |
| 1084 | 1084 |
| 1085 /** | 1085 /** |
| 1086 * Return `true` if this library is the dart:core library. |
| 1087 * |
| 1088 * @return `true` if this library is the dart:core library |
| 1089 */ |
| 1090 bool get isInSdk; |
| 1091 |
| 1092 /** |
| 1086 * Return `true` if this library is up to date with respect to the given time
stamp. If any | 1093 * Return `true` if this library is up to date with respect to the given time
stamp. If any |
| 1087 * transitively referenced Source is newer than the time stamp, this method re
turns false. | 1094 * transitively referenced Source is newer than the time stamp, this method re
turns false. |
| 1088 * | 1095 * |
| 1089 * @param timeStamp the time stamp to compare against | 1096 * @param timeStamp the time stamp to compare against |
| 1090 * @return `true` if this library is up to date with respect to the given time
stamp | 1097 * @return `true` if this library is up to date with respect to the given time
stamp |
| 1091 */ | 1098 */ |
| 1092 bool isUpToDate2(int timeStamp); | 1099 bool isUpToDate2(int timeStamp); |
| 1093 } | 1100 } |
| 1094 /** | 1101 /** |
| 1095 * The interface `LocalElement` defines the behavior of elements that can be (bu
t are not | 1102 * The interface `LocalElement` defines the behavior of elements that can be (bu
t are not |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 } | 1380 } |
| 1374 /** | 1381 /** |
| 1375 * The interface `TopLevelVariableElement` defines the behavior of elements repr
esenting a | 1382 * The interface `TopLevelVariableElement` defines the behavior of elements repr
esenting a |
| 1376 * top-level variable. | 1383 * top-level variable. |
| 1377 * | 1384 * |
| 1378 * @coverage dart.engine.element | 1385 * @coverage dart.engine.element |
| 1379 */ | 1386 */ |
| 1380 abstract class TopLevelVariableElement implements PropertyInducingElement { | 1387 abstract class TopLevelVariableElement implements PropertyInducingElement { |
| 1381 } | 1388 } |
| 1382 /** | 1389 /** |
| 1383 * The interface `TypeVariableElement` defines the behavior of elements represen
ting a type | 1390 * The interface `TypeParameterElement` defines the behavior of elements represe
nting a type |
| 1384 * variable. | 1391 * parameter. |
| 1385 * | 1392 * |
| 1386 * @coverage dart.engine.element | 1393 * @coverage dart.engine.element |
| 1387 */ | 1394 */ |
| 1388 abstract class TypeVariableElement implements Element { | 1395 abstract class TypeParameterElement implements Element { |
| 1389 | 1396 |
| 1390 /** | 1397 /** |
| 1391 * Return the type representing the bound associated with this variable, or `n
ull` if this | 1398 * Return the type representing the bound associated with this parameter, or `
null` if this |
| 1392 * variable does not have an explicit bound. | 1399 * parameter does not have an explicit bound. |
| 1393 * | 1400 * |
| 1394 * @return the type representing the bound associated with this variable | 1401 * @return the type representing the bound associated with this parameter |
| 1395 */ | 1402 */ |
| 1396 Type2 get bound; | 1403 Type2 get bound; |
| 1397 | 1404 |
| 1398 /** | 1405 /** |
| 1399 * Return the type defined by this type variable. | 1406 * Return the type defined by this type parameter. |
| 1400 * | 1407 * |
| 1401 * @return the type defined by this type variable | 1408 * @return the type defined by this type parameter |
| 1402 */ | 1409 */ |
| 1403 TypeVariableType get type; | 1410 TypeParameterType get type; |
| 1404 } | 1411 } |
| 1405 /** | 1412 /** |
| 1406 * The interface `UndefinedElement` defines the behavior of pseudo-elements that
represent | 1413 * The interface `UndefinedElement` defines the behavior of pseudo-elements that
represent |
| 1407 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing | 1414 * names that are undefined. This situation is not allowed by the language, so o
bjects implementing |
| 1408 * this interface always represent an error. As a result, most of the normal ope
rations on elements | 1415 * this interface always represent an error. As a result, most of the normal ope
rations on elements |
| 1409 * do not make sense and will return useless results. | 1416 * do not make sense and will return useless results. |
| 1410 * | 1417 * |
| 1411 * @coverage dart.engine.element | 1418 * @coverage dart.engine.element |
| 1412 */ | 1419 */ |
| 1413 abstract class UndefinedElement implements Element { | 1420 abstract class UndefinedElement implements Element { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 * MethodElement | 1507 * MethodElement |
| 1501 * PropertyAccessorElement | 1508 * PropertyAccessorElement |
| 1502 * ExportElement | 1509 * ExportElement |
| 1503 * HtmlElement | 1510 * HtmlElement |
| 1504 * ImportElement | 1511 * ImportElement |
| 1505 * LabelElement | 1512 * LabelElement |
| 1506 * LibraryElement | 1513 * LibraryElement |
| 1507 * MultiplyDefinedElement | 1514 * MultiplyDefinedElement |
| 1508 * PrefixElement | 1515 * PrefixElement |
| 1509 * TypeAliasElement | 1516 * TypeAliasElement |
| 1510 * TypeVariableElement | 1517 * TypeParameterElement |
| 1511 * UndefinedElement | 1518 * UndefinedElement |
| 1512 * VariableElement | 1519 * VariableElement |
| 1513 * PropertyInducingElement | 1520 * PropertyInducingElement |
| 1514 * FieldElement | 1521 * FieldElement |
| 1515 * TopLevelVariableElement | 1522 * TopLevelVariableElement |
| 1516 * LocalElement | 1523 * LocalElement |
| 1517 * LocalVariableElement | 1524 * LocalVariableElement |
| 1518 * ParameterElement | 1525 * ParameterElement |
| 1519 * FieldFormalParameterElement | 1526 * FieldFormalParameterElement |
| 1520 * </pre> | 1527 * </pre> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 return null; | 1565 return null; |
| 1559 } | 1566 } |
| 1560 R visitLocalVariableElement(LocalVariableElement element) => visitLocalElement
(element); | 1567 R visitLocalVariableElement(LocalVariableElement element) => visitLocalElement
(element); |
| 1561 R visitMethodElement(MethodElement element) => visitExecutableElement(element)
; | 1568 R visitMethodElement(MethodElement element) => visitExecutableElement(element)
; |
| 1562 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(
element); | 1569 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => visitElement(
element); |
| 1563 R visitParameterElement(ParameterElement element) => visitLocalElement(element
); | 1570 R visitParameterElement(ParameterElement element) => visitLocalElement(element
); |
| 1564 R visitPrefixElement(PrefixElement element) => visitElement(element); | 1571 R visitPrefixElement(PrefixElement element) => visitElement(element); |
| 1565 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut
ableElement(element); | 1572 R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecut
ableElement(element); |
| 1566 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab
leElement(element); | 1573 R visitPropertyInducingElement(PropertyInducingElement element) => visitVariab
leElement(element); |
| 1567 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper
tyInducingElement(element); | 1574 R visitTopLevelVariableElement(TopLevelVariableElement element) => visitProper
tyInducingElement(element); |
| 1568 R visitTypeVariableElement(TypeVariableElement element) => visitElement(elemen
t); | 1575 R visitTypeParameterElement(TypeParameterElement element) => visitElement(elem
ent); |
| 1569 R visitVariableElement(VariableElement element) => visitElement(element); | 1576 R visitVariableElement(VariableElement element) => visitElement(element); |
| 1570 } | 1577 } |
| 1571 /** | 1578 /** |
| 1572 * Instances of the class `RecursiveElementVisitor` implement an element visitor
that will | 1579 * Instances of the class `RecursiveElementVisitor` implement an element visitor
that will |
| 1573 * recursively visit all of the element in an element model. For example, using
an instance of this | 1580 * recursively visit all of the element in an element model. For example, using
an instance of this |
| 1574 * class to visit a [CompilationUnitElement] will also cause all of the types in
the | 1581 * class to visit a [CompilationUnitElement] will also cause all of the types in
the |
| 1575 * compilation unit to be visited. | 1582 * compilation unit to be visited. |
| 1576 * | 1583 * |
| 1577 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 1584 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
| 1578 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the | 1585 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 return null; | 1665 return null; |
| 1659 } | 1666 } |
| 1660 R visitPropertyAccessorElement(PropertyAccessorElement element) { | 1667 R visitPropertyAccessorElement(PropertyAccessorElement element) { |
| 1661 element.visitChildren(this); | 1668 element.visitChildren(this); |
| 1662 return null; | 1669 return null; |
| 1663 } | 1670 } |
| 1664 R visitTopLevelVariableElement(TopLevelVariableElement element) { | 1671 R visitTopLevelVariableElement(TopLevelVariableElement element) { |
| 1665 element.visitChildren(this); | 1672 element.visitChildren(this); |
| 1666 return null; | 1673 return null; |
| 1667 } | 1674 } |
| 1668 R visitTypeVariableElement(TypeVariableElement element) { | 1675 R visitTypeParameterElement(TypeParameterElement element) { |
| 1669 element.visitChildren(this); | 1676 element.visitChildren(this); |
| 1670 return null; | 1677 return null; |
| 1671 } | 1678 } |
| 1672 } | 1679 } |
| 1673 /** | 1680 /** |
| 1674 * Instances of the class `SimpleElementVisitor` implement an element visitor th
at will do | 1681 * Instances of the class `SimpleElementVisitor` implement an element visitor th
at will do |
| 1675 * nothing when visiting an element. It is intended to be a superclass for class
es that use the | 1682 * nothing when visiting an element. It is intended to be a superclass for class
es that use the |
| 1676 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a | 1683 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a |
| 1677 * whole structure) and that only need to visit a small number of element types. | 1684 * whole structure) and that only need to visit a small number of element types. |
| 1678 * | 1685 * |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1693 R visitImportElement(ImportElement element) => null; | 1700 R visitImportElement(ImportElement element) => null; |
| 1694 R visitLabelElement(LabelElement element) => null; | 1701 R visitLabelElement(LabelElement element) => null; |
| 1695 R visitLibraryElement(LibraryElement element) => null; | 1702 R visitLibraryElement(LibraryElement element) => null; |
| 1696 R visitLocalVariableElement(LocalVariableElement element) => null; | 1703 R visitLocalVariableElement(LocalVariableElement element) => null; |
| 1697 R visitMethodElement(MethodElement element) => null; | 1704 R visitMethodElement(MethodElement element) => null; |
| 1698 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; | 1705 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; |
| 1699 R visitParameterElement(ParameterElement element) => null; | 1706 R visitParameterElement(ParameterElement element) => null; |
| 1700 R visitPrefixElement(PrefixElement element) => null; | 1707 R visitPrefixElement(PrefixElement element) => null; |
| 1701 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; | 1708 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; |
| 1702 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; | 1709 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; |
| 1703 R visitTypeVariableElement(TypeVariableElement element) => null; | 1710 R visitTypeParameterElement(TypeParameterElement element) => null; |
| 1704 } | 1711 } |
| 1705 /** | 1712 /** |
| 1706 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and | 1713 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and |
| 1707 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an | 1714 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an |
| 1708 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved | 1715 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved |
| 1709 * using propagated type information, this class is a wrapper for a pair of | 1716 * using propagated type information, this class is a wrapper for a pair of |
| 1710 * [ExecutableElement]s, not just a single [ExecutableElement]. | 1717 * [ExecutableElement]s, not just a single [ExecutableElement]. |
| 1711 */ | 1718 */ |
| 1712 class AuxiliaryElements { | 1719 class AuxiliaryElements { |
| 1713 | 1720 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 * The superclass of the class, or `null` if the class does not have an explic
it superclass. | 1783 * The superclass of the class, or `null` if the class does not have an explic
it superclass. |
| 1777 */ | 1784 */ |
| 1778 InterfaceType _supertype; | 1785 InterfaceType _supertype; |
| 1779 | 1786 |
| 1780 /** | 1787 /** |
| 1781 * The type defined by the class. | 1788 * The type defined by the class. |
| 1782 */ | 1789 */ |
| 1783 InterfaceType _type; | 1790 InterfaceType _type; |
| 1784 | 1791 |
| 1785 /** | 1792 /** |
| 1786 * An array containing all of the type variables defined for this class. | 1793 * An array containing all of the type parameters defined for this class. |
| 1787 */ | 1794 */ |
| 1788 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY
; | 1795 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR
RAY; |
| 1789 | 1796 |
| 1790 /** | 1797 /** |
| 1791 * An empty array of type elements. | 1798 * An empty array of type elements. |
| 1792 */ | 1799 */ |
| 1793 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); | 1800 static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0); |
| 1794 | 1801 |
| 1795 /** | 1802 /** |
| 1796 * Initialize a newly created class element to have the given name. | 1803 * Initialize a newly created class element to have the given name. |
| 1797 * | 1804 * |
| 1798 * @param name the name of this element | 1805 * @param name the name of this element |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1819 for (FieldElement field in _fields) { | 1826 for (FieldElement field in _fields) { |
| 1820 if (((field as FieldElementImpl)).identifier == identifier2) { | 1827 if (((field as FieldElementImpl)).identifier == identifier2) { |
| 1821 return field as FieldElementImpl; | 1828 return field as FieldElementImpl; |
| 1822 } | 1829 } |
| 1823 } | 1830 } |
| 1824 for (MethodElement method in _methods) { | 1831 for (MethodElement method in _methods) { |
| 1825 if (((method as MethodElementImpl)).identifier == identifier2) { | 1832 if (((method as MethodElementImpl)).identifier == identifier2) { |
| 1826 return method as MethodElementImpl; | 1833 return method as MethodElementImpl; |
| 1827 } | 1834 } |
| 1828 } | 1835 } |
| 1829 for (TypeVariableElement typeVariable in _typeVariables) { | 1836 for (TypeParameterElement typeParameter in _typeParameters) { |
| 1830 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2)
{ | 1837 if (((typeParameter as TypeParameterElementImpl)).identifier == identifier
2) { |
| 1831 return typeVariable as TypeVariableElementImpl; | 1838 return typeParameter as TypeParameterElementImpl; |
| 1832 } | 1839 } |
| 1833 } | 1840 } |
| 1834 return null; | 1841 return null; |
| 1835 } | 1842 } |
| 1836 List<ConstructorElement> get constructors => _constructors; | 1843 List<ConstructorElement> get constructors => _constructors; |
| 1837 | 1844 |
| 1838 /** | 1845 /** |
| 1839 * Given some name, this returns the [FieldElement] with the matching name, if
there is no | 1846 * Given some name, this returns the [FieldElement] with the matching name, if
there is no |
| 1840 * such field, then `null` is returned. | 1847 * such field, then `null` is returned. |
| 1841 * | 1848 * |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 } | 1893 } |
| 1887 for (PropertyAccessorElement accessor in _accessors) { | 1894 for (PropertyAccessorElement accessor in _accessors) { |
| 1888 if (accessor.isSetter && accessor.name == setterName) { | 1895 if (accessor.isSetter && accessor.name == setterName) { |
| 1889 return accessor; | 1896 return accessor; |
| 1890 } | 1897 } |
| 1891 } | 1898 } |
| 1892 return null; | 1899 return null; |
| 1893 } | 1900 } |
| 1894 InterfaceType get supertype => _supertype; | 1901 InterfaceType get supertype => _supertype; |
| 1895 InterfaceType get type => _type; | 1902 InterfaceType get type => _type; |
| 1896 List<TypeVariableElement> get typeVariables => _typeVariables; | 1903 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 1897 ConstructorElement get unnamedConstructor { | 1904 ConstructorElement get unnamedConstructor { |
| 1898 for (ConstructorElement element in constructors) { | 1905 for (ConstructorElement element in constructors) { |
| 1899 String name = element.displayName; | 1906 String name = element.displayName; |
| 1900 if (name == null || name.isEmpty) { | 1907 if (name == null || name.isEmpty) { |
| 1901 return element; | 1908 return element; |
| 1902 } | 1909 } |
| 1903 } | 1910 } |
| 1904 return null; | 1911 return null; |
| 1905 } | 1912 } |
| 1906 bool hasNonFinalField() { | 1913 bool hasNonFinalField() { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 /** | 2126 /** |
| 2120 * Set whether this class is defined by a typedef construct to correspond to t
he given value. | 2127 * Set whether this class is defined by a typedef construct to correspond to t
he given value. |
| 2121 * | 2128 * |
| 2122 * @param isTypedef `true` if the class is defined by a typedef construct | 2129 * @param isTypedef `true` if the class is defined by a typedef construct |
| 2123 */ | 2130 */ |
| 2124 void set typedef(bool isTypedef) { | 2131 void set typedef(bool isTypedef) { |
| 2125 setModifier(Modifier.TYPEDEF, isTypedef); | 2132 setModifier(Modifier.TYPEDEF, isTypedef); |
| 2126 } | 2133 } |
| 2127 | 2134 |
| 2128 /** | 2135 /** |
| 2129 * Set the type variables defined for this class to the given type variables. | 2136 * Set the type parameters defined for this class to the given type parameters
. |
| 2130 * | 2137 * |
| 2131 * @param typeVariables the type variables defined for this class | 2138 * @param typeParameters the type parameters defined for this class |
| 2132 */ | 2139 */ |
| 2133 void set typeVariables(List<TypeVariableElement> typeVariables2) { | 2140 void set typeParameters(List<TypeParameterElement> typeParameters2) { |
| 2134 for (TypeVariableElement typeVariable in typeVariables2) { | 2141 for (TypeParameterElement typeParameter in typeParameters2) { |
| 2135 ((typeVariable as TypeVariableElementImpl)).enclosingElement = this; | 2142 ((typeParameter as TypeParameterElementImpl)).enclosingElement = this; |
| 2136 } | 2143 } |
| 2137 this._typeVariables = typeVariables2; | 2144 this._typeParameters = typeParameters2; |
| 2138 } | 2145 } |
| 2139 | 2146 |
| 2140 /** | 2147 /** |
| 2141 * Set whether this class is a valid mixin to correspond to the given value. | 2148 * Set whether this class is a valid mixin to correspond to the given value. |
| 2142 * | 2149 * |
| 2143 * @param isValidMixin `true` if this class can be used as a mixin | 2150 * @param isValidMixin `true` if this class can be used as a mixin |
| 2144 */ | 2151 */ |
| 2145 void set validMixin(bool isValidMixin) { | 2152 void set validMixin(bool isValidMixin) { |
| 2146 setModifier(Modifier.MIXIN, isValidMixin); | 2153 setModifier(Modifier.MIXIN, isValidMixin); |
| 2147 } | 2154 } |
| 2148 void visitChildren(ElementVisitor visitor) { | 2155 void visitChildren(ElementVisitor visitor) { |
| 2149 super.visitChildren(visitor); | 2156 super.visitChildren(visitor); |
| 2150 safelyVisitChildren(_accessors, visitor); | 2157 safelyVisitChildren(_accessors, visitor); |
| 2151 safelyVisitChildren(_constructors, visitor); | 2158 safelyVisitChildren(_constructors, visitor); |
| 2152 safelyVisitChildren(_fields, visitor); | 2159 safelyVisitChildren(_fields, visitor); |
| 2153 safelyVisitChildren(_methods, visitor); | 2160 safelyVisitChildren(_methods, visitor); |
| 2154 safelyVisitChildren(_typeVariables, visitor); | 2161 safelyVisitChildren(_typeParameters, visitor); |
| 2155 } | 2162 } |
| 2156 void appendTo(JavaStringBuilder builder) { | 2163 void appendTo(JavaStringBuilder builder) { |
| 2157 String name = displayName; | 2164 String name = displayName; |
| 2158 if (name == null) { | 2165 if (name == null) { |
| 2159 builder.append("{unnamed class}"); | 2166 builder.append("{unnamed class}"); |
| 2160 } else { | 2167 } else { |
| 2161 builder.append(name); | 2168 builder.append(name); |
| 2162 } | 2169 } |
| 2163 int variableCount = _typeVariables.length; | 2170 int variableCount = _typeParameters.length; |
| 2164 if (variableCount > 0) { | 2171 if (variableCount > 0) { |
| 2165 builder.append("<"); | 2172 builder.append("<"); |
| 2166 for (int i = 0; i < variableCount; i++) { | 2173 for (int i = 0; i < variableCount; i++) { |
| 2167 if (i > 0) { | 2174 if (i > 0) { |
| 2168 builder.append(", "); | 2175 builder.append(", "); |
| 2169 } | 2176 } |
| 2170 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); | 2177 ((_typeParameters[i] as TypeParameterElementImpl)).appendTo(builder); |
| 2171 } | 2178 } |
| 2172 builder.append(">"); | 2179 builder.append(">"); |
| 2173 } | 2180 } |
| 2174 } | 2181 } |
| 2175 void collectAllSupertypes(List<InterfaceType> supertypes) { | 2182 void collectAllSupertypes(List<InterfaceType> supertypes) { |
| 2176 List<InterfaceType> typesToVisit = new List<InterfaceType>(); | 2183 List<InterfaceType> typesToVisit = new List<InterfaceType>(); |
| 2177 List<ClassElement> visitedClasses = new List<ClassElement>(); | 2184 List<ClassElement> visitedClasses = new List<ClassElement>(); |
| 2178 typesToVisit.add(this.type); | 2185 typesToVisit.add(this.type); |
| 2179 while (!typesToVisit.isEmpty) { | 2186 while (!typesToVisit.isEmpty) { |
| 2180 InterfaceType currentType = typesToVisit.removeAt(0); | 2187 InterfaceType currentType = typesToVisit.removeAt(0); |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3534 * The return type defined by this type alias. | 3541 * The return type defined by this type alias. |
| 3535 */ | 3542 */ |
| 3536 Type2 _returnType; | 3543 Type2 _returnType; |
| 3537 | 3544 |
| 3538 /** | 3545 /** |
| 3539 * The type of function defined by this type alias. | 3546 * The type of function defined by this type alias. |
| 3540 */ | 3547 */ |
| 3541 FunctionType _type; | 3548 FunctionType _type; |
| 3542 | 3549 |
| 3543 /** | 3550 /** |
| 3544 * An array containing all of the type variables defined for this type. | 3551 * An array containing all of the type parameters defined for this type. |
| 3545 */ | 3552 */ |
| 3546 List<TypeVariableElement> _typeVariables = TypeVariableElementImpl.EMPTY_ARRAY
; | 3553 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR
RAY; |
| 3547 | 3554 |
| 3548 /** | 3555 /** |
| 3549 * An empty array of type alias elements. | 3556 * An empty array of type alias elements. |
| 3550 */ | 3557 */ |
| 3551 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); | 3558 static List<FunctionTypeAliasElement> EMPTY_ARRAY = new List<FunctionTypeAlias
Element>(0); |
| 3552 | 3559 |
| 3553 /** | 3560 /** |
| 3554 * Initialize a newly created type alias element to have the given name. | 3561 * Initialize a newly created type alias element to have the given name. |
| 3555 * | 3562 * |
| 3556 * @param name the name of this element | 3563 * @param name the name of this element |
| 3557 */ | 3564 */ |
| 3558 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name); | 3565 FunctionTypeAliasElementImpl(Identifier name) : super.con1(name); |
| 3559 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); | 3566 accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this); |
| 3560 ElementImpl getChild(String identifier2) { | 3567 ElementImpl getChild(String identifier2) { |
| 3561 for (VariableElement parameter in _parameters) { | 3568 for (VariableElement parameter in _parameters) { |
| 3562 if (((parameter as VariableElementImpl)).identifier == identifier2) { | 3569 if (((parameter as VariableElementImpl)).identifier == identifier2) { |
| 3563 return parameter as VariableElementImpl; | 3570 return parameter as VariableElementImpl; |
| 3564 } | 3571 } |
| 3565 } | 3572 } |
| 3566 for (TypeVariableElement typeVariable in _typeVariables) { | 3573 for (TypeParameterElement typeParameter in _typeParameters) { |
| 3567 if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2)
{ | 3574 if (((typeParameter as TypeParameterElementImpl)).identifier == identifier
2) { |
| 3568 return typeVariable as TypeVariableElementImpl; | 3575 return typeParameter as TypeParameterElementImpl; |
| 3569 } | 3576 } |
| 3570 } | 3577 } |
| 3571 return null; | 3578 return null; |
| 3572 } | 3579 } |
| 3573 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; | 3580 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi
lationUnitElement; |
| 3574 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; | 3581 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
| 3575 List<ParameterElement> get parameters => _parameters; | 3582 List<ParameterElement> get parameters => _parameters; |
| 3576 Type2 get returnType => _returnType; | 3583 Type2 get returnType => _returnType; |
| 3577 FunctionType get type => _type; | 3584 FunctionType get type => _type; |
| 3578 List<TypeVariableElement> get typeVariables => _typeVariables; | 3585 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 3579 | 3586 |
| 3580 /** | 3587 /** |
| 3581 * Set the parameters defined by this type alias to the given parameters. | 3588 * Set the parameters defined by this type alias to the given parameters. |
| 3582 * | 3589 * |
| 3583 * @param parameters the parameters defined by this type alias | 3590 * @param parameters the parameters defined by this type alias |
| 3584 */ | 3591 */ |
| 3585 void set parameters(List<ParameterElement> parameters2) { | 3592 void set parameters(List<ParameterElement> parameters2) { |
| 3586 if (parameters2 != null) { | 3593 if (parameters2 != null) { |
| 3587 for (ParameterElement parameter in parameters2) { | 3594 for (ParameterElement parameter in parameters2) { |
| 3588 ((parameter as ParameterElementImpl)).enclosingElement = this; | 3595 ((parameter as ParameterElementImpl)).enclosingElement = this; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3603 /** | 3610 /** |
| 3604 * Set the type of function defined by this type alias to the given type. | 3611 * Set the type of function defined by this type alias to the given type. |
| 3605 * | 3612 * |
| 3606 * @param type the type of function defined by this type alias | 3613 * @param type the type of function defined by this type alias |
| 3607 */ | 3614 */ |
| 3608 void set type(FunctionType type2) { | 3615 void set type(FunctionType type2) { |
| 3609 this._type = type2; | 3616 this._type = type2; |
| 3610 } | 3617 } |
| 3611 | 3618 |
| 3612 /** | 3619 /** |
| 3613 * Set the type variables defined for this type to the given variables. | 3620 * Set the type parameters defined for this type to the given parameters. |
| 3614 * | 3621 * |
| 3615 * @param typeVariables the type variables defined for this type | 3622 * @param typeParameters the type parameters defined for this type |
| 3616 */ | 3623 */ |
| 3617 void set typeVariables(List<TypeVariableElement> typeVariables2) { | 3624 void set typeParameters(List<TypeParameterElement> typeParameters2) { |
| 3618 for (TypeVariableElement variable in typeVariables2) { | 3625 for (TypeParameterElement typeParameter in typeParameters2) { |
| 3619 ((variable as TypeVariableElementImpl)).enclosingElement = this; | 3626 ((typeParameter as TypeParameterElementImpl)).enclosingElement = this; |
| 3620 } | 3627 } |
| 3621 this._typeVariables = typeVariables2; | 3628 this._typeParameters = typeParameters2; |
| 3622 } | 3629 } |
| 3623 | 3630 |
| 3624 /** | 3631 /** |
| 3625 * Set the parameters defined by this type alias to the given parameters witho
ut becoming the | 3632 * Set the parameters defined by this type alias to the given parameters witho
ut becoming the |
| 3626 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when | 3633 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when |
| 3627 * creating a synthetic type alias. | 3634 * creating a synthetic type alias. |
| 3628 * | 3635 * |
| 3629 * @param parameters the parameters defined by this type alias | 3636 * @param parameters the parameters defined by this type alias |
| 3630 */ | 3637 */ |
| 3631 void shareParameters(List<ParameterElement> parameters2) { | 3638 void shareParameters(List<ParameterElement> parameters2) { |
| 3632 this._parameters = parameters2; | 3639 this._parameters = parameters2; |
| 3633 } | 3640 } |
| 3634 | 3641 |
| 3635 /** | 3642 /** |
| 3636 * Set the type variables defined for this type to the given variables without
becoming the parent | 3643 * Set the type parameters defined for this type to the given parameters witho
ut becoming the |
| 3637 * of the variables. This should only be used by the [TypeResolverVisitor] whe
n creating a | 3644 * parent of the parameters. This should only be used by the [TypeResolverVisi
tor] when |
| 3638 * synthetic type alias. | 3645 * creating a synthetic type alias. |
| 3639 * | 3646 * |
| 3640 * @param typeVariables the type variables defined for this type | 3647 * @param typeParameters the type parameters defined for this type |
| 3641 */ | 3648 */ |
| 3642 void shareTypeVariables(List<TypeVariableElement> typeVariables2) { | 3649 void shareTypeParameters(List<TypeParameterElement> typeParameters2) { |
| 3643 this._typeVariables = typeVariables2; | 3650 this._typeParameters = typeParameters2; |
| 3644 } | 3651 } |
| 3645 void visitChildren(ElementVisitor visitor) { | 3652 void visitChildren(ElementVisitor visitor) { |
| 3646 super.visitChildren(visitor); | 3653 super.visitChildren(visitor); |
| 3647 safelyVisitChildren(_parameters, visitor); | 3654 safelyVisitChildren(_parameters, visitor); |
| 3648 safelyVisitChildren(_typeVariables, visitor); | 3655 safelyVisitChildren(_typeParameters, visitor); |
| 3649 } | 3656 } |
| 3650 void appendTo(JavaStringBuilder builder) { | 3657 void appendTo(JavaStringBuilder builder) { |
| 3651 builder.append("typedef "); | 3658 builder.append("typedef "); |
| 3652 builder.append(displayName); | 3659 builder.append(displayName); |
| 3653 int variableCount = _typeVariables.length; | 3660 int typeParameterCount = _typeParameters.length; |
| 3654 if (variableCount > 0) { | 3661 if (typeParameterCount > 0) { |
| 3655 builder.append("<"); | 3662 builder.append("<"); |
| 3656 for (int i = 0; i < variableCount; i++) { | 3663 for (int i = 0; i < typeParameterCount; i++) { |
| 3657 if (i > 0) { | 3664 if (i > 0) { |
| 3658 builder.append(", "); | 3665 builder.append(", "); |
| 3659 } | 3666 } |
| 3660 ((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder); | 3667 ((_typeParameters[i] as TypeParameterElementImpl)).appendTo(builder); |
| 3661 } | 3668 } |
| 3662 builder.append(">"); | 3669 builder.append(">"); |
| 3663 } | 3670 } |
| 3664 builder.append("("); | 3671 builder.append("("); |
| 3665 int parameterCount = _parameters.length; | 3672 int parameterCount = _parameters.length; |
| 3666 for (int i = 0; i < parameterCount; i++) { | 3673 for (int i = 0; i < parameterCount; i++) { |
| 3667 if (i > 0) { | 3674 if (i > 0) { |
| 3668 builder.append(", "); | 3675 builder.append(", "); |
| 3669 } | 3676 } |
| 3670 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); | 3677 ((_parameters[i] as ParameterElementImpl)).appendTo(builder); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4098 type = part.getType(className); | 4105 type = part.getType(className); |
| 4099 if (type != null) { | 4106 if (type != null) { |
| 4100 return type; | 4107 return type; |
| 4101 } | 4108 } |
| 4102 } | 4109 } |
| 4103 return null; | 4110 return null; |
| 4104 } | 4111 } |
| 4105 int get hashCode => _definingCompilationUnit.hashCode; | 4112 int get hashCode => _definingCompilationUnit.hashCode; |
| 4106 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr
ary; | 4113 bool get isBrowserApplication => _entryPoint != null && isOrImportsBrowserLibr
ary; |
| 4107 bool get isDartCore => name == "dart.core"; | 4114 bool get isDartCore => name == "dart.core"; |
| 4115 bool get isInSdk => name.startsWith("dart."); |
| 4108 bool isUpToDate2(int timeStamp) { | 4116 bool isUpToDate2(int timeStamp) { |
| 4109 Set<LibraryElement> visitedLibraries = new Set(); | 4117 Set<LibraryElement> visitedLibraries = new Set(); |
| 4110 return isUpToDate(this, timeStamp, visitedLibraries); | 4118 return isUpToDate(this, timeStamp, visitedLibraries); |
| 4111 } | 4119 } |
| 4112 | 4120 |
| 4113 /** | 4121 /** |
| 4114 * Set the compilation unit that defines this library to the given compilation
unit. | 4122 * Set the compilation unit that defines this library to the given compilation
unit. |
| 4115 * | 4123 * |
| 4116 * @param definingCompilationUnit the compilation unit that defines this libra
ry | 4124 * @param definingCompilationUnit the compilation unit that defines this libra
ry |
| 4117 */ | 4125 */ |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4392 */ | 4400 */ |
| 4393 List<Element> _conflictingElements; | 4401 List<Element> _conflictingElements; |
| 4394 | 4402 |
| 4395 /** | 4403 /** |
| 4396 * Initialize a newly created element to represent a list of conflicting eleme
nts. | 4404 * Initialize a newly created element to represent a list of conflicting eleme
nts. |
| 4397 * | 4405 * |
| 4398 * @param context the analysis context in which the multiply defined elements
are defined | 4406 * @param context the analysis context in which the multiply defined elements
are defined |
| 4399 * @param firstElement the first element that conflicts | 4407 * @param firstElement the first element that conflicts |
| 4400 * @param secondElement the second element that conflicts | 4408 * @param secondElement the second element that conflicts |
| 4401 */ | 4409 */ |
| 4402 MultiplyDefinedElementImpl(AnalysisContext context, Element firstElement, Elem
ent secondElement) { | 4410 MultiplyDefinedElementImpl.con1(AnalysisContext context, Element firstElement,
Element secondElement) { |
| 4411 this._context = context; |
| 4403 _name = firstElement.name; | 4412 _name = firstElement.name; |
| 4404 _conflictingElements = computeConflictingElements(firstElement, secondElemen
t); | 4413 _conflictingElements = computeConflictingElements(firstElement, secondElemen
t); |
| 4405 } | 4414 } |
| 4415 |
| 4416 /** |
| 4417 * Initialize a newly created element to represent a list of conflicting eleme
nts. |
| 4418 * |
| 4419 * @param context the analysis context in which the multiply defined elements
are defined |
| 4420 * @param conflictingElements the elements that conflict |
| 4421 */ |
| 4422 MultiplyDefinedElementImpl.con2(AnalysisContext context, List<Element> conflic
tingElements) { |
| 4423 this._context = context; |
| 4424 _name = conflictingElements[0].name; |
| 4425 this._conflictingElements = conflictingElements; |
| 4426 } |
| 4406 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 4427 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
| 4407 String computeDocumentationComment() => null; | 4428 String computeDocumentationComment() => null; |
| 4408 Element getAncestor(Type elementClass) => null; | 4429 Element getAncestor(Type elementClass) => null; |
| 4409 List<Element> get conflictingElements => _conflictingElements; | 4430 List<Element> get conflictingElements => _conflictingElements; |
| 4410 AnalysisContext get context => _context; | 4431 AnalysisContext get context => _context; |
| 4411 String get displayName => _name; | 4432 String get displayName => _name; |
| 4412 Element get enclosingElement => null; | 4433 Element get enclosingElement => null; |
| 4413 ElementKind get kind => ElementKind.ERROR; | 4434 ElementKind get kind => ElementKind.ERROR; |
| 4414 LibraryElement get library => null; | 4435 LibraryElement get library => null; |
| 4415 ElementLocation get location => null; | 4436 ElementLocation get location => null; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4443 void visitChildren(ElementVisitor visitor) { | 4464 void visitChildren(ElementVisitor visitor) { |
| 4444 } | 4465 } |
| 4445 | 4466 |
| 4446 /** | 4467 /** |
| 4447 * Add the given element to the list of elements. If the element is a multiply
-defined element, | 4468 * Add the given element to the list of elements. If the element is a multiply
-defined element, |
| 4448 * add all of the conflicting elements that it represents. | 4469 * add all of the conflicting elements that it represents. |
| 4449 * | 4470 * |
| 4450 * @param elements the list to which the element(s) are to be added | 4471 * @param elements the list to which the element(s) are to be added |
| 4451 * @param element the element(s) to be added | 4472 * @param element the element(s) to be added |
| 4452 */ | 4473 */ |
| 4453 void add(List<Element> elements, Element element) { | 4474 void add(Set<Element> elements, Element element) { |
| 4454 if (element is MultiplyDefinedElementImpl) { | 4475 if (element is MultiplyDefinedElementImpl) { |
| 4455 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl
))._conflictingElements) { | 4476 for (Element conflictingElement in ((element as MultiplyDefinedElementImpl
))._conflictingElements) { |
| 4456 elements.add(conflictingElement); | 4477 javaSetAdd(elements, conflictingElement); |
| 4457 } | 4478 } |
| 4458 } else { | 4479 } else { |
| 4459 elements.add(element); | 4480 javaSetAdd(elements, element); |
| 4460 } | 4481 } |
| 4461 } | 4482 } |
| 4462 | 4483 |
| 4463 /** | 4484 /** |
| 4464 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given | 4485 * Use the given elements to construct an array of conflicting elements. If ei
ther of the given |
| 4465 * elements are multiply-defined elements then the conflicting elements they r
epresent will be | 4486 * elements are multiply-defined elements then the conflicting elements they r
epresent will be |
| 4466 * included in the array. Otherwise, the element itself will be included. | 4487 * included in the array. Otherwise, the element itself will be included. |
| 4467 * | 4488 * |
| 4468 * @param firstElement the first element to be included | 4489 * @param firstElement the first element to be included |
| 4469 * @param secondElement the second element to be included | 4490 * @param secondElement the second element to be included |
| 4470 * @return an array containing all of the conflicting elements | 4491 * @return an array containing all of the conflicting elements |
| 4471 */ | 4492 */ |
| 4472 List<Element> computeConflictingElements(Element firstElement, Element secondE
lement) { | 4493 List<Element> computeConflictingElements(Element firstElement, Element secondE
lement) { |
| 4473 List<Element> elements = new List<Element>(); | 4494 Set<Element> elements = new Set<Element>(); |
| 4474 add(elements, firstElement); | 4495 add(elements, firstElement); |
| 4475 add(elements, secondElement); | 4496 add(elements, secondElement); |
| 4476 return new List.from(elements); | 4497 return new List.from(elements); |
| 4477 } | 4498 } |
| 4478 } | 4499 } |
| 4479 /** | 4500 /** |
| 4480 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. | 4501 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. |
| 4481 * | 4502 * |
| 4482 * @coverage dart.engine.element | 4503 * @coverage dart.engine.element |
| 4483 */ | 4504 */ |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4906 * Initialize a newly created synthetic top-level variable element to have the
given name. | 4927 * Initialize a newly created synthetic top-level variable element to have the
given name. |
| 4907 * | 4928 * |
| 4908 * @param name the name of this element | 4929 * @param name the name of this element |
| 4909 */ | 4930 */ |
| 4910 TopLevelVariableElementImpl.con2(String name) : super.con2(name); | 4931 TopLevelVariableElementImpl.con2(String name) : super.con2(name); |
| 4911 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); | 4932 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); |
| 4912 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; | 4933 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; |
| 4913 bool get isStatic => true; | 4934 bool get isStatic => true; |
| 4914 } | 4935 } |
| 4915 /** | 4936 /** |
| 4916 * Instances of the class `TypeVariableElementImpl` implement a `TypeVariableEle
ment`. | 4937 * Instances of the class `TypeParameterElementImpl` implement a [TypeParameterE
lement]. |
| 4917 * | 4938 * |
| 4918 * @coverage dart.engine.element | 4939 * @coverage dart.engine.element |
| 4919 */ | 4940 */ |
| 4920 class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement
{ | 4941 class TypeParameterElementImpl extends ElementImpl implements TypeParameterEleme
nt { |
| 4921 | 4942 |
| 4922 /** | 4943 /** |
| 4923 * The type defined by this type variable. | 4944 * The type defined by this type parameter. |
| 4924 */ | 4945 */ |
| 4925 TypeVariableType _type; | 4946 TypeParameterType _type; |
| 4926 | 4947 |
| 4927 /** | 4948 /** |
| 4928 * The type representing the bound associated with this variable, or `null` if
this variable | 4949 * The type representing the bound associated with this parameter, or `null` i
f this |
| 4929 * does not have an explicit bound. | 4950 * parameter does not have an explicit bound. |
| 4930 */ | 4951 */ |
| 4931 Type2 _bound; | 4952 Type2 _bound; |
| 4932 | 4953 |
| 4933 /** | 4954 /** |
| 4934 * An empty array of type variable elements. | 4955 * An empty array of type parameter elements. |
| 4935 */ | 4956 */ |
| 4936 static List<TypeVariableElement> EMPTY_ARRAY = new List<TypeVariableElement>(0
); | 4957 static List<TypeParameterElement> EMPTY_ARRAY = new List<TypeParameterElement>
(0); |
| 4937 | 4958 |
| 4938 /** | 4959 /** |
| 4939 * Initialize a newly created type variable element to have the given name. | 4960 * Initialize a newly created type parameter element to have the given name. |
| 4940 * | 4961 * |
| 4941 * @param name the name of this element | 4962 * @param name the name of this element |
| 4942 */ | 4963 */ |
| 4943 TypeVariableElementImpl(Identifier name) : super.con1(name); | 4964 TypeParameterElementImpl(Identifier name) : super.con1(name); |
| 4944 accept(ElementVisitor visitor) => visitor.visitTypeVariableElement(this); | 4965 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); |
| 4945 Type2 get bound => _bound; | 4966 Type2 get bound => _bound; |
| 4946 ElementKind get kind => ElementKind.TYPE_VARIABLE; | 4967 ElementKind get kind => ElementKind.TYPE_PARAMETER; |
| 4947 TypeVariableType get type => _type; | 4968 TypeParameterType get type => _type; |
| 4948 | 4969 |
| 4949 /** | 4970 /** |
| 4950 * Set the type representing the bound associated with this variable to the gi
ven type. | 4971 * Set the type representing the bound associated with this parameter to the g
iven type. |
| 4951 * | 4972 * |
| 4952 * @param bound the type representing the bound associated with this variable | 4973 * @param bound the type representing the bound associated with this parameter |
| 4953 */ | 4974 */ |
| 4954 void set bound(Type2 bound2) { | 4975 void set bound(Type2 bound2) { |
| 4955 this._bound = bound2; | 4976 this._bound = bound2; |
| 4956 } | 4977 } |
| 4957 | 4978 |
| 4958 /** | 4979 /** |
| 4959 * Set the type defined by this type variable to the given type | 4980 * Set the type defined by this type parameter to the given type |
| 4960 * | 4981 * |
| 4961 * @param type the type defined by this type variable | 4982 * @param type the type defined by this type parameter |
| 4962 */ | 4983 */ |
| 4963 void set type(TypeVariableType type2) { | 4984 void set type(TypeParameterType type2) { |
| 4964 this._type = type2; | 4985 this._type = type2; |
| 4965 } | 4986 } |
| 4966 void appendTo(JavaStringBuilder builder) { | 4987 void appendTo(JavaStringBuilder builder) { |
| 4967 builder.append(displayName); | 4988 builder.append(displayName); |
| 4968 if (_bound != null) { | 4989 if (_bound != null) { |
| 4969 builder.append(" extends "); | 4990 builder.append(" extends "); |
| 4970 builder.append(_bound); | 4991 builder.append(_bound); |
| 4971 } | 4992 } |
| 4972 } | 4993 } |
| 4973 } | 4994 } |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5337 | 5358 |
| 5338 /** | 5359 /** |
| 5339 * Return the type that results from replacing the type parameters in the give
n type with the type | 5360 * Return the type that results from replacing the type parameters in the give
n type with the type |
| 5340 * arguments. | 5361 * arguments. |
| 5341 * | 5362 * |
| 5342 * @param type the type to be transformed | 5363 * @param type the type to be transformed |
| 5343 * @return the result of transforming the type | 5364 * @return the result of transforming the type |
| 5344 */ | 5365 */ |
| 5345 Type2 substituteFor(Type2 type) { | 5366 Type2 substituteFor(Type2 type) { |
| 5346 List<Type2> argumentTypes = _definingType.typeArguments; | 5367 List<Type2> argumentTypes = _definingType.typeArguments; |
| 5347 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.typ
eVariables); | 5368 List<Type2> parameterTypes = TypeParameterTypeImpl.getTypes(_definingType.ty
peParameters); |
| 5348 return type.substitute2(argumentTypes, parameterTypes) as Type2; | 5369 return type.substitute2(argumentTypes, parameterTypes) as Type2; |
| 5349 } | 5370 } |
| 5350 | 5371 |
| 5351 /** | 5372 /** |
| 5352 * Return the array of types that results from replacing the type parameters i
n the given types | 5373 * Return the array of types that results from replacing the type parameters i
n the given types |
| 5353 * with the type arguments. | 5374 * with the type arguments. |
| 5354 * | 5375 * |
| 5355 * @param types the types to be transformed | 5376 * @param types the types to be transformed |
| 5356 * @return the result of transforming the types | 5377 * @return the result of transforming the types |
| 5357 */ | 5378 */ |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5446 * @param definingType the type defining the parameters and arguments to be us
ed in the | 5467 * @param definingType the type defining the parameters and arguments to be us
ed in the |
| 5447 * substitution | 5468 * substitution |
| 5448 * @return the parameter element that will return the correctly substituted ty
pes | 5469 * @return the parameter element that will return the correctly substituted ty
pes |
| 5449 */ | 5470 */ |
| 5450 static ParameterElement from(ParameterElement baseParameter, ParameterizedType
definingType) { | 5471 static ParameterElement from(ParameterElement baseParameter, ParameterizedType
definingType) { |
| 5451 if (baseParameter == null || definingType.typeArguments.length == 0) { | 5472 if (baseParameter == null || definingType.typeArguments.length == 0) { |
| 5452 return baseParameter; | 5473 return baseParameter; |
| 5453 } | 5474 } |
| 5454 Type2 baseType = baseParameter.type; | 5475 Type2 baseType = baseParameter.type; |
| 5455 List<Type2> argumentTypes = definingType.typeArguments; | 5476 List<Type2> argumentTypes = definingType.typeArguments; |
| 5456 List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.type
Variables); | 5477 List<Type2> parameterTypes = TypeParameterTypeImpl.getTypes(definingType.typ
eParameters); |
| 5457 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); | 5478 Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes); |
| 5458 if (baseType == substitutedType) { | 5479 if (baseType == substitutedType) { |
| 5459 return baseParameter; | 5480 return baseParameter; |
| 5460 } | 5481 } |
| 5461 return new ParameterMember(baseParameter, definingType); | 5482 return new ParameterMember(baseParameter, definingType); |
| 5462 } | 5483 } |
| 5463 | 5484 |
| 5464 /** | 5485 /** |
| 5465 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. | 5486 * Initialize a newly created element to represent a parameter of the given pa
rameterized type. |
| 5466 * | 5487 * |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5821 name = builder.toString(); | 5842 name = builder.toString(); |
| 5822 } | 5843 } |
| 5823 return name; | 5844 return name; |
| 5824 } | 5845 } |
| 5825 Map<String, Type2> get namedParameterTypes { | 5846 Map<String, Type2> get namedParameterTypes { |
| 5826 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); | 5847 LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String,
Type2>(); |
| 5827 List<ParameterElement> parameters = baseParameters; | 5848 List<ParameterElement> parameters = baseParameters; |
| 5828 if (parameters.length == 0) { | 5849 if (parameters.length == 0) { |
| 5829 return namedParameterTypes; | 5850 return namedParameterTypes; |
| 5830 } | 5851 } |
| 5831 List<Type2> typeParameters = TypeVariableTypeImpl.getTypes(typeVariables); | 5852 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 5832 for (ParameterElement parameter in parameters) { | 5853 for (ParameterElement parameter in parameters) { |
| 5833 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { | 5854 if (identical(parameter.parameterKind, ParameterKind.NAMED)) { |
| 5834 namedParameterTypes[parameter.name] = parameter.type.substitute2(_typeAr
guments, typeParameters); | 5855 namedParameterTypes[parameter.name] = parameter.type.substitute2(_typeAr
guments, typeParameters); |
| 5835 } | 5856 } |
| 5836 } | 5857 } |
| 5837 return namedParameterTypes; | 5858 return namedParameterTypes; |
| 5838 } | 5859 } |
| 5839 List<Type2> get normalParameterTypes { | 5860 List<Type2> get normalParameterTypes { |
| 5840 List<ParameterElement> parameters = baseParameters; | 5861 List<ParameterElement> parameters = baseParameters; |
| 5841 if (parameters.length == 0) { | 5862 if (parameters.length == 0) { |
| 5842 return TypeImpl.EMPTY_ARRAY; | 5863 return TypeImpl.EMPTY_ARRAY; |
| 5843 } | 5864 } |
| 5844 List<Type2> typeParameters = TypeVariableTypeImpl.getTypes(typeVariables); | 5865 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 5845 List<Type2> types = new List<Type2>(); | 5866 List<Type2> types = new List<Type2>(); |
| 5846 for (ParameterElement parameter in parameters) { | 5867 for (ParameterElement parameter in parameters) { |
| 5847 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { | 5868 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { |
| 5848 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); | 5869 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); |
| 5849 } | 5870 } |
| 5850 } | 5871 } |
| 5851 return new List.from(types); | 5872 return new List.from(types); |
| 5852 } | 5873 } |
| 5853 List<Type2> get optionalParameterTypes { | 5874 List<Type2> get optionalParameterTypes { |
| 5854 List<ParameterElement> parameters = baseParameters; | 5875 List<ParameterElement> parameters = baseParameters; |
| 5855 if (parameters.length == 0) { | 5876 if (parameters.length == 0) { |
| 5856 return TypeImpl.EMPTY_ARRAY; | 5877 return TypeImpl.EMPTY_ARRAY; |
| 5857 } | 5878 } |
| 5858 List<Type2> typeParameters = TypeVariableTypeImpl.getTypes(typeVariables); | 5879 List<Type2> typeParameters = TypeParameterTypeImpl.getTypes(this.typeParamet
ers); |
| 5859 List<Type2> types = new List<Type2>(); | 5880 List<Type2> types = new List<Type2>(); |
| 5860 for (ParameterElement parameter in parameters) { | 5881 for (ParameterElement parameter in parameters) { |
| 5861 if (identical(parameter.parameterKind, ParameterKind.POSITIONAL)) { | 5882 if (identical(parameter.parameterKind, ParameterKind.POSITIONAL)) { |
| 5862 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); | 5883 types.add(parameter.type.substitute2(_typeArguments, typeParameters)); |
| 5863 } | 5884 } |
| 5864 } | 5885 } |
| 5865 return new List.from(types); | 5886 return new List.from(types); |
| 5866 } | 5887 } |
| 5867 List<ParameterElement> get parameters { | 5888 List<ParameterElement> get parameters { |
| 5868 List<ParameterElement> baseParameters = this.baseParameters; | 5889 List<ParameterElement> baseParameters = this.baseParameters; |
| 5869 int parameterCount = baseParameters.length; | 5890 int parameterCount = baseParameters.length; |
| 5870 if (parameterCount == 0) { | 5891 if (parameterCount == 0) { |
| 5871 return baseParameters; | 5892 return baseParameters; |
| 5872 } | 5893 } |
| 5873 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); | 5894 List<ParameterElement> specializedParameters = new List<ParameterElement>(pa
rameterCount); |
| 5874 for (int i = 0; i < parameterCount; i++) { | 5895 for (int i = 0; i < parameterCount; i++) { |
| 5875 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); | 5896 specializedParameters[i] = ParameterMember.from(baseParameters[i], this); |
| 5876 } | 5897 } |
| 5877 return specializedParameters; | 5898 return specializedParameters; |
| 5878 } | 5899 } |
| 5879 Type2 get returnType { | 5900 Type2 get returnType { |
| 5880 Type2 baseReturnType = this.baseReturnType; | 5901 Type2 baseReturnType = this.baseReturnType; |
| 5881 return baseReturnType.substitute2(_typeArguments, TypeVariableTypeImpl.getTy
pes(typeVariables)); | 5902 if (baseReturnType == null) { |
| 5903 return DynamicTypeImpl.instance; |
| 5904 } |
| 5905 return baseReturnType.substitute2(_typeArguments, TypeParameterTypeImpl.getT
ypes(typeParameters)); |
| 5882 } | 5906 } |
| 5883 List<Type2> get typeArguments => _typeArguments; | 5907 List<Type2> get typeArguments => _typeArguments; |
| 5884 List<TypeVariableElement> get typeVariables { | 5908 List<TypeParameterElement> get typeParameters { |
| 5885 Element element = this.element; | 5909 Element element = this.element; |
| 5886 if (element is FunctionTypeAliasElement) { | 5910 if (element is FunctionTypeAliasElement) { |
| 5887 return ((element as FunctionTypeAliasElement)).typeVariables; | 5911 return ((element as FunctionTypeAliasElement)).typeParameters; |
| 5888 } | 5912 } |
| 5889 ClassElement definingClass = element.getAncestor(ClassElement); | 5913 ClassElement definingClass = element.getAncestor(ClassElement); |
| 5890 if (definingClass != null) { | 5914 if (definingClass != null) { |
| 5891 return definingClass.typeVariables; | 5915 return definingClass.typeParameters; |
| 5892 } | 5916 } |
| 5893 return TypeVariableElementImpl.EMPTY_ARRAY; | 5917 return TypeParameterElementImpl.EMPTY_ARRAY; |
| 5894 } | 5918 } |
| 5895 int get hashCode { | 5919 int get hashCode { |
| 5896 Element element = this.element; | 5920 Element element = this.element; |
| 5897 if (element == null) { | 5921 if (element == null) { |
| 5898 return 0; | 5922 return 0; |
| 5899 } | 5923 } |
| 5900 return element.hashCode; | 5924 return element.hashCode; |
| 5901 } | 5925 } |
| 5902 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); | 5926 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); |
| 5903 bool isSubtypeOf(Type2 type) { | 5927 bool isSubtypeOf(Type2 type) { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6315 builder.append(">"); | 6339 builder.append(">"); |
| 6316 name = builder.toString(); | 6340 name = builder.toString(); |
| 6317 } | 6341 } |
| 6318 return name; | 6342 return name; |
| 6319 } | 6343 } |
| 6320 ClassElement get element => super.element as ClassElement; | 6344 ClassElement get element => super.element as ClassElement; |
| 6321 PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getGetter(getterName), this); | 6345 PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getGetter(getterName), this); |
| 6322 List<InterfaceType> get interfaces { | 6346 List<InterfaceType> get interfaces { |
| 6323 ClassElement classElement = element; | 6347 ClassElement classElement = element; |
| 6324 List<InterfaceType> interfaces = classElement.interfaces; | 6348 List<InterfaceType> interfaces = classElement.interfaces; |
| 6325 List<TypeVariableElement> typeVariables = classElement.typeVariables; | 6349 List<TypeParameterElement> typeParameters = classElement.typeParameters; |
| 6326 List<Type2> parameterTypes = classElement.type.typeArguments; | 6350 List<Type2> parameterTypes = classElement.type.typeArguments; |
| 6327 if (typeVariables.length == 0) { | 6351 if (typeParameters.length == 0) { |
| 6328 return interfaces; | 6352 return interfaces; |
| 6329 } | 6353 } |
| 6330 int count = interfaces.length; | 6354 int count = interfaces.length; |
| 6331 List<InterfaceType> typedInterfaces = new List<InterfaceType>(count); | 6355 List<InterfaceType> typedInterfaces = new List<InterfaceType>(count); |
| 6332 for (int i = 0; i < count; i++) { | 6356 for (int i = 0; i < count; i++) { |
| 6333 typedInterfaces[i] = interfaces[i].substitute2(_typeArguments, parameterTy
pes); | 6357 typedInterfaces[i] = interfaces[i].substitute2(_typeArguments, parameterTy
pes); |
| 6334 } | 6358 } |
| 6335 return typedInterfaces; | 6359 return typedInterfaces; |
| 6336 } | 6360 } |
| 6337 Type2 getLeastUpperBound(Type2 type) { | 6361 Type2 getLeastUpperBound(Type2 type) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6380 List<MethodElement> methods = element.methods; | 6404 List<MethodElement> methods = element.methods; |
| 6381 List<MethodElement> members = new List<MethodElement>(methods.length); | 6405 List<MethodElement> members = new List<MethodElement>(methods.length); |
| 6382 for (int i = 0; i < methods.length; i++) { | 6406 for (int i = 0; i < methods.length; i++) { |
| 6383 members[i] = MethodMember.from(methods[i], this); | 6407 members[i] = MethodMember.from(methods[i], this); |
| 6384 } | 6408 } |
| 6385 return members; | 6409 return members; |
| 6386 } | 6410 } |
| 6387 List<InterfaceType> get mixins { | 6411 List<InterfaceType> get mixins { |
| 6388 ClassElement classElement = element; | 6412 ClassElement classElement = element; |
| 6389 List<InterfaceType> mixins = classElement.mixins; | 6413 List<InterfaceType> mixins = classElement.mixins; |
| 6390 List<TypeVariableElement> typeVariables = classElement.typeVariables; | 6414 List<TypeParameterElement> typeParameters = classElement.typeParameters; |
| 6391 List<Type2> parameterTypes = classElement.type.typeArguments; | 6415 List<Type2> parameterTypes = classElement.type.typeArguments; |
| 6392 if (typeVariables.length == 0) { | 6416 if (typeParameters.length == 0) { |
| 6393 return mixins; | 6417 return mixins; |
| 6394 } | 6418 } |
| 6395 int count = mixins.length; | 6419 int count = mixins.length; |
| 6396 List<InterfaceType> typedMixins = new List<InterfaceType>(count); | 6420 List<InterfaceType> typedMixins = new List<InterfaceType>(count); |
| 6397 for (int i = 0; i < count; i++) { | 6421 for (int i = 0; i < count; i++) { |
| 6398 typedMixins[i] = mixins[i].substitute2(_typeArguments, parameterTypes); | 6422 typedMixins[i] = mixins[i].substitute2(_typeArguments, parameterTypes); |
| 6399 } | 6423 } |
| 6400 return typedMixins; | 6424 return typedMixins; |
| 6401 } | 6425 } |
| 6402 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getSetter(setterName), this); | 6426 PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember
.from(((element as ClassElementImpl)).getSetter(setterName), this); |
| 6403 InterfaceType get superclass { | 6427 InterfaceType get superclass { |
| 6404 ClassElement classElement = element; | 6428 ClassElement classElement = element; |
| 6405 InterfaceType supertype = classElement.supertype; | 6429 InterfaceType supertype = classElement.supertype; |
| 6406 if (supertype == null) { | 6430 if (supertype == null) { |
| 6407 return null; | 6431 return null; |
| 6408 } | 6432 } |
| 6409 return supertype.substitute2(_typeArguments, classElement.type.typeArguments
); | 6433 return supertype.substitute2(_typeArguments, classElement.type.typeArguments
); |
| 6410 } | 6434 } |
| 6411 List<Type2> get typeArguments => _typeArguments; | 6435 List<Type2> get typeArguments => _typeArguments; |
| 6412 List<TypeVariableElement> get typeVariables => element.typeVariables; | 6436 List<TypeParameterElement> get typeParameters => element.typeParameters; |
| 6413 int get hashCode { | 6437 int get hashCode { |
| 6414 ClassElement element = this.element; | 6438 ClassElement element = this.element; |
| 6415 if (element == null) { | 6439 if (element == null) { |
| 6416 return 0; | 6440 return 0; |
| 6417 } | 6441 } |
| 6418 return element.hashCode; | 6442 return element.hashCode; |
| 6419 } | 6443 } |
| 6420 bool get isDartCoreFunction { | 6444 bool get isDartCoreFunction { |
| 6421 ClassElement element = this.element; | 6445 ClassElement element = this.element; |
| 6422 if (element == null) { | 6446 if (element == null) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6452 return true; | 6476 return true; |
| 6453 } else if (type is! InterfaceType) { | 6477 } else if (type is! InterfaceType) { |
| 6454 return false; | 6478 return false; |
| 6455 } | 6479 } |
| 6456 return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>()); | 6480 return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>()); |
| 6457 } | 6481 } |
| 6458 bool get isObject => element.supertype == null; | 6482 bool get isObject => element.supertype == null; |
| 6459 bool isSubtypeOf(Type2 type2) { | 6483 bool isSubtypeOf(Type2 type2) { |
| 6460 if (identical(type2, DynamicTypeImpl.instance)) { | 6484 if (identical(type2, DynamicTypeImpl.instance)) { |
| 6461 return true; | 6485 return true; |
| 6462 } else if (type2 is TypeVariableType) { | 6486 } else if (type2 is TypeParameterType) { |
| 6463 return true; | 6487 return true; |
| 6464 } else if (type2 is FunctionType) { | 6488 } else if (type2 is FunctionType) { |
| 6465 ClassElement element = this.element; | 6489 ClassElement element = this.element; |
| 6466 MethodElement callMethod = element.lookUpMethod("call", element.library); | 6490 MethodElement callMethod = element.lookUpMethod("call", element.library); |
| 6467 if (callMethod != null) { | 6491 if (callMethod != null) { |
| 6468 return callMethod.type.isSubtypeOf(type2); | 6492 return callMethod.type.isSubtypeOf(type2); |
| 6469 } | 6493 } |
| 6470 return false; | 6494 return false; |
| 6471 } else if (type2 is! InterfaceType) { | 6495 } else if (type2 is! InterfaceType) { |
| 6472 return false; | 6496 return false; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6795 */ | 6819 */ |
| 6796 void appendTo(JavaStringBuilder builder) { | 6820 void appendTo(JavaStringBuilder builder) { |
| 6797 if (_name == null) { | 6821 if (_name == null) { |
| 6798 builder.append("<unnamed type>"); | 6822 builder.append("<unnamed type>"); |
| 6799 } else { | 6823 } else { |
| 6800 builder.append(_name); | 6824 builder.append(_name); |
| 6801 } | 6825 } |
| 6802 } | 6826 } |
| 6803 } | 6827 } |
| 6804 /** | 6828 /** |
| 6805 * Instances of the class `TypeVariableTypeImpl` defines the behavior of objects
representing | 6829 * Instances of the class `TypeParameterTypeImpl` defines the behavior of object
s representing |
| 6806 * the type introduced by a type variable. | 6830 * the type introduced by a type parameter. |
| 6807 * | 6831 * |
| 6808 * @coverage dart.engine.type | 6832 * @coverage dart.engine.type |
| 6809 */ | 6833 */ |
| 6810 class TypeVariableTypeImpl extends TypeImpl implements TypeVariableType { | 6834 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType { |
| 6811 | 6835 |
| 6812 /** | 6836 /** |
| 6813 * An empty array of type variable types. | 6837 * An empty array of type parameter types. |
| 6814 */ | 6838 */ |
| 6815 static List<TypeVariableType> EMPTY_ARRAY = new List<TypeVariableType>(0); | 6839 static List<TypeParameterType> EMPTY_ARRAY = new List<TypeParameterType>(0); |
| 6816 | 6840 |
| 6817 /** | 6841 /** |
| 6818 * Return an array containing the type variable types defined by the given arr
ay of type variable | 6842 * Return an array containing the type parameter types defined by the given ar
ray of type |
| 6819 * elements. | 6843 * parameter elements. |
| 6820 * | 6844 * |
| 6821 * @param typeVariables the type variable elements defining the type variable
types to be returned | 6845 * @param typeParameters the type parameter elements defining the type paramet
er types to be |
| 6822 * @return the type variable types defined by the type variable elements | 6846 * returned |
| 6847 * @return the type parameter types defined by the type parameter elements |
| 6823 */ | 6848 */ |
| 6824 static List<TypeVariableType> getTypes(List<TypeVariableElement> typeVariables
) { | 6849 static List<TypeParameterType> getTypes(List<TypeParameterElement> typeParamet
ers) { |
| 6825 int count = typeVariables.length; | 6850 int count = typeParameters.length; |
| 6826 if (count == 0) { | 6851 if (count == 0) { |
| 6827 return EMPTY_ARRAY; | 6852 return EMPTY_ARRAY; |
| 6828 } | 6853 } |
| 6829 List<TypeVariableType> types = new List<TypeVariableType>(count); | 6854 List<TypeParameterType> types = new List<TypeParameterType>(count); |
| 6830 for (int i = 0; i < count; i++) { | 6855 for (int i = 0; i < count; i++) { |
| 6831 types[i] = typeVariables[i].type; | 6856 types[i] = typeParameters[i].type; |
| 6832 } | 6857 } |
| 6833 return types; | 6858 return types; |
| 6834 } | 6859 } |
| 6835 | 6860 |
| 6836 /** | 6861 /** |
| 6837 * Initialize a newly created type variable to be declared by the given elemen
t and to have the | 6862 * Initialize a newly created type parameter type to be declared by the given
element and to have |
| 6838 * given name. | 6863 * the given name. |
| 6839 * | 6864 * |
| 6840 * @param element the element representing the declaration of the type variabl
e | 6865 * @param element the element representing the declaration of the type paramet
er |
| 6841 */ | 6866 */ |
| 6842 TypeVariableTypeImpl(TypeVariableElement element) : super(element, element.nam
e); | 6867 TypeParameterTypeImpl(TypeParameterElement element) : super(element, element.n
ame); |
| 6843 bool operator ==(Object object) => object is TypeVariableTypeImpl && element =
= ((object as TypeVariableTypeImpl)).element; | 6868 bool operator ==(Object object) => object is TypeParameterTypeImpl && element
== ((object as TypeParameterTypeImpl)).element; |
| 6844 TypeVariableElement get element => super.element as TypeVariableElement; | 6869 TypeParameterElement get element => super.element as TypeParameterElement; |
| 6845 int get hashCode => element.hashCode; | 6870 int get hashCode => element.hashCode; |
| 6846 bool isMoreSpecificThan(Type2 type) { | 6871 bool isMoreSpecificThan(Type2 type) { |
| 6847 Type2 upperBound = element.bound; | 6872 Type2 upperBound = element.bound; |
| 6848 return type == upperBound; | 6873 return type == upperBound; |
| 6849 } | 6874 } |
| 6850 bool isSubtypeOf(Type2 type) => true; | 6875 bool isSubtypeOf(Type2 type) => true; |
| 6851 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { | 6876 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { |
| 6852 int length = parameterTypes.length; | 6877 int length = parameterTypes.length; |
| 6853 for (int i = 0; i < length; i++) { | 6878 for (int i = 0; i < length; i++) { |
| 6854 if (parameterTypes[i] == this) { | 6879 if (parameterTypes[i] == this) { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7132 | 7157 |
| 7133 /** | 7158 /** |
| 7134 * Return `true` if this type is more specific than the given type. An interfa
ce type | 7159 * Return `true` if this type is more specific than the given type. An interfa
ce type |
| 7135 * <i>T</i> is more specific than an interface type <i>S</i>, written <i>T &la
quo; S</i>, if one | 7160 * <i>T</i> is more specific than an interface type <i>S</i>, written <i>T &la
quo; S</i>, if one |
| 7136 * of the following conditions is met: | 7161 * of the following conditions is met: |
| 7137 * | 7162 * |
| 7138 * * Reflexivity: <i>T</i> is <i>S</i>. | 7163 * * Reflexivity: <i>T</i> is <i>S</i>. |
| 7139 * * <i>T</i> is bottom. | 7164 * * <i>T</i> is bottom. |
| 7140 * * <i>S</i> is dynamic. | 7165 * * <i>S</i> is dynamic. |
| 7141 * * Direct supertype: <i>S</i> is a direct supertype of <i>T</i>. | 7166 * * Direct supertype: <i>S</i> is a direct supertype of <i>T</i>. |
| 7142 * * <i>T</i> is a type variable and <i>S</i> is the upper bound of <i>T</i>. | 7167 * * <i>T</i> is a type parameter and <i>S</i> is the upper bound of <i>T</i>. |
| 7143 * * Covariance: <i>T</i> is of the form <i>I<T<sub>1</sub>, …, T<su
b>n</sub>></i> | 7168 * * Covariance: <i>T</i> is of the form <i>I<T<sub>1</sub>, …, T<su
b>n</sub>></i> |
| 7144 * and S</i> is of the form <i>I<S<sub>1</sub>, …, S<sub>n</sub>>
</i> and | 7169 * and S</i> is of the form <i>I<S<sub>1</sub>, …, S<sub>n</sub>>
</i> and |
| 7145 * <i>T<sub>i</sub> « S<sub>i</sub></i>, <i>1 <= i <= n</i>. | 7170 * <i>T<sub>i</sub> « S<sub>i</sub></i>, <i>1 <= i <= n</i>. |
| 7146 * * Transitivity: <i>T « U</i> and <i>U « S</i>. | 7171 * * Transitivity: <i>T « U</i> and <i>U « S</i>. |
| 7147 * | 7172 * |
| 7148 * | 7173 * |
| 7149 * @param type the type being compared with this type | 7174 * @param type the type being compared with this type |
| 7150 * @return `true` if this type is more specific than the given type | 7175 * @return `true` if this type is more specific than the given type |
| 7151 */ | 7176 */ |
| 7152 bool isMoreSpecificThan(Type2 type); | 7177 bool isMoreSpecificThan(Type2 type); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7312 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. | 7337 * Return the type resulting from substituting the given arguments for this ty
pe's parameters. |
| 7313 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())`
. | 7338 * This is fully equivalent to `substitute(argumentTypes, getTypeArguments())`
. |
| 7314 * | 7339 * |
| 7315 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters | 7340 * @param argumentTypes the actual type arguments being substituted for the ty
pe parameters |
| 7316 * @return the result of performing the substitution | 7341 * @return the result of performing the substitution |
| 7317 */ | 7342 */ |
| 7318 InterfaceType substitute4(List<Type2> argumentTypes); | 7343 InterfaceType substitute4(List<Type2> argumentTypes); |
| 7319 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType
s); | 7344 InterfaceType substitute2(List<Type2> argumentTypes, List<Type2> parameterType
s); |
| 7320 } | 7345 } |
| 7321 /** | 7346 /** |
| 7322 * The interface `ParameterizedType` defines the behavior common to objects repr
esenting the | 7347 * The interface `ParameterizedType` defines the behavior common to objects repr
esenting a |
| 7323 * type with type parameters, such as class and function type alias. | 7348 * type with type parameters, such as a class or function type alias. |
| 7324 * | 7349 * |
| 7325 * @coverage dart.engine.type | 7350 * @coverage dart.engine.type |
| 7326 */ | 7351 */ |
| 7327 abstract class ParameterizedType implements Type2 { | 7352 abstract class ParameterizedType implements Type2 { |
| 7328 | 7353 |
| 7329 /** | 7354 /** |
| 7330 * Return an array containing the actual types of the type arguments. If this
type's element does | 7355 * Return an array containing the actual types of the type arguments. If this
type's element does |
| 7331 * not have type parameters, then the array should be empty (although it is po
ssible for type | 7356 * not have type parameters, then the array should be empty (although it is po
ssible for type |
| 7332 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type | 7357 * arguments to be erroneously declared). If the element has type parameters a
nd the actual type |
| 7333 * does not explicitly include argument values, then the type "dynamic" will b
e automatically | 7358 * does not explicitly include argument values, then the type "dynamic" will b
e automatically |
| 7334 * provided. | 7359 * provided. |
| 7335 * | 7360 * |
| 7336 * @return the actual types of the type arguments | 7361 * @return the actual types of the type arguments |
| 7337 */ | 7362 */ |
| 7338 List<Type2> get typeArguments; | 7363 List<Type2> get typeArguments; |
| 7339 | 7364 |
| 7340 /** | 7365 /** |
| 7341 * Return an array containing all of the type variables declared for this type
. | 7366 * Return an array containing all of the type parameters declared for this typ
e. |
| 7342 * | 7367 * |
| 7343 * @return the type variables declared for this type | 7368 * @return the type parameters declared for this type |
| 7344 */ | 7369 */ |
| 7345 List<TypeVariableElement> get typeVariables; | 7370 List<TypeParameterElement> get typeParameters; |
| 7346 } | 7371 } |
| 7347 /** | 7372 /** |
| 7348 * The interface `Type` defines the behavior of objects representing the declare
d type of | 7373 * The interface `Type` defines the behavior of objects representing the declare
d type of |
| 7349 * elements in the element model. | 7374 * elements in the element model. |
| 7350 * | 7375 * |
| 7351 * @coverage dart.engine.type | 7376 * @coverage dart.engine.type |
| 7352 */ | 7377 */ |
| 7353 abstract class Type2 { | 7378 abstract class Type2 { |
| 7354 | 7379 |
| 7355 /** | 7380 /** |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7460 * not create a copy of this type if no substitutions were required, but will
return this type | 7485 * not create a copy of this type if no substitutions were required, but will
return this type |
| 7461 * directly. | 7486 * directly. |
| 7462 * | 7487 * |
| 7463 * @param argumentTypes the actual type arguments being substituted for the pa
rameters | 7488 * @param argumentTypes the actual type arguments being substituted for the pa
rameters |
| 7464 * @param parameterTypes the parameters to be replaced | 7489 * @param parameterTypes the parameters to be replaced |
| 7465 * @return the result of performing the substitution | 7490 * @return the result of performing the substitution |
| 7466 */ | 7491 */ |
| 7467 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 7492 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 7468 } | 7493 } |
| 7469 /** | 7494 /** |
| 7470 * The interface `TypeVariableType` defines the behavior of objects representing
the type | 7495 * The interface `TypeParameterType` defines the behavior of objects representin
g the type |
| 7471 * introduced by a type variable. | 7496 * introduced by a type parameter. |
| 7472 * | 7497 * |
| 7473 * @coverage dart.engine.type | 7498 * @coverage dart.engine.type |
| 7474 */ | 7499 */ |
| 7475 abstract class TypeVariableType implements Type2 { | 7500 abstract class TypeParameterType implements Type2 { |
| 7476 TypeVariableElement get element; | 7501 TypeParameterElement get element; |
| 7477 } | 7502 } |
| 7478 /** | 7503 /** |
| 7479 * The interface `VoidType` defines the behavior of the unique object representi
ng the type | 7504 * The interface `VoidType` defines the behavior of the unique object representi
ng the type |
| 7480 * `void`. | 7505 * `void`. |
| 7481 * | 7506 * |
| 7482 * @coverage dart.engine.type | 7507 * @coverage dart.engine.type |
| 7483 */ | 7508 */ |
| 7484 abstract class VoidType implements Type2 { | 7509 abstract class VoidType implements Type2 { |
| 7485 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 7510 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 7486 } | 7511 } |
| OLD | NEW |