| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element; | 8 library engine.element; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 * | 225 * |
| 226 * <b>Note:</b> Because the element model represents the state of the code, it | 226 * <b>Note:</b> Because the element model represents the state of the code, it |
| 227 * is possible for it to be semantically invalid. In particular, it is not | 227 * is possible for it to be semantically invalid. In particular, it is not |
| 228 * safe to assume that the inheritance structure of a class does not contain a | 228 * safe to assume that the inheritance structure of a class does not contain a |
| 229 * cycle. Clients that traverse the inheritance structure must explicitly | 229 * cycle. Clients that traverse the inheritance structure must explicitly |
| 230 * guard against infinite loops. | 230 * guard against infinite loops. |
| 231 */ | 231 */ |
| 232 List<InterfaceType> get mixins; | 232 List<InterfaceType> get mixins; |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * Return the resolved [ClassDeclaration] or [EnumDeclaration] node that | |
| 236 * declares this [ClassElement]. | |
| 237 * | |
| 238 * This method is expensive, because resolved AST might be evicted from cache, | |
| 239 * so parsing and resolving will be performed. | |
| 240 */ | |
| 241 @override | |
| 242 NamedCompilationUnitMember get node; | |
| 243 | |
| 244 /** | |
| 245 * Return the superclass of this class, or `null` if the class represents the | 235 * Return the superclass of this class, or `null` if the class represents the |
| 246 * class 'Object'. All other classes will have a non-`null` superclass. If the | 236 * class 'Object'. All other classes will have a non-`null` superclass. If the |
| 247 * superclass was not explicitly declared then the implicit superclass | 237 * superclass was not explicitly declared then the implicit superclass |
| 248 * 'Object' will be returned. | 238 * 'Object' will be returned. |
| 249 * | 239 * |
| 250 * <b>Note:</b> Because the element model represents the state of the code, it | 240 * <b>Note:</b> Because the element model represents the state of the code, it |
| 251 * is possible for it to be semantically invalid. In particular, it is not | 241 * is possible for it to be semantically invalid. In particular, it is not |
| 252 * safe to assume that the inheritance structure of a class does not contain a | 242 * safe to assume that the inheritance structure of a class does not contain a |
| 253 * cycle. Clients that traverse the inheritance structure must explicitly | 243 * cycle. Clients that traverse the inheritance structure must explicitly |
| 254 * guard against infinite loops. | 244 * guard against infinite loops. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 269 /** | 259 /** |
| 270 * Return the unnamed constructor declared in this class, or `null` if this | 260 * Return the unnamed constructor declared in this class, or `null` if this |
| 271 * class does not declare an unnamed constructor but does declare named | 261 * class does not declare an unnamed constructor but does declare named |
| 272 * constructors. The returned constructor will be synthetic if this class does | 262 * constructors. The returned constructor will be synthetic if this class does |
| 273 * not declare any constructors, in which case it will represent the default | 263 * not declare any constructors, in which case it will represent the default |
| 274 * constructor for the class. | 264 * constructor for the class. |
| 275 */ | 265 */ |
| 276 ConstructorElement get unnamedConstructor; | 266 ConstructorElement get unnamedConstructor; |
| 277 | 267 |
| 278 /** | 268 /** |
| 269 * Return the resolved [ClassDeclaration] or [EnumDeclaration] node that |
| 270 * declares this [ClassElement]. |
| 271 * |
| 272 * This method is expensive, because resolved AST might be evicted from cache, |
| 273 * so parsing and resolving will be performed. |
| 274 */ |
| 275 @override |
| 276 NamedCompilationUnitMember computeNode(); |
| 277 |
| 278 /** |
| 279 * Return the field (synthetic or explicit) defined in this class that has the | 279 * Return the field (synthetic or explicit) defined in this class that has the |
| 280 * given [name], or `null` if this class does not define a field with the | 280 * given [name], or `null` if this class does not define a field with the |
| 281 * given name. | 281 * given name. |
| 282 */ | 282 */ |
| 283 FieldElement getField(String name); | 283 FieldElement getField(String name); |
| 284 | 284 |
| 285 /** | 285 /** |
| 286 * Return the element representing the getter with the given [name] that is | 286 * Return the element representing the getter with the given [name] that is |
| 287 * declared in this class, or `null` if this class does not declare a getter | 287 * declared in this class, or `null` if this class does not declare a getter |
| 288 * with the given name. | 288 * with the given name. |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 bool get mixinErrorsReported => hasModifier(Modifier.MIXIN_ERRORS_REPORTED); | 716 bool get mixinErrorsReported => hasModifier(Modifier.MIXIN_ERRORS_REPORTED); |
| 717 | 717 |
| 718 /** | 718 /** |
| 719 * Set whether an error has reported explaining why this class is an | 719 * Set whether an error has reported explaining why this class is an |
| 720 * invalid mixin application. | 720 * invalid mixin application. |
| 721 */ | 721 */ |
| 722 void set mixinErrorsReported(bool value) { | 722 void set mixinErrorsReported(bool value) { |
| 723 setModifier(Modifier.MIXIN_ERRORS_REPORTED, value); | 723 setModifier(Modifier.MIXIN_ERRORS_REPORTED, value); |
| 724 } | 724 } |
| 725 | 725 |
| 726 @override | |
| 727 NamedCompilationUnitMember get node { | |
| 728 if (isEnum) { | |
| 729 return getNodeMatching((node) => node is EnumDeclaration); | |
| 730 } else { | |
| 731 return getNodeMatching( | |
| 732 (node) => node is ClassDeclaration || node is ClassTypeAlias); | |
| 733 } | |
| 734 } | |
| 735 | |
| 736 /** | 726 /** |
| 737 * Set whether this class is defined by a typedef construct. | 727 * Set whether this class is defined by a typedef construct. |
| 738 */ | 728 */ |
| 739 void set typedef(bool isTypedef) { | 729 void set typedef(bool isTypedef) { |
| 740 setModifier(Modifier.TYPEDEF, isTypedef); | 730 setModifier(Modifier.TYPEDEF, isTypedef); |
| 741 } | 731 } |
| 742 | 732 |
| 743 @override | 733 @override |
| 744 List<TypeParameterElement> get typeParameters => _typeParameters; | 734 List<TypeParameterElement> get typeParameters => _typeParameters; |
| 745 | 735 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 if (i > 0) { | 780 if (i > 0) { |
| 791 buffer.write(", "); | 781 buffer.write(", "); |
| 792 } | 782 } |
| 793 (_typeParameters[i] as TypeParameterElementImpl).appendTo(buffer); | 783 (_typeParameters[i] as TypeParameterElementImpl).appendTo(buffer); |
| 794 } | 784 } |
| 795 buffer.write(">"); | 785 buffer.write(">"); |
| 796 } | 786 } |
| 797 } | 787 } |
| 798 | 788 |
| 799 @override | 789 @override |
| 790 NamedCompilationUnitMember computeNode() { |
| 791 if (isEnum) { |
| 792 return getNodeMatching((node) => node is EnumDeclaration); |
| 793 } else { |
| 794 return getNodeMatching( |
| 795 (node) => node is ClassDeclaration || node is ClassTypeAlias); |
| 796 } |
| 797 } |
| 798 |
| 799 @override |
| 800 ElementImpl getChild(String identifier) { | 800 ElementImpl getChild(String identifier) { |
| 801 // | 801 // |
| 802 // The casts in this method are safe because the set methods would have | 802 // The casts in this method are safe because the set methods would have |
| 803 // thrown a CCE if any of the elements in the arrays were not of the | 803 // thrown a CCE if any of the elements in the arrays were not of the |
| 804 // expected types. | 804 // expected types. |
| 805 // | 805 // |
| 806 for (PropertyAccessorElement accessor in _accessors) { | 806 for (PropertyAccessorElement accessor in _accessors) { |
| 807 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { | 807 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { |
| 808 return accessor as PropertyAccessorElementImpl; | 808 return accessor as PropertyAccessorElementImpl; |
| 809 } | 809 } |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 */ | 1213 */ |
| 1214 List<FunctionTypeAliasElement> get functionTypeAliases; | 1214 List<FunctionTypeAliasElement> get functionTypeAliases; |
| 1215 | 1215 |
| 1216 /** | 1216 /** |
| 1217 * Return `true` if this compilation unit defines a top-level function named | 1217 * Return `true` if this compilation unit defines a top-level function named |
| 1218 * `loadLibrary`. | 1218 * `loadLibrary`. |
| 1219 */ | 1219 */ |
| 1220 bool get hasLoadLibraryFunction; | 1220 bool get hasLoadLibraryFunction; |
| 1221 | 1221 |
| 1222 /** | 1222 /** |
| 1223 * Return the resolved [CompilationUnit] node that declares this element. | |
| 1224 * | |
| 1225 * This method is expensive, because resolved AST might be evicted from cache, | |
| 1226 * so parsing and resolving will be performed. | |
| 1227 */ | |
| 1228 @override | |
| 1229 CompilationUnit get node; | |
| 1230 | |
| 1231 /** | |
| 1232 * Return a list containing all of the top-level variables contained in this | 1223 * Return a list containing all of the top-level variables contained in this |
| 1233 * compilation unit. | 1224 * compilation unit. |
| 1234 */ | 1225 */ |
| 1235 List<TopLevelVariableElement> get topLevelVariables; | 1226 List<TopLevelVariableElement> get topLevelVariables; |
| 1236 | 1227 |
| 1237 /** | 1228 /** |
| 1238 * Return a list containing all of the classes contained in this compilation | 1229 * Return a list containing all of the classes contained in this compilation |
| 1239 * unit. | 1230 * unit. |
| 1240 */ | 1231 */ |
| 1241 List<ClassElement> get types; | 1232 List<ClassElement> get types; |
| 1242 | 1233 |
| 1243 /** | 1234 /** |
| 1235 * Return the resolved [CompilationUnit] node that declares this element. |
| 1236 * |
| 1237 * This method is expensive, because resolved AST might be evicted from cache, |
| 1238 * so parsing and resolving will be performed. |
| 1239 */ |
| 1240 @override |
| 1241 CompilationUnit computeNode(); |
| 1242 |
| 1243 /** |
| 1244 * Return the element at the given [offset], maybe `null` if no such element. | 1244 * Return the element at the given [offset], maybe `null` if no such element. |
| 1245 */ | 1245 */ |
| 1246 Element getElementAt(int offset); | 1246 Element getElementAt(int offset); |
| 1247 | 1247 |
| 1248 /** | 1248 /** |
| 1249 * Return the enum defined in this compilation unit that has the given [name], | 1249 * Return the enum defined in this compilation unit that has the given [name], |
| 1250 * or `null` if this compilation unit does not define an enum with the given | 1250 * or `null` if this compilation unit does not define an enum with the given |
| 1251 * name. | 1251 * name. |
| 1252 */ | 1252 */ |
| 1253 ClassElement getEnum(String name); | 1253 ClassElement getEnum(String name); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 return false; | 1392 return false; |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 @override | 1395 @override |
| 1396 String get identifier => source.encoding; | 1396 String get identifier => source.encoding; |
| 1397 | 1397 |
| 1398 @override | 1398 @override |
| 1399 ElementKind get kind => ElementKind.COMPILATION_UNIT; | 1399 ElementKind get kind => ElementKind.COMPILATION_UNIT; |
| 1400 | 1400 |
| 1401 @override | 1401 @override |
| 1402 CompilationUnit get node => unit; | |
| 1403 | |
| 1404 @override | |
| 1405 List<TopLevelVariableElement> get topLevelVariables => _variables; | 1402 List<TopLevelVariableElement> get topLevelVariables => _variables; |
| 1406 | 1403 |
| 1407 /** | 1404 /** |
| 1408 * Set the top-level variables contained in this compilation unit to the given | 1405 * Set the top-level variables contained in this compilation unit to the given |
| 1409 * [variables]. | 1406 * [variables]. |
| 1410 */ | 1407 */ |
| 1411 void set topLevelVariables(List<TopLevelVariableElement> variables) { | 1408 void set topLevelVariables(List<TopLevelVariableElement> variables) { |
| 1412 for (TopLevelVariableElement field in variables) { | 1409 for (TopLevelVariableElement field in variables) { |
| 1413 (field as TopLevelVariableElementImpl).enclosingElement = this; | 1410 (field as TopLevelVariableElementImpl).enclosingElement = this; |
| 1414 } | 1411 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 @override | 1453 @override |
| 1457 void appendTo(StringBuffer buffer) { | 1454 void appendTo(StringBuffer buffer) { |
| 1458 if (source == null) { | 1455 if (source == null) { |
| 1459 buffer.write("{compilation unit}"); | 1456 buffer.write("{compilation unit}"); |
| 1460 } else { | 1457 } else { |
| 1461 buffer.write(source.fullName); | 1458 buffer.write(source.fullName); |
| 1462 } | 1459 } |
| 1463 } | 1460 } |
| 1464 | 1461 |
| 1465 @override | 1462 @override |
| 1463 CompilationUnit computeNode() => unit; |
| 1464 |
| 1465 @override |
| 1466 ElementImpl getChild(String identifier) { | 1466 ElementImpl getChild(String identifier) { |
| 1467 // | 1467 // |
| 1468 // The casts in this method are safe because the set methods would have | 1468 // The casts in this method are safe because the set methods would have |
| 1469 // thrown a CCE if any of the elements in the arrays were not of the | 1469 // thrown a CCE if any of the elements in the arrays were not of the |
| 1470 // expected types. | 1470 // expected types. |
| 1471 // | 1471 // |
| 1472 for (PropertyAccessorElement accessor in _accessors) { | 1472 for (PropertyAccessorElement accessor in _accessors) { |
| 1473 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { | 1473 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { |
| 1474 return accessor as PropertyAccessorElementImpl; | 1474 return accessor as PropertyAccessorElementImpl; |
| 1475 } | 1475 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 */ | 1660 */ |
| 1661 bool get isFactory; | 1661 bool get isFactory; |
| 1662 | 1662 |
| 1663 /** | 1663 /** |
| 1664 * Return the offset of the character immediately following the last character | 1664 * Return the offset of the character immediately following the last character |
| 1665 * of this constructor's name, or `null` if not named. | 1665 * of this constructor's name, or `null` if not named. |
| 1666 */ | 1666 */ |
| 1667 int get nameEnd; | 1667 int get nameEnd; |
| 1668 | 1668 |
| 1669 /** | 1669 /** |
| 1670 * Return the resolved [ConstructorDeclaration] node that declares this | |
| 1671 * [ConstructorElement] . | |
| 1672 * | |
| 1673 * This method is expensive, because resolved AST might be evicted from cache, | |
| 1674 * so parsing and resolving will be performed. | |
| 1675 */ | |
| 1676 @override | |
| 1677 ConstructorDeclaration get node; | |
| 1678 | |
| 1679 /** | |
| 1680 * Return the offset of the `.` before this constructor name, or `null` if | 1670 * Return the offset of the `.` before this constructor name, or `null` if |
| 1681 * not named. | 1671 * not named. |
| 1682 */ | 1672 */ |
| 1683 int get periodOffset; | 1673 int get periodOffset; |
| 1684 | 1674 |
| 1685 /** | 1675 /** |
| 1686 * Return the constructor to which this constructor is redirecting, or `null` | 1676 * Return the constructor to which this constructor is redirecting, or `null` |
| 1687 * if this constructor does not redirect to another constructor or if the | 1677 * if this constructor does not redirect to another constructor or if the |
| 1688 * library containing this constructor has not yet been resolved. | 1678 * library containing this constructor has not yet been resolved. |
| 1689 */ | 1679 */ |
| 1690 ConstructorElement get redirectedConstructor; | 1680 ConstructorElement get redirectedConstructor; |
| 1681 |
| 1682 /** |
| 1683 * Return the resolved [ConstructorDeclaration] node that declares this |
| 1684 * [ConstructorElement] . |
| 1685 * |
| 1686 * This method is expensive, because resolved AST might be evicted from cache, |
| 1687 * so parsing and resolving will be performed. |
| 1688 */ |
| 1689 @override |
| 1690 ConstructorDeclaration computeNode(); |
| 1691 } | 1691 } |
| 1692 | 1692 |
| 1693 /** | 1693 /** |
| 1694 * A concrete implementation of a [ConstructorElement]. | 1694 * A concrete implementation of a [ConstructorElement]. |
| 1695 */ | 1695 */ |
| 1696 class ConstructorElementImpl extends ExecutableElementImpl | 1696 class ConstructorElementImpl extends ExecutableElementImpl |
| 1697 implements ConstructorElement { | 1697 implements ConstructorElement { |
| 1698 /** | 1698 /** |
| 1699 * An empty list of constructor elements. | 1699 * An empty list of constructor elements. |
| 1700 */ | 1700 */ |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 @override | 1781 @override |
| 1782 bool get isFactory => hasModifier(Modifier.FACTORY); | 1782 bool get isFactory => hasModifier(Modifier.FACTORY); |
| 1783 | 1783 |
| 1784 @override | 1784 @override |
| 1785 bool get isStatic => false; | 1785 bool get isStatic => false; |
| 1786 | 1786 |
| 1787 @override | 1787 @override |
| 1788 ElementKind get kind => ElementKind.CONSTRUCTOR; | 1788 ElementKind get kind => ElementKind.CONSTRUCTOR; |
| 1789 | 1789 |
| 1790 @override | 1790 @override |
| 1791 ConstructorDeclaration get node => | |
| 1792 getNodeMatching((node) => node is ConstructorDeclaration); | |
| 1793 | |
| 1794 @override | |
| 1795 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 1791 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 1796 | 1792 |
| 1797 @override | 1793 @override |
| 1798 void appendTo(StringBuffer buffer) { | 1794 void appendTo(StringBuffer buffer) { |
| 1799 if (enclosingElement == null) { | 1795 if (enclosingElement == null) { |
| 1800 String message; | 1796 String message; |
| 1801 String name = displayName; | 1797 String name = displayName; |
| 1802 if (name != null && !name.isEmpty) { | 1798 if (name != null && !name.isEmpty) { |
| 1803 message = | 1799 message = |
| 1804 'Found constructor element named $name with no enclosing element'; | 1800 'Found constructor element named $name with no enclosing element'; |
| 1805 } else { | 1801 } else { |
| 1806 message = 'Found unnamed constructor element with no enclosing element'; | 1802 message = 'Found unnamed constructor element with no enclosing element'; |
| 1807 } | 1803 } |
| 1808 AnalysisEngine.instance.logger.logError(message); | 1804 AnalysisEngine.instance.logger.logError(message); |
| 1809 buffer.write('<unknown class>'); | 1805 buffer.write('<unknown class>'); |
| 1810 } else { | 1806 } else { |
| 1811 buffer.write(enclosingElement.displayName); | 1807 buffer.write(enclosingElement.displayName); |
| 1812 } | 1808 } |
| 1813 String name = displayName; | 1809 String name = displayName; |
| 1814 if (name != null && !name.isEmpty) { | 1810 if (name != null && !name.isEmpty) { |
| 1815 buffer.write("."); | 1811 buffer.write("."); |
| 1816 buffer.write(name); | 1812 buffer.write(name); |
| 1817 } | 1813 } |
| 1818 super.appendTo(buffer); | 1814 super.appendTo(buffer); |
| 1819 } | 1815 } |
| 1816 |
| 1817 @override |
| 1818 ConstructorDeclaration computeNode() => |
| 1819 getNodeMatching((node) => node is ConstructorDeclaration); |
| 1820 } | 1820 } |
| 1821 | 1821 |
| 1822 /** | 1822 /** |
| 1823 * A constructor element defined in a parameterized type where the values of the | 1823 * A constructor element defined in a parameterized type where the values of the |
| 1824 * type parameters are known. | 1824 * type parameters are known. |
| 1825 */ | 1825 */ |
| 1826 class ConstructorMember extends ExecutableMember implements ConstructorElement { | 1826 class ConstructorMember extends ExecutableMember implements ConstructorElement { |
| 1827 /** | 1827 /** |
| 1828 * Initialize a newly created element to represent a constructor, based on the | 1828 * Initialize a newly created element to represent a constructor, based on the |
| 1829 * [baseElement], defined by the [definingType]. | 1829 * [baseElement], defined by the [definingType]. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1846 @override | 1846 @override |
| 1847 bool get isDefaultConstructor => baseElement.isDefaultConstructor; | 1847 bool get isDefaultConstructor => baseElement.isDefaultConstructor; |
| 1848 | 1848 |
| 1849 @override | 1849 @override |
| 1850 bool get isFactory => baseElement.isFactory; | 1850 bool get isFactory => baseElement.isFactory; |
| 1851 | 1851 |
| 1852 @override | 1852 @override |
| 1853 int get nameEnd => baseElement.nameEnd; | 1853 int get nameEnd => baseElement.nameEnd; |
| 1854 | 1854 |
| 1855 @override | 1855 @override |
| 1856 ConstructorDeclaration get node => baseElement.node; | |
| 1857 | |
| 1858 @override | |
| 1859 int get periodOffset => baseElement.periodOffset; | 1856 int get periodOffset => baseElement.periodOffset; |
| 1860 | 1857 |
| 1861 @override | 1858 @override |
| 1862 ConstructorElement get redirectedConstructor => | 1859 ConstructorElement get redirectedConstructor => |
| 1863 from(baseElement.redirectedConstructor, definingType); | 1860 from(baseElement.redirectedConstructor, definingType); |
| 1864 | 1861 |
| 1865 @override | 1862 @override |
| 1866 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); | 1863 accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
| 1867 | 1864 |
| 1868 @override | 1865 @override |
| 1866 ConstructorDeclaration computeNode() => baseElement.computeNode(); |
| 1867 |
| 1868 @override |
| 1869 String toString() { | 1869 String toString() { |
| 1870 ConstructorElement baseElement = this.baseElement; | 1870 ConstructorElement baseElement = this.baseElement; |
| 1871 List<ParameterElement> parameters = this.parameters; | 1871 List<ParameterElement> parameters = this.parameters; |
| 1872 FunctionType type = this.type; | 1872 FunctionType type = this.type; |
| 1873 StringBuffer buffer = new StringBuffer(); | 1873 StringBuffer buffer = new StringBuffer(); |
| 1874 buffer.write(baseElement.enclosingElement.displayName); | 1874 buffer.write(baseElement.enclosingElement.displayName); |
| 1875 String name = displayName; | 1875 String name = displayName; |
| 1876 if (name != null && !name.isEmpty) { | 1876 if (name != null && !name.isEmpty) { |
| 1877 buffer.write("."); | 1877 buffer.write("."); |
| 1878 buffer.write(name); | 1878 buffer.write(name); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 | 2126 |
| 2127 @override | 2127 @override |
| 2128 EvaluationResultImpl get evaluationResult => _result; | 2128 EvaluationResultImpl get evaluationResult => _result; |
| 2129 | 2129 |
| 2130 @override | 2130 @override |
| 2131 void set evaluationResult(EvaluationResultImpl result) { | 2131 void set evaluationResult(EvaluationResultImpl result) { |
| 2132 this._result = result; | 2132 this._result = result; |
| 2133 } | 2133 } |
| 2134 | 2134 |
| 2135 @override | 2135 @override |
| 2136 DefaultFormalParameter get node => | 2136 DefaultFormalParameter computeNode() => |
| 2137 getNodeMatching((node) => node is DefaultFormalParameter); | 2137 getNodeMatching((node) => node is DefaultFormalParameter); |
| 2138 } | 2138 } |
| 2139 | 2139 |
| 2140 /** | 2140 /** |
| 2141 * The synthetic element representing the declaration of the type `dynamic`. | 2141 * The synthetic element representing the declaration of the type `dynamic`. |
| 2142 */ | 2142 */ |
| 2143 class DynamicElementImpl extends ElementImpl { | 2143 class DynamicElementImpl extends ElementImpl { |
| 2144 /** | 2144 /** |
| 2145 * Return the unique instance of this class. | 2145 * Return the unique instance of this class. |
| 2146 */ | 2146 */ |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 /** | 2375 /** |
| 2376 * Return the resolved [AstNode] node that declares this element, or `null` if | 2376 * Return the resolved [AstNode] node that declares this element, or `null` if |
| 2377 * this element is synthetic or isn't contained in a compilation unit, such as | 2377 * this element is synthetic or isn't contained in a compilation unit, such as |
| 2378 * a [LibraryElement]. | 2378 * a [LibraryElement]. |
| 2379 * | 2379 * |
| 2380 * This method is expensive, because resolved AST might be evicted from cache, | 2380 * This method is expensive, because resolved AST might be evicted from cache, |
| 2381 * so parsing and resolving will be performed. | 2381 * so parsing and resolving will be performed. |
| 2382 * | 2382 * |
| 2383 * <b>Note:</b> This method cannot be used in an async environment. | 2383 * <b>Note:</b> This method cannot be used in an async environment. |
| 2384 */ | 2384 */ |
| 2385 @deprecated |
| 2385 AstNode get node; | 2386 AstNode get node; |
| 2386 | 2387 |
| 2387 /** | 2388 /** |
| 2388 * Return the source that contains this element, or `null` if this element is | 2389 * Return the source that contains this element, or `null` if this element is |
| 2389 * not contained in a source. | 2390 * not contained in a source. |
| 2390 */ | 2391 */ |
| 2391 Source get source; | 2392 Source get source; |
| 2392 | 2393 |
| 2393 /** | 2394 /** |
| 2394 * Return the resolved [CompilationUnit] that declares this element, or `null` | 2395 * Return the resolved [CompilationUnit] that declares this element, or `null` |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2411 * `null` if this element does not have a documentation comment associated | 2412 * `null` if this element does not have a documentation comment associated |
| 2412 * with it. This can be a long-running operation if the information needed to | 2413 * with it. This can be a long-running operation if the information needed to |
| 2413 * access the comment is not cached. | 2414 * access the comment is not cached. |
| 2414 * | 2415 * |
| 2415 * Throws [AnalysisException] if the documentation comment could not be | 2416 * Throws [AnalysisException] if the documentation comment could not be |
| 2416 * determined because the analysis could not be performed | 2417 * determined because the analysis could not be performed |
| 2417 */ | 2418 */ |
| 2418 String computeDocumentationComment(); | 2419 String computeDocumentationComment(); |
| 2419 | 2420 |
| 2420 /** | 2421 /** |
| 2422 * Return the resolved [AstNode] node that declares this element, or `null` if |
| 2423 * this element is synthetic or isn't contained in a compilation unit, such as |
| 2424 * a [LibraryElement]. |
| 2425 * |
| 2426 * This method is expensive, because resolved AST might be evicted from cache, |
| 2427 * so parsing and resolving will be performed. |
| 2428 * |
| 2429 * <b>Note:</b> This method cannot be used in an async environment. |
| 2430 */ |
| 2431 AstNode computeNode(); |
| 2432 |
| 2433 /** |
| 2421 * Return the most immediate ancestor of this element for which the | 2434 * Return the most immediate ancestor of this element for which the |
| 2422 * [predicate] returns `true`, or `null` if there is no such ancestor. Note | 2435 * [predicate] returns `true`, or `null` if there is no such ancestor. Note |
| 2423 * that this element will never be returned. | 2436 * that this element will never be returned. |
| 2424 */ | 2437 */ |
| 2425 Element getAncestor(Predicate<Element> predicate); | 2438 Element getAncestor(Predicate<Element> predicate); |
| 2426 | 2439 |
| 2427 /** | 2440 /** |
| 2428 * Return a display name for the given element that includes the path to the | 2441 * Return a display name for the given element that includes the path to the |
| 2429 * compilation unit in which the type is defined. If [shortName] is `null` | 2442 * compilation unit in which the type is defined. If [shortName] is `null` |
| 2430 * then [getDisplayName] will be used as the name of this element. Otherwise | 2443 * then [getDisplayName] will be used as the name of this element. Otherwise |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 /** | 2773 /** |
| 2761 * Sets the offset of the name of this element in the file that contains the | 2774 * Sets the offset of the name of this element in the file that contains the |
| 2762 * declaration of this element. | 2775 * declaration of this element. |
| 2763 */ | 2776 */ |
| 2764 void set nameOffset(int offset) { | 2777 void set nameOffset(int offset) { |
| 2765 _nameOffset = offset; | 2778 _nameOffset = offset; |
| 2766 _cachedHashCode = null; | 2779 _cachedHashCode = null; |
| 2767 _cachedLocation = null; | 2780 _cachedLocation = null; |
| 2768 } | 2781 } |
| 2769 | 2782 |
| 2783 @deprecated |
| 2770 @override | 2784 @override |
| 2771 AstNode get node => getNodeMatching((node) => node is AstNode); | 2785 AstNode get node => computeNode(); |
| 2772 | 2786 |
| 2773 @override | 2787 @override |
| 2774 Source get source { | 2788 Source get source { |
| 2775 if (_enclosingElement == null) { | 2789 if (_enclosingElement == null) { |
| 2776 return null; | 2790 return null; |
| 2777 } | 2791 } |
| 2778 return _enclosingElement.source; | 2792 return _enclosingElement.source; |
| 2779 } | 2793 } |
| 2780 | 2794 |
| 2781 /** | 2795 /** |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 | 2829 |
| 2816 @override | 2830 @override |
| 2817 String computeDocumentationComment() { | 2831 String computeDocumentationComment() { |
| 2818 AnalysisContext context = this.context; | 2832 AnalysisContext context = this.context; |
| 2819 if (context == null) { | 2833 if (context == null) { |
| 2820 return null; | 2834 return null; |
| 2821 } | 2835 } |
| 2822 return context.computeDocumentationComment(this); | 2836 return context.computeDocumentationComment(this); |
| 2823 } | 2837 } |
| 2824 | 2838 |
| 2839 @override |
| 2840 AstNode computeNode() => getNodeMatching((node) => node is AstNode); |
| 2841 |
| 2825 /** | 2842 /** |
| 2826 * Set this element as the enclosing element for given [element]. | 2843 * Set this element as the enclosing element for given [element]. |
| 2827 */ | 2844 */ |
| 2828 void encloseElement(ElementImpl element) { | 2845 void encloseElement(ElementImpl element) { |
| 2829 element.enclosingElement = this; | 2846 element.enclosingElement = this; |
| 2830 } | 2847 } |
| 2831 | 2848 |
| 2832 @override | 2849 @override |
| 2833 Element getAncestor(Predicate<Element> predicate) { | 2850 Element getAncestor(Predicate<Element> predicate) { |
| 2834 Element ancestor = _enclosingElement; | 2851 Element ancestor = _enclosingElement; |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3878 bool get isEnumConstant; | 3895 bool get isEnumConstant; |
| 3879 | 3896 |
| 3880 /** | 3897 /** |
| 3881 * Return the resolved [VariableDeclaration] or [EnumConstantDeclaration] | 3898 * Return the resolved [VariableDeclaration] or [EnumConstantDeclaration] |
| 3882 * node that declares this [FieldElement]. | 3899 * node that declares this [FieldElement]. |
| 3883 * | 3900 * |
| 3884 * This method is expensive, because resolved AST might be evicted from cache, | 3901 * This method is expensive, because resolved AST might be evicted from cache, |
| 3885 * so parsing and resolving will be performed. | 3902 * so parsing and resolving will be performed. |
| 3886 */ | 3903 */ |
| 3887 @override | 3904 @override |
| 3888 AstNode get node; | 3905 AstNode computeNode(); |
| 3889 } | 3906 } |
| 3890 | 3907 |
| 3891 /** | 3908 /** |
| 3892 * A concrete implementation of a [FieldElement]. | 3909 * A concrete implementation of a [FieldElement]. |
| 3893 */ | 3910 */ |
| 3894 class FieldElementImpl extends PropertyInducingElementImpl | 3911 class FieldElementImpl extends PropertyInducingElementImpl |
| 3895 with PotentiallyConstVariableElement implements FieldElement { | 3912 with PotentiallyConstVariableElement implements FieldElement { |
| 3896 /** | 3913 /** |
| 3897 * An empty list of field elements. | 3914 * An empty list of field elements. |
| 3898 */ | 3915 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3916 @override | 3933 @override |
| 3917 bool get isEnumConstant => | 3934 bool get isEnumConstant => |
| 3918 enclosingElement != null ? enclosingElement.isEnum : false; | 3935 enclosingElement != null ? enclosingElement.isEnum : false; |
| 3919 | 3936 |
| 3920 @override | 3937 @override |
| 3921 bool get isStatic => hasModifier(Modifier.STATIC); | 3938 bool get isStatic => hasModifier(Modifier.STATIC); |
| 3922 | 3939 |
| 3923 @override | 3940 @override |
| 3924 ElementKind get kind => ElementKind.FIELD; | 3941 ElementKind get kind => ElementKind.FIELD; |
| 3925 | 3942 |
| 3926 @override | |
| 3927 AstNode get node { | |
| 3928 if (isEnumConstant) { | |
| 3929 return getNodeMatching((node) => node is EnumConstantDeclaration); | |
| 3930 } else { | |
| 3931 return getNodeMatching((node) => node is VariableDeclaration); | |
| 3932 } | |
| 3933 } | |
| 3934 | |
| 3935 /** | 3943 /** |
| 3936 * Set whether this field is static. | 3944 * Set whether this field is static. |
| 3937 */ | 3945 */ |
| 3938 void set static(bool isStatic) { | 3946 void set static(bool isStatic) { |
| 3939 setModifier(Modifier.STATIC, isStatic); | 3947 setModifier(Modifier.STATIC, isStatic); |
| 3940 } | 3948 } |
| 3941 | 3949 |
| 3942 @override | 3950 @override |
| 3943 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 3951 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
| 3952 |
| 3953 @override |
| 3954 AstNode computeNode() { |
| 3955 if (isEnumConstant) { |
| 3956 return getNodeMatching((node) => node is EnumConstantDeclaration); |
| 3957 } else { |
| 3958 return getNodeMatching((node) => node is VariableDeclaration); |
| 3959 } |
| 3960 } |
| 3944 } | 3961 } |
| 3945 | 3962 |
| 3946 /** | 3963 /** |
| 3947 * A field formal parameter defined within a constructor element. | 3964 * A field formal parameter defined within a constructor element. |
| 3948 */ | 3965 */ |
| 3949 abstract class FieldFormalParameterElement implements ParameterElement { | 3966 abstract class FieldFormalParameterElement implements ParameterElement { |
| 3950 /** | 3967 /** |
| 3951 * Return the field element associated with this field formal parameter, or | 3968 * Return the field element associated with this field formal parameter, or |
| 3952 * `null` if the parameter references a field that doesn't exist. | 3969 * `null` if the parameter references a field that doesn't exist. |
| 3953 */ | 3970 */ |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4031 PropertyAccessorElement get getter => | 4048 PropertyAccessorElement get getter => |
| 4032 PropertyAccessorMember.from(baseElement.getter, definingType); | 4049 PropertyAccessorMember.from(baseElement.getter, definingType); |
| 4033 | 4050 |
| 4034 @override | 4051 @override |
| 4035 bool get isEnumConstant => baseElement.isEnumConstant; | 4052 bool get isEnumConstant => baseElement.isEnumConstant; |
| 4036 | 4053 |
| 4037 @override | 4054 @override |
| 4038 bool get isStatic => baseElement.isStatic; | 4055 bool get isStatic => baseElement.isStatic; |
| 4039 | 4056 |
| 4040 @override | 4057 @override |
| 4041 VariableDeclaration get node => baseElement.node; | |
| 4042 | |
| 4043 @override | |
| 4044 DartType get propagatedType => substituteFor(baseElement.propagatedType); | 4058 DartType get propagatedType => substituteFor(baseElement.propagatedType); |
| 4045 | 4059 |
| 4046 @override | 4060 @override |
| 4047 PropertyAccessorElement get setter => | 4061 PropertyAccessorElement get setter => |
| 4048 PropertyAccessorMember.from(baseElement.setter, definingType); | 4062 PropertyAccessorMember.from(baseElement.setter, definingType); |
| 4049 | 4063 |
| 4050 @override | 4064 @override |
| 4051 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); | 4065 accept(ElementVisitor visitor) => visitor.visitFieldElement(this); |
| 4052 | 4066 |
| 4053 @override | 4067 @override |
| 4068 VariableDeclaration computeNode() => baseElement.computeNode(); |
| 4069 |
| 4070 @override |
| 4054 String toString() => '$type $displayName'; | 4071 String toString() => '$type $displayName'; |
| 4055 | 4072 |
| 4056 /** | 4073 /** |
| 4057 * If the given [field]'s type is different when any type parameters from the | 4074 * If the given [field]'s type is different when any type parameters from the |
| 4058 * defining type's declaration are replaced with the actual type arguments | 4075 * defining type's declaration are replaced with the actual type arguments |
| 4059 * from the [definingType], create a field member representing the given | 4076 * from the [definingType], create a field member representing the given |
| 4060 * field. Return the member that was created, or the base field if no member | 4077 * field. Return the member that was created, or the base field if no member |
| 4061 * was created. | 4078 * was created. |
| 4062 */ | 4079 */ |
| 4063 static FieldElement from(FieldElement field, InterfaceType definingType) { | 4080 static FieldElement from(FieldElement field, InterfaceType definingType) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4142 */ | 4159 */ |
| 4143 bool get isEntryPoint; | 4160 bool get isEntryPoint; |
| 4144 | 4161 |
| 4145 /** | 4162 /** |
| 4146 * Return the resolved function declaration node that declares this element. | 4163 * Return the resolved function declaration node that declares this element. |
| 4147 * | 4164 * |
| 4148 * This method is expensive, because resolved AST might be evicted from cache, | 4165 * This method is expensive, because resolved AST might be evicted from cache, |
| 4149 * so parsing and resolving will be performed. | 4166 * so parsing and resolving will be performed. |
| 4150 */ | 4167 */ |
| 4151 @override | 4168 @override |
| 4152 FunctionDeclaration get node; | 4169 FunctionDeclaration computeNode(); |
| 4153 } | 4170 } |
| 4154 | 4171 |
| 4155 /** | 4172 /** |
| 4156 * A concrete implementation of a [FunctionElement]. | 4173 * A concrete implementation of a [FunctionElement]. |
| 4157 */ | 4174 */ |
| 4158 class FunctionElementImpl extends ExecutableElementImpl | 4175 class FunctionElementImpl extends ExecutableElementImpl |
| 4159 implements FunctionElement { | 4176 implements FunctionElement { |
| 4160 /** | 4177 /** |
| 4161 * An empty list of function elements. | 4178 * An empty list of function elements. |
| 4162 */ | 4179 */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4205 return isStatic && displayName == FunctionElement.MAIN_FUNCTION_NAME; | 4222 return isStatic && displayName == FunctionElement.MAIN_FUNCTION_NAME; |
| 4206 } | 4223 } |
| 4207 | 4224 |
| 4208 @override | 4225 @override |
| 4209 bool get isStatic => enclosingElement is CompilationUnitElement; | 4226 bool get isStatic => enclosingElement is CompilationUnitElement; |
| 4210 | 4227 |
| 4211 @override | 4228 @override |
| 4212 ElementKind get kind => ElementKind.FUNCTION; | 4229 ElementKind get kind => ElementKind.FUNCTION; |
| 4213 | 4230 |
| 4214 @override | 4231 @override |
| 4215 FunctionDeclaration get node => | |
| 4216 getNodeMatching((node) => node is FunctionDeclaration); | |
| 4217 | |
| 4218 @override | |
| 4219 SourceRange get visibleRange { | 4232 SourceRange get visibleRange { |
| 4220 if (_visibleRangeLength < 0) { | 4233 if (_visibleRangeLength < 0) { |
| 4221 return null; | 4234 return null; |
| 4222 } | 4235 } |
| 4223 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4236 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 4224 } | 4237 } |
| 4225 | 4238 |
| 4226 @override | 4239 @override |
| 4227 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); | 4240 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
| 4228 | 4241 |
| 4229 @override | 4242 @override |
| 4230 void appendTo(StringBuffer buffer) { | 4243 void appendTo(StringBuffer buffer) { |
| 4231 String name = displayName; | 4244 String name = displayName; |
| 4232 if (name != null) { | 4245 if (name != null) { |
| 4233 buffer.write(name); | 4246 buffer.write(name); |
| 4234 } | 4247 } |
| 4235 super.appendTo(buffer); | 4248 super.appendTo(buffer); |
| 4236 } | 4249 } |
| 4237 | 4250 |
| 4251 @override |
| 4252 FunctionDeclaration computeNode() => |
| 4253 getNodeMatching((node) => node is FunctionDeclaration); |
| 4254 |
| 4238 /** | 4255 /** |
| 4239 * Set the visible range for this element to the range starting at the given | 4256 * Set the visible range for this element to the range starting at the given |
| 4240 * [offset] with the given [length]. | 4257 * [offset] with the given [length]. |
| 4241 */ | 4258 */ |
| 4242 void setVisibleRange(int offset, int length) { | 4259 void setVisibleRange(int offset, int length) { |
| 4243 _visibleRangeOffset = offset; | 4260 _visibleRangeOffset = offset; |
| 4244 _visibleRangeLength = length; | 4261 _visibleRangeLength = length; |
| 4245 } | 4262 } |
| 4246 } | 4263 } |
| 4247 | 4264 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 static List<FunctionTypeAliasElement> EMPTY_LIST = | 4397 static List<FunctionTypeAliasElement> EMPTY_LIST = |
| 4381 new List<FunctionTypeAliasElement>(0); | 4398 new List<FunctionTypeAliasElement>(0); |
| 4382 | 4399 |
| 4383 /** | 4400 /** |
| 4384 * Return the compilation unit in which this type alias is defined. | 4401 * Return the compilation unit in which this type alias is defined. |
| 4385 */ | 4402 */ |
| 4386 @override | 4403 @override |
| 4387 CompilationUnitElement get enclosingElement; | 4404 CompilationUnitElement get enclosingElement; |
| 4388 | 4405 |
| 4389 /** | 4406 /** |
| 4390 * Return the resolved function type alias node that declares this element. | |
| 4391 * | |
| 4392 * This method is expensive, because resolved AST might be evicted from cache, | |
| 4393 * so parsing and resolving will be performed. | |
| 4394 */ | |
| 4395 @override | |
| 4396 FunctionTypeAlias get node; | |
| 4397 | |
| 4398 /** | |
| 4399 * Return a list containing all of the parameters defined by this type alias. | 4407 * Return a list containing all of the parameters defined by this type alias. |
| 4400 */ | 4408 */ |
| 4401 List<ParameterElement> get parameters; | 4409 List<ParameterElement> get parameters; |
| 4402 | 4410 |
| 4403 /** | 4411 /** |
| 4404 * Return the return type defined by this type alias. | 4412 * Return the return type defined by this type alias. |
| 4405 */ | 4413 */ |
| 4406 DartType get returnType; | 4414 DartType get returnType; |
| 4407 | 4415 |
| 4408 /** | 4416 /** |
| 4409 * Return the type of function defined by this type alias. | 4417 * Return the type of function defined by this type alias. |
| 4410 */ | 4418 */ |
| 4411 FunctionType get type; | 4419 FunctionType get type; |
| 4412 | 4420 |
| 4413 /** | 4421 /** |
| 4414 * Return a list containing all of the type parameters defined for this type. | 4422 * Return a list containing all of the type parameters defined for this type. |
| 4415 */ | 4423 */ |
| 4416 List<TypeParameterElement> get typeParameters; | 4424 List<TypeParameterElement> get typeParameters; |
| 4425 |
| 4426 /** |
| 4427 * Return the resolved function type alias node that declares this element. |
| 4428 * |
| 4429 * This method is expensive, because resolved AST might be evicted from cache, |
| 4430 * so parsing and resolving will be performed. |
| 4431 */ |
| 4432 @override |
| 4433 FunctionTypeAlias computeNode(); |
| 4417 } | 4434 } |
| 4418 | 4435 |
| 4419 /** | 4436 /** |
| 4420 * A concrete implementation of a [FunctionTypeAliasElement]. | 4437 * A concrete implementation of a [FunctionTypeAliasElement]. |
| 4421 */ | 4438 */ |
| 4422 class FunctionTypeAliasElementImpl extends ElementImpl | 4439 class FunctionTypeAliasElementImpl extends ElementImpl |
| 4423 implements FunctionTypeAliasElement { | 4440 implements FunctionTypeAliasElement { |
| 4424 /** | 4441 /** |
| 4425 * An empty array of type alias elements. | 4442 * An empty array of type alias elements. |
| 4426 */ | 4443 */ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4464 FunctionTypeAliasElementImpl.forNode(Identifier name) : super.forNode(name); | 4481 FunctionTypeAliasElementImpl.forNode(Identifier name) : super.forNode(name); |
| 4465 | 4482 |
| 4466 @override | 4483 @override |
| 4467 CompilationUnitElement get enclosingElement => | 4484 CompilationUnitElement get enclosingElement => |
| 4468 super.enclosingElement as CompilationUnitElement; | 4485 super.enclosingElement as CompilationUnitElement; |
| 4469 | 4486 |
| 4470 @override | 4487 @override |
| 4471 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; | 4488 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; |
| 4472 | 4489 |
| 4473 @override | 4490 @override |
| 4474 FunctionTypeAlias get node => | |
| 4475 getNodeMatching((node) => node is FunctionTypeAlias); | |
| 4476 | |
| 4477 @override | |
| 4478 List<ParameterElement> get parameters => _parameters; | 4491 List<ParameterElement> get parameters => _parameters; |
| 4479 | 4492 |
| 4480 /** | 4493 /** |
| 4481 * Set the parameters defined by this type alias to the given [parameters]. | 4494 * Set the parameters defined by this type alias to the given [parameters]. |
| 4482 */ | 4495 */ |
| 4483 void set parameters(List<ParameterElement> parameters) { | 4496 void set parameters(List<ParameterElement> parameters) { |
| 4484 if (parameters != null) { | 4497 if (parameters != null) { |
| 4485 for (ParameterElement parameter in parameters) { | 4498 for (ParameterElement parameter in parameters) { |
| 4486 (parameter as ParameterElementImpl).enclosingElement = this; | 4499 (parameter as ParameterElementImpl).enclosingElement = this; |
| 4487 } | 4500 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4533 if (type != null) { | 4546 if (type != null) { |
| 4534 buffer.write(Element.RIGHT_ARROW); | 4547 buffer.write(Element.RIGHT_ARROW); |
| 4535 buffer.write(type.returnType); | 4548 buffer.write(type.returnType); |
| 4536 } else if (returnType != null) { | 4549 } else if (returnType != null) { |
| 4537 buffer.write(Element.RIGHT_ARROW); | 4550 buffer.write(Element.RIGHT_ARROW); |
| 4538 buffer.write(returnType); | 4551 buffer.write(returnType); |
| 4539 } | 4552 } |
| 4540 } | 4553 } |
| 4541 | 4554 |
| 4542 @override | 4555 @override |
| 4556 FunctionTypeAlias computeNode() => |
| 4557 getNodeMatching((node) => node is FunctionTypeAlias); |
| 4558 |
| 4559 @override |
| 4543 ElementImpl getChild(String identifier) { | 4560 ElementImpl getChild(String identifier) { |
| 4544 for (VariableElement parameter in _parameters) { | 4561 for (VariableElement parameter in _parameters) { |
| 4545 if ((parameter as VariableElementImpl).identifier == identifier) { | 4562 if ((parameter as VariableElementImpl).identifier == identifier) { |
| 4546 return parameter as VariableElementImpl; | 4563 return parameter as VariableElementImpl; |
| 4547 } | 4564 } |
| 4548 } | 4565 } |
| 4549 for (TypeParameterElement typeParameter in _typeParameters) { | 4566 for (TypeParameterElement typeParameter in _typeParameters) { |
| 4550 if ((typeParameter as TypeParameterElementImpl).identifier == | 4567 if ((typeParameter as TypeParameterElementImpl).identifier == |
| 4551 identifier) { | 4568 identifier) { |
| 4552 return typeParameter as TypeParameterElementImpl; | 4569 return typeParameter as TypeParameterElementImpl; |
| (...skipping 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7498 const <LocalVariableElement>[]; | 7515 const <LocalVariableElement>[]; |
| 7499 | 7516 |
| 7500 /** | 7517 /** |
| 7501 * Return the resolved [VariableDeclaration] node that declares this | 7518 * Return the resolved [VariableDeclaration] node that declares this |
| 7502 * [LocalVariableElement]. | 7519 * [LocalVariableElement]. |
| 7503 * | 7520 * |
| 7504 * This method is expensive, because resolved AST might be evicted from cache, | 7521 * This method is expensive, because resolved AST might be evicted from cache, |
| 7505 * so parsing and resolving will be performed. | 7522 * so parsing and resolving will be performed. |
| 7506 */ | 7523 */ |
| 7507 @override | 7524 @override |
| 7508 VariableDeclaration get node; | 7525 VariableDeclaration computeNode(); |
| 7509 } | 7526 } |
| 7510 | 7527 |
| 7511 /** | 7528 /** |
| 7512 * A concrete implementation of a [LocalVariableElement]. | 7529 * A concrete implementation of a [LocalVariableElement]. |
| 7513 */ | 7530 */ |
| 7514 class LocalVariableElementImpl extends VariableElementImpl | 7531 class LocalVariableElementImpl extends VariableElementImpl |
| 7515 with PotentiallyConstVariableElement implements LocalVariableElement { | 7532 with PotentiallyConstVariableElement implements LocalVariableElement { |
| 7516 /** | 7533 /** |
| 7517 * An empty list of field elements. | 7534 * An empty list of field elements. |
| 7518 */ | 7535 */ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7555 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT); | 7572 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT); |
| 7556 | 7573 |
| 7557 @override | 7574 @override |
| 7558 bool get isPotentiallyMutatedInScope => | 7575 bool get isPotentiallyMutatedInScope => |
| 7559 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE); | 7576 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE); |
| 7560 | 7577 |
| 7561 @override | 7578 @override |
| 7562 ElementKind get kind => ElementKind.LOCAL_VARIABLE; | 7579 ElementKind get kind => ElementKind.LOCAL_VARIABLE; |
| 7563 | 7580 |
| 7564 @override | 7581 @override |
| 7565 VariableDeclaration get node => | |
| 7566 getNodeMatching((node) => node is VariableDeclaration); | |
| 7567 | |
| 7568 @override | |
| 7569 SourceRange get visibleRange { | 7582 SourceRange get visibleRange { |
| 7570 if (_visibleRangeLength < 0) { | 7583 if (_visibleRangeLength < 0) { |
| 7571 return null; | 7584 return null; |
| 7572 } | 7585 } |
| 7573 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 7586 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 7574 } | 7587 } |
| 7575 | 7588 |
| 7576 @override | 7589 @override |
| 7577 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); | 7590 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); |
| 7578 | 7591 |
| 7579 @override | 7592 @override |
| 7580 void appendTo(StringBuffer buffer) { | 7593 void appendTo(StringBuffer buffer) { |
| 7581 buffer.write(type); | 7594 buffer.write(type); |
| 7582 buffer.write(" "); | 7595 buffer.write(" "); |
| 7583 buffer.write(displayName); | 7596 buffer.write(displayName); |
| 7584 } | 7597 } |
| 7585 | 7598 |
| 7599 @override |
| 7600 VariableDeclaration computeNode() => |
| 7601 getNodeMatching((node) => node is VariableDeclaration); |
| 7602 |
| 7586 /** | 7603 /** |
| 7587 * Specifies that this variable is potentially mutated somewhere in closure. | 7604 * Specifies that this variable is potentially mutated somewhere in closure. |
| 7588 */ | 7605 */ |
| 7589 void markPotentiallyMutatedInClosure() { | 7606 void markPotentiallyMutatedInClosure() { |
| 7590 setModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT, true); | 7607 setModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT, true); |
| 7591 } | 7608 } |
| 7592 | 7609 |
| 7593 /** | 7610 /** |
| 7594 * Specifies that this variable is potentially mutated somewhere in its scope. | 7611 * Specifies that this variable is potentially mutated somewhere in its scope. |
| 7595 */ | 7612 */ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7672 | 7689 |
| 7673 @override | 7690 @override |
| 7674 List<ElementAnnotation> get metadata => _baseElement.metadata; | 7691 List<ElementAnnotation> get metadata => _baseElement.metadata; |
| 7675 | 7692 |
| 7676 @override | 7693 @override |
| 7677 String get name => _baseElement.name; | 7694 String get name => _baseElement.name; |
| 7678 | 7695 |
| 7679 @override | 7696 @override |
| 7680 int get nameOffset => _baseElement.nameOffset; | 7697 int get nameOffset => _baseElement.nameOffset; |
| 7681 | 7698 |
| 7699 @deprecated |
| 7682 @override | 7700 @override |
| 7683 AstNode get node => _baseElement.node; | 7701 AstNode get node => computeNode(); |
| 7684 | 7702 |
| 7685 @override | 7703 @override |
| 7686 Source get source => _baseElement.source; | 7704 Source get source => _baseElement.source; |
| 7687 | 7705 |
| 7688 @override | 7706 @override |
| 7689 CompilationUnit get unit => _baseElement.unit; | 7707 CompilationUnit get unit => _baseElement.unit; |
| 7690 | 7708 |
| 7691 @override | 7709 @override |
| 7692 String computeDocumentationComment() => | 7710 String computeDocumentationComment() => |
| 7693 _baseElement.computeDocumentationComment(); | 7711 _baseElement.computeDocumentationComment(); |
| 7694 | 7712 |
| 7695 @override | 7713 @override |
| 7714 AstNode computeNode() => _baseElement.computeNode(); |
| 7715 |
| 7716 @override |
| 7696 Element getAncestor(Predicate<Element> predicate) => | 7717 Element getAncestor(Predicate<Element> predicate) => |
| 7697 baseElement.getAncestor(predicate); | 7718 baseElement.getAncestor(predicate); |
| 7698 | 7719 |
| 7699 @override | 7720 @override |
| 7700 String getExtendedDisplayName(String shortName) => | 7721 String getExtendedDisplayName(String shortName) => |
| 7701 _baseElement.getExtendedDisplayName(shortName); | 7722 _baseElement.getExtendedDisplayName(shortName); |
| 7702 | 7723 |
| 7703 @override | 7724 @override |
| 7704 bool isAccessibleIn(LibraryElement library) => | 7725 bool isAccessibleIn(LibraryElement library) => |
| 7705 _baseElement.isAccessibleIn(library); | 7726 _baseElement.isAccessibleIn(library); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7769 static const List<MethodElement> EMPTY_LIST = const <MethodElement>[]; | 7790 static const List<MethodElement> EMPTY_LIST = const <MethodElement>[]; |
| 7770 | 7791 |
| 7771 /** | 7792 /** |
| 7772 * Return the resolved [MethodDeclaration] node that declares this | 7793 * Return the resolved [MethodDeclaration] node that declares this |
| 7773 * [MethodElement]. | 7794 * [MethodElement]. |
| 7774 * | 7795 * |
| 7775 * This method is expensive, because resolved AST might be evicted from cache, | 7796 * This method is expensive, because resolved AST might be evicted from cache, |
| 7776 * so parsing and resolving will be performed. | 7797 * so parsing and resolving will be performed. |
| 7777 */ | 7798 */ |
| 7778 @override | 7799 @override |
| 7779 MethodDeclaration get node; | 7800 MethodDeclaration computeNode(); |
| 7780 } | 7801 } |
| 7781 | 7802 |
| 7782 /** | 7803 /** |
| 7783 * A concrete implementation of a [MethodElement]. | 7804 * A concrete implementation of a [MethodElement]. |
| 7784 */ | 7805 */ |
| 7785 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { | 7806 class MethodElementImpl extends ExecutableElementImpl implements MethodElement { |
| 7786 /** | 7807 /** |
| 7787 * An empty list of method elements. | 7808 * An empty list of method elements. |
| 7788 */ | 7809 */ |
| 7789 @deprecated // Use MethodElement.EMPTY_LIST | 7810 @deprecated // Use MethodElement.EMPTY_LIST |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7842 String get name { | 7863 String get name { |
| 7843 String name = super.name; | 7864 String name = super.name; |
| 7844 if (isOperator && name == "-") { | 7865 if (isOperator && name == "-") { |
| 7845 if (parameters.length == 0) { | 7866 if (parameters.length == 0) { |
| 7846 return "unary-"; | 7867 return "unary-"; |
| 7847 } | 7868 } |
| 7848 } | 7869 } |
| 7849 return super.name; | 7870 return super.name; |
| 7850 } | 7871 } |
| 7851 | 7872 |
| 7852 @override | |
| 7853 MethodDeclaration get node => | |
| 7854 getNodeMatching((node) => node is MethodDeclaration); | |
| 7855 | |
| 7856 /** | 7873 /** |
| 7857 * Set whether this method is static. | 7874 * Set whether this method is static. |
| 7858 */ | 7875 */ |
| 7859 void set static(bool isStatic) { | 7876 void set static(bool isStatic) { |
| 7860 setModifier(Modifier.STATIC, isStatic); | 7877 setModifier(Modifier.STATIC, isStatic); |
| 7861 } | 7878 } |
| 7862 | 7879 |
| 7863 @override | 7880 @override |
| 7864 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 7881 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
| 7865 | 7882 |
| 7866 @override | 7883 @override |
| 7867 void appendTo(StringBuffer buffer) { | 7884 void appendTo(StringBuffer buffer) { |
| 7868 buffer.write(displayName); | 7885 buffer.write(displayName); |
| 7869 super.appendTo(buffer); | 7886 super.appendTo(buffer); |
| 7870 } | 7887 } |
| 7888 |
| 7889 @override |
| 7890 MethodDeclaration computeNode() => |
| 7891 getNodeMatching((node) => node is MethodDeclaration); |
| 7871 } | 7892 } |
| 7872 | 7893 |
| 7873 /** | 7894 /** |
| 7874 * A method element defined in a parameterized type where the values of the type | 7895 * A method element defined in a parameterized type where the values of the type |
| 7875 * parameters are known. | 7896 * parameters are known. |
| 7876 */ | 7897 */ |
| 7877 class MethodMember extends ExecutableMember implements MethodElement { | 7898 class MethodMember extends ExecutableMember implements MethodElement { |
| 7878 /** | 7899 /** |
| 7879 * Initialize a newly created element to represent a constructor, based on the | 7900 * Initialize a newly created element to represent a constructor, based on the |
| 7880 * [baseElement], defined by the [definingType]. | 7901 * [baseElement], defined by the [definingType]. |
| 7881 */ | 7902 */ |
| 7882 MethodMember(MethodElement baseElement, InterfaceType definingType) | 7903 MethodMember(MethodElement baseElement, InterfaceType definingType) |
| 7883 : super(baseElement, definingType); | 7904 : super(baseElement, definingType); |
| 7884 | 7905 |
| 7885 @override | 7906 @override |
| 7886 MethodElement get baseElement => super.baseElement as MethodElement; | 7907 MethodElement get baseElement => super.baseElement as MethodElement; |
| 7887 | 7908 |
| 7888 @override | 7909 @override |
| 7889 ClassElement get enclosingElement => baseElement.enclosingElement; | 7910 ClassElement get enclosingElement => baseElement.enclosingElement; |
| 7890 | 7911 |
| 7891 @override | 7912 @override |
| 7892 MethodDeclaration get node => baseElement.node; | |
| 7893 | |
| 7894 @override | |
| 7895 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); | 7913 accept(ElementVisitor visitor) => visitor.visitMethodElement(this); |
| 7896 | 7914 |
| 7897 @override | 7915 @override |
| 7916 MethodDeclaration computeNode() => baseElement.computeNode(); |
| 7917 |
| 7918 @override |
| 7898 String toString() { | 7919 String toString() { |
| 7899 MethodElement baseElement = this.baseElement; | 7920 MethodElement baseElement = this.baseElement; |
| 7900 List<ParameterElement> parameters = this.parameters; | 7921 List<ParameterElement> parameters = this.parameters; |
| 7901 FunctionType type = this.type; | 7922 FunctionType type = this.type; |
| 7902 StringBuffer buffer = new StringBuffer(); | 7923 StringBuffer buffer = new StringBuffer(); |
| 7903 buffer.write(baseElement.enclosingElement.displayName); | 7924 buffer.write(baseElement.enclosingElement.displayName); |
| 7904 buffer.write("."); | 7925 buffer.write("."); |
| 7905 buffer.write(baseElement.displayName); | 7926 buffer.write(baseElement.displayName); |
| 7906 buffer.write("("); | 7927 buffer.write("("); |
| 7907 int parameterCount = parameters.length; | 7928 int parameterCount = parameters.length; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8182 | 8203 |
| 8183 @override | 8204 @override |
| 8184 List<ElementAnnotation> get metadata => ElementAnnotation.EMPTY_LIST; | 8205 List<ElementAnnotation> get metadata => ElementAnnotation.EMPTY_LIST; |
| 8185 | 8206 |
| 8186 @override | 8207 @override |
| 8187 String get name => _name; | 8208 String get name => _name; |
| 8188 | 8209 |
| 8189 @override | 8210 @override |
| 8190 int get nameOffset => -1; | 8211 int get nameOffset => -1; |
| 8191 | 8212 |
| 8213 @deprecated |
| 8192 @override | 8214 @override |
| 8193 AstNode get node => null; | 8215 AstNode get node => null; |
| 8194 | 8216 |
| 8195 @override | 8217 @override |
| 8196 Source get source => null; | 8218 Source get source => null; |
| 8197 | 8219 |
| 8198 @override | 8220 @override |
| 8199 DartType get type => DynamicTypeImpl.instance; | 8221 DartType get type => DynamicTypeImpl.instance; |
| 8200 | 8222 |
| 8201 @override | 8223 @override |
| 8202 CompilationUnit get unit => null; | 8224 CompilationUnit get unit => null; |
| 8203 | 8225 |
| 8204 @override | 8226 @override |
| 8205 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); | 8227 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); |
| 8206 | 8228 |
| 8207 @override | 8229 @override |
| 8208 String computeDocumentationComment() => null; | 8230 String computeDocumentationComment() => null; |
| 8209 | 8231 |
| 8210 @override | 8232 @override |
| 8233 AstNode computeNode() => null; |
| 8234 |
| 8235 @override |
| 8211 Element getAncestor(Predicate<Element> predicate) => null; | 8236 Element getAncestor(Predicate<Element> predicate) => null; |
| 8212 | 8237 |
| 8213 @override | 8238 @override |
| 8214 String getExtendedDisplayName(String shortName) { | 8239 String getExtendedDisplayName(String shortName) { |
| 8215 if (shortName != null) { | 8240 if (shortName != null) { |
| 8216 return shortName; | 8241 return shortName; |
| 8217 } | 8242 } |
| 8218 return displayName; | 8243 return displayName; |
| 8219 } | 8244 } |
| 8220 | 8245 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8389 /** | 8414 /** |
| 8390 * Return the Dart code of the default value, or `null` if no default value. | 8415 * Return the Dart code of the default value, or `null` if no default value. |
| 8391 */ | 8416 */ |
| 8392 String get defaultValueCode; | 8417 String get defaultValueCode; |
| 8393 | 8418 |
| 8394 /** | 8419 /** |
| 8395 * Return `true` if this parameter is an initializing formal parameter. | 8420 * Return `true` if this parameter is an initializing formal parameter. |
| 8396 */ | 8421 */ |
| 8397 bool get isInitializingFormal; | 8422 bool get isInitializingFormal; |
| 8398 | 8423 |
| 8399 @override | |
| 8400 FormalParameter get node; | |
| 8401 | |
| 8402 /** | 8424 /** |
| 8403 * Return the kind of this parameter. | 8425 * Return the kind of this parameter. |
| 8404 */ | 8426 */ |
| 8405 ParameterKind get parameterKind; | 8427 ParameterKind get parameterKind; |
| 8406 | 8428 |
| 8407 /** | 8429 /** |
| 8408 * Return a list containing all of the parameters defined by this parameter. | 8430 * Return a list containing all of the parameters defined by this parameter. |
| 8409 * A parameter will only define other parameters if it is a function typed | 8431 * A parameter will only define other parameters if it is a function typed |
| 8410 * parameter. | 8432 * parameter. |
| 8411 */ | 8433 */ |
| 8412 List<ParameterElement> get parameters; | 8434 List<ParameterElement> get parameters; |
| 8435 |
| 8436 @override |
| 8437 FormalParameter computeNode(); |
| 8413 } | 8438 } |
| 8414 | 8439 |
| 8415 /** | 8440 /** |
| 8416 * A concrete implementation of a [ParameterElement]. | 8441 * A concrete implementation of a [ParameterElement]. |
| 8417 */ | 8442 */ |
| 8418 class ParameterElementImpl extends VariableElementImpl | 8443 class ParameterElementImpl extends VariableElementImpl |
| 8419 with PotentiallyConstVariableElement implements ParameterElement { | 8444 with PotentiallyConstVariableElement implements ParameterElement { |
| 8420 /** | 8445 /** |
| 8421 * An empty list of parameter elements. | 8446 * An empty list of parameter elements. |
| 8422 */ | 8447 */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8480 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT); | 8505 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT); |
| 8481 | 8506 |
| 8482 @override | 8507 @override |
| 8483 bool get isPotentiallyMutatedInScope => | 8508 bool get isPotentiallyMutatedInScope => |
| 8484 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE); | 8509 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE); |
| 8485 | 8510 |
| 8486 @override | 8511 @override |
| 8487 ElementKind get kind => ElementKind.PARAMETER; | 8512 ElementKind get kind => ElementKind.PARAMETER; |
| 8488 | 8513 |
| 8489 @override | 8514 @override |
| 8490 FormalParameter get node => | |
| 8491 getNodeMatching((node) => node is FormalParameter); | |
| 8492 | |
| 8493 @override | |
| 8494 List<ParameterElement> get parameters => _parameters; | 8515 List<ParameterElement> get parameters => _parameters; |
| 8495 | 8516 |
| 8496 /** | 8517 /** |
| 8497 * Set the parameters defined by this executable element to the given | 8518 * Set the parameters defined by this executable element to the given |
| 8498 * [parameters]. | 8519 * [parameters]. |
| 8499 */ | 8520 */ |
| 8500 void set parameters(List<ParameterElement> parameters) { | 8521 void set parameters(List<ParameterElement> parameters) { |
| 8501 for (ParameterElement parameter in parameters) { | 8522 for (ParameterElement parameter in parameters) { |
| 8502 (parameter as ParameterElementImpl).enclosingElement = this; | 8523 (parameter as ParameterElementImpl).enclosingElement = this; |
| 8503 } | 8524 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8546 buffer.write(": "); | 8567 buffer.write(": "); |
| 8547 } | 8568 } |
| 8548 if (parameterKind == ParameterKind.POSITIONAL) { | 8569 if (parameterKind == ParameterKind.POSITIONAL) { |
| 8549 buffer.write(" = "); | 8570 buffer.write(" = "); |
| 8550 } | 8571 } |
| 8551 buffer.write(_defaultValueCode); | 8572 buffer.write(_defaultValueCode); |
| 8552 } | 8573 } |
| 8553 } | 8574 } |
| 8554 | 8575 |
| 8555 @override | 8576 @override |
| 8577 FormalParameter computeNode() => |
| 8578 getNodeMatching((node) => node is FormalParameter); |
| 8579 |
| 8580 @override |
| 8556 ElementImpl getChild(String identifier) { | 8581 ElementImpl getChild(String identifier) { |
| 8557 for (ParameterElement parameter in _parameters) { | 8582 for (ParameterElement parameter in _parameters) { |
| 8558 if ((parameter as ParameterElementImpl).identifier == identifier) { | 8583 if ((parameter as ParameterElementImpl).identifier == identifier) { |
| 8559 return parameter as ParameterElementImpl; | 8584 return parameter as ParameterElementImpl; |
| 8560 } | 8585 } |
| 8561 } | 8586 } |
| 8562 return null; | 8587 return null; |
| 8563 } | 8588 } |
| 8564 | 8589 |
| 8565 /** | 8590 /** |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8630 @override | 8655 @override |
| 8631 String get defaultValueCode => baseElement.defaultValueCode; | 8656 String get defaultValueCode => baseElement.defaultValueCode; |
| 8632 | 8657 |
| 8633 @override | 8658 @override |
| 8634 Element get enclosingElement => baseElement.enclosingElement; | 8659 Element get enclosingElement => baseElement.enclosingElement; |
| 8635 | 8660 |
| 8636 @override | 8661 @override |
| 8637 bool get isInitializingFormal => baseElement.isInitializingFormal; | 8662 bool get isInitializingFormal => baseElement.isInitializingFormal; |
| 8638 | 8663 |
| 8639 @override | 8664 @override |
| 8640 FormalParameter get node => baseElement.node; | |
| 8641 | |
| 8642 @override | |
| 8643 ParameterKind get parameterKind => baseElement.parameterKind; | 8665 ParameterKind get parameterKind => baseElement.parameterKind; |
| 8644 | 8666 |
| 8645 @override | 8667 @override |
| 8646 List<ParameterElement> get parameters { | 8668 List<ParameterElement> get parameters { |
| 8647 List<ParameterElement> baseParameters = baseElement.parameters; | 8669 List<ParameterElement> baseParameters = baseElement.parameters; |
| 8648 int parameterCount = baseParameters.length; | 8670 int parameterCount = baseParameters.length; |
| 8649 if (parameterCount == 0) { | 8671 if (parameterCount == 0) { |
| 8650 return baseParameters; | 8672 return baseParameters; |
| 8651 } | 8673 } |
| 8652 List<ParameterElement> parameterizedParameters = | 8674 List<ParameterElement> parameterizedParameters = |
| 8653 new List<ParameterElement>(parameterCount); | 8675 new List<ParameterElement>(parameterCount); |
| 8654 for (int i = 0; i < parameterCount; i++) { | 8676 for (int i = 0; i < parameterCount; i++) { |
| 8655 parameterizedParameters[i] = | 8677 parameterizedParameters[i] = |
| 8656 ParameterMember.from(baseParameters[i], definingType); | 8678 ParameterMember.from(baseParameters[i], definingType); |
| 8657 } | 8679 } |
| 8658 return parameterizedParameters; | 8680 return parameterizedParameters; |
| 8659 } | 8681 } |
| 8660 | 8682 |
| 8661 @override | 8683 @override |
| 8662 SourceRange get visibleRange => baseElement.visibleRange; | 8684 SourceRange get visibleRange => baseElement.visibleRange; |
| 8663 | 8685 |
| 8664 @override | 8686 @override |
| 8665 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); | 8687 accept(ElementVisitor visitor) => visitor.visitParameterElement(this); |
| 8666 | 8688 |
| 8667 @override | 8689 @override |
| 8690 FormalParameter computeNode() => baseElement.computeNode(); |
| 8691 |
| 8692 @override |
| 8668 Element getAncestor(Predicate<Element> predicate) { | 8693 Element getAncestor(Predicate<Element> predicate) { |
| 8669 Element element = baseElement.getAncestor(predicate); | 8694 Element element = baseElement.getAncestor(predicate); |
| 8670 ParameterizedType definingType = this.definingType; | 8695 ParameterizedType definingType = this.definingType; |
| 8671 if (definingType is InterfaceType) { | 8696 if (definingType is InterfaceType) { |
| 8672 InterfaceType definingInterfaceType = definingType; | 8697 InterfaceType definingInterfaceType = definingType; |
| 8673 if (element is ConstructorElement) { | 8698 if (element is ConstructorElement) { |
| 8674 return ConstructorMember.from(element, definingInterfaceType); | 8699 return ConstructorMember.from(element, definingInterfaceType); |
| 8675 } else if (element is MethodElement) { | 8700 } else if (element is MethodElement) { |
| 8676 return MethodMember.from(element, definingInterfaceType); | 8701 return MethodMember.from(element, definingInterfaceType); |
| 8677 } else if (element is PropertyAccessorElement) { | 8702 } else if (element is PropertyAccessorElement) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8992 } | 9017 } |
| 8993 | 9018 |
| 8994 @override | 9019 @override |
| 8995 String get name { | 9020 String get name { |
| 8996 if (isSetter) { | 9021 if (isSetter) { |
| 8997 return "${super.name}="; | 9022 return "${super.name}="; |
| 8998 } | 9023 } |
| 8999 return super.name; | 9024 return super.name; |
| 9000 } | 9025 } |
| 9001 | 9026 |
| 9002 @override | |
| 9003 AstNode get node { | |
| 9004 if (isSynthetic) { | |
| 9005 return null; | |
| 9006 } | |
| 9007 if (enclosingElement is ClassElement) { | |
| 9008 return getNodeMatching((node) => node is MethodDeclaration); | |
| 9009 } | |
| 9010 if (enclosingElement is CompilationUnitElement) { | |
| 9011 return getNodeMatching((node) => node is FunctionDeclaration); | |
| 9012 } | |
| 9013 return null; | |
| 9014 } | |
| 9015 | |
| 9016 /** | 9027 /** |
| 9017 * Set whether this accessor is a setter. | 9028 * Set whether this accessor is a setter. |
| 9018 */ | 9029 */ |
| 9019 void set setter(bool isSetter) { | 9030 void set setter(bool isSetter) { |
| 9020 setModifier(Modifier.SETTER, isSetter); | 9031 setModifier(Modifier.SETTER, isSetter); |
| 9021 } | 9032 } |
| 9022 | 9033 |
| 9023 /** | 9034 /** |
| 9024 * Set whether this accessor is static. | 9035 * Set whether this accessor is static. |
| 9025 */ | 9036 */ |
| 9026 void set static(bool isStatic) { | 9037 void set static(bool isStatic) { |
| 9027 setModifier(Modifier.STATIC, isStatic); | 9038 setModifier(Modifier.STATIC, isStatic); |
| 9028 } | 9039 } |
| 9029 | 9040 |
| 9030 @override | 9041 @override |
| 9031 bool operator ==(Object object) => super == object && | 9042 bool operator ==(Object object) => super == object && |
| 9032 isGetter == (object as PropertyAccessorElement).isGetter; | 9043 isGetter == (object as PropertyAccessorElement).isGetter; |
| 9033 | 9044 |
| 9034 @override | 9045 @override |
| 9035 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 9046 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
| 9036 | 9047 |
| 9037 @override | 9048 @override |
| 9038 void appendTo(StringBuffer buffer) { | 9049 void appendTo(StringBuffer buffer) { |
| 9039 buffer.write(isGetter ? "get " : "set "); | 9050 buffer.write(isGetter ? "get " : "set "); |
| 9040 buffer.write(variable.displayName); | 9051 buffer.write(variable.displayName); |
| 9041 super.appendTo(buffer); | 9052 super.appendTo(buffer); |
| 9042 } | 9053 } |
| 9054 |
| 9055 @override |
| 9056 AstNode computeNode() { |
| 9057 if (isSynthetic) { |
| 9058 return null; |
| 9059 } |
| 9060 if (enclosingElement is ClassElement) { |
| 9061 return getNodeMatching((node) => node is MethodDeclaration); |
| 9062 } |
| 9063 if (enclosingElement is CompilationUnitElement) { |
| 9064 return getNodeMatching((node) => node is FunctionDeclaration); |
| 9065 } |
| 9066 return null; |
| 9067 } |
| 9043 } | 9068 } |
| 9044 | 9069 |
| 9045 /** | 9070 /** |
| 9046 * A property accessor element defined in a parameterized type where the values | 9071 * A property accessor element defined in a parameterized type where the values |
| 9047 * of the type parameters are known. | 9072 * of the type parameters are known. |
| 9048 */ | 9073 */ |
| 9049 class PropertyAccessorMember extends ExecutableMember | 9074 class PropertyAccessorMember extends ExecutableMember |
| 9050 implements PropertyAccessorElement { | 9075 implements PropertyAccessorElement { |
| 9051 /** | 9076 /** |
| 9052 * Initialize a newly created element to represent a constructor, based on the | 9077 * Initialize a newly created element to represent a constructor, based on the |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9561 * A top-level variable. | 9586 * A top-level variable. |
| 9562 */ | 9587 */ |
| 9563 abstract class TopLevelVariableElement implements PropertyInducingElement { | 9588 abstract class TopLevelVariableElement implements PropertyInducingElement { |
| 9564 /** | 9589 /** |
| 9565 * An empty list of top-level variable elements. | 9590 * An empty list of top-level variable elements. |
| 9566 */ | 9591 */ |
| 9567 static const List<TopLevelVariableElement> EMPTY_LIST = | 9592 static const List<TopLevelVariableElement> EMPTY_LIST = |
| 9568 const <TopLevelVariableElement>[]; | 9593 const <TopLevelVariableElement>[]; |
| 9569 | 9594 |
| 9570 @override | 9595 @override |
| 9571 VariableDeclaration get node; | 9596 VariableDeclaration computeNode(); |
| 9572 } | 9597 } |
| 9573 | 9598 |
| 9574 /** | 9599 /** |
| 9575 * A concrete implementation of a [TopLevelVariableElement]. | 9600 * A concrete implementation of a [TopLevelVariableElement]. |
| 9576 */ | 9601 */ |
| 9577 class TopLevelVariableElementImpl extends PropertyInducingElementImpl | 9602 class TopLevelVariableElementImpl extends PropertyInducingElementImpl |
| 9578 with PotentiallyConstVariableElement implements TopLevelVariableElement { | 9603 with PotentiallyConstVariableElement implements TopLevelVariableElement { |
| 9579 /** | 9604 /** |
| 9580 * An empty list of top-level variable elements. | 9605 * An empty list of top-level variable elements. |
| 9581 */ | 9606 */ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 9595 */ | 9620 */ |
| 9596 TopLevelVariableElementImpl.forNode(Identifier name) : super.forNode(name); | 9621 TopLevelVariableElementImpl.forNode(Identifier name) : super.forNode(name); |
| 9597 | 9622 |
| 9598 @override | 9623 @override |
| 9599 bool get isStatic => true; | 9624 bool get isStatic => true; |
| 9600 | 9625 |
| 9601 @override | 9626 @override |
| 9602 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; | 9627 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; |
| 9603 | 9628 |
| 9604 @override | 9629 @override |
| 9605 VariableDeclaration get node => | 9630 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); |
| 9606 getNodeMatching((node) => node is VariableDeclaration); | |
| 9607 | 9631 |
| 9608 @override | 9632 @override |
| 9609 accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this); | 9633 VariableDeclaration computeNode() => |
| 9634 getNodeMatching((node) => node is VariableDeclaration); |
| 9610 } | 9635 } |
| 9611 | 9636 |
| 9612 /** | 9637 /** |
| 9613 * The abstract class `TypeImpl` implements the behavior common to objects | 9638 * The abstract class `TypeImpl` implements the behavior common to objects |
| 9614 * representing the declared type of elements in the element model. | 9639 * representing the declared type of elements in the element model. |
| 9615 */ | 9640 */ |
| 9616 abstract class TypeImpl implements DartType { | 9641 abstract class TypeImpl implements DartType { |
| 9617 /** | 9642 /** |
| 9618 * An empty list of types. | 9643 * An empty list of types. |
| 9619 */ | 9644 */ |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10431 | 10456 |
| 10432 @override | 10457 @override |
| 10433 void visitElement(Element element) { | 10458 void visitElement(Element element) { |
| 10434 int offset = element.nameOffset; | 10459 int offset = element.nameOffset; |
| 10435 if (offset != -1) { | 10460 if (offset != -1) { |
| 10436 map[offset] = element; | 10461 map[offset] = element; |
| 10437 } | 10462 } |
| 10438 super.visitElement(element); | 10463 super.visitElement(element); |
| 10439 } | 10464 } |
| 10440 } | 10465 } |
| OLD | NEW |