Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 921 /** | 921 /** |
| 922 * The source of the library containing this compilation unit. | 922 * The source of the library containing this compilation unit. |
| 923 * | 923 * |
| 924 * This is the same as the source of the containing [LibraryElement], | 924 * This is the same as the source of the containing [LibraryElement], |
| 925 * except that it does not require the containing [LibraryElement] to be | 925 * except that it does not require the containing [LibraryElement] to be |
| 926 * computed. | 926 * computed. |
| 927 */ | 927 */ |
| 928 Source librarySource; | 928 Source librarySource; |
| 929 | 929 |
| 930 /** | 930 /** |
| 931 * A table mapping the offset of a directive to the annotations associated | |
| 932 * with that directive, or `null` if none of the annotations in the | |
| 933 * compilation unit have annotations. | |
| 934 */ | |
| 935 Map<int, List<ElementAnnotation>> annotationMap = null; | |
| 936 | |
| 937 /** | |
| 931 * A list containing all of the top-level accessors (getters and setters) | 938 * A list containing all of the top-level accessors (getters and setters) |
| 932 * contained in this compilation unit. | 939 * contained in this compilation unit. |
| 933 */ | 940 */ |
| 934 List<PropertyAccessorElement> _accessors = PropertyAccessorElement.EMPTY_LIST; | 941 List<PropertyAccessorElement> _accessors = PropertyAccessorElement.EMPTY_LIST; |
| 935 | 942 |
| 936 /** | 943 /** |
| 937 * A list containing all of the enums contained in this compilation unit. | 944 * A list containing all of the enums contained in this compilation unit. |
| 938 */ | 945 */ |
| 939 List<ClassElement> _enums = ClassElement.EMPTY_LIST; | 946 List<ClassElement> _enums = ClassElement.EMPTY_LIST; |
| 940 | 947 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1096 if (source == null) { | 1103 if (source == null) { |
| 1097 buffer.write("{compilation unit}"); | 1104 buffer.write("{compilation unit}"); |
| 1098 } else { | 1105 } else { |
| 1099 buffer.write(source.fullName); | 1106 buffer.write(source.fullName); |
| 1100 } | 1107 } |
| 1101 } | 1108 } |
| 1102 | 1109 |
| 1103 @override | 1110 @override |
| 1104 CompilationUnit computeNode() => unit; | 1111 CompilationUnit computeNode() => unit; |
| 1105 | 1112 |
| 1113 /** | |
| 1114 * Return the annotations associated with the directive at the given [offset], | |
| 1115 * or an empty list if the directive has no annotations or if there is no | |
| 1116 * directive at the given offset. | |
| 1117 */ | |
| 1118 List<ElementAnnotation> getAnnotations(int offset) { | |
| 1119 if (annotationMap == null) { | |
| 1120 return ElementAnnotation.EMPTY_LIST; | |
| 1121 } | |
| 1122 return annotationMap[offset] ?? ElementAnnotation.EMPTY_LIST; | |
| 1123 } | |
| 1124 | |
| 1106 @override | 1125 @override |
| 1107 ElementImpl getChild(String identifier) { | 1126 ElementImpl getChild(String identifier) { |
| 1108 // | 1127 // |
| 1109 // The casts in this method are safe because the set methods would have | 1128 // The casts in this method are safe because the set methods would have |
| 1110 // thrown a CCE if any of the elements in the arrays were not of the | 1129 // thrown a CCE if any of the elements in the arrays were not of the |
| 1111 // expected types. | 1130 // expected types. |
| 1112 // | 1131 // |
| 1113 for (PropertyAccessorElement accessor in _accessors) { | 1132 for (PropertyAccessorElement accessor in _accessors) { |
| 1114 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { | 1133 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { |
| 1115 return accessor as PropertyAccessorElementImpl; | 1134 return accessor as PropertyAccessorElementImpl; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1174 | 1193 |
| 1175 /** | 1194 /** |
| 1176 * Replace the given [from] top-level variable with [to] in this compilation u nit. | 1195 * Replace the given [from] top-level variable with [to] in this compilation u nit. |
| 1177 */ | 1196 */ |
| 1178 void replaceTopLevelVariable( | 1197 void replaceTopLevelVariable( |
| 1179 TopLevelVariableElement from, TopLevelVariableElement to) { | 1198 TopLevelVariableElement from, TopLevelVariableElement to) { |
| 1180 int index = _variables.indexOf(from); | 1199 int index = _variables.indexOf(from); |
| 1181 _variables[index] = to; | 1200 _variables[index] = to; |
| 1182 } | 1201 } |
| 1183 | 1202 |
| 1203 /** | |
| 1204 * Set the annotations associated with the directive at the given [offset] to | |
| 1205 * the given list of [annotations]. | |
| 1206 */ | |
| 1207 void setAnnotations(int offset, List<ElementAnnotation> annotations) { | |
| 1208 if (annotationMap == null) { | |
|
Paul Berry
2016/03/04 22:02:11
Nit: this seems like a premature optimization (the
Brian Wilkerson
2016/03/07 16:20:28
I have almost 3000 CompilationUnitElements in my e
| |
| 1209 annotationMap = new HashMap<int, List<ElementAnnotation>>(); | |
|
scheglov
2016/03/04 21:49:30
annotationMap ??= new HashMap<int, List<ElementAnn
Brian Wilkerson
2016/03/07 16:20:28
Done
| |
| 1210 } | |
| 1211 annotationMap[offset] = annotations; | |
| 1212 } | |
| 1213 | |
| 1184 @override | 1214 @override |
| 1185 void visitChildren(ElementVisitor visitor) { | 1215 void visitChildren(ElementVisitor visitor) { |
| 1186 super.visitChildren(visitor); | 1216 super.visitChildren(visitor); |
| 1187 safelyVisitChildren(_accessors, visitor); | 1217 safelyVisitChildren(_accessors, visitor); |
| 1188 safelyVisitChildren(_enums, visitor); | 1218 safelyVisitChildren(_enums, visitor); |
| 1189 safelyVisitChildren(_functions, visitor); | 1219 safelyVisitChildren(_functions, visitor); |
| 1190 safelyVisitChildren(_typeAliases, visitor); | 1220 safelyVisitChildren(_typeAliases, visitor); |
| 1191 safelyVisitChildren(_types, visitor); | 1221 safelyVisitChildren(_types, visitor); |
| 1192 safelyVisitChildren(_variables, visitor); | 1222 safelyVisitChildren(_variables, visitor); |
| 1193 } | 1223 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1267 } | 1297 } |
| 1268 | 1298 |
| 1269 /** | 1299 /** |
| 1270 * A concrete implementation of a [ConstructorElement]. | 1300 * A concrete implementation of a [ConstructorElement]. |
| 1271 */ | 1301 */ |
| 1272 class ConstructorElementImpl extends ExecutableElementImpl | 1302 class ConstructorElementImpl extends ExecutableElementImpl |
| 1273 implements ConstructorElement { | 1303 implements ConstructorElement { |
| 1274 /** | 1304 /** |
| 1275 * The constructor to which this constructor is redirecting. | 1305 * The constructor to which this constructor is redirecting. |
| 1276 */ | 1306 */ |
| 1307 @override | |
|
Paul Berry
2016/03/04 22:02:11
Normally I am ok with rolling this sort of clean-u
Brian Wilkerson
2016/03/07 16:20:28
Not sure it didn't take more time to remove them,
| |
| 1277 ConstructorElement redirectedConstructor; | 1308 ConstructorElement redirectedConstructor; |
| 1278 | 1309 |
| 1279 /** | 1310 /** |
| 1280 * The initializers for this constructor (used for evaluating constant | 1311 * The initializers for this constructor (used for evaluating constant |
| 1281 * instance creation expressions). | 1312 * instance creation expressions). |
| 1282 */ | 1313 */ |
| 1283 List<ConstructorInitializer> constantInitializers; | 1314 List<ConstructorInitializer> constantInitializers; |
| 1284 | 1315 |
| 1285 /** | 1316 /** |
| 1286 * The offset of the `.` before this constructor name or `null` if not named. | 1317 * The offset of the `.` before this constructor name or `null` if not named. |
| 1287 */ | 1318 */ |
| 1319 @override | |
| 1288 int periodOffset; | 1320 int periodOffset; |
| 1289 | 1321 |
| 1290 /** | 1322 /** |
| 1291 * Return the offset of the character immediately following the last character | 1323 * Return the offset of the character immediately following the last character |
| 1292 * of this constructor's name, or `null` if not named. | 1324 * of this constructor's name, or `null` if not named. |
| 1293 */ | 1325 */ |
| 1326 @override | |
| 1294 int nameEnd; | 1327 int nameEnd; |
| 1295 | 1328 |
| 1296 /** | 1329 /** |
| 1297 * True if this constructor has been found by constant evaluation to be free | 1330 * True if this constructor has been found by constant evaluation to be free |
| 1298 * of redirect cycles, and is thus safe to evaluate. | 1331 * of redirect cycles, and is thus safe to evaluate. |
| 1299 */ | 1332 */ |
| 1300 bool isCycleFree = false; | 1333 bool isCycleFree = false; |
| 1301 | 1334 |
| 1302 /** | 1335 /** |
| 1303 * Initialize a newly created constructor element to have the given [name] and | 1336 * Initialize a newly created constructor element to have the given [name] and |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1587 /** | 1620 /** |
| 1588 * The name of the top-level variable used to mark a class as implementing a | 1621 * The name of the top-level variable used to mark a class as implementing a |
| 1589 * proxy object. | 1622 * proxy object. |
| 1590 */ | 1623 */ |
| 1591 static String PROXY_VARIABLE_NAME = "proxy"; | 1624 static String PROXY_VARIABLE_NAME = "proxy"; |
| 1592 | 1625 |
| 1593 /** | 1626 /** |
| 1594 * The element representing the field, variable, or constructor being used as | 1627 * The element representing the field, variable, or constructor being used as |
| 1595 * an annotation. | 1628 * an annotation. |
| 1596 */ | 1629 */ |
| 1630 @override | |
| 1597 Element element; | 1631 Element element; |
| 1598 | 1632 |
| 1599 /** | 1633 /** |
| 1600 * The compilation unit in which this annotation appears. | 1634 * The compilation unit in which this annotation appears. |
| 1601 */ | 1635 */ |
| 1602 final CompilationUnitElementImpl compilationUnit; | 1636 final CompilationUnitElementImpl compilationUnit; |
| 1603 | 1637 |
| 1604 /** | 1638 /** |
| 1605 * The AST of the annotation itself, cloned from the resolved AST for the | 1639 * The AST of the annotation itself, cloned from the resolved AST for the |
| 1606 * source code. | 1640 * source code. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1672 * A base class for concrete implementations of an [Element]. | 1706 * A base class for concrete implementations of an [Element]. |
| 1673 */ | 1707 */ |
| 1674 abstract class ElementImpl implements Element { | 1708 abstract class ElementImpl implements Element { |
| 1675 /** | 1709 /** |
| 1676 * An Unicode right arrow. | 1710 * An Unicode right arrow. |
| 1677 */ | 1711 */ |
| 1678 static final String RIGHT_ARROW = " \u2192 "; | 1712 static final String RIGHT_ARROW = " \u2192 "; |
| 1679 | 1713 |
| 1680 static int _NEXT_ID = 0; | 1714 static int _NEXT_ID = 0; |
| 1681 | 1715 |
| 1716 @override | |
| 1682 final int id = _NEXT_ID++; | 1717 final int id = _NEXT_ID++; |
| 1683 | 1718 |
| 1684 /** | 1719 /** |
| 1685 * The enclosing element of this element, or `null` if this element is at the | 1720 * The enclosing element of this element, or `null` if this element is at the |
| 1686 * root of the element structure. | 1721 * root of the element structure. |
| 1687 */ | 1722 */ |
| 1688 ElementImpl _enclosingElement; | 1723 ElementImpl _enclosingElement; |
| 1689 | 1724 |
| 1690 /** | 1725 /** |
| 1691 * The name of this element. | 1726 * The name of this element. |
| 1692 */ | 1727 */ |
| 1693 String _name; | 1728 String _name; |
| 1694 | 1729 |
| 1695 /** | 1730 /** |
| 1696 * The offset of the name of this element in the file that contains the | 1731 * The offset of the name of this element in the file that contains the |
| 1697 * declaration of this element. | 1732 * declaration of this element. |
| 1698 */ | 1733 */ |
| 1699 int _nameOffset = 0; | 1734 int _nameOffset = 0; |
| 1700 | 1735 |
| 1701 /** | 1736 /** |
| 1702 * A bit-encoded form of the modifiers associated with this element. | 1737 * A bit-encoded form of the modifiers associated with this element. |
| 1703 */ | 1738 */ |
| 1704 int _modifiers = 0; | 1739 int _modifiers = 0; |
| 1705 | 1740 |
| 1706 /** | 1741 /** |
| 1707 * A list containing all of the metadata associated with this element. | 1742 * A list containing all of the metadata associated with this element. |
| 1708 */ | 1743 */ |
| 1744 @override | |
| 1709 List<ElementAnnotation> metadata = ElementAnnotation.EMPTY_LIST; | 1745 List<ElementAnnotation> metadata = ElementAnnotation.EMPTY_LIST; |
| 1710 | 1746 |
| 1711 /** | 1747 /** |
| 1712 * A cached copy of the calculated hashCode for this element. | 1748 * A cached copy of the calculated hashCode for this element. |
| 1713 */ | 1749 */ |
| 1714 int _cachedHashCode; | 1750 int _cachedHashCode; |
| 1715 | 1751 |
| 1716 /** | 1752 /** |
| 1717 * A cached copy of the calculated location for this element. | 1753 * A cached copy of the calculated location for this element. |
| 1718 */ | 1754 */ |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2296 | 2332 |
| 2297 /** | 2333 /** |
| 2298 * A list containing all of the type parameters defined for this executable | 2334 * A list containing all of the type parameters defined for this executable |
| 2299 * element. | 2335 * element. |
| 2300 */ | 2336 */ |
| 2301 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; | 2337 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; |
| 2302 | 2338 |
| 2303 /** | 2339 /** |
| 2304 * The return type defined by this executable element. | 2340 * The return type defined by this executable element. |
| 2305 */ | 2341 */ |
| 2342 @override | |
| 2306 DartType returnType; | 2343 DartType returnType; |
| 2307 | 2344 |
| 2308 /** | 2345 /** |
| 2309 * The type of function defined by this executable element. | 2346 * The type of function defined by this executable element. |
| 2310 */ | 2347 */ |
| 2348 @override | |
| 2311 FunctionType type; | 2349 FunctionType type; |
| 2312 | 2350 |
| 2313 /** | 2351 /** |
| 2314 * Initialize a newly created executable element to have the given [name] and | 2352 * Initialize a newly created executable element to have the given [name] and |
| 2315 * [offset]. | 2353 * [offset]. |
| 2316 */ | 2354 */ |
| 2317 ExecutableElementImpl(String name, int offset) : super(name, offset); | 2355 ExecutableElementImpl(String name, int offset) : super(name, offset); |
| 2318 | 2356 |
| 2319 /** | 2357 /** |
| 2320 * Initialize a newly created executable element to have the given [name]. | 2358 * Initialize a newly created executable element to have the given [name]. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2528 } | 2566 } |
| 2529 | 2567 |
| 2530 /** | 2568 /** |
| 2531 * A concrete implementation of an [ExportElement]. | 2569 * A concrete implementation of an [ExportElement]. |
| 2532 */ | 2570 */ |
| 2533 class ExportElementImpl extends UriReferencedElementImpl | 2571 class ExportElementImpl extends UriReferencedElementImpl |
| 2534 implements ExportElement { | 2572 implements ExportElement { |
| 2535 /** | 2573 /** |
| 2536 * The library that is exported from this library by this export directive. | 2574 * The library that is exported from this library by this export directive. |
| 2537 */ | 2575 */ |
| 2576 @override | |
| 2538 LibraryElement exportedLibrary; | 2577 LibraryElement exportedLibrary; |
| 2539 | 2578 |
| 2540 /** | 2579 /** |
| 2541 * The combinators that were specified as part of the export directive in the | 2580 * The combinators that were specified as part of the export directive in the |
| 2542 * order in which they were specified. | 2581 * order in which they were specified. |
| 2543 */ | 2582 */ |
| 2583 @override | |
| 2544 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST; | 2584 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST; |
| 2545 | 2585 |
| 2546 /** | 2586 /** |
| 2547 * Initialize a newly created export element at the given [offset]. | 2587 * Initialize a newly created export element at the given [offset]. |
| 2548 */ | 2588 */ |
| 2549 ExportElementImpl(int offset) : super(null, offset); | 2589 ExportElementImpl(int offset) : super(null, offset); |
| 2550 | 2590 |
| 2551 @override | 2591 @override |
| 2552 String get identifier => exportedLibrary.name; | 2592 String get identifier => exportedLibrary.name; |
| 2553 | 2593 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2612 | 2652 |
| 2613 /** | 2653 /** |
| 2614 * A [ParameterElementImpl] that has the additional information of the | 2654 * A [ParameterElementImpl] that has the additional information of the |
| 2615 * [FieldElement] associated with the parameter. | 2655 * [FieldElement] associated with the parameter. |
| 2616 */ | 2656 */ |
| 2617 class FieldFormalParameterElementImpl extends ParameterElementImpl | 2657 class FieldFormalParameterElementImpl extends ParameterElementImpl |
| 2618 implements FieldFormalParameterElement { | 2658 implements FieldFormalParameterElement { |
| 2619 /** | 2659 /** |
| 2620 * The field associated with this field formal parameter. | 2660 * The field associated with this field formal parameter. |
| 2621 */ | 2661 */ |
| 2662 @override | |
| 2622 FieldElement field; | 2663 FieldElement field; |
| 2623 | 2664 |
| 2624 /** | 2665 /** |
| 2625 * Initialize a newly created parameter element to have the given [name] and | 2666 * Initialize a newly created parameter element to have the given [name] and |
| 2626 * [nameOffset]. | 2667 * [nameOffset]. |
| 2627 */ | 2668 */ |
| 2628 FieldFormalParameterElementImpl(String name, int nameOffset) | 2669 FieldFormalParameterElementImpl(String name, int nameOffset) |
| 2629 : super(name, nameOffset); | 2670 : super(name, nameOffset); |
| 2630 | 2671 |
| 2631 /** | 2672 /** |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2766 class FunctionTypeAliasElementImpl extends ElementImpl | 2807 class FunctionTypeAliasElementImpl extends ElementImpl |
| 2767 implements FunctionTypeAliasElement { | 2808 implements FunctionTypeAliasElement { |
| 2768 /** | 2809 /** |
| 2769 * A list containing all of the parameters defined by this type alias. | 2810 * A list containing all of the parameters defined by this type alias. |
| 2770 */ | 2811 */ |
| 2771 List<ParameterElement> _parameters = ParameterElement.EMPTY_LIST; | 2812 List<ParameterElement> _parameters = ParameterElement.EMPTY_LIST; |
| 2772 | 2813 |
| 2773 /** | 2814 /** |
| 2774 * The return type defined by this type alias. | 2815 * The return type defined by this type alias. |
| 2775 */ | 2816 */ |
| 2817 @override | |
| 2776 DartType returnType; | 2818 DartType returnType; |
| 2777 | 2819 |
| 2778 /** | 2820 /** |
| 2779 * The type of function defined by this type alias. | 2821 * The type of function defined by this type alias. |
| 2780 */ | 2822 */ |
| 2823 @override | |
| 2781 FunctionType type; | 2824 FunctionType type; |
| 2782 | 2825 |
| 2783 /** | 2826 /** |
| 2784 * A list containing all of the type parameters defined for this type. | 2827 * A list containing all of the type parameters defined for this type. |
| 2785 */ | 2828 */ |
| 2786 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; | 2829 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; |
| 2787 | 2830 |
| 2788 /** | 2831 /** |
| 2789 * Initialize a newly created type alias element to have the given name. | 2832 * Initialize a newly created type alias element to have the given name. |
| 2790 * | 2833 * |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2901 } | 2944 } |
| 2902 | 2945 |
| 2903 /** | 2946 /** |
| 2904 * A concrete implementation of a [HideElementCombinator]. | 2947 * A concrete implementation of a [HideElementCombinator]. |
| 2905 */ | 2948 */ |
| 2906 class HideElementCombinatorImpl implements HideElementCombinator { | 2949 class HideElementCombinatorImpl implements HideElementCombinator { |
| 2907 /** | 2950 /** |
| 2908 * The names that are not to be made visible in the importing library even if | 2951 * The names that are not to be made visible in the importing library even if |
| 2909 * they are defined in the imported library. | 2952 * they are defined in the imported library. |
| 2910 */ | 2953 */ |
| 2954 @override | |
| 2911 List<String> hiddenNames = StringUtilities.EMPTY_ARRAY; | 2955 List<String> hiddenNames = StringUtilities.EMPTY_ARRAY; |
| 2912 | 2956 |
| 2913 @override | 2957 @override |
| 2914 String toString() { | 2958 String toString() { |
| 2915 StringBuffer buffer = new StringBuffer(); | 2959 StringBuffer buffer = new StringBuffer(); |
| 2916 buffer.write("show "); | 2960 buffer.write("show "); |
| 2917 int count = hiddenNames.length; | 2961 int count = hiddenNames.length; |
| 2918 for (int i = 0; i < count; i++) { | 2962 for (int i = 0; i < count; i++) { |
| 2919 if (i > 0) { | 2963 if (i > 0) { |
| 2920 buffer.write(", "); | 2964 buffer.write(", "); |
| 2921 } | 2965 } |
| 2922 buffer.write(hiddenNames[i]); | 2966 buffer.write(hiddenNames[i]); |
| 2923 } | 2967 } |
| 2924 return buffer.toString(); | 2968 return buffer.toString(); |
| 2925 } | 2969 } |
| 2926 } | 2970 } |
| 2927 | 2971 |
| 2928 /** | 2972 /** |
| 2929 * A concrete implementation of an [ImportElement]. | 2973 * A concrete implementation of an [ImportElement]. |
| 2930 */ | 2974 */ |
| 2931 class ImportElementImpl extends UriReferencedElementImpl | 2975 class ImportElementImpl extends UriReferencedElementImpl |
| 2932 implements ImportElement { | 2976 implements ImportElement { |
| 2933 /** | 2977 /** |
| 2934 * The offset of the prefix of this import in the file that contains the this | 2978 * The offset of the prefix of this import in the file that contains the this |
| 2935 * import directive, or `-1` if this import is synthetic. | 2979 * import directive, or `-1` if this import is synthetic. |
| 2936 */ | 2980 */ |
| 2981 @override | |
| 2937 int prefixOffset = 0; | 2982 int prefixOffset = 0; |
| 2938 | 2983 |
| 2939 /** | 2984 /** |
| 2940 * The library that is imported into this library by this import directive. | 2985 * The library that is imported into this library by this import directive. |
| 2941 */ | 2986 */ |
| 2987 @override | |
| 2942 LibraryElement importedLibrary; | 2988 LibraryElement importedLibrary; |
| 2943 | 2989 |
| 2944 /** | 2990 /** |
| 2945 * The combinators that were specified as part of the import directive in the | 2991 * The combinators that were specified as part of the import directive in the |
| 2946 * order in which they were specified. | 2992 * order in which they were specified. |
| 2947 */ | 2993 */ |
| 2994 @override | |
| 2948 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST; | 2995 List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST; |
| 2949 | 2996 |
| 2950 /** | 2997 /** |
| 2951 * The prefix that was specified as part of the import directive, or `null` if | 2998 * The prefix that was specified as part of the import directive, or `null` if |
| 2952 * there was no prefix specified. | 2999 * there was no prefix specified. |
| 2953 */ | 3000 */ |
| 3001 @override | |
| 2954 PrefixElement prefix; | 3002 PrefixElement prefix; |
| 2955 | 3003 |
| 2956 /** | 3004 /** |
| 2957 * Initialize a newly created import element at the given [offset]. | 3005 * Initialize a newly created import element at the given [offset]. |
| 2958 * The offset may be `-1` if the import is synthetic. | 3006 * The offset may be `-1` if the import is synthetic. |
| 2959 */ | 3007 */ |
| 2960 ImportElementImpl(int offset) : super(null, offset); | 3008 ImportElementImpl(int offset) : super(null, offset); |
| 2961 | 3009 |
| 2962 /** | 3010 /** |
| 2963 * Set whether this import is for a deferred library. | 3011 * Set whether this import is for a deferred library. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3051 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); | 3099 accept(ElementVisitor visitor) => visitor.visitLabelElement(this); |
| 3052 } | 3100 } |
| 3053 | 3101 |
| 3054 /** | 3102 /** |
| 3055 * A concrete implementation of a [LibraryElement]. | 3103 * A concrete implementation of a [LibraryElement]. |
| 3056 */ | 3104 */ |
| 3057 class LibraryElementImpl extends ElementImpl implements LibraryElement { | 3105 class LibraryElementImpl extends ElementImpl implements LibraryElement { |
| 3058 /** | 3106 /** |
| 3059 * The analysis context in which this library is defined. | 3107 * The analysis context in which this library is defined. |
| 3060 */ | 3108 */ |
| 3109 @override | |
| 3061 final AnalysisContext context; | 3110 final AnalysisContext context; |
| 3062 | 3111 |
| 3063 /** | 3112 /** |
| 3064 * The compilation unit that defines this library. | 3113 * The compilation unit that defines this library. |
| 3065 */ | 3114 */ |
| 3066 CompilationUnitElement _definingCompilationUnit; | 3115 CompilationUnitElement _definingCompilationUnit; |
| 3067 | 3116 |
| 3068 /** | 3117 /** |
| 3069 * The entry point for this library, or `null` if this library does not have | 3118 * The entry point for this library, or `null` if this library does not have |
| 3070 * an entry point. | 3119 * an entry point. |
| 3071 */ | 3120 */ |
| 3121 @override | |
| 3072 FunctionElement entryPoint; | 3122 FunctionElement entryPoint; |
| 3073 | 3123 |
| 3074 /** | 3124 /** |
| 3075 * A list containing specifications of all of the imports defined in this | 3125 * A list containing specifications of all of the imports defined in this |
| 3076 * library. | 3126 * library. |
| 3077 */ | 3127 */ |
| 3078 List<ImportElement> _imports = ImportElement.EMPTY_LIST; | 3128 List<ImportElement> _imports = ImportElement.EMPTY_LIST; |
| 3079 | 3129 |
| 3080 /** | 3130 /** |
| 3081 * A list containing specifications of all of the exports defined in this | 3131 * A list containing specifications of all of the exports defined in this |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3932 const Modifier(String name, int ordinal) : super(name, ordinal); | 3982 const Modifier(String name, int ordinal) : super(name, ordinal); |
| 3933 } | 3983 } |
| 3934 | 3984 |
| 3935 /** | 3985 /** |
| 3936 * A concrete implementation of a [MultiplyDefinedElement]. | 3986 * A concrete implementation of a [MultiplyDefinedElement]. |
| 3937 */ | 3987 */ |
| 3938 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { | 3988 class MultiplyDefinedElementImpl implements MultiplyDefinedElement { |
| 3939 /** | 3989 /** |
| 3940 * The unique integer identifier of this element. | 3990 * The unique integer identifier of this element. |
| 3941 */ | 3991 */ |
| 3992 @override | |
| 3942 final int id = ElementImpl._NEXT_ID++; | 3993 final int id = ElementImpl._NEXT_ID++; |
| 3943 | 3994 |
| 3944 /** | 3995 /** |
| 3945 * The analysis context in which the multiply defined elements are defined. | 3996 * The analysis context in which the multiply defined elements are defined. |
| 3946 */ | 3997 */ |
| 3998 @override | |
| 3947 final AnalysisContext context; | 3999 final AnalysisContext context; |
| 3948 | 4000 |
| 3949 /** | 4001 /** |
| 3950 * The name of the conflicting elements. | 4002 * The name of the conflicting elements. |
| 3951 */ | 4003 */ |
| 3952 String _name; | 4004 String _name; |
| 3953 | 4005 |
| 3954 /** | 4006 /** |
| 3955 * A list containing all of the elements that conflict. | 4007 * A list containing all of the elements that conflict. |
| 3956 */ | 4008 */ |
| 4009 @override | |
| 3957 final List<Element> conflictingElements; | 4010 final List<Element> conflictingElements; |
| 3958 | 4011 |
| 3959 /** | 4012 /** |
| 3960 * Initialize a newly created element in the given [context] to represent a | 4013 * Initialize a newly created element in the given [context] to represent a |
| 3961 * list of [conflictingElements]. | 4014 * list of [conflictingElements]. |
| 3962 */ | 4015 */ |
| 3963 MultiplyDefinedElementImpl(this.context, this.conflictingElements) { | 4016 MultiplyDefinedElementImpl(this.context, this.conflictingElements) { |
| 3964 _name = conflictingElements[0].name; | 4017 _name = conflictingElements[0].name; |
| 3965 } | 4018 } |
| 3966 | 4019 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4194 /** | 4247 /** |
| 4195 * A list containing all of the type parameters defined for this parameter | 4248 * A list containing all of the type parameters defined for this parameter |
| 4196 * element. There will only be parameters if this parameter is a function | 4249 * element. There will only be parameters if this parameter is a function |
| 4197 * typed parameter. | 4250 * typed parameter. |
| 4198 */ | 4251 */ |
| 4199 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; | 4252 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; |
| 4200 | 4253 |
| 4201 /** | 4254 /** |
| 4202 * The kind of this parameter. | 4255 * The kind of this parameter. |
| 4203 */ | 4256 */ |
| 4257 @override | |
| 4204 ParameterKind parameterKind; | 4258 ParameterKind parameterKind; |
| 4205 | 4259 |
| 4206 /** | 4260 /** |
| 4207 * The Dart code of the default value. | 4261 * The Dart code of the default value. |
| 4208 */ | 4262 */ |
| 4209 String _defaultValueCode; | 4263 String _defaultValueCode; |
| 4210 | 4264 |
| 4211 /** | 4265 /** |
| 4212 * The offset to the beginning of the visible range for this element. | 4266 * The offset to the beginning of the visible range for this element. |
| 4213 */ | 4267 */ |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4413 } | 4467 } |
| 4414 | 4468 |
| 4415 /** | 4469 /** |
| 4416 * A concrete implementation of a [PropertyAccessorElement]. | 4470 * A concrete implementation of a [PropertyAccessorElement]. |
| 4417 */ | 4471 */ |
| 4418 class PropertyAccessorElementImpl extends ExecutableElementImpl | 4472 class PropertyAccessorElementImpl extends ExecutableElementImpl |
| 4419 implements PropertyAccessorElement { | 4473 implements PropertyAccessorElement { |
| 4420 /** | 4474 /** |
| 4421 * The variable associated with this accessor. | 4475 * The variable associated with this accessor. |
| 4422 */ | 4476 */ |
| 4477 @override | |
| 4423 PropertyInducingElement variable; | 4478 PropertyInducingElement variable; |
| 4424 | 4479 |
| 4425 /** | 4480 /** |
| 4426 * Initialize a newly created property accessor element to have the given | 4481 * Initialize a newly created property accessor element to have the given |
| 4427 * [name] and [offset]. | 4482 * [name] and [offset]. |
| 4428 */ | 4483 */ |
| 4429 PropertyAccessorElementImpl(String name, int offset) : super(name, offset); | 4484 PropertyAccessorElementImpl(String name, int offset) : super(name, offset); |
| 4430 | 4485 |
| 4431 /** | 4486 /** |
| 4432 * Initialize a newly created property accessor element to have the given | 4487 * Initialize a newly created property accessor element to have the given |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4555 } | 4610 } |
| 4556 | 4611 |
| 4557 /** | 4612 /** |
| 4558 * A concrete implementation of a [PropertyInducingElement]. | 4613 * A concrete implementation of a [PropertyInducingElement]. |
| 4559 */ | 4614 */ |
| 4560 abstract class PropertyInducingElementImpl extends VariableElementImpl | 4615 abstract class PropertyInducingElementImpl extends VariableElementImpl |
| 4561 implements PropertyInducingElement { | 4616 implements PropertyInducingElement { |
| 4562 /** | 4617 /** |
| 4563 * The getter associated with this element. | 4618 * The getter associated with this element. |
| 4564 */ | 4619 */ |
| 4620 @override | |
| 4565 PropertyAccessorElement getter; | 4621 PropertyAccessorElement getter; |
| 4566 | 4622 |
| 4567 /** | 4623 /** |
| 4568 * The setter associated with this element, or `null` if the element is | 4624 * The setter associated with this element, or `null` if the element is |
| 4569 * effectively `final` and therefore does not have a setter associated with | 4625 * effectively `final` and therefore does not have a setter associated with |
| 4570 * it. | 4626 * it. |
| 4571 */ | 4627 */ |
| 4628 @override | |
| 4572 PropertyAccessorElement setter; | 4629 PropertyAccessorElement setter; |
| 4573 | 4630 |
| 4574 /** | 4631 /** |
| 4575 * The propagated type of this variable, or `null` if type propagation has not | 4632 * The propagated type of this variable, or `null` if type propagation has not |
| 4576 * been performed. | 4633 * been performed. |
| 4577 */ | 4634 */ |
| 4635 @override | |
| 4578 DartType propagatedType; | 4636 DartType propagatedType; |
| 4579 | 4637 |
| 4580 /** | 4638 /** |
| 4581 * Initialize a newly created synthetic element to have the given [name] and | 4639 * Initialize a newly created synthetic element to have the given [name] and |
| 4582 * [offset]. | 4640 * [offset]. |
| 4583 */ | 4641 */ |
| 4584 PropertyInducingElementImpl(String name, int offset) : super(name, offset); | 4642 PropertyInducingElementImpl(String name, int offset) : super(name, offset); |
| 4585 | 4643 |
| 4586 /** | 4644 /** |
| 4587 * Initialize a newly created element to have the given [name]. | 4645 * Initialize a newly created element to have the given [name]. |
| 4588 */ | 4646 */ |
| 4589 PropertyInducingElementImpl.forNode(Identifier name) : super.forNode(name); | 4647 PropertyInducingElementImpl.forNode(Identifier name) : super.forNode(name); |
| 4590 } | 4648 } |
| 4591 | 4649 |
| 4592 /** | 4650 /** |
| 4593 * A concrete implementation of a [ShowElementCombinator]. | 4651 * A concrete implementation of a [ShowElementCombinator]. |
| 4594 */ | 4652 */ |
| 4595 class ShowElementCombinatorImpl implements ShowElementCombinator { | 4653 class ShowElementCombinatorImpl implements ShowElementCombinator { |
| 4596 /** | 4654 /** |
| 4597 * The names that are to be made visible in the importing library if they are | 4655 * The names that are to be made visible in the importing library if they are |
| 4598 * defined in the imported library. | 4656 * defined in the imported library. |
| 4599 */ | 4657 */ |
| 4658 @override | |
| 4600 List<String> shownNames = StringUtilities.EMPTY_ARRAY; | 4659 List<String> shownNames = StringUtilities.EMPTY_ARRAY; |
| 4601 | 4660 |
| 4602 /** | 4661 /** |
| 4603 * The offset of the character immediately following the last character of | 4662 * The offset of the character immediately following the last character of |
| 4604 * this node. | 4663 * this node. |
| 4605 */ | 4664 */ |
| 4665 @override | |
| 4606 int end = -1; | 4666 int end = -1; |
| 4607 | 4667 |
| 4608 /** | 4668 /** |
| 4609 * The offset of the 'show' keyword of this element. | 4669 * The offset of the 'show' keyword of this element. |
| 4610 */ | 4670 */ |
| 4671 @override | |
| 4611 int offset = 0; | 4672 int offset = 0; |
| 4612 | 4673 |
| 4613 @override | 4674 @override |
| 4614 String toString() { | 4675 String toString() { |
| 4615 StringBuffer buffer = new StringBuffer(); | 4676 StringBuffer buffer = new StringBuffer(); |
| 4616 buffer.write("show "); | 4677 buffer.write("show "); |
| 4617 int count = shownNames.length; | 4678 int count = shownNames.length; |
| 4618 for (int i = 0; i < count; i++) { | 4679 for (int i = 0; i < count; i++) { |
| 4619 if (i > 0) { | 4680 if (i > 0) { |
| 4620 buffer.write(", "); | 4681 buffer.write(", "); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4657 } | 4718 } |
| 4658 | 4719 |
| 4659 /** | 4720 /** |
| 4660 * A concrete implementation of a [TypeParameterElement]. | 4721 * A concrete implementation of a [TypeParameterElement]. |
| 4661 */ | 4722 */ |
| 4662 class TypeParameterElementImpl extends ElementImpl | 4723 class TypeParameterElementImpl extends ElementImpl |
| 4663 implements TypeParameterElement { | 4724 implements TypeParameterElement { |
| 4664 /** | 4725 /** |
| 4665 * The type defined by this type parameter. | 4726 * The type defined by this type parameter. |
| 4666 */ | 4727 */ |
| 4728 @override | |
| 4667 TypeParameterType type; | 4729 TypeParameterType type; |
| 4668 | 4730 |
| 4669 /** | 4731 /** |
| 4670 * The type representing the bound associated with this parameter, or `null` | 4732 * The type representing the bound associated with this parameter, or `null` |
| 4671 * if this parameter does not have an explicit bound. | 4733 * if this parameter does not have an explicit bound. |
| 4672 */ | 4734 */ |
| 4735 @override | |
| 4673 DartType bound; | 4736 DartType bound; |
| 4674 | 4737 |
| 4675 /** | 4738 /** |
| 4676 * Initialize a newly created method element to have the given [name] and | 4739 * Initialize a newly created method element to have the given [name] and |
| 4677 * [offset]. | 4740 * [offset]. |
| 4678 */ | 4741 */ |
| 4679 TypeParameterElementImpl(String name, int offset) : super(name, offset); | 4742 TypeParameterElementImpl(String name, int offset) : super(name, offset); |
| 4680 | 4743 |
| 4681 /** | 4744 /** |
| 4682 * Initialize a newly created type parameter element to have the given [name]. | 4745 * Initialize a newly created type parameter element to have the given [name]. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 4708 } | 4771 } |
| 4709 | 4772 |
| 4710 /** | 4773 /** |
| 4711 * A concrete implementation of a [UriReferencedElement]. | 4774 * A concrete implementation of a [UriReferencedElement]. |
| 4712 */ | 4775 */ |
| 4713 abstract class UriReferencedElementImpl extends ElementImpl | 4776 abstract class UriReferencedElementImpl extends ElementImpl |
| 4714 implements UriReferencedElement { | 4777 implements UriReferencedElement { |
| 4715 /** | 4778 /** |
| 4716 * The offset of the URI in the file, may be `-1` if synthetic. | 4779 * The offset of the URI in the file, may be `-1` if synthetic. |
| 4717 */ | 4780 */ |
| 4781 @override | |
| 4718 int uriOffset = -1; | 4782 int uriOffset = -1; |
| 4719 | 4783 |
| 4720 /** | 4784 /** |
| 4721 * The offset of the character immediately following the last character of | 4785 * The offset of the character immediately following the last character of |
| 4722 * this node's URI, may be `-1` if synthetic. | 4786 * this node's URI, may be `-1` if synthetic. |
| 4723 */ | 4787 */ |
| 4788 @override | |
| 4724 int uriEnd = -1; | 4789 int uriEnd = -1; |
| 4725 | 4790 |
| 4726 /** | 4791 /** |
| 4727 * The URI that is specified by this directive. | 4792 * The URI that is specified by this directive. |
| 4728 */ | 4793 */ |
| 4794 @override | |
| 4729 String uri; | 4795 String uri; |
| 4730 | 4796 |
| 4731 /** | 4797 /** |
| 4732 * Initialize a newly created import element to have the given [name] and | 4798 * Initialize a newly created import element to have the given [name] and |
| 4733 * [offset]. The offset may be `-1` if the element is synthetic. | 4799 * [offset]. The offset may be `-1` if the element is synthetic. |
| 4734 */ | 4800 */ |
| 4735 UriReferencedElementImpl(String name, int offset) : super(name, offset); | 4801 UriReferencedElementImpl(String name, int offset) : super(name, offset); |
| 4736 } | 4802 } |
| 4737 | 4803 |
| 4738 /** | 4804 /** |
| 4739 * A concrete implementation of a [VariableElement]. | 4805 * A concrete implementation of a [VariableElement]. |
| 4740 */ | 4806 */ |
| 4741 abstract class VariableElementImpl extends ElementImpl | 4807 abstract class VariableElementImpl extends ElementImpl |
| 4742 implements VariableElement { | 4808 implements VariableElement { |
| 4743 /** | 4809 /** |
| 4744 * The declared type of this variable. | 4810 * The declared type of this variable. |
| 4745 */ | 4811 */ |
| 4812 @override | |
| 4746 DartType type; | 4813 DartType type; |
| 4747 | 4814 |
| 4748 /** | 4815 /** |
| 4749 * A synthetic function representing this variable's initializer, or `null` if | 4816 * A synthetic function representing this variable's initializer, or `null` if |
| 4750 * this variable does not have an initializer. | 4817 * this variable does not have an initializer. |
| 4751 */ | 4818 */ |
| 4752 FunctionElement _initializer; | 4819 FunctionElement _initializer; |
| 4753 | 4820 |
| 4754 /** | 4821 /** |
| 4755 * Initialize a newly created variable element to have the given [name] and | 4822 * Initialize a newly created variable element to have the given [name] and |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4870 | 4937 |
| 4871 @override | 4938 @override |
| 4872 void visitElement(Element element) { | 4939 void visitElement(Element element) { |
| 4873 int offset = element.nameOffset; | 4940 int offset = element.nameOffset; |
| 4874 if (offset != -1) { | 4941 if (offset != -1) { |
| 4875 map[offset] = element; | 4942 map[offset] = element; |
| 4876 } | 4943 } |
| 4877 super.visitElement(element); | 4944 super.visitElement(element); |
| 4878 } | 4945 } |
| 4879 } | 4946 } |
| OLD | NEW |