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

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

Issue 123763002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.element; 4 library engine.element;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart'; 8 import 'java_engine.dart';
9 import 'utilities_collection.dart'; 9 import 'utilities_collection.dart';
10 import 'source.dart'; 10 import 'source.dart';
11 import 'scanner.dart' show Keyword; 11 import 'scanner.dart' show Keyword;
12 import 'ast.dart' show Identifier, LibraryIdentifier; 12 import 'ast.dart';
13 import 'sdk.dart' show DartSdk; 13 import 'sdk.dart' show DartSdk;
14 import 'html.dart' show XmlTagNode; 14 import 'html.dart' show XmlTagNode;
15 import 'engine.dart' show AnalysisContext; 15 import 'engine.dart' show AnalysisContext;
16 import 'constant.dart' show EvaluationResultImpl; 16 import 'constant.dart' show EvaluationResultImpl;
17 import 'utilities_dart.dart'; 17 import 'utilities_dart.dart';
18 18
19 /** 19 /**
20 * 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.
21 * 21 *
22 * @coverage dart.engine.element 22 * @coverage dart.engine.element
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /** 104 /**
105 * Return the named constructor declared in this class with the given name, or `null` if 105 * Return the named constructor declared in this class with the given name, or `null` if
106 * this class does not declare a named constructor with the given name. 106 * this class does not declare a named constructor with the given name.
107 * 107 *
108 * @param name the name of the constructor to be returned 108 * @param name the name of the constructor to be returned
109 * @return the element representing the specified constructor 109 * @return the element representing the specified constructor
110 */ 110 */
111 ConstructorElement getNamedConstructor(String name); 111 ConstructorElement getNamedConstructor(String name);
112 112
113 /** 113 /**
114 * Return the resolved [ClassDeclaration] node that declares this [ClassElemen t].
115 *
116 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
117 * resolving will be performed.
118 *
119 * @return the resolved [ClassDeclaration], not `null`.
120 */
121 ClassDeclaration get node;
122
123 /**
114 * Return the element representing the setter with the given name that is decl ared in this class, 124 * Return the element representing the setter with the given name that is decl ared in this class,
115 * or `null` if this class does not declare a setter with the given name. 125 * or `null` if this class does not declare a setter with the given name.
116 * 126 *
117 * @param setterName the name of the getter to be returned 127 * @param setterName the name of the getter to be returned
118 * @return the setter declared in this class with the given name 128 * @return the setter declared in this class with the given name
119 */ 129 */
120 PropertyAccessorElement getSetter(String setterName); 130 PropertyAccessorElement getSetter(String setterName);
121 131
122 /** 132 /**
123 * Return the superclass of this class, or `null` if the class represents the class 133 * Return the superclass of this class, or `null` if the class represents the class
124 * 'Object'. All other classes will have a non-`null` superclass. If the super class was not 134 * 'Object'. All other classes will have a non-`null` superclass. If the super class was not
125 * explicitly declared then the implicit superclass 'Object' will be returned. 135 * explicitly declared then the implicit superclass 'Object' will be returned.
126 * 136 *
127 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it 137 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it
128 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance 138 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance
129 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure 139 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure
130 * must explicitly guard against infinite loops. 140 * must explicitly guard against infinite loops.
131 * 141 *
132 * @return the superclass of this class 142 * @return the superclass of this class
133 */ 143 */
134 InterfaceType get supertype; 144 InterfaceType get supertype;
135 145
136 /** 146 /**
147 * Return an array containing all of the toolkit specific objects attached to this class.
148 *
149 * @return the toolkit objects attached to this class
150 */
151 List<ToolkitObjectElement> get toolkitObjects;
152
153 /**
137 * Return the type defined by the class. 154 * Return the type defined by the class.
138 * 155 *
139 * @return the type defined by the class 156 * @return the type defined by the class
140 */ 157 */
141 InterfaceType get type; 158 InterfaceType get type;
142 159
143 /** 160 /**
144 * Return an array containing all of the type parameters declared for this cla ss. 161 * Return an array containing all of the type parameters declared for this cla ss.
145 * 162 *
146 * @return the type parameters declared for this class 163 * @return the type parameters declared for this class
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 List<FunctionElement> get functions; 341 List<FunctionElement> get functions;
325 342
326 /** 343 /**
327 * Return an array containing all of the function type aliases contained in th is compilation unit. 344 * Return an array containing all of the function type aliases contained in th is compilation unit.
328 * 345 *
329 * @return the function type aliases contained in this compilation unit 346 * @return the function type aliases contained in this compilation unit
330 */ 347 */
331 List<FunctionTypeAliasElement> get functionTypeAliases; 348 List<FunctionTypeAliasElement> get functionTypeAliases;
332 349
333 /** 350 /**
351 * Return the resolved [CompilationUnit] node that declares this element.
352 *
353 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
354 * resolving will be performed.
355 *
356 * @return the resolved [CompilationUnit], not `null`.
357 */
358 CompilationUnit get node;
359
360 /**
334 * Return an array containing all of the top-level variables contained in this compilation unit. 361 * Return an array containing all of the top-level variables contained in this compilation unit.
335 * 362 *
336 * @return the top-level variables contained in this compilation unit 363 * @return the top-level variables contained in this compilation unit
337 */ 364 */
338 List<TopLevelVariableElement> get topLevelVariables; 365 List<TopLevelVariableElement> get topLevelVariables;
339 366
340 /** 367 /**
341 * Return the class defined in this compilation unit that has the given name, or `null` if 368 * Return the class defined in this compilation unit that has the given name, or `null` if
342 * this compilation unit does not define a class with the given name. 369 * this compilation unit does not define a class with the given name.
343 * 370 *
(...skipping 11 matching lines...) Expand all
355 } 382 }
356 383
357 /** 384 /**
358 * The interface `ConstructorElement` defines the behavior of elements represent ing a 385 * The interface `ConstructorElement` defines the behavior of elements represent ing a
359 * constructor or a factory method defined within a type. 386 * constructor or a factory method defined within a type.
360 * 387 *
361 * @coverage dart.engine.element 388 * @coverage dart.engine.element
362 */ 389 */
363 abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme nt { 390 abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme nt {
364 /** 391 /**
392 * Return the resolved [ConstructorDeclaration] node that declares this
393 * [ConstructorElement] .
394 *
395 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
396 * resolving will be performed.
397 *
398 * @return the resolved [ConstructorDeclaration], not `null`.
399 */
400 ConstructorDeclaration get node;
401
402 /**
365 * Return the constructor to which this constructor is redirecting. 403 * Return the constructor to which this constructor is redirecting.
366 * 404 *
367 * @return the constructor to which this constructor is redirecting 405 * @return the constructor to which this constructor is redirecting
368 */ 406 */
369 ConstructorElement get redirectedConstructor; 407 ConstructorElement get redirectedConstructor;
370 408
371 /** 409 /**
372 * Return `true` if this constructor is a const constructor. 410 * Return `true` if this constructor is a const constructor.
373 * 411 *
374 * @return `true` if this constructor is a const constructor 412 * @return `true` if this constructor is a const constructor
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 /** 559 /**
522 * Return the offset of the name of this element in the file that contains the declaration of this 560 * Return the offset of the name of this element in the file that contains the declaration of this
523 * element, or `-1` if this element is synthetic, does not have a name, or oth erwise does 561 * element, or `-1` if this element is synthetic, does not have a name, or oth erwise does
524 * not have an offset. 562 * not have an offset.
525 * 563 *
526 * @return the offset of the name of this element 564 * @return the offset of the name of this element
527 */ 565 */
528 int get nameOffset; 566 int get nameOffset;
529 567
530 /** 568 /**
569 * Return the resolved [ASTNode] node that declares this [Element].
570 *
571 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
572 * resolving will be performed.
573 *
574 * @return the resolved [ASTNode], maybe `null` if [Element] is synthetic or
575 * isn't contained in a compilation unit, such as a [LibraryElement].
576 */
577 ASTNode get node;
578
579 /**
531 * Return the source that contains this element, or `null` if this element is not contained 580 * Return the source that contains this element, or `null` if this element is not contained
532 * in a source. 581 * in a source.
533 * 582 *
534 * @return the source that contains this element 583 * @return the source that contains this element
535 */ 584 */
536 Source get source; 585 Source get source;
537 586
538 /** 587 /**
588 * Return the resolved [CompilationUnit] that declares this [Element].
589 *
590 * This method is expensive, because resolved AST might have been already evic ted from cache, so
591 * parsing and resolving will be performed.
592 *
593 * @return the resolved [CompilationUnit], maybe `null` if synthetic [Element] .
594 */
595 CompilationUnit get unit;
596
597 /**
539 * Return `true` if this element, assuming that it is within scope, is accessi ble to code in 598 * Return `true` if this element, assuming that it is within scope, is accessi ble to code in
540 * the given library. This is defined by the Dart Language Specification in se ction 3.2: 599 * the given library. This is defined by the Dart Language Specification in se ction 3.2:
541 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i >m</i> is declared 600 * <blockquote> A declaration <i>m</i> is accessible to library <i>L</i> if <i >m</i> is declared
542 * in <i>L</i> or if <i>m</i> is public. </blockquote> 601 * in <i>L</i> or if <i>m</i> is public. </blockquote>
543 * 602 *
544 * @param library the library in which a possible reference to this element wo uld occur 603 * @param library the library in which a possible reference to this element wo uld occur
545 * @return `true` if this element is accessible to code in the given library 604 * @return `true` if this element is accessible to code in the given library
546 */ 605 */
547 bool isAccessibleIn(LibraryElement library); 606 bool isAccessibleIn(LibraryElement library);
548 607
549 /** 608 /**
550 * Return `true` if this element has an annotation of the form '@deprecated' o r 609 * Return `true` if this element has an annotation of the form '@deprecated' o r
551 * '@Deprecated('..')'. 610 * '@Deprecated('..')'.
552 * 611 *
553 * @return `true` if this element is deprecated 612 * @return `true` if this element is deprecated
554 */ 613 */
555 bool get isDeprecated; 614 bool get isDeprecated;
556 615
557 /** 616 /**
617 * Return `true` if this element is private. Private elements are visible only within the
618 * library in which they are declared.
619 *
620 * @return `true` if this element is private
621 */
622 bool get isPrivate;
623
624 /**
625 * Return `true` if this element is public. Public elements are visible within any library
626 * that imports the library in which they are declared.
627 *
628 * @return `true` if this element is public
629 */
630 bool get isPublic;
631
632 /**
558 * Return `true` if this element is synthetic. A synthetic element is an eleme nt that is not 633 * Return `true` if this element is synthetic. A synthetic element is an eleme nt that is not
559 * represented in the source code explicitly, but is implied by the source cod e, such as the 634 * represented in the source code explicitly, but is implied by the source cod e, such as the
560 * default constructor for a class that does not explicitly define any constru ctors. 635 * default constructor for a class that does not explicitly define any constru ctors.
561 * 636 *
562 * @return `true` if this element is synthetic 637 * @return `true` if this element is synthetic
563 */ 638 */
564 bool get isSynthetic; 639 bool get isSynthetic;
565 640
566 /** 641 /**
567 * Use the given visitor to visit all of the children of this element. There i s no guarantee of 642 * Use the given visitor to visit all of the children of this element. There i s no guarantee of
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 */ 1015 */
941 FieldElement get field; 1016 FieldElement get field;
942 } 1017 }
943 1018
944 /** 1019 /**
945 * The interface `FunctionElement` defines the behavior of elements representing a function. 1020 * The interface `FunctionElement` defines the behavior of elements representing a function.
946 * 1021 *
947 * @coverage dart.engine.element 1022 * @coverage dart.engine.element
948 */ 1023 */
949 abstract class FunctionElement implements ExecutableElement, LocalElement { 1024 abstract class FunctionElement implements ExecutableElement, LocalElement {
1025 /**
1026 * Return the resolved [FunctionDeclaration] node that declares this [Function Element]
1027 * .
1028 *
1029 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
1030 * resolving will be performed.
1031 *
1032 * @return the resolved [FunctionDeclaration], not `null`.
1033 */
1034 FunctionDeclaration get node;
950 } 1035 }
951 1036
952 /** 1037 /**
953 * The interface `FunctionTypeAliasElement` defines the behavior of elements rep resenting a 1038 * The interface `FunctionTypeAliasElement` defines the behavior of elements rep resenting a
954 * function type alias (`typedef`). 1039 * function type alias (`typedef`).
955 * 1040 *
956 * @coverage dart.engine.element 1041 * @coverage dart.engine.element
957 */ 1042 */
958 abstract class FunctionTypeAliasElement implements Element { 1043 abstract class FunctionTypeAliasElement implements Element {
959 /** 1044 /**
960 * Return the compilation unit in which this type alias is defined. 1045 * Return the compilation unit in which this type alias is defined.
961 * 1046 *
962 * @return the compilation unit in which this type alias is defined 1047 * @return the compilation unit in which this type alias is defined
963 */ 1048 */
964 CompilationUnitElement get enclosingElement; 1049 CompilationUnitElement get enclosingElement;
965 1050
966 /** 1051 /**
1052 * Return the resolved [FunctionTypeAlias] node that declares this
1053 * [FunctionTypeAliasElement] .
1054 *
1055 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
1056 * resolving will be performed.
1057 *
1058 * @return the resolved [FunctionTypeAlias], not `null`.
1059 */
1060 FunctionTypeAlias get node;
1061
1062 /**
967 * Return an array containing all of the parameters defined by this type alias . 1063 * Return an array containing all of the parameters defined by this type alias .
968 * 1064 *
969 * @return the parameters defined by this type alias 1065 * @return the parameters defined by this type alias
970 */ 1066 */
971 List<ParameterElement> get parameters; 1067 List<ParameterElement> get parameters;
972 1068
973 /** 1069 /**
974 * Return the return type defined by this type alias. 1070 * Return the return type defined by this type alias.
975 * 1071 *
976 * @return the return type defined by this type alias 1072 * @return the return type defined by this type alias
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 /** 1271 /**
1176 * Return the class defined in this library that has the given name, or `null` if this 1272 * Return the class defined in this library that has the given name, or `null` if this
1177 * library does not define a class with the given name. 1273 * library does not define a class with the given name.
1178 * 1274 *
1179 * @param className the name of the class to be returned 1275 * @param className the name of the class to be returned
1180 * @return the class with the given name that is defined in this library 1276 * @return the class with the given name that is defined in this library
1181 */ 1277 */
1182 ClassElement getType(String className); 1278 ClassElement getType(String className);
1183 1279
1184 /** 1280 /**
1281 * Return an array containing all directly and indirectly imported libraries.
1282 *
1283 * @return all directly and indirectly imported libraries
1284 */
1285 List<LibraryElement> get visibleLibraries;
1286
1287 /**
1185 * Answer `true` if this library is an application that can be run in the brow ser. 1288 * Answer `true` if this library is an application that can be run in the brow ser.
1186 * 1289 *
1187 * @return `true` if this library is an application that can be run in the bro wser 1290 * @return `true` if this library is an application that can be run in the bro wser
1188 */ 1291 */
1189 bool get isBrowserApplication; 1292 bool get isBrowserApplication;
1190 1293
1191 /** 1294 /**
1192 * Return `true` if this library is the dart:core library. 1295 * Return `true` if this library is the dart:core library.
1193 * 1296 *
1194 * @return `true` if this library is the dart:core library 1297 * @return `true` if this library is the dart:core library
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 } 1352 }
1250 1353
1251 /** 1354 /**
1252 * The interface `MethodElement` defines the behavior of elements that represent a method 1355 * The interface `MethodElement` defines the behavior of elements that represent a method
1253 * defined within a type. 1356 * defined within a type.
1254 * 1357 *
1255 * @coverage dart.engine.element 1358 * @coverage dart.engine.element
1256 */ 1359 */
1257 abstract class MethodElement implements ClassMemberElement, ExecutableElement { 1360 abstract class MethodElement implements ClassMemberElement, ExecutableElement {
1258 /** 1361 /**
1362 * Return the resolved [MethodDeclaration] node that declares this [MethodElem ent].
1363 *
1364 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
1365 * resolving will be performed.
1366 *
1367 * @return the resolved [MethodDeclaration], not `null`.
1368 */
1369 MethodDeclaration get node;
1370
1371 /**
1259 * Return `true` if this method is abstract. Methods are abstract if they are not external 1372 * Return `true` if this method is abstract. Methods are abstract if they are not external
1260 * and have no body. 1373 * and have no body.
1261 * 1374 *
1262 * @return `true` if this method is abstract 1375 * @return `true` if this method is abstract
1263 */ 1376 */
1264 bool get isAbstract; 1377 bool get isAbstract;
1265 } 1378 }
1266 1379
1267 /** 1380 /**
1268 * The interface `MultiplyDefinedElement` defines the behavior of pseudo-element s that 1381 * The interface `MultiplyDefinedElement` defines the behavior of pseudo-element s that
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 /** 1614 /**
1502 * Return an array containing the names that are to be made visible in the imp orting library if 1615 * Return an array containing the names that are to be made visible in the imp orting library if
1503 * they are defined in the imported library. 1616 * they are defined in the imported library.
1504 * 1617 *
1505 * @return the names from the imported library that are visible in the importi ng library 1618 * @return the names from the imported library that are visible in the importi ng library
1506 */ 1619 */
1507 List<String> get shownNames; 1620 List<String> get shownNames;
1508 } 1621 }
1509 1622
1510 /** 1623 /**
1624 * The interface `ToolkitObjectElement` defines the behavior of elements that re present a
1625 * toolkit specific object, such as Angular controller or component. These eleme nts are not based on
1626 * the Dart syntax, but on some semantic agreement, such as a special annotation .
1627 *
1628 * @coverage dart.engine.element
1629 */
1630 abstract class ToolkitObjectElement implements Element {
1631 /**
1632 * An empty array of toolkit object elements.
1633 */
1634 static final List<ToolkitObjectElement> EMPTY_ARRAY = new List<ToolkitObjectEl ement>(0);
1635 }
1636
1637 /**
1511 * The interface `TopLevelVariableElement` defines the behavior of elements repr esenting a 1638 * The interface `TopLevelVariableElement` defines the behavior of elements repr esenting a
1512 * top-level variable. 1639 * top-level variable.
1513 * 1640 *
1514 * @coverage dart.engine.element 1641 * @coverage dart.engine.element
1515 */ 1642 */
1516 abstract class TopLevelVariableElement implements PropertyInducingElement { 1643 abstract class TopLevelVariableElement implements PropertyInducingElement {
1517 } 1644 }
1518 1645
1519 /** 1646 /**
1520 * The interface `TypeParameterElement` defines the behavior of elements represe nting a type 1647 * The interface `TypeParameterElement` defines the behavior of elements represe nting a type
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 /** 1703 /**
1577 * Return a synthetic function representing this variable's initializer, or `n ull` if this 1704 * Return a synthetic function representing this variable's initializer, or `n ull` if this
1578 * variable does not have an initializer. The function will have no parameters . The return type of 1705 * variable does not have an initializer. The function will have no parameters . The return type of
1579 * the function will be the compile-time type of the initialization expression . 1706 * the function will be the compile-time type of the initialization expression .
1580 * 1707 *
1581 * @return a synthetic function representing this variable's initializer 1708 * @return a synthetic function representing this variable's initializer
1582 */ 1709 */
1583 FunctionElement get initializer; 1710 FunctionElement get initializer;
1584 1711
1585 /** 1712 /**
1713 * Return the resolved [VariableDeclaration] node that declares this [Variable Element]
1714 * .
1715 *
1716 * This method is expensive, because resolved AST might be evicted from cache, so parsing and
1717 * resolving will be performed.
1718 *
1719 * @return the resolved [VariableDeclaration], not `null`.
1720 */
1721 VariableDeclaration get node;
1722
1723 /**
1586 * Return the declared type of this variable, or `null` if the variable did no t have a 1724 * Return the declared type of this variable, or `null` if the variable did no t have a
1587 * declared type (such as if it was declared using the keyword 'var'). 1725 * declared type (such as if it was declared using the keyword 'var').
1588 * 1726 *
1589 * @return the declared type of this variable 1727 * @return the declared type of this variable
1590 */ 1728 */
1591 Type2 get type; 1729 Type2 get type;
1592 1730
1593 /** 1731 /**
1594 * Return `true` if this variable was declared with the 'const' modifier. 1732 * Return `true` if this variable was declared with the 'const' modifier.
1595 * 1733 *
1596 * @return `true` if this variable was declared with the 'const' modifier 1734 * @return `true` if this variable was declared with the 'const' modifier
1597 */ 1735 */
1598 bool get isConst; 1736 bool get isConst;
1599 1737
1600 /** 1738 /**
1601 * Return `true` if this variable was declared with the 'final' modifier. Vari ables that are 1739 * Return `true` if this variable was declared with the 'final' modifier. Vari ables that are
1602 * declared with the 'const' modifier will return `false` even though they are implicitly 1740 * declared with the 'const' modifier will return `false` even though they are implicitly
1603 * final. 1741 * final.
1604 * 1742 *
1605 * @return `true` if this variable was declared with the 'final' modifier 1743 * @return `true` if this variable was declared with the 'final' modifier
1606 */ 1744 */
1607 bool get isFinal; 1745 bool get isFinal;
1608 } 1746 }
1609 1747
1610 /** 1748 /**
1749 * The interface `AngularControllerElement` defines the Angular component descri bed by
1750 * <code>NgComponent</code> annotation.
1751 *
1752 * @coverage dart.engine.element
1753 */
1754 abstract class AngularComponentElement implements AngularSelectorElement {
1755 /**
1756 * Return an array containing all of the properties declared by this component .
1757 */
1758 List<AngularPropertyElement> get properties;
1759
1760 /**
1761 * Returns the CSS file URI.
1762 */
1763 String get styleUri;
1764
1765 /**
1766 * Return the offset of the [getStyleUri] in the [getSource].
1767 *
1768 * @return the offset of the style URI
1769 */
1770 int get styleUriOffset;
1771
1772 /**
1773 * Returns the HTML template URI.
1774 */
1775 String get templateUri;
1776
1777 /**
1778 * Return the offset of the [getTemplateUri] in the [getSource].
1779 *
1780 * @return the offset of the template URI
1781 */
1782 int get templateUriOffset;
1783 }
1784
1785 /**
1786 * The interface `AngularControllerElement` defines the Angular controller descr ibed by
1787 * <code>NgController</code> annotation.
1788 *
1789 * @coverage dart.engine.element
1790 */
1791 abstract class AngularControllerElement implements AngularSelectorElement {
1792 }
1793
1794 /**
1795 * The interface `AngularElement` defines the behavior of objects representing i nformation
1796 * about an Angular specific element.
1797 *
1798 * @coverage dart.engine.element
1799 */
1800 abstract class AngularElement implements ToolkitObjectElement {
1801 }
1802
1803 /**
1804 * The interface `AngularFilterElement` defines the Angular filter described by
1805 * <code>NgFilter</code> annotation.
1806 *
1807 * @coverage dart.engine.element
1808 */
1809 abstract class AngularFilterElement implements AngularElement {
1810 }
1811
1812 /**
1813 * The interface `AngularControllerElement` defines a single property in
1814 * [AngularComponentElement].
1815 *
1816 * @coverage dart.engine.element
1817 */
1818 abstract class AngularPropertyElement implements AngularElement {
1819 /**
1820 * Returns the field this property is mapped to.
1821 *
1822 * @return the field this property is mapped to.
1823 */
1824 FieldElement get field;
1825
1826 /**
1827 * Return the offset of the field name of this property in the [getSource].
1828 *
1829 * @return the offset of the field name of this property
1830 */
1831 int get fieldNameOffset;
1832
1833 /**
1834 * Returns the kind of this property.
1835 *
1836 * @return the kind of this property
1837 */
1838 AngularPropertyKind get propertyKind;
1839 }
1840
1841 /**
1842 * The enumeration `AngularPropertyKind` defines the different kinds of property bindings.
1843 *
1844 * @coverage dart.engine.element
1845 */
1846 class AngularPropertyKind extends Enum<AngularPropertyKind> {
1847 /**
1848 * `@` - Map the DOM attribute string. The attribute string will be taken lite rally or
1849 * interpolated if it contains binding {{}} syntax and assigned to the express ion. (cost: 0
1850 * watches)
1851 */
1852 static final AngularPropertyKind ATTR = new AngularPropertyKind('ATTR', 0);
1853
1854 /**
1855 * `&` - Treat the DOM attribute value as an expression. Assign a closure func tion into the field.
1856 * This allows the component to control the invocation of the closure. This is useful for passing
1857 * expressions into controllers which act like callbacks. (cost: 0 watches)
1858 */
1859 static final AngularPropertyKind CALLBACK = new AngularPropertyKind('CALLBACK' , 1);
1860
1861 /**
1862 * `=>` - Treat the DOM attribute value as an expression. Set up a watch, whic h will read the
1863 * expression in the attribute and assign the value to destination expression. (cost: 1 watch)
1864 */
1865 static final AngularPropertyKind ONE_WAY = new AngularPropertyKind('ONE_WAY', 2);
1866
1867 /**
1868 * `=>!` - Treat the DOM attribute value as an expression. Set up a one time w atch on expression.
1869 * Once the expression turns not null it will no longer update. (cost: 1 watch es until not null,
1870 * then 0 watches)
1871 */
1872 static final AngularPropertyKind ONE_WAY_ONE_TIME = new AngularPropertyKind('O NE_WAY_ONE_TIME', 3);
1873
1874 /**
1875 * `<=>` - Treat the DOM attribute value as an expression. Set up a watch on b oth outside as well
1876 * as component scope to keep the source and destination in sync. (cost: 2 wat ches)
1877 */
1878 static final AngularPropertyKind TWO_WAY = new AngularPropertyKind('TWO_WAY', 4);
1879
1880 static final List<AngularPropertyKind> values = [ATTR, CALLBACK, ONE_WAY, ONE_ WAY_ONE_TIME, TWO_WAY];
1881
1882 AngularPropertyKind(String name, int ordinal) : super(name, ordinal);
1883 }
1884
1885 /**
1886 * [AngularSelector] is used to decide when Angular object should be applied.
1887 */
1888 abstract class AngularSelector {
1889 /**
1890 * Checks if the given [XmlTagNode] matches this selector.
1891 *
1892 * @param node the [XmlTagNode] to check
1893 * @return `true` if the given [XmlTagNode] matches, or `false` otherwise
1894 */
1895 bool apply(XmlTagNode node);
1896 }
1897
1898 /**
1899 * The interface `AngularElement` defines the behavior of objects representing i nformation
1900 * about an Angular element which is applied conditionally using some [AngularSe lector].
1901 *
1902 * @coverage dart.engine.element
1903 */
1904 abstract class AngularSelectorElement implements AngularElement {
1905 /**
1906 * Returns the selector specified for this element.
1907 *
1908 * @return the [AngularSelector] specified for this element
1909 */
1910 AngularSelector get selector;
1911 }
1912
1913 /**
1611 * Instances of the class `GeneralizingElementVisitor` implement an element visi tor that will 1914 * Instances of the class `GeneralizingElementVisitor` implement an element visi tor that will
1612 * recursively visit all of the elements in an element model (like instances of the class 1915 * recursively visit all of the elements in an element model (like instances of the class
1613 * [RecursiveElementVisitor]). In addition, when an element of a specific type i s visited not 1916 * [RecursiveElementVisitor]). In addition, when an element of a specific type i s visited not
1614 * only will the visit method for that specific type of element be invoked, but additional methods 1917 * only will the visit method for that specific type of element be invoked, but additional methods
1615 * for the supertypes of that element will also be invoked. For example, using a n instance of this 1918 * for the supertypes of that element will also be invoked. For example, using a n instance of this
1616 * class to visit a [MethodElement] will cause the method 1919 * class to visit a [MethodElement] will cause the method
1617 * [visitMethodElement] to be invoked but will also cause the methods 1920 * [visitMethodElement] to be invoked but will also cause the methods
1618 * [visitExecutableElement] and [visitElement] to be 1921 * [visitExecutableElement] and [visitElement] to be
1619 * subsequently invoked. This allows visitors to be written that visit all execu table elements 1922 * subsequently invoked. This allows visitors to be written that visit all execu table elements
1620 * without needing to override the visit method for each of the specific subclas ses of 1923 * without needing to override the visit method for each of the specific subclas ses of
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 * An array containing all of the methods contained in this class. 2280 * An array containing all of the methods contained in this class.
1978 */ 2281 */
1979 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; 2282 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY;
1980 2283
1981 /** 2284 /**
1982 * The superclass of the class, or `null` if the class does not have an explic it superclass. 2285 * The superclass of the class, or `null` if the class does not have an explic it superclass.
1983 */ 2286 */
1984 InterfaceType supertype; 2287 InterfaceType supertype;
1985 2288
1986 /** 2289 /**
2290 * An array containing all of the toolkit objects attached to this class.
2291 */
2292 List<ToolkitObjectElement> _toolkitObjects = ToolkitObjectElement.EMPTY_ARRAY;
2293
2294 /**
1987 * The type defined by the class. 2295 * The type defined by the class.
1988 */ 2296 */
1989 InterfaceType type; 2297 InterfaceType type;
1990 2298
1991 /** 2299 /**
1992 * An array containing all of the type parameters defined for this class. 2300 * An array containing all of the type parameters defined for this class.
1993 */ 2301 */
1994 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR RAY; 2302 List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_AR RAY;
1995 2303
1996 /** 2304 /**
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 ConstructorElement getNamedConstructor(String name) { 2397 ConstructorElement getNamedConstructor(String name) {
2090 for (ConstructorElement element in constructors) { 2398 for (ConstructorElement element in constructors) {
2091 String elementName = element.name; 2399 String elementName = element.name;
2092 if (elementName != null && elementName == name) { 2400 if (elementName != null && elementName == name) {
2093 return element; 2401 return element;
2094 } 2402 }
2095 } 2403 }
2096 return null; 2404 return null;
2097 } 2405 }
2098 2406
2407 ClassDeclaration get node => getNode2(ClassDeclaration);
2408
2099 PropertyAccessorElement getSetter(String setterName) { 2409 PropertyAccessorElement getSetter(String setterName) {
2100 if (!setterName.endsWith("=")) { 2410 if (!setterName.endsWith("=")) {
2101 setterName += '='; 2411 setterName += '=';
2102 } 2412 }
2103 for (PropertyAccessorElement accessor in _accessors) { 2413 for (PropertyAccessorElement accessor in _accessors) {
2104 if (accessor.isSetter && accessor.name == setterName) { 2414 if (accessor.isSetter && accessor.name == setterName) {
2105 return accessor; 2415 return accessor;
2106 } 2416 }
2107 } 2417 }
2108 return null; 2418 return null;
2109 } 2419 }
2110 2420
2421 List<ToolkitObjectElement> get toolkitObjects => _toolkitObjects;
2422
2111 List<TypeParameterElement> get typeParameters => _typeParameters; 2423 List<TypeParameterElement> get typeParameters => _typeParameters;
2112 2424
2113 ConstructorElement get unnamedConstructor { 2425 ConstructorElement get unnamedConstructor {
2114 for (ConstructorElement element in constructors) { 2426 for (ConstructorElement element in constructors) {
2115 String name = element.displayName; 2427 String name = element.displayName;
2116 if (name == null || name.isEmpty) { 2428 if (name == null || name.isEmpty) {
2117 return element; 2429 return element;
2118 } 2430 }
2119 } 2431 }
2120 return null; 2432 return null;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 * @param methods the methods contained in this class 2618 * @param methods the methods contained in this class
2307 */ 2619 */
2308 void set methods(List<MethodElement> methods) { 2620 void set methods(List<MethodElement> methods) {
2309 for (MethodElement method in methods) { 2621 for (MethodElement method in methods) {
2310 (method as MethodElementImpl).enclosingElement = this; 2622 (method as MethodElementImpl).enclosingElement = this;
2311 } 2623 }
2312 this._methods = methods; 2624 this._methods = methods;
2313 } 2625 }
2314 2626
2315 /** 2627 /**
2628 * Set the toolkit specific information objects attached to this class.
2629 *
2630 * @param toolkitObjects the toolkit objects attached to this class
2631 */
2632 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) {
2633 for (ToolkitObjectElement toolkitObject in toolkitObjects) {
2634 (toolkitObject as ToolkitObjectElementImpl).enclosingElement = this;
2635 }
2636 this._toolkitObjects = toolkitObjects;
2637 }
2638
2639 /**
2316 * Set whether this class is defined by a typedef construct to correspond to t he given value. 2640 * Set whether this class is defined by a typedef construct to correspond to t he given value.
2317 * 2641 *
2318 * @param isTypedef `true` if the class is defined by a typedef construct 2642 * @param isTypedef `true` if the class is defined by a typedef construct
2319 */ 2643 */
2320 void set typedef(bool isTypedef) { 2644 void set typedef(bool isTypedef) {
2321 setModifier(Modifier.TYPEDEF, isTypedef); 2645 setModifier(Modifier.TYPEDEF, isTypedef);
2322 } 2646 }
2323 2647
2324 /** 2648 /**
2325 * Set the type parameters defined for this class to the given type parameters . 2649 * Set the type parameters defined for this class to the given type parameters .
(...skipping 15 matching lines...) Expand all
2341 void set validMixin(bool isValidMixin) { 2665 void set validMixin(bool isValidMixin) {
2342 setModifier(Modifier.MIXIN, isValidMixin); 2666 setModifier(Modifier.MIXIN, isValidMixin);
2343 } 2667 }
2344 2668
2345 void visitChildren(ElementVisitor visitor) { 2669 void visitChildren(ElementVisitor visitor) {
2346 super.visitChildren(visitor); 2670 super.visitChildren(visitor);
2347 safelyVisitChildren(_accessors, visitor); 2671 safelyVisitChildren(_accessors, visitor);
2348 safelyVisitChildren(_constructors, visitor); 2672 safelyVisitChildren(_constructors, visitor);
2349 safelyVisitChildren(_fields, visitor); 2673 safelyVisitChildren(_fields, visitor);
2350 safelyVisitChildren(_methods, visitor); 2674 safelyVisitChildren(_methods, visitor);
2675 safelyVisitChildren(_toolkitObjects, visitor);
2351 safelyVisitChildren(_typeParameters, visitor); 2676 safelyVisitChildren(_typeParameters, visitor);
2352 } 2677 }
2353 2678
2354 void appendTo(JavaStringBuilder builder) { 2679 void appendTo(JavaStringBuilder builder) {
2355 String name = displayName; 2680 String name = displayName;
2356 if (name == null) { 2681 if (name == null) {
2357 builder.append("{unnamed class}"); 2682 builder.append("{unnamed class}");
2358 } else { 2683 } else {
2359 builder.append(name); 2684 builder.append(name);
2360 } 2685 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 * 2732 *
2408 * @coverage dart.engine.element 2733 * @coverage dart.engine.element
2409 */ 2734 */
2410 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE lement { 2735 class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE lement {
2411 /** 2736 /**
2412 * An empty array of compilation unit elements. 2737 * An empty array of compilation unit elements.
2413 */ 2738 */
2414 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>(0); 2739 static List<CompilationUnitElement> EMPTY_ARRAY = new List<CompilationUnitElem ent>(0);
2415 2740
2416 /** 2741 /**
2742 * The source that corresponds to this compilation unit.
2743 */
2744 Source source;
2745
2746 /**
2417 * An array containing all of the top-level accessors (getters and setters) co ntained in this 2747 * An array containing all of the top-level accessors (getters and setters) co ntained in this
2418 * compilation unit. 2748 * compilation unit.
2419 */ 2749 */
2420 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY; 2750 List<PropertyAccessorElement> _accessors = PropertyAccessorElementImpl.EMPTY_A RRAY;
2421 2751
2422 /** 2752 /**
2423 * An array containing all of the top-level functions contained in this compil ation unit. 2753 * An array containing all of the top-level functions contained in this compil ation unit.
2424 */ 2754 */
2425 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; 2755 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
2426 2756
2427 /** 2757 /**
2428 * An array containing all of the variables contained in this compilation unit .
2429 */
2430 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A RRAY;
2431
2432 /**
2433 * The source that corresponds to this compilation unit.
2434 */
2435 Source source;
2436
2437 /**
2438 * An array containing all of the function type aliases contained in this comp ilation unit. 2758 * An array containing all of the function type aliases contained in this comp ilation unit.
2439 */ 2759 */
2440 List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMP TY_ARRAY; 2760 List<FunctionTypeAliasElement> _typeAliases = FunctionTypeAliasElementImpl.EMP TY_ARRAY;
2441 2761
2442 /** 2762 /**
2443 * An array containing all of the types contained in this compilation unit. 2763 * An array containing all of the types contained in this compilation unit.
2444 */ 2764 */
2445 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; 2765 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY;
2446 2766
2447 /** 2767 /**
2768 * An array containing all of the variables contained in this compilation unit .
2769 */
2770 List<TopLevelVariableElement> _variables = TopLevelVariableElementImpl.EMPTY_A RRAY;
2771
2772 /**
2448 * The URI that is specified by the "part" directive in the enclosing library, or `null` if 2773 * The URI that is specified by the "part" directive in the enclosing library, or `null` if
2449 * this is the defining compilation unit of a library. 2774 * this is the defining compilation unit of a library.
2450 */ 2775 */
2451 String uri; 2776 String uri;
2452 2777
2453 /** 2778 /**
2454 * Initialize a newly created compilation unit element to have the given name. 2779 * Initialize a newly created compilation unit element to have the given name.
2455 * 2780 *
2456 * @param name the name of this element 2781 * @param name the name of this element
2457 */ 2782 */
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 } 2818 }
2494 2819
2495 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t; 2820 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen t;
2496 2821
2497 List<FunctionElement> get functions => _functions; 2822 List<FunctionElement> get functions => _functions;
2498 2823
2499 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; 2824 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases;
2500 2825
2501 ElementKind get kind => ElementKind.COMPILATION_UNIT; 2826 ElementKind get kind => ElementKind.COMPILATION_UNIT;
2502 2827
2828 CompilationUnit get node => unit;
2829
2503 List<TopLevelVariableElement> get topLevelVariables => _variables; 2830 List<TopLevelVariableElement> get topLevelVariables => _variables;
2504 2831
2505 ClassElement getType(String className) { 2832 ClassElement getType(String className) {
2506 for (ClassElement type in _types) { 2833 for (ClassElement type in _types) {
2507 if (type.name == className) { 2834 if (type.name == className) {
2508 return type; 2835 return type;
2509 } 2836 }
2510 } 2837 }
2511 return null; 2838 return null;
2512 } 2839 }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 * @param name the name of this element 3019 * @param name the name of this element
2693 */ 3020 */
2694 ConstructorElementImpl(Identifier name) : super.con1(name); 3021 ConstructorElementImpl(Identifier name) : super.con1(name);
2695 3022
2696 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); 3023 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
2697 3024
2698 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 3025 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
2699 3026
2700 ElementKind get kind => ElementKind.CONSTRUCTOR; 3027 ElementKind get kind => ElementKind.CONSTRUCTOR;
2701 3028
3029 ConstructorDeclaration get node => getNode2(ConstructorDeclaration);
3030
2702 bool get isConst => hasModifier(Modifier.CONST); 3031 bool get isConst => hasModifier(Modifier.CONST);
2703 3032
2704 bool get isDefaultConstructor { 3033 bool get isDefaultConstructor {
2705 String name = this.name; 3034 String name = this.name;
2706 if (name != null && name.length != 0) { 3035 if (name != null && name.length != 0) {
2707 return false; 3036 return false;
2708 } 3037 }
2709 for (ParameterElement parameter in parameters) { 3038 for (ParameterElement parameter in parameters) {
2710 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) { 3039 if (identical(parameter.parameterKind, ParameterKind.REQUIRED)) {
2711 return false; 3040 return false;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 String get displayName => _name; 3352 String get displayName => _name;
3024 3353
3025 Element get enclosingElement => _enclosingElement; 3354 Element get enclosingElement => _enclosingElement;
3026 3355
3027 LibraryElement get library => getAncestor(LibraryElement); 3356 LibraryElement get library => getAncestor(LibraryElement);
3028 3357
3029 ElementLocation get location => new ElementLocationImpl.con1(this); 3358 ElementLocation get location => new ElementLocationImpl.con1(this);
3030 3359
3031 String get name => _name; 3360 String get name => _name;
3032 3361
3362 ASTNode get node => getNode2(ASTNode);
3363
3033 Source get source { 3364 Source get source {
3034 if (_enclosingElement == null) { 3365 if (_enclosingElement == null) {
3035 return null; 3366 return null;
3036 } 3367 }
3037 return _enclosingElement.source; 3368 return _enclosingElement.source;
3038 } 3369 }
3039 3370
3371 CompilationUnit get unit => context.resolveCompilationUnit(source, library);
3372
3040 int get hashCode { 3373 int get hashCode {
3041 if (_cachedHashCode == 0) { 3374 if (_cachedHashCode == 0) {
3042 _cachedHashCode = location.hashCode; 3375 _cachedHashCode = location.hashCode;
3043 } 3376 }
3044 return _cachedHashCode; 3377 return _cachedHashCode;
3045 } 3378 }
3046 3379
3047 bool isAccessibleIn(LibraryElement library) { 3380 bool isAccessibleIn(LibraryElement library) {
3048 if (Identifier.isPrivateName(_name)) { 3381 if (Identifier.isPrivateName(_name)) {
3049 return library == this.library; 3382 return library == this.library;
3050 } 3383 }
3051 return true; 3384 return true;
3052 } 3385 }
3053 3386
3054 bool get isDeprecated { 3387 bool get isDeprecated {
3055 for (ElementAnnotation annotation in metadata) { 3388 for (ElementAnnotation annotation in metadata) {
3056 if (annotation.isDeprecated) { 3389 if (annotation.isDeprecated) {
3057 return true; 3390 return true;
3058 } 3391 }
3059 } 3392 }
3060 return false; 3393 return false;
3061 } 3394 }
3062 3395
3396 bool get isPrivate {
3397 String name = displayName;
3398 if (name == null) {
3399 return true;
3400 }
3401 return Identifier.isPrivateName(name);
3402 }
3403
3404 bool get isPublic => !isPrivate;
3405
3063 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC); 3406 bool get isSynthetic => hasModifier(Modifier.SYNTHETIC);
3064 3407
3065 /** 3408 /**
3066 * Set whether this element is synthetic to correspond to the given value. 3409 * Set whether this element is synthetic to correspond to the given value.
3067 * 3410 *
3068 * @param isSynthetic `true` if the element is synthetic 3411 * @param isSynthetic `true` if the element is synthetic
3069 */ 3412 */
3070 void set synthetic(bool isSynthetic) { 3413 void set synthetic(bool isSynthetic) {
3071 setModifier(Modifier.SYNTHETIC, isSynthetic); 3414 setModifier(Modifier.SYNTHETIC, isSynthetic);
3072 } 3415 }
(...skipping 24 matching lines...) Expand all
3097 3440
3098 /** 3441 /**
3099 * Return an identifier that uniquely identifies this element among the childr en of this element's 3442 * Return an identifier that uniquely identifies this element among the childr en of this element's
3100 * parent. 3443 * parent.
3101 * 3444 *
3102 * @return an identifier that uniquely identifies this element relative to its parent 3445 * @return an identifier that uniquely identifies this element relative to its parent
3103 */ 3446 */
3104 String get identifier => name; 3447 String get identifier => name;
3105 3448
3106 /** 3449 /**
3450 * Return the resolved [ASTNode] of the given type enclosing [getNameOffset].
3451 */
3452 ASTNode getNode2(Type clazz) {
3453 CompilationUnit unit = this.unit;
3454 if (unit == null) {
3455 return null;
3456 }
3457 int offset = nameOffset;
3458 ASTNode node = new NodeLocator.con1(offset).searchWithin(unit);
3459 if (node == null) {
3460 return null;
3461 }
3462 return node.getAncestor(clazz);
3463 }
3464
3465 /**
3107 * Return `true` if this element has the given modifier associated with it. 3466 * Return `true` if this element has the given modifier associated with it.
3108 * 3467 *
3109 * @param modifier the modifier being tested for 3468 * @param modifier the modifier being tested for
3110 * @return `true` if this element has the given modifier associated with it 3469 * @return `true` if this element has the given modifier associated with it
3111 */ 3470 */
3112 bool hasModifier(Modifier modifier) => BooleanArray.get(_modifiers, modifier); 3471 bool hasModifier(Modifier modifier) => BooleanArray.get(_modifiers, modifier);
3113 3472
3114 /** 3473 /**
3115 * If the given child is not `null`, use the given visitor to visit it. 3474 * If the given child is not `null`, use the given visitor to visit it.
3116 * 3475 *
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 */ 3702 */
3344 int hashSourceComponent(String sourceComponent) { 3703 int hashSourceComponent(String sourceComponent) {
3345 if (sourceComponent.length <= 1) { 3704 if (sourceComponent.length <= 1) {
3346 return sourceComponent.hashCode; 3705 return sourceComponent.hashCode;
3347 } 3706 }
3348 return sourceComponent.substring(1).hashCode; 3707 return sourceComponent.substring(1).hashCode;
3349 } 3708 }
3350 } 3709 }
3351 3710
3352 /** 3711 /**
3712 * The class `ElementPair` is a pair of [Element]s. [Object#equals] and
3713 * [Object#hashCode] so this class can be used in hashed data structures.
3714 */
3715 class ElementPair {
3716 /**
3717 * The first [Element]
3718 */
3719 Element _first;
3720
3721 /**
3722 * The second [Element]
3723 */
3724 Element _second;
3725
3726 /**
3727 * The sole constructor for this class, taking two [Element]s.
3728 *
3729 * @param first the first element
3730 * @param second the second element
3731 */
3732 ElementPair(Element first, Element second) {
3733 this._first = first;
3734 this._second = second;
3735 }
3736
3737 bool operator ==(Object object) {
3738 if (identical(object, this)) {
3739 return true;
3740 }
3741 if (object is ElementPair) {
3742 ElementPair elementPair = object as ElementPair;
3743 return (_first == elementPair._first) && (_second == elementPair._second);
3744 }
3745 return false;
3746 }
3747
3748 /**
3749 * Return the first element.
3750 *
3751 * @return the first element
3752 */
3753 Element get firstElt => _first;
3754
3755 /**
3756 * Return the second element
3757 *
3758 * @return the second element
3759 */
3760 Element get secondElt => _second;
3761
3762 int get hashCode => ObjectUtilities.combineHashCodes(_first.hashCode, _second. hashCode);
3763 }
3764
3765 /**
3353 * Instances of the class `EmbeddedHtmlScriptElementImpl` implement an 3766 * Instances of the class `EmbeddedHtmlScriptElementImpl` implement an
3354 * [EmbeddedHtmlScriptElement]. 3767 * [EmbeddedHtmlScriptElement].
3355 * 3768 *
3356 * @coverage dart.engine.element 3769 * @coverage dart.engine.element
3357 */ 3770 */
3358 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb eddedHtmlScriptElement { 3771 class EmbeddedHtmlScriptElementImpl extends HtmlScriptElementImpl implements Emb eddedHtmlScriptElement {
3359 /** 3772 /**
3360 * The library defined by the script tag's content. 3773 * The library defined by the script tag's content.
3361 */ 3774 */
3362 LibraryElement _scriptLibrary; 3775 LibraryElement _scriptLibrary;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 * 4133 *
3721 * @param nameOffset the offset of the name of this element in the file that c ontains the 4134 * @param nameOffset the offset of the name of this element in the file that c ontains the
3722 * declaration of this element 4135 * declaration of this element
3723 */ 4136 */
3724 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); 4137 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset);
3725 4138
3726 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); 4139 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
3727 4140
3728 ElementKind get kind => ElementKind.FUNCTION; 4141 ElementKind get kind => ElementKind.FUNCTION;
3729 4142
4143 FunctionDeclaration get node => getNode2(FunctionDeclaration);
4144
3730 SourceRange get visibleRange { 4145 SourceRange get visibleRange {
3731 if (_visibleRangeLength < 0) { 4146 if (_visibleRangeLength < 0) {
3732 return null; 4147 return null;
3733 } 4148 }
3734 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 4149 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
3735 } 4150 }
3736 4151
3737 bool get isStatic => enclosingElement is CompilationUnitElement; 4152 bool get isStatic => enclosingElement is CompilationUnitElement;
3738 4153
3739 /** 4154 /**
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 return typeParameter as TypeParameterElementImpl; 4227 return typeParameter as TypeParameterElementImpl;
3813 } 4228 }
3814 } 4229 }
3815 return null; 4230 return null;
3816 } 4231 }
3817 4232
3818 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi lationUnitElement; 4233 CompilationUnitElement get enclosingElement => super.enclosingElement as Compi lationUnitElement;
3819 4234
3820 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; 4235 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
3821 4236
4237 FunctionTypeAlias get node => getNode2(FunctionTypeAlias);
4238
3822 List<ParameterElement> get parameters => _parameters; 4239 List<ParameterElement> get parameters => _parameters;
3823 4240
3824 List<TypeParameterElement> get typeParameters => _typeParameters; 4241 List<TypeParameterElement> get typeParameters => _typeParameters;
3825 4242
3826 /** 4243 /**
3827 * Set the parameters defined by this type alias to the given parameters. 4244 * Set the parameters defined by this type alias to the given parameters.
3828 * 4245 *
3829 * @param parameters the parameters defined by this type alias 4246 * @param parameters the parameters defined by this type alias
3830 */ 4247 */
3831 void set parameters(List<ParameterElement> parameters) { 4248 void set parameters(List<ParameterElement> parameters) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
4026 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag. offset); 4443 HtmlScriptElementImpl(XmlTagNode node) : super.con2(node.tag.lexeme, node.tag. offset);
4027 } 4444 }
4028 4445
4029 /** 4446 /**
4030 * Instances of the class `ImportElementImpl` implement an [ImportElement]. 4447 * Instances of the class `ImportElementImpl` implement an [ImportElement].
4031 * 4448 *
4032 * @coverage dart.engine.element 4449 * @coverage dart.engine.element
4033 */ 4450 */
4034 class ImportElementImpl extends ElementImpl implements ImportElement { 4451 class ImportElementImpl extends ElementImpl implements ImportElement {
4035 /** 4452 /**
4036 * The offset of this directive, may be `-1` if synthetic.
4037 */
4038 int _offset = -1;
4039
4040 /**
4041 * The offset of the character immediately following the last character of thi s node's URI, may be 4453 * The offset of the character immediately following the last character of thi s node's URI, may be
4042 * `-1` if synthetic. 4454 * `-1` if synthetic.
4043 */ 4455 */
4044 int uriEnd = -1; 4456 int uriEnd = -1;
4045 4457
4046 /** 4458 /**
4047 * The offset of the prefix of this import in the file that contains the this import directive, or 4459 * The offset of the prefix of this import in the file that contains the this import directive, or
4048 * `-1` if this import is synthetic. 4460 * `-1` if this import is synthetic.
4049 */ 4461 */
4050 int prefixOffset = 0; 4462 int prefixOffset = 0;
(...skipping 15 matching lines...) Expand all
4066 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY; 4478 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY;
4067 4479
4068 /** 4480 /**
4069 * The prefix that was specified as part of the import directive, or `null` if there was no 4481 * The prefix that was specified as part of the import directive, or `null` if there was no
4070 * prefix specified. 4482 * prefix specified.
4071 */ 4483 */
4072 PrefixElement prefix; 4484 PrefixElement prefix;
4073 4485
4074 /** 4486 /**
4075 * Initialize a newly created import element. 4487 * Initialize a newly created import element.
4488 *
4489 * @param offset the directive offset, may be `-1` if synthetic.
4076 */ 4490 */
4077 ImportElementImpl() : super.con1(null); 4491 ImportElementImpl(int offset) : super.con2(null, offset);
4078 4492
4079 accept(ElementVisitor visitor) => visitor.visitImportElement(this); 4493 accept(ElementVisitor visitor) => visitor.visitImportElement(this);
4080 4494
4081 ElementKind get kind => ElementKind.IMPORT; 4495 ElementKind get kind => ElementKind.IMPORT;
4082 4496
4083 /**
4084 * Set the offset of this directive.
4085 */
4086 void set offset(int offset) {
4087 this._offset = offset;
4088 }
4089
4090 void visitChildren(ElementVisitor visitor) { 4497 void visitChildren(ElementVisitor visitor) {
4091 super.visitChildren(visitor); 4498 super.visitChildren(visitor);
4092 safelyVisitChild(prefix, visitor); 4499 safelyVisitChild(prefix, visitor);
4093 } 4500 }
4094 4501
4095 void appendTo(JavaStringBuilder builder) { 4502 void appendTo(JavaStringBuilder builder) {
4096 builder.append("import "); 4503 builder.append("import ");
4097 (importedLibrary as LibraryElementImpl).appendTo(builder); 4504 (importedLibrary as LibraryElementImpl).appendTo(builder);
4098 } 4505 }
4099 4506
4100 String get identifier => "${(importedLibrary as LibraryElementImpl).identifier }@${_offset}"; 4507 String get identifier => "${(importedLibrary as LibraryElementImpl).identifier }@${nameOffset}";
4101 } 4508 }
4102 4509
4103 /** 4510 /**
4104 * Instances of the class `LabelElementImpl` implement a `LabelElement`. 4511 * Instances of the class `LabelElementImpl` implement a `LabelElement`.
4105 * 4512 *
4106 * @coverage dart.engine.element 4513 * @coverage dart.engine.element
4107 */ 4514 */
4108 class LabelElementImpl extends ElementImpl implements LabelElement { 4515 class LabelElementImpl extends ElementImpl implements LabelElement {
4109 /** 4516 /**
4110 * A flag indicating whether this label is associated with a `switch` statemen t. 4517 * A flag indicating whether this label is associated with a `switch` statemen t.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 } 4731 }
4325 for (CompilationUnitElement part in _parts) { 4732 for (CompilationUnitElement part in _parts) {
4326 type = part.getType(className); 4733 type = part.getType(className);
4327 if (type != null) { 4734 if (type != null) {
4328 return type; 4735 return type;
4329 } 4736 }
4330 } 4737 }
4331 return null; 4738 return null;
4332 } 4739 }
4333 4740
4741 List<LibraryElement> get visibleLibraries {
4742 Set<LibraryElement> visibleLibraries = new Set();
4743 addVisibleLibraries(visibleLibraries, false);
4744 return new List.from(visibleLibraries);
4745 }
4746
4334 int get hashCode => _definingCompilationUnit.hashCode; 4747 int get hashCode => _definingCompilationUnit.hashCode;
4335 4748
4336 bool get isBrowserApplication => entryPoint != null && isOrImportsBrowserLibra ry; 4749 bool get isBrowserApplication => entryPoint != null && isOrImportsBrowserLibra ry;
4337 4750
4338 bool get isDartCore => name == "dart.core"; 4751 bool get isDartCore => name == "dart.core";
4339 4752
4340 bool get isInSdk => name.startsWith("dart."); 4753 bool get isInSdk => name.startsWith("dart.");
4341 4754
4342 bool isUpToDate2(int timeStamp) { 4755 bool isUpToDate2(int timeStamp) {
4343 Set<LibraryElement> visitedLibraries = new Set(); 4756 Set<LibraryElement> visitedLibraries = new Set();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4399 super.visitChildren(visitor); 4812 super.visitChildren(visitor);
4400 safelyVisitChild(_definingCompilationUnit, visitor); 4813 safelyVisitChild(_definingCompilationUnit, visitor);
4401 safelyVisitChildren(_exports, visitor); 4814 safelyVisitChildren(_exports, visitor);
4402 safelyVisitChildren(_imports, visitor); 4815 safelyVisitChildren(_imports, visitor);
4403 safelyVisitChildren(_parts, visitor); 4816 safelyVisitChildren(_parts, visitor);
4404 } 4817 }
4405 4818
4406 String get identifier => _definingCompilationUnit.source.encoding; 4819 String get identifier => _definingCompilationUnit.source.encoding;
4407 4820
4408 /** 4821 /**
4822 * Recursively fills set of visible libraries for [getVisibleElementsLibraries ].
4823 */
4824 void addVisibleLibraries(Set<LibraryElement> visibleLibraries, bool includeExp orts) {
4825 if (!visibleLibraries.add(this)) {
4826 return;
4827 }
4828 for (ImportElement importElement in _imports) {
4829 LibraryElement importedLibrary = importElement.importedLibrary;
4830 if (importedLibrary != null) {
4831 (importedLibrary as LibraryElementImpl).addVisibleLibraries(visibleLibra ries, true);
4832 }
4833 }
4834 if (includeExports) {
4835 for (ExportElement exportElement in _exports) {
4836 LibraryElement exportedLibrary = exportElement.exportedLibrary;
4837 if (exportedLibrary != null) {
4838 (exportedLibrary as LibraryElementImpl).addVisibleLibraries(visibleLib raries, true);
4839 }
4840 }
4841 }
4842 }
4843
4844 /**
4409 * Answer `true` if the receiver directly or indirectly imports the dart:html libraries. 4845 * Answer `true` if the receiver directly or indirectly imports the dart:html libraries.
4410 * 4846 *
4411 * @return `true` if the receiver directly or indirectly imports the dart:html libraries 4847 * @return `true` if the receiver directly or indirectly imports the dart:html libraries
4412 */ 4848 */
4413 bool get isOrImportsBrowserLibrary { 4849 bool get isOrImportsBrowserLibrary {
4414 List<LibraryElement> visited = new List<LibraryElement>(); 4850 List<LibraryElement> visited = new List<LibraryElement>();
4415 Source htmlLibSource = context.sourceFactory.forUri(DartSdk.DART_HTML); 4851 Source htmlLibSource = context.sourceFactory.forUri(DartSdk.DART_HTML);
4416 visited.add(this); 4852 visited.add(this);
4417 for (int index = 0; index < visited.length; index++) { 4853 for (int index = 0; index < visited.length; index++) {
4418 LibraryElement library = visited[index]; 4854 LibraryElement library = visited[index];
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 String get name { 4997 String get name {
4562 String name = super.name; 4998 String name = super.name;
4563 if (isOperator && name == "-") { 4999 if (isOperator && name == "-") {
4564 if (parameters.length == 0) { 5000 if (parameters.length == 0) {
4565 return "unary-"; 5001 return "unary-";
4566 } 5002 }
4567 } 5003 }
4568 return super.name; 5004 return super.name;
4569 } 5005 }
4570 5006
5007 MethodDeclaration get node => getNode2(MethodDeclaration);
5008
4571 bool get isAbstract => hasModifier(Modifier.ABSTRACT); 5009 bool get isAbstract => hasModifier(Modifier.ABSTRACT);
4572 5010
4573 bool get isOperator { 5011 bool get isOperator {
4574 String name = displayName; 5012 String name = displayName;
4575 if (name.isEmpty) { 5013 if (name.isEmpty) {
4576 return false; 5014 return false;
4577 } 5015 }
4578 int first = name.codeUnitAt(0); 5016 int first = name.codeUnitAt(0);
4579 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A ) || first == 0x5F || first == 0x24); 5017 return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A ) || first == 0x5F || first == 0x24);
4580 } 5018 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 LibraryElement get library => null; 5188 LibraryElement get library => null;
4751 5189
4752 ElementLocation get location => null; 5190 ElementLocation get location => null;
4753 5191
4754 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY; 5192 List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY;
4755 5193
4756 String get name => _name; 5194 String get name => _name;
4757 5195
4758 int get nameOffset => -1; 5196 int get nameOffset => -1;
4759 5197
5198 ASTNode get node => null;
5199
4760 Source get source => null; 5200 Source get source => null;
4761 5201
4762 Type2 get type => DynamicTypeImpl.instance; 5202 Type2 get type => DynamicTypeImpl.instance;
4763 5203
5204 CompilationUnit get unit => null;
5205
4764 bool isAccessibleIn(LibraryElement library) { 5206 bool isAccessibleIn(LibraryElement library) {
4765 for (Element element in conflictingElements) { 5207 for (Element element in conflictingElements) {
4766 if (element.isAccessibleIn(library)) { 5208 if (element.isAccessibleIn(library)) {
4767 return true; 5209 return true;
4768 } 5210 }
4769 } 5211 }
4770 return false; 5212 return false;
4771 } 5213 }
4772 5214
4773 bool get isDeprecated => false; 5215 bool get isDeprecated => false;
4774 5216
5217 bool get isPrivate {
5218 String name = displayName;
5219 if (name == null) {
5220 return false;
5221 }
5222 return Identifier.isPrivateName(name);
5223 }
5224
5225 bool get isPublic => !isPrivate;
5226
4775 bool get isSynthetic => true; 5227 bool get isSynthetic => true;
4776 5228
4777 String toString() { 5229 String toString() {
4778 JavaStringBuilder builder = new JavaStringBuilder(); 5230 JavaStringBuilder builder = new JavaStringBuilder();
4779 builder.append("["); 5231 builder.append("[");
4780 int count = conflictingElements.length; 5232 int count = conflictingElements.length;
4781 for (int i = 0; i < count; i++) { 5233 for (int i = 0; i < count; i++) {
4782 if (i > 0) { 5234 if (i > 0) {
4783 builder.append(", "); 5235 builder.append(", ");
4784 } 5236 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 return ElementKind.SETTER; 5529 return ElementKind.SETTER;
5078 } 5530 }
5079 5531
5080 String get name { 5532 String get name {
5081 if (isSetter) { 5533 if (isSetter) {
5082 return "${super.name}="; 5534 return "${super.name}=";
5083 } 5535 }
5084 return super.name; 5536 return super.name;
5085 } 5537 }
5086 5538
5539 ASTNode get node {
5540 if (isSynthetic) {
5541 return null;
5542 }
5543 if (enclosingElement is ClassElement) {
5544 return getNode2(MethodDeclaration);
5545 }
5546 if (enclosingElement is CompilationUnitElement) {
5547 return getNode2(FunctionDeclaration);
5548 }
5549 return null;
5550 }
5551
5087 int get hashCode => ObjectUtilities.combineHashCodes(super.hashCode, isGetter ? 1 : 2); 5552 int get hashCode => ObjectUtilities.combineHashCodes(super.hashCode, isGetter ? 1 : 2);
5088 5553
5089 bool get isAbstract => hasModifier(Modifier.ABSTRACT); 5554 bool get isAbstract => hasModifier(Modifier.ABSTRACT);
5090 5555
5091 bool get isGetter => hasModifier(Modifier.GETTER); 5556 bool get isGetter => hasModifier(Modifier.GETTER);
5092 5557
5093 bool get isSetter => hasModifier(Modifier.SETTER); 5558 bool get isSetter => hasModifier(Modifier.SETTER);
5094 5559
5095 bool get isStatic => hasModifier(Modifier.STATIC); 5560 bool get isStatic => hasModifier(Modifier.STATIC);
5096 5561
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 if (i > 0) { 5673 if (i > 0) {
5209 builder.append(", "); 5674 builder.append(", ");
5210 } 5675 }
5211 builder.append(shownNames[i]); 5676 builder.append(shownNames[i]);
5212 } 5677 }
5213 return builder.toString(); 5678 return builder.toString();
5214 } 5679 }
5215 } 5680 }
5216 5681
5217 /** 5682 /**
5683 * Instances of the class `ToolkitObjectElementImpl` implement a `ToolkitObjectE lement`.
5684 *
5685 * @coverage dart.engine.element
5686 */
5687 abstract class ToolkitObjectElementImpl extends ElementImpl implements ToolkitOb jectElement {
5688 /**
5689 * Initialize a newly created toolkit object element to have the given name.
5690 *
5691 * @param name the name of this element
5692 * @param nameOffset the offset of the name of this element in the file that c ontains the
5693 * declaration of this element
5694 */
5695 ToolkitObjectElementImpl(String name, int nameOffset) : super.con2(name, nameO ffset);
5696 }
5697
5698 /**
5218 * Instances of the class `TopLevelVariableElementImpl` implement a 5699 * Instances of the class `TopLevelVariableElementImpl` implement a
5219 * `TopLevelVariableElement`. 5700 * `TopLevelVariableElement`.
5220 * 5701 *
5221 * @coverage dart.engine.element 5702 * @coverage dart.engine.element
5222 */ 5703 */
5223 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement { 5704 class TopLevelVariableElementImpl extends PropertyInducingElementImpl implements TopLevelVariableElement {
5224 /** 5705 /**
5225 * An empty array of top-level variable elements. 5706 * An empty array of top-level variable elements.
5226 */ 5707 */
5227 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl ement>(0); 5708 static List<TopLevelVariableElement> EMPTY_ARRAY = new List<TopLevelVariableEl ement>(0);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5331 * Return the result of evaluating this variable's initializer as a compile-ti me constant 5812 * Return the result of evaluating this variable's initializer as a compile-ti me constant
5332 * expression, or `null` if this variable is not a 'const' variable or does no t have an 5813 * expression, or `null` if this variable is not a 'const' variable or does no t have an
5333 * initializer. 5814 * initializer.
5334 * 5815 *
5335 * @return the result of evaluating this variable's initializer 5816 * @return the result of evaluating this variable's initializer
5336 */ 5817 */
5337 EvaluationResultImpl get evaluationResult => null; 5818 EvaluationResultImpl get evaluationResult => null;
5338 5819
5339 FunctionElement get initializer => _initializer; 5820 FunctionElement get initializer => _initializer;
5340 5821
5822 VariableDeclaration get node => getNode2(VariableDeclaration);
5823
5341 bool get isConst => hasModifier(Modifier.CONST); 5824 bool get isConst => hasModifier(Modifier.CONST);
5342 5825
5343 bool get isFinal => hasModifier(Modifier.FINAL); 5826 bool get isFinal => hasModifier(Modifier.FINAL);
5344 5827
5345 /** 5828 /**
5346 * Return `true` if this variable is potentially mutated somewhere in closure. This 5829 * Return `true` if this variable is potentially mutated somewhere in closure. This
5347 * information is only available for local variables (including parameters). 5830 * information is only available for local variables (including parameters).
5348 * 5831 *
5349 * @return `true` if this variable is potentially mutated somewhere in closure 5832 * @return `true` if this variable is potentially mutated somewhere in closure
5350 */ 5833 */
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
5450 * @param definingType the type in which the element is defined 5933 * @param definingType the type in which the element is defined
5451 */ 5934 */
5452 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType) : super(baseElement, definingType); 5935 ConstructorMember(ConstructorElement baseElement, InterfaceType definingType) : super(baseElement, definingType);
5453 5936
5454 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); 5937 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
5455 5938
5456 ConstructorElement get baseElement => super.baseElement as ConstructorElement; 5939 ConstructorElement get baseElement => super.baseElement as ConstructorElement;
5457 5940
5458 ClassElement get enclosingElement => baseElement.enclosingElement; 5941 ClassElement get enclosingElement => baseElement.enclosingElement;
5459 5942
5943 ConstructorDeclaration get node => baseElement.node;
5944
5460 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon structor, definingType); 5945 ConstructorElement get redirectedConstructor => from(baseElement.redirectedCon structor, definingType);
5461 5946
5462 bool get isConst => baseElement.isConst; 5947 bool get isConst => baseElement.isConst;
5463 5948
5464 bool get isDefaultConstructor => baseElement.isDefaultConstructor; 5949 bool get isDefaultConstructor => baseElement.isDefaultConstructor;
5465 5950
5466 bool get isFactory => baseElement.isFactory; 5951 bool get isFactory => baseElement.isFactory;
5467 5952
5468 String toString() { 5953 String toString() {
5469 ConstructorElement baseElement = this.baseElement; 5954 ConstructorElement baseElement = this.baseElement;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
5672 LibraryElement get library => _baseElement.library; 6157 LibraryElement get library => _baseElement.library;
5673 6158
5674 ElementLocation get location => _baseElement.location; 6159 ElementLocation get location => _baseElement.location;
5675 6160
5676 List<ElementAnnotation> get metadata => _baseElement.metadata; 6161 List<ElementAnnotation> get metadata => _baseElement.metadata;
5677 6162
5678 String get name => _baseElement.name; 6163 String get name => _baseElement.name;
5679 6164
5680 int get nameOffset => _baseElement.nameOffset; 6165 int get nameOffset => _baseElement.nameOffset;
5681 6166
6167 ASTNode get node => _baseElement.node;
6168
5682 Source get source => _baseElement.source; 6169 Source get source => _baseElement.source;
5683 6170
6171 CompilationUnit get unit => _baseElement.unit;
6172
5684 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib rary); 6173 bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(lib rary);
5685 6174
5686 bool get isDeprecated => _baseElement.isDeprecated; 6175 bool get isDeprecated => _baseElement.isDeprecated;
5687 6176
6177 bool get isPrivate => _baseElement.isPrivate;
6178
6179 bool get isPublic => _baseElement.isPublic;
6180
5688 bool get isSynthetic => _baseElement.isSynthetic; 6181 bool get isSynthetic => _baseElement.isSynthetic;
5689 6182
5690 void visitChildren(ElementVisitor visitor) { 6183 void visitChildren(ElementVisitor visitor) {
5691 } 6184 }
5692 6185
5693 /** 6186 /**
5694 * Return the type in which the element is defined. 6187 * Return the type in which the element is defined.
5695 * 6188 *
5696 * @return the type in which the element is defined 6189 * @return the type in which the element is defined
5697 */ 6190 */
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
5790 * @param definingType the type in which the element is defined 6283 * @param definingType the type in which the element is defined
5791 */ 6284 */
5792 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba seElement, definingType); 6285 MethodMember(MethodElement baseElement, InterfaceType definingType) : super(ba seElement, definingType);
5793 6286
5794 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); 6287 accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
5795 6288
5796 MethodElement get baseElement => super.baseElement as MethodElement; 6289 MethodElement get baseElement => super.baseElement as MethodElement;
5797 6290
5798 ClassElement get enclosingElement => baseElement.enclosingElement; 6291 ClassElement get enclosingElement => baseElement.enclosingElement;
5799 6292
6293 MethodDeclaration get node => baseElement.node;
6294
5800 bool get isAbstract => baseElement.isAbstract; 6295 bool get isAbstract => baseElement.isAbstract;
5801 6296
5802 String toString() { 6297 String toString() {
5803 MethodElement baseElement = this.baseElement; 6298 MethodElement baseElement = this.baseElement;
5804 List<ParameterElement> parameters = this.parameters; 6299 List<ParameterElement> parameters = this.parameters;
5805 FunctionType type = this.type; 6300 FunctionType type = this.type;
5806 JavaStringBuilder builder = new JavaStringBuilder(); 6301 JavaStringBuilder builder = new JavaStringBuilder();
5807 builder.append(baseElement.enclosingElement.displayName); 6302 builder.append(baseElement.enclosingElement.displayName);
5808 builder.append("."); 6303 builder.append(".");
5809 builder.append(baseElement.displayName); 6304 builder.append(baseElement.displayName);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
6049 * @param definingType the type in which the element is defined 6544 * @param definingType the type in which the element is defined
6050 */ 6545 */
6051 VariableMember(VariableElement baseElement, ParameterizedType definingType) : super(baseElement, definingType); 6546 VariableMember(VariableElement baseElement, ParameterizedType definingType) : super(baseElement, definingType);
6052 6547
6053 VariableElement get baseElement => super.baseElement as VariableElement; 6548 VariableElement get baseElement => super.baseElement as VariableElement;
6054 6549
6055 FunctionElement get initializer { 6550 FunctionElement get initializer {
6056 throw new UnsupportedOperationException(); 6551 throw new UnsupportedOperationException();
6057 } 6552 }
6058 6553
6554 VariableDeclaration get node => baseElement.node;
6555
6059 Type2 get type => substituteFor(baseElement.type); 6556 Type2 get type => substituteFor(baseElement.type);
6060 6557
6061 bool get isConst => baseElement.isConst; 6558 bool get isConst => baseElement.isConst;
6062 6559
6063 bool get isFinal => baseElement.isFinal; 6560 bool get isFinal => baseElement.isFinal;
6064 6561
6065 void visitChildren(ElementVisitor visitor) { 6562 void visitChildren(ElementVisitor visitor) {
6066 super.visitChildren(visitor); 6563 super.visitChildren(visitor);
6067 safelyVisitChild(baseElement.initializer, visitor); 6564 safelyVisitChild(baseElement.initializer, visitor);
6068 } 6565 }
(...skipping 25 matching lines...) Expand all
6094 bool operator ==(Object object) => identical(object, this); 6591 bool operator ==(Object object) => identical(object, this);
6095 6592
6096 int get hashCode => 0; 6593 int get hashCode => 0;
6097 6594
6098 bool get isBottom => true; 6595 bool get isBottom => true;
6099 6596
6100 bool isSupertypeOf(Type2 type) => false; 6597 bool isSupertypeOf(Type2 type) => false;
6101 6598
6102 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp es) => this; 6599 BottomTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTyp es) => this;
6103 6600
6601 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id entical(object, this);
6602
6104 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) => true; 6603 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) => true;
6105 6604
6106 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) => true; 6605 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) => true;
6107 } 6606 }
6108 6607
6109 /** 6608 /**
6110 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam ic`. 6609 * The unique instance of the class `DynamicTypeImpl` implements the type `dynam ic`.
6111 * 6610 *
6112 * @coverage dart.engine.type 6611 * @coverage dart.engine.type
6113 */ 6612 */
(...skipping 28 matching lines...) Expand all
6142 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { 6641 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
6143 int length = parameterTypes.length; 6642 int length = parameterTypes.length;
6144 for (int i = 0; i < length; i++) { 6643 for (int i = 0; i < length; i++) {
6145 if (parameterTypes[i] == this) { 6644 if (parameterTypes[i] == this) {
6146 return argumentTypes[i]; 6645 return argumentTypes[i];
6147 } 6646 }
6148 } 6647 }
6149 return this; 6648 return this;
6150 } 6649 }
6151 6650
6651 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id entical(object, this);
6652
6152 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) { 6653 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) {
6153 if (identical(this, type)) { 6654 if (identical(this, type)) {
6154 return true; 6655 return true;
6155 } 6656 }
6156 return withDynamic; 6657 return withDynamic;
6157 } 6658 }
6158 6659
6159 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) => true; 6660 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) => true;
6160 } 6661 }
6161 6662
6162 /** 6663 /**
6163 * Instances of the class `FunctionTypeImpl` defines the behavior common to obje cts 6664 * Instances of the class `FunctionTypeImpl` defines the behavior common to obje cts
6164 * representing the type of a function, method, constructor, getter, or setter. 6665 * representing the type of a function, method, constructor, getter, or setter.
6165 * 6666 *
6166 * @coverage dart.engine.type 6667 * @coverage dart.engine.type
6167 */ 6668 */
6168 class FunctionTypeImpl extends TypeImpl implements FunctionType { 6669 class FunctionTypeImpl extends TypeImpl implements FunctionType {
6169 /** 6670 /**
6170 * Return `true` if all of the name/type pairs in the first map are equal to t he 6671 * Return `true` if all of the name/type pairs in the first map are equal to t he
6171 * corresponding name/type pairs in the second map. The maps are expected to i terate over their 6672 * corresponding name/type pairs in the second map. The maps are expected to i terate over their
6172 * entries in the same order in which those entries were added to the map. 6673 * entries in the same order in which those entries were added to the map.
6173 * 6674 *
6174 * @param firstTypes the first map of name/type pairs being compared 6675 * @param firstTypes the first map of name/type pairs being compared
6175 * @param secondTypes the second map of name/type pairs being compared 6676 * @param secondTypes the second map of name/type pairs being compared
6677 * @param visitedElementPairs a set of visited element pairs
6176 * @return `true` if all of the name/type pairs in the first map are equal to the 6678 * @return `true` if all of the name/type pairs in the first map are equal to the
6177 * corresponding name/type pairs in the second map 6679 * corresponding name/type pairs in the second map
6178 */ 6680 */
6179 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy pes) { 6681 static bool equals2(Map<String, Type2> firstTypes, Map<String, Type2> secondTy pes, Set<ElementPair> visitedElementPairs) {
6180 if (secondTypes.length != firstTypes.length) { 6682 if (secondTypes.length != firstTypes.length) {
6181 return false; 6683 return false;
6182 } 6684 }
6183 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes)); 6685 JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMa pEntrySet(firstTypes));
6184 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(secondTypes)); 6686 JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getM apEntrySet(secondTypes));
6185 while (firstIterator.hasNext) { 6687 while (firstIterator.hasNext) {
6186 MapEntry<String, Type2> firstEntry = firstIterator.next(); 6688 MapEntry<String, Type2> firstEntry = firstIterator.next();
6187 MapEntry<String, Type2> secondEntry = secondIterator.next(); 6689 MapEntry<String, Type2> secondEntry = secondIterator.next();
6188 if (firstEntry.getKey() != secondEntry.getKey() || firstEntry.getValue() ! = secondEntry.getValue()) { 6690 if (firstEntry.getKey() != secondEntry.getKey() || !(firstEntry.getValue() as TypeImpl).internalEquals(secondEntry.getValue(), visitedElementPairs)) {
6189 return false; 6691 return false;
6190 } 6692 }
6191 } 6693 }
6192 return true; 6694 return true;
6193 } 6695 }
6194 6696
6195 /** 6697 /**
6196 * An array containing the actual types of the type arguments. 6698 * An array containing the actual types of the type arguments.
6197 */ 6699 */
6198 List<Type2> typeArguments = TypeImpl.EMPTY_ARRAY; 6700 List<Type2> typeArguments = TypeImpl.EMPTY_ARRAY;
6199 6701
6200 /** 6702 /**
6201 * Initialize a newly created function type to be declared by the given elemen t and to have the 6703 * Initialize a newly created function type to be declared by the given elemen t and to have the
6202 * given name. 6704 * given name.
6203 * 6705 *
6204 * @param element the element representing the declaration of the function typ e 6706 * @param element the element representing the declaration of the function typ e
6205 */ 6707 */
6206 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name); 6708 FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == n ull ? null : element.name);
6207 6709
6208 /** 6710 /**
6209 * Initialize a newly created function type to be declared by the given elemen t and to have the 6711 * Initialize a newly created function type to be declared by the given elemen t and to have the
6210 * given name. 6712 * given name.
6211 * 6713 *
6212 * @param element the element representing the declaration of the function typ e 6714 * @param element the element representing the declaration of the function typ e
6213 */ 6715 */
6214 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme nt == null ? null : element.name); 6716 FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, eleme nt == null ? null : element.name);
6215 6717
6216 bool operator ==(Object object) { 6718 bool operator ==(Object object) => internalEquals(object, new Set<ElementPair> ());
6217 if (object is! FunctionTypeImpl) {
6218 return false;
6219 }
6220 FunctionTypeImpl otherType = object as FunctionTypeImpl;
6221 return (element == otherType.element) && JavaArrays.equals(normalParameterTy pes, otherType.normalParameterTypes) && JavaArrays.equals(optionalParameterTypes , otherType.optionalParameterTypes) && equals2(namedParameterTypes, otherType.na medParameterTypes) && (returnType == otherType.returnType);
6222 }
6223 6719
6224 String get displayName { 6720 String get displayName {
6225 String name = this.name; 6721 String name = this.name;
6226 if (name == null || name.length == 0) { 6722 if (name == null || name.length == 0) {
6227 List<Type2> normalParameterTypes = this.normalParameterTypes; 6723 List<Type2> normalParameterTypes = this.normalParameterTypes;
6228 List<Type2> optionalParameterTypes = this.optionalParameterTypes; 6724 List<Type2> optionalParameterTypes = this.optionalParameterTypes;
6229 Map<String, Type2> namedParameterTypes = this.namedParameterTypes; 6725 Map<String, Type2> namedParameterTypes = this.namedParameterTypes;
6230 Type2 returnType = this.returnType; 6726 Type2 returnType = this.returnType;
6231 JavaStringBuilder builder = new JavaStringBuilder(); 6727 JavaStringBuilder builder = new JavaStringBuilder();
6232 builder.append("("); 6728 builder.append("(");
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
6361 return (element as FunctionTypeAliasElement).typeParameters; 6857 return (element as FunctionTypeAliasElement).typeParameters;
6362 } 6858 }
6363 ClassElement definingClass = element.getAncestor(ClassElement); 6859 ClassElement definingClass = element.getAncestor(ClassElement);
6364 if (definingClass != null) { 6860 if (definingClass != null) {
6365 return definingClass.typeParameters; 6861 return definingClass.typeParameters;
6366 } 6862 }
6367 return TypeParameterElementImpl.EMPTY_ARRAY; 6863 return TypeParameterElementImpl.EMPTY_ARRAY;
6368 } 6864 }
6369 6865
6370 int get hashCode { 6866 int get hashCode {
6371 Element element = this.element;
6372 if (element == null) { 6867 if (element == null) {
6373 return 0; 6868 return 0;
6374 } 6869 }
6375 return element.hashCode; 6870 List<Type2> normalParameterTypes = this.normalParameterTypes;
6871 List<Type2> optionalParameterTypes = this.optionalParameterTypes;
6872 Iterable<Type2> namedParameterTypes = this.namedParameterTypes.values;
6873 int hashCode = returnType.hashCode;
6874 for (int i = 0; i < normalParameterTypes.length; i++) {
6875 hashCode = (hashCode << 1) + normalParameterTypes[i].hashCode;
6876 }
6877 for (int i = 0; i < optionalParameterTypes.length; i++) {
6878 hashCode = (hashCode << 1) + optionalParameterTypes[i].hashCode;
6879 }
6880 for (Type2 type in namedParameterTypes) {
6881 hashCode = (hashCode << 1) + type.hashCode;
6882 }
6883 return hashCode;
6376 } 6884 }
6377 6885
6378 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) { 6886 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) {
6379 if (type == null) { 6887 if (type == null) {
6380 return false; 6888 return false;
6381 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio n || type.isObject) { 6889 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio n || type.isObject) {
6382 return true; 6890 return true;
6383 } else if (type is! FunctionType) { 6891 } else if (type is! FunctionType) {
6384 return false; 6892 return false;
6385 } else if (this == type) { 6893 } else if (this == type) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6545 */ 7053 */
6546 List<ParameterElement> get baseParameters { 7054 List<ParameterElement> get baseParameters {
6547 Element element = this.element; 7055 Element element = this.element;
6548 if (element is ExecutableElement) { 7056 if (element is ExecutableElement) {
6549 return (element as ExecutableElement).parameters; 7057 return (element as ExecutableElement).parameters;
6550 } else { 7058 } else {
6551 return (element as FunctionTypeAliasElement).parameters; 7059 return (element as FunctionTypeAliasElement).parameters;
6552 } 7060 }
6553 } 7061 }
6554 7062
7063 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) {
7064 if (object is! FunctionTypeImpl) {
7065 return false;
7066 }
7067 FunctionTypeImpl otherType = object as FunctionTypeImpl;
7068 ElementPair elementPair = new ElementPair(element, otherType.element);
7069 if (!visitedElementPairs.add(elementPair)) {
7070 return elementPair.firstElt == elementPair.secondElt;
7071 }
7072 bool result = TypeImpl.equalArrays(normalParameterTypes, otherType.normalPar ameterTypes, visitedElementPairs) && TypeImpl.equalArrays(optionalParameterTypes , otherType.optionalParameterTypes, visitedElementPairs) && equals2(namedParamet erTypes, otherType.namedParameterTypes, visitedElementPairs) && (returnType as T ypeImpl).internalEquals(otherType.returnType, visitedElementPairs);
7073 visitedElementPairs.remove(elementPair);
7074 return result;
7075 }
7076
6555 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) { 7077 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) {
6556 if (type == null) { 7078 if (type == null) {
6557 return false; 7079 return false;
6558 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio n || type.isObject) { 7080 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio n || type.isObject) {
6559 return true; 7081 return true;
6560 } else if (type is! FunctionType) { 7082 } else if (type is! FunctionType) {
6561 return false; 7083 return false;
6562 } else if (this == type) { 7084 } else if (this == type) {
6563 return true; 7085 return true;
6564 } 7086 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
6830 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN ame); 7352 InterfaceTypeImpl.con1(ClassElement element) : super(element, element.displayN ame);
6831 7353
6832 /** 7354 /**
6833 * Initialize a newly created type to have the given name. This constructor sh ould only be used in 7355 * Initialize a newly created type to have the given name. This constructor sh ould only be used in
6834 * cases where there is no declaration of the type. 7356 * cases where there is no declaration of the type.
6835 * 7357 *
6836 * @param name the name of the type 7358 * @param name the name of the type
6837 */ 7359 */
6838 InterfaceTypeImpl.con2(String name) : super(null, name); 7360 InterfaceTypeImpl.con2(String name) : super(null, name);
6839 7361
6840 bool operator ==(Object object) { 7362 bool operator ==(Object object) => internalEquals(object, new Set<ElementPair> ());
6841 if (object is! InterfaceTypeImpl) {
6842 return false;
6843 }
6844 InterfaceTypeImpl otherType = object as InterfaceTypeImpl;
6845 return (element == otherType.element) && JavaArrays.equals(typeArguments, ot herType.typeArguments);
6846 }
6847 7363
6848 List<PropertyAccessorElement> get accessors { 7364 List<PropertyAccessorElement> get accessors {
6849 List<PropertyAccessorElement> accessors = element.accessors; 7365 List<PropertyAccessorElement> accessors = element.accessors;
6850 List<PropertyAccessorElement> members = new List<PropertyAccessorElement>(ac cessors.length); 7366 List<PropertyAccessorElement> members = new List<PropertyAccessorElement>(ac cessors.length);
6851 for (int i = 0; i < accessors.length; i++) { 7367 for (int i = 0; i < accessors.length; i++) {
6852 members[i] = PropertyAccessorMember.from(accessors[i], this); 7368 members[i] = PropertyAccessorMember.from(accessors[i], this);
6853 } 7369 }
6854 return members; 7370 return members;
6855 } 7371 }
6856 7372
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
7177 for (int i = 0; i < argumentCount; i++) { 7693 for (int i = 0; i < argumentCount; i++) {
7178 if (i > 0) { 7694 if (i > 0) {
7179 builder.append(", "); 7695 builder.append(", ");
7180 } 7696 }
7181 (typeArguments[i] as TypeImpl).appendTo(builder); 7697 (typeArguments[i] as TypeImpl).appendTo(builder);
7182 } 7698 }
7183 builder.append(">"); 7699 builder.append(">");
7184 } 7700 }
7185 } 7701 }
7186 7702
7703 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) {
7704 if (object is! InterfaceTypeImpl) {
7705 return false;
7706 }
7707 InterfaceTypeImpl otherType = object as InterfaceTypeImpl;
7708 return (element == otherType.element) && TypeImpl.equalArrays(typeArguments, otherType.typeArguments, visitedElementPairs);
7709 }
7710
7187 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) { 7711 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) {
7188 if (identical(type, DynamicTypeImpl.instance)) { 7712 if (identical(type, DynamicTypeImpl.instance)) {
7189 return true; 7713 return true;
7190 } else if (type is! InterfaceType) { 7714 } else if (type is! InterfaceType) {
7191 return false; 7715 return false;
7192 } 7716 }
7193 return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>(), w ithDynamic, visitedTypePairs); 7717 return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>(), w ithDynamic, visitedTypePairs);
7194 } 7718 }
7195 7719
7196 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) { 7720 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
7302 } 7826 }
7303 } 7827 }
7304 7828
7305 /** 7829 /**
7306 * The abstract class `TypeImpl` implements the behavior common to objects repre senting the 7830 * The abstract class `TypeImpl` implements the behavior common to objects repre senting the
7307 * declared type of elements in the element model. 7831 * declared type of elements in the element model.
7308 * 7832 *
7309 * @coverage dart.engine.type 7833 * @coverage dart.engine.type
7310 */ 7834 */
7311 abstract class TypeImpl implements Type2 { 7835 abstract class TypeImpl implements Type2 {
7836 static bool equalArrays(List<Type2> typeArgs1, List<Type2> typeArgs2, Set<Elem entPair> visitedElementPairs) {
7837 if (typeArgs1.length != typeArgs2.length) {
7838 return false;
7839 }
7840 for (int i = 0; i < typeArgs1.length; i++) {
7841 if (!(typeArgs1[i] as TypeImpl).internalEquals(typeArgs2[i], visitedElemen tPairs)) {
7842 return false;
7843 }
7844 }
7845 return true;
7846 }
7847
7312 /** 7848 /**
7313 * Return an array containing the results of using the given argument types an d parameter types to 7849 * Return an array containing the results of using the given argument types an d parameter types to
7314 * perform a substitution on all of the given types. 7850 * perform a substitution on all of the given types.
7315 * 7851 *
7316 * @param types the types on which a substitution is to be performed 7852 * @param types the types on which a substitution is to be performed
7317 * @param argumentTypes the argument types for the substitution 7853 * @param argumentTypes the argument types for the substitution
7318 * @param parameterTypes the parameter types for the substitution 7854 * @param parameterTypes the parameter types for the substitution
7319 * @return the result of performing the substitution on each of the types 7855 * @return the result of performing the substitution on each of the types
7320 */ 7856 */
7321 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li st<Type2> parameterTypes) { 7857 static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, Li st<Type2> parameterTypes) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
7450 * @param builder the builder to which the text is to be appended 7986 * @param builder the builder to which the text is to be appended
7451 */ 7987 */
7452 void appendTo(JavaStringBuilder builder) { 7988 void appendTo(JavaStringBuilder builder) {
7453 if (name == null) { 7989 if (name == null) {
7454 builder.append("<unnamed type>"); 7990 builder.append("<unnamed type>");
7455 } else { 7991 } else {
7456 builder.append(name); 7992 builder.append(name);
7457 } 7993 }
7458 } 7994 }
7459 7995
7996 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs);
7997
7460 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs); 7998 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs);
7461 7999
7462 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs); 8000 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs);
7463 } 8001 }
7464 8002
7465 class TypeImpl_TypePair { 8003 class TypeImpl_TypePair {
7466 Type2 _firstType; 8004 Type2 _firstType;
7467 8005
7468 Type2 _secondType; 8006 Type2 _secondType;
7469 8007
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
7545 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { 8083 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
7546 int length = parameterTypes.length; 8084 int length = parameterTypes.length;
7547 for (int i = 0; i < length; i++) { 8085 for (int i = 0; i < length; i++) {
7548 if (parameterTypes[i] == this) { 8086 if (parameterTypes[i] == this) {
7549 return argumentTypes[i]; 8087 return argumentTypes[i];
7550 } 8088 }
7551 } 8089 }
7552 return this; 8090 return this;
7553 } 8091 }
7554 8092
8093 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => th is == object;
8094
7555 bool internalIsMoreSpecificThan(Type2 s, bool withDynamic, Set<TypeImpl_TypePa ir> visitedTypePairs) { 8095 bool internalIsMoreSpecificThan(Type2 s, bool withDynamic, Set<TypeImpl_TypePa ir> visitedTypePairs) {
7556 if (this == s) { 8096 if (this == s) {
7557 return true; 8097 return true;
7558 } 8098 }
7559 if (s.isBottom) { 8099 if (s.isBottom) {
7560 return true; 8100 return true;
7561 } 8101 }
7562 if (s.isDynamic) { 8102 if (s.isDynamic) {
7563 return true; 8103 return true;
7564 } 8104 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7614 VoidTypeImpl() : super(null, Keyword.VOID.syntax); 8154 VoidTypeImpl() : super(null, Keyword.VOID.syntax);
7615 8155
7616 bool operator ==(Object object) => identical(object, this); 8156 bool operator ==(Object object) => identical(object, this);
7617 8157
7618 int get hashCode => 2; 8158 int get hashCode => 2;
7619 8159
7620 bool get isVoid => true; 8160 bool get isVoid => true;
7621 8161
7622 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this; 8162 VoidTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes ) => this;
7623 8163
8164 bool internalEquals(Object object, Set<ElementPair> visitedElementPairs) => id entical(object, this);
8165
7624 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) => isSubtypeOf(type); 8166 bool internalIsMoreSpecificThan(Type2 type, bool withDynamic, Set<TypeImpl_Typ ePair> visitedTypePairs) => isSubtypeOf(type);
7625 8167
7626 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) => identical(type, this) || identical(type, DynamicTypeImpl.instance); 8168 bool internalIsSubtypeOf(Type2 type, Set<TypeImpl_TypePair> visitedTypePairs) => identical(type, this) || identical(type, DynamicTypeImpl.instance);
7627 } 8169 }
7628 8170
7629 /** 8171 /**
7630 * The interface `FunctionType` defines the behavior common to objects represent ing the type 8172 * The interface `FunctionType` defines the behavior common to objects represent ing the type
7631 * of a function, method, constructor, getter, or setter. Function types come in three variations: 8173 * of a function, method, constructor, getter, or setter. Function types come in three variations:
7632 * <ol> 8174 * <ol>
7633 * * The types of functions that only have required parameters. These have the g eneral form 8175 * * The types of functions that only have required parameters. These have the g eneral form
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
8235 8777
8236 /** 8778 /**
8237 * The interface `VoidType` defines the behavior of the unique object representi ng the type 8779 * The interface `VoidType` defines the behavior of the unique object representi ng the type
8238 * `void`. 8780 * `void`.
8239 * 8781 *
8240 * @coverage dart.engine.type 8782 * @coverage dart.engine.type
8241 */ 8783 */
8242 abstract class VoidType implements Type2 { 8784 abstract class VoidType implements Type2 {
8243 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); 8785 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
8244 } 8786 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698