| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 elements; | 5 library elements; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 * A declared element of a program. | 134 * A declared element of a program. |
| 135 * | 135 * |
| 136 * The declared elements of a program include classes, methods, | 136 * The declared elements of a program include classes, methods, |
| 137 * fields, variables, parameters, etc. | 137 * fields, variables, parameters, etc. |
| 138 * | 138 * |
| 139 * Sometimes it makes sense to construct "synthetic" elements that | 139 * Sometimes it makes sense to construct "synthetic" elements that |
| 140 * have not been declared anywhere in a program, for example, there | 140 * have not been declared anywhere in a program, for example, there |
| 141 * are elements corresponding to "dynamic", "null", and unresolved | 141 * are elements corresponding to "dynamic", "null", and unresolved |
| 142 * references. | 142 * references. |
| 143 * | 143 * |
| 144 * Elements are distinct from types ([DartType]). For example, there | 144 * Elements are distinct from types ([ResolutionDartType]). For example, there |
| 145 * is one declaration of the class List, but several related types, | 145 * is one declaration of the class List, but several related types, |
| 146 * for example, List, List<int>, List<String>, etc. | 146 * for example, List, List<int>, List<String>, etc. |
| 147 * | 147 * |
| 148 * Elements are distinct from AST nodes ([Node]), and there normally is a | 148 * Elements are distinct from AST nodes ([Node]), and there normally is a |
| 149 * one-to-one correspondence between an AST node and an element | 149 * one-to-one correspondence between an AST node and an element |
| 150 * (except that not all kinds of AST nodes have an associated | 150 * (except that not all kinds of AST nodes have an associated |
| 151 * element). | 151 * element). |
| 152 * | 152 * |
| 153 * AST nodes represent precisely what is written in source code, for | 153 * AST nodes represent precisely what is written in source code, for |
| 154 * example, when a user writes "class MyClass {}", the corresponding | 154 * example, when a user writes "class MyClass {}", the corresponding |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 GetterElement get loadLibrary; | 991 GetterElement get loadLibrary; |
| 992 } | 992 } |
| 993 | 993 |
| 994 /// A type alias definition. | 994 /// A type alias definition. |
| 995 abstract class TypedefElement extends Element | 995 abstract class TypedefElement extends Element |
| 996 implements AstElement, TypeDeclarationElement, FunctionTypedElement { | 996 implements AstElement, TypeDeclarationElement, FunctionTypedElement { |
| 997 /// The type defined by this typedef with the type variables as its type | 997 /// The type defined by this typedef with the type variables as its type |
| 998 /// arguments. | 998 /// arguments. |
| 999 /// | 999 /// |
| 1000 /// For instance `F<T>` for `typedef void F<T>(T t)`. | 1000 /// For instance `F<T>` for `typedef void F<T>(T t)`. |
| 1001 TypedefType get thisType; | 1001 ResolutionTypedefType get thisType; |
| 1002 | 1002 |
| 1003 /// The type defined by this typedef with `dynamic` as its type arguments. | 1003 /// The type defined by this typedef with `dynamic` as its type arguments. |
| 1004 /// | 1004 /// |
| 1005 /// For instance `F<dynamic>` for `typedef void F<T>(T t)`. | 1005 /// For instance `F<dynamic>` for `typedef void F<T>(T t)`. |
| 1006 TypedefType get rawType; | 1006 ResolutionTypedefType get rawType; |
| 1007 | 1007 |
| 1008 /// The type, function type if well-defined, for which this typedef is an | 1008 /// The type, function type if well-defined, for which this typedef is an |
| 1009 /// alias. | 1009 /// alias. |
| 1010 /// | 1010 /// |
| 1011 /// For instance `(int)->void` for `typedef void F(int)`. | 1011 /// For instance `(int)->void` for `typedef void F(int)`. |
| 1012 DartType get alias; | 1012 ResolutionDartType get alias; |
| 1013 | 1013 |
| 1014 void checkCyclicReference(Resolution resolution); | 1014 void checkCyclicReference(Resolution resolution); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 /// An executable element is an element that can hold code. | 1017 /// An executable element is an element that can hold code. |
| 1018 /// | 1018 /// |
| 1019 /// These elements variables (fields, parameters and locals), which can hold | 1019 /// These elements variables (fields, parameters and locals), which can hold |
| 1020 /// code in their initializer, and functions (including methods and | 1020 /// code in their initializer, and functions (including methods and |
| 1021 /// constructors), which can hold code in their body. | 1021 /// constructors), which can hold code in their body. |
| 1022 abstract class ExecutableElement extends Element | 1022 abstract class ExecutableElement extends Element |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 * This element unifies handling of fields and getters/setters. When | 1158 * This element unifies handling of fields and getters/setters. When |
| 1159 * looking at code like "foo.x", we don't have to look for both a | 1159 * looking at code like "foo.x", we don't have to look for both a |
| 1160 * field named "x", a getter named "x", and a setter named "x=". | 1160 * field named "x", a getter named "x", and a setter named "x=". |
| 1161 */ | 1161 */ |
| 1162 abstract class AbstractFieldElement extends Element { | 1162 abstract class AbstractFieldElement extends Element { |
| 1163 GetterElement get getter; | 1163 GetterElement get getter; |
| 1164 SetterElement get setter; | 1164 SetterElement get setter; |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 abstract class FunctionSignature { | 1167 abstract class FunctionSignature { |
| 1168 FunctionType get type; | 1168 ResolutionFunctionType get type; |
| 1169 DartType get returnType; | 1169 ResolutionDartType get returnType; |
| 1170 List<DartType> get typeVariables; | 1170 List<ResolutionDartType> get typeVariables; |
| 1171 List<FormalElement> get requiredParameters; | 1171 List<FormalElement> get requiredParameters; |
| 1172 List<FormalElement> get optionalParameters; | 1172 List<FormalElement> get optionalParameters; |
| 1173 | 1173 |
| 1174 int get requiredParameterCount; | 1174 int get requiredParameterCount; |
| 1175 int get optionalParameterCount; | 1175 int get optionalParameterCount; |
| 1176 bool get optionalParametersAreNamed; | 1176 bool get optionalParametersAreNamed; |
| 1177 bool get hasOptionalParameters; | 1177 bool get hasOptionalParameters; |
| 1178 | 1178 |
| 1179 int get parameterCount; | 1179 int get parameterCount; |
| 1180 List<FormalElement> get orderedOptionalParameters; | 1180 List<FormalElement> get orderedOptionalParameters; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1201 | 1201 |
| 1202 FunctionElement get patch; | 1202 FunctionElement get patch; |
| 1203 FunctionElement get origin; | 1203 FunctionElement get origin; |
| 1204 | 1204 |
| 1205 bool get hasFunctionSignature; | 1205 bool get hasFunctionSignature; |
| 1206 | 1206 |
| 1207 /// The parameters of this function. | 1207 /// The parameters of this function. |
| 1208 List<ParameterElement> get parameters; | 1208 List<ParameterElement> get parameters; |
| 1209 | 1209 |
| 1210 /// The type of this function. | 1210 /// The type of this function. |
| 1211 FunctionType get type; | 1211 ResolutionFunctionType get type; |
| 1212 | 1212 |
| 1213 /// The synchronous/asynchronous marker on this function. | 1213 /// The synchronous/asynchronous marker on this function. |
| 1214 AsyncMarker get asyncMarker; | 1214 AsyncMarker get asyncMarker; |
| 1215 | 1215 |
| 1216 /// `true` if this function is external. | 1216 /// `true` if this function is external. |
| 1217 bool get isExternal; | 1217 bool get isExternal; |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 /// A getter or setter. | 1220 /// A getter or setter. |
| 1221 abstract class AccessorElement extends MethodElement { | 1221 abstract class AccessorElement extends MethodElement { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 /// - it is part of a redirection cycle, | 1346 /// - it is part of a redirection cycle, |
| 1347 /// - the effective target is a generative constructor on an abstract | 1347 /// - the effective target is a generative constructor on an abstract |
| 1348 /// class, or | 1348 /// class, or |
| 1349 /// - this constructor is constant but the effective target is not, | 1349 /// - this constructor is constant but the effective target is not, |
| 1350 /// - the arguments to this constructor are incompatible with the | 1350 /// - the arguments to this constructor are incompatible with the |
| 1351 /// parameters of the effective target. | 1351 /// parameters of the effective target. |
| 1352 bool get isEffectiveTargetMalformed; | 1352 bool get isEffectiveTargetMalformed; |
| 1353 | 1353 |
| 1354 /// Compute the type of the effective target of this constructor for an | 1354 /// Compute the type of the effective target of this constructor for an |
| 1355 /// instantiation site with type [:newType:]. | 1355 /// instantiation site with type [:newType:]. |
| 1356 InterfaceType computeEffectiveTargetType(InterfaceType newType); | 1356 ResolutionInterfaceType computeEffectiveTargetType( |
| 1357 ResolutionInterfaceType newType); |
| 1357 | 1358 |
| 1358 /// If this is a synthesized constructor [definingConstructor] points to | 1359 /// If this is a synthesized constructor [definingConstructor] points to |
| 1359 /// the generative constructor from which this constructor was created. | 1360 /// the generative constructor from which this constructor was created. |
| 1360 /// Otherwise [definingConstructor] is `null`. | 1361 /// Otherwise [definingConstructor] is `null`. |
| 1361 /// | 1362 /// |
| 1362 /// Consider for instance this hierarchy: | 1363 /// Consider for instance this hierarchy: |
| 1363 /// | 1364 /// |
| 1364 /// class C { C.c(a, {b}); | 1365 /// class C { C.c(a, {b}); |
| 1365 /// class D {} | 1366 /// class D {} |
| 1366 /// class E = C with D; | 1367 /// class E = C with D; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 | 1403 |
| 1403 /// [GenericElement] defines the common interface for generic functions and | 1404 /// [GenericElement] defines the common interface for generic functions and |
| 1404 /// [TypeDeclarationElement]. | 1405 /// [TypeDeclarationElement]. |
| 1405 abstract class GenericElement extends Element implements AstElement { | 1406 abstract class GenericElement extends Element implements AstElement { |
| 1406 /// Do not use [computeType] outside of the resolver. | 1407 /// Do not use [computeType] outside of the resolver. |
| 1407 /// | 1408 /// |
| 1408 /// Trying to access a type that has not been computed in resolution is an | 1409 /// Trying to access a type that has not been computed in resolution is an |
| 1409 /// error and calling [computeType] covers that error. | 1410 /// error and calling [computeType] covers that error. |
| 1410 /// This method will go away! | 1411 /// This method will go away! |
| 1411 @deprecated | 1412 @deprecated |
| 1412 DartType computeType(Resolution resolution); | 1413 ResolutionDartType computeType(Resolution resolution); |
| 1413 | 1414 |
| 1414 /** | 1415 /** |
| 1415 * The type variables declared on this declaration. The type variables are not | 1416 * The type variables declared on this declaration. The type variables are not |
| 1416 * available until the type of the element has been computed through | 1417 * available until the type of the element has been computed through |
| 1417 * [computeType]. | 1418 * [computeType]. |
| 1418 */ | 1419 */ |
| 1419 List<DartType> get typeVariables; | 1420 List<ResolutionDartType> get typeVariables; |
| 1420 } | 1421 } |
| 1421 | 1422 |
| 1422 /// [TypeDeclarationElement] defines the common interface for class/interface | 1423 /// [TypeDeclarationElement] defines the common interface for class/interface |
| 1423 /// declarations and typedefs. | 1424 /// declarations and typedefs. |
| 1424 abstract class TypeDeclarationElement extends GenericElement { | 1425 abstract class TypeDeclarationElement extends GenericElement { |
| 1425 /// The name of this type declaration, taking privacy into account. | 1426 /// The name of this type declaration, taking privacy into account. |
| 1426 Name get memberName; | 1427 Name get memberName; |
| 1427 | 1428 |
| 1428 /// Do not use [computeType] outside of the resolver; instead retrieve the | 1429 /// Do not use [computeType] outside of the resolver; instead retrieve the |
| 1429 /// type from the [thisType] or [rawType], depending on the use case. | 1430 /// type from the [thisType] or [rawType], depending on the use case. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1450 * | 1451 * |
| 1451 * The raw type is the generic type base on this element in which the type | 1452 * The raw type is the generic type base on this element in which the type |
| 1452 * arguments are all [dynamic]. For instance [:List<dynamic>:] for [:List:] | 1453 * arguments are all [dynamic]. For instance [:List<dynamic>:] for [:List:] |
| 1453 * and [:Map<dynamic,dynamic>:] for [:Map:]. For non-generic classes [rawType] | 1454 * and [:Map<dynamic,dynamic>:] for [:Map:]. For non-generic classes [rawType] |
| 1454 * is the same as [thisType]. | 1455 * is the same as [thisType]. |
| 1455 * | 1456 * |
| 1456 * The [rawType] field is a canonicalization of the raw type and should be | 1457 * The [rawType] field is a canonicalization of the raw type and should be |
| 1457 * used to distinguish explicit and implicit uses of the [dynamic] | 1458 * used to distinguish explicit and implicit uses of the [dynamic] |
| 1458 * type arguments. For instance should [:List:] be the [rawType] of the | 1459 * type arguments. For instance should [:List:] be the [rawType] of the |
| 1459 * [:List:] class element whereas [:List<dynamic>:] should be its own | 1460 * [:List:] class element whereas [:List<dynamic>:] should be its own |
| 1460 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using | 1461 * instantiation of [ResolutionInterfaceType] with [:dynamic:] as type |
| 1461 * this distinction, we can print the raw type with type arguments only when | 1462 * argument. Using this distinction, we can print the raw type with type |
| 1462 * the input source has used explicit type arguments. | 1463 * arguments only when the input source has used explicit type arguments. |
| 1463 */ | 1464 */ |
| 1464 GenericType get rawType; | 1465 GenericType get rawType; |
| 1465 | 1466 |
| 1466 bool get isResolved; | 1467 bool get isResolved; |
| 1467 | 1468 |
| 1468 void ensureResolved(Resolution resolution); | 1469 void ensureResolved(Resolution resolution); |
| 1469 } | 1470 } |
| 1470 | 1471 |
| 1471 abstract class ClassElement extends TypeDeclarationElement | 1472 abstract class ClassElement extends TypeDeclarationElement |
| 1472 implements ScopeContainerElement, ClassEntity { | 1473 implements ScopeContainerElement, ClassEntity { |
| 1473 /// The length of the longest inheritance path from [:Object:]. | 1474 /// The length of the longest inheritance path from [:Object:]. |
| 1474 int get hierarchyDepth; | 1475 int get hierarchyDepth; |
| 1475 | 1476 |
| 1476 InterfaceType get rawType; | 1477 ResolutionInterfaceType get rawType; |
| 1477 InterfaceType get thisType; | 1478 ResolutionInterfaceType get thisType; |
| 1478 ClassElement get superclass; | 1479 ClassElement get superclass; |
| 1479 | 1480 |
| 1480 /// The direct supertype of this class. | 1481 /// The direct supertype of this class. |
| 1481 DartType get supertype; | 1482 ResolutionDartType get supertype; |
| 1482 | 1483 |
| 1483 /// Ordered set of all supertypes of this class including the class itself. | 1484 /// Ordered set of all supertypes of this class including the class itself. |
| 1484 OrderedTypeSet get allSupertypesAndSelf; | 1485 OrderedTypeSet get allSupertypesAndSelf; |
| 1485 | 1486 |
| 1486 /// A list of all supertypes of this class excluding the class itself. | 1487 /// A list of all supertypes of this class excluding the class itself. |
| 1487 Link<DartType> get allSupertypes; | 1488 Link<ResolutionDartType> get allSupertypes; |
| 1488 | 1489 |
| 1489 /// Returns the this type of this class as an instance of [cls]. | 1490 /// Returns the this type of this class as an instance of [cls]. |
| 1490 InterfaceType asInstanceOf(ClassElement cls); | 1491 ResolutionInterfaceType asInstanceOf(ClassElement cls); |
| 1491 | 1492 |
| 1492 /// A list of all direct superinterfaces of this class. | 1493 /// A list of all direct superinterfaces of this class. |
| 1493 Link<DartType> get interfaces; | 1494 Link<ResolutionDartType> get interfaces; |
| 1494 | 1495 |
| 1495 bool get hasConstructor; | 1496 bool get hasConstructor; |
| 1496 Link<Element> get constructors; | 1497 Link<Element> get constructors; |
| 1497 | 1498 |
| 1498 ClassElement get patch; | 1499 ClassElement get patch; |
| 1499 ClassElement get origin; | 1500 ClassElement get origin; |
| 1500 ClassElement get declaration; | 1501 ClassElement get declaration; |
| 1501 ClassElement get implementation; | 1502 ClassElement get implementation; |
| 1502 | 1503 |
| 1503 /// `true` if this class is an enum declaration. | 1504 /// `true` if this class is an enum declaration. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 void forEachClassMember(f(Member member)); | 1595 void forEachClassMember(f(Member member)); |
| 1595 | 1596 |
| 1596 /// Looks up the member [name] in the interface of this class. | 1597 /// Looks up the member [name] in the interface of this class. |
| 1597 MemberSignature lookupInterfaceMember(Name name); | 1598 MemberSignature lookupInterfaceMember(Name name); |
| 1598 | 1599 |
| 1599 /// Calls [f] with each member of the interface of this class. | 1600 /// Calls [f] with each member of the interface of this class. |
| 1600 void forEachInterfaceMember(f(MemberSignature member)); | 1601 void forEachInterfaceMember(f(MemberSignature member)); |
| 1601 | 1602 |
| 1602 /// Returns the type of the 'call' method in the interface of this class, or | 1603 /// Returns the type of the 'call' method in the interface of this class, or |
| 1603 /// `null` if the interface has no 'call' method. | 1604 /// `null` if the interface has no 'call' method. |
| 1604 FunctionType get callType; | 1605 ResolutionFunctionType get callType; |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 abstract class MixinApplicationElement extends ClassElement { | 1608 abstract class MixinApplicationElement extends ClassElement { |
| 1608 ClassElement get mixin; | 1609 ClassElement get mixin; |
| 1609 InterfaceType get mixinType; | 1610 ResolutionInterfaceType get mixinType; |
| 1610 | 1611 |
| 1611 /// If this is an unnamed mixin application [subclass] is the subclass for | 1612 /// If this is an unnamed mixin application [subclass] is the subclass for |
| 1612 /// which this mixin application is created. | 1613 /// which this mixin application is created. |
| 1613 ClassElement get subclass; | 1614 ClassElement get subclass; |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 /// Enum declaration. | 1617 /// Enum declaration. |
| 1617 abstract class EnumClassElement extends ClassElement { | 1618 abstract class EnumClassElement extends ClassElement { |
| 1618 /// The static fields implied by the enum values. | 1619 /// The static fields implied by the enum values. |
| 1619 List<EnumConstantElement> get enumValues; | 1620 List<EnumConstantElement> get enumValues; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 get enclosingElement; | 1673 get enclosingElement; |
| 1673 | 1674 |
| 1674 /// The class, typedef, function, method, or function typed parameter on | 1675 /// The class, typedef, function, method, or function typed parameter on |
| 1675 /// which this type variable is defined. | 1676 /// which this type variable is defined. |
| 1676 GenericElement get typeDeclaration; | 1677 GenericElement get typeDeclaration; |
| 1677 | 1678 |
| 1678 /// The index of this type variable within its type declaration. | 1679 /// The index of this type variable within its type declaration. |
| 1679 int get index; | 1680 int get index; |
| 1680 | 1681 |
| 1681 /// The [type] defined by the type variable. | 1682 /// The [type] defined by the type variable. |
| 1682 TypeVariableType get type; | 1683 ResolutionTypeVariableType get type; |
| 1683 | 1684 |
| 1684 /// The upper bound on the type variable. If not explicitly declared, this is | 1685 /// The upper bound on the type variable. If not explicitly declared, this is |
| 1685 /// `Object`. | 1686 /// `Object`. |
| 1686 DartType get bound; | 1687 ResolutionDartType get bound; |
| 1687 } | 1688 } |
| 1688 | 1689 |
| 1689 abstract class MetadataAnnotation implements Spannable { | 1690 abstract class MetadataAnnotation implements Spannable { |
| 1690 /// The front-end constant of this metadata annotation. | 1691 /// The front-end constant of this metadata annotation. |
| 1691 ConstantExpression get constant; | 1692 ConstantExpression get constant; |
| 1692 Element get annotatedElement; | 1693 Element get annotatedElement; |
| 1693 SourceSpan get sourcePosition; | 1694 SourceSpan get sourcePosition; |
| 1694 | 1695 |
| 1695 bool get hasNode; | 1696 bool get hasNode; |
| 1696 Node get node; | 1697 Node get node; |
| 1697 | 1698 |
| 1698 MetadataAnnotation ensureResolved(Resolution resolution); | 1699 MetadataAnnotation ensureResolved(Resolution resolution); |
| 1699 } | 1700 } |
| 1700 | 1701 |
| 1701 /// An [Element] that has a type. | 1702 /// An [Element] that has a type. |
| 1702 abstract class TypedElement extends Element { | 1703 abstract class TypedElement extends Element { |
| 1703 /// Do not use [computeType] outside of the resolver; instead retrieve the | 1704 /// Do not use [computeType] outside of the resolver; instead retrieve the |
| 1704 /// type from [type] property. | 1705 /// type from [type] property. |
| 1705 /// | 1706 /// |
| 1706 /// Trying to access a type that has not been computed in resolution is an | 1707 /// Trying to access a type that has not been computed in resolution is an |
| 1707 /// error and calling [computeType] covers that error. | 1708 /// error and calling [computeType] covers that error. |
| 1708 /// This method will go away! | 1709 /// This method will go away! |
| 1709 @deprecated | 1710 @deprecated |
| 1710 DartType computeType(Resolution resolution); | 1711 ResolutionDartType computeType(Resolution resolution); |
| 1711 | 1712 |
| 1712 DartType get type; | 1713 ResolutionDartType get type; |
| 1713 } | 1714 } |
| 1714 | 1715 |
| 1715 /// An [Element] that can define a function type. | 1716 /// An [Element] that can define a function type. |
| 1716 abstract class FunctionTypedElement extends Element implements GenericElement { | 1717 abstract class FunctionTypedElement extends Element implements GenericElement { |
| 1717 /// The function signature for the function type defined by this element, | 1718 /// The function signature for the function type defined by this element, |
| 1718 /// if any. | 1719 /// if any. |
| 1719 FunctionSignature get functionSignature; | 1720 FunctionSignature get functionSignature; |
| 1720 } | 1721 } |
| 1721 | 1722 |
| 1722 /// An [Element] that holds a [TreeElements] mapping. | 1723 /// An [Element] that holds a [TreeElements] mapping. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 /// | 1854 /// |
| 1854 /// A [MemberSignature] may be defined by a member declaration or may be | 1855 /// A [MemberSignature] may be defined by a member declaration or may be |
| 1855 /// synthetized from a set of declarations. | 1856 /// synthetized from a set of declarations. |
| 1856 abstract class MemberSignature { | 1857 abstract class MemberSignature { |
| 1857 /// The name of this member. | 1858 /// The name of this member. |
| 1858 Name get name; | 1859 Name get name; |
| 1859 | 1860 |
| 1860 /// The type of the member when accessed. For getters and setters this is the | 1861 /// The type of the member when accessed. For getters and setters this is the |
| 1861 /// return type and argument type, respectively. For methods the type is the | 1862 /// return type and argument type, respectively. For methods the type is the |
| 1862 /// [functionType] defined by the return type and parameters. | 1863 /// [functionType] defined by the return type and parameters. |
| 1863 DartType get type; | 1864 ResolutionDartType get type; |
| 1864 | 1865 |
| 1865 /// The function type of the member. For a getter `Foo get foo` this is | 1866 /// The function type of the member. For a getter `Foo get foo` this is |
| 1866 /// `() -> Foo`, for a setter `void set foo(Foo _)` this is `(Foo) -> void`. | 1867 /// `() -> Foo`, for a setter `void set foo(Foo _)` this is `(Foo) -> void`. |
| 1867 /// For methods the function type is defined by the return type and | 1868 /// For methods the function type is defined by the return type and |
| 1868 /// parameters. | 1869 /// parameters. |
| 1869 FunctionType get functionType; | 1870 ResolutionFunctionType get functionType; |
| 1870 | 1871 |
| 1871 /// Returns `true` if this member is a getter, possibly implictly defined by a | 1872 /// Returns `true` if this member is a getter, possibly implictly defined by a |
| 1872 /// field declaration. | 1873 /// field declaration. |
| 1873 bool get isGetter; | 1874 bool get isGetter; |
| 1874 | 1875 |
| 1875 /// Returns `true` if this member is a setter, possibly implictly defined by a | 1876 /// Returns `true` if this member is a setter, possibly implictly defined by a |
| 1876 /// field declaration. | 1877 /// field declaration. |
| 1877 bool get isSetter; | 1878 bool get isSetter; |
| 1878 | 1879 |
| 1879 /// Returns `true` if this member is a method, that is neither a getter nor | 1880 /// Returns `true` if this member is a method, that is neither a getter nor |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1901 /// a getter or setter defined by a field. | 1902 /// a getter or setter defined by a field. |
| 1902 Element get element; | 1903 Element get element; |
| 1903 | 1904 |
| 1904 /// The instance of the class that declared this member. | 1905 /// The instance of the class that declared this member. |
| 1905 /// | 1906 /// |
| 1906 /// For instance: | 1907 /// For instance: |
| 1907 /// class A<T> { T m() {} } | 1908 /// class A<T> { T m() {} } |
| 1908 /// class B<S> extends A<S> {} | 1909 /// class B<S> extends A<S> {} |
| 1909 /// The declarer of `m` in `A` is `A<T>` whereas the declarer of `m` in `B` is | 1910 /// The declarer of `m` in `A` is `A<T>` whereas the declarer of `m` in `B` is |
| 1910 /// `A<S>`. | 1911 /// `A<S>`. |
| 1911 InterfaceType get declarer; | 1912 ResolutionInterfaceType get declarer; |
| 1912 | 1913 |
| 1913 /// Returns `true` if this member is static. | 1914 /// Returns `true` if this member is static. |
| 1914 bool get isStatic; | 1915 bool get isStatic; |
| 1915 | 1916 |
| 1916 /// Returns `true` if this member is a getter or setter implicitly declared | 1917 /// Returns `true` if this member is a getter or setter implicitly declared |
| 1917 /// by a field. | 1918 /// by a field. |
| 1918 bool get isDeclaredByField; | 1919 bool get isDeclaredByField; |
| 1919 | 1920 |
| 1920 /// Returns `true` if this member is abstract. | 1921 /// Returns `true` if this member is abstract. |
| 1921 bool get isAbstract; | 1922 bool get isAbstract; |
| 1922 | 1923 |
| 1923 /// If abstract, [implementation] points to the overridden concrete member, | 1924 /// If abstract, [implementation] points to the overridden concrete member, |
| 1924 /// if any. Otherwise [implementation] points to the member itself. | 1925 /// if any. Otherwise [implementation] points to the member itself. |
| 1925 Member get implementation; | 1926 Member get implementation; |
| 1926 } | 1927 } |
| OLD | NEW |