mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:47:36 +00:00
Create a TypeDefiningElement interface.
This interface is common to ClassElement, FunctionTypeAliasElement, and the element for the pseudo-type "dynamic". This should allow us to avoid some unnecessary casting in the dev_compiler (see https://codereview.chromium.org/1160223006/#msg11). R=brianwilkerson@google.com Review URL: https://codereview.chromium.org//1165213002
This commit is contained in:
parent
12696cafe9
commit
2c533ac971
|
@ -128,7 +128,7 @@ class CircularTypeImpl extends DynamicTypeImpl {
|
|||
/**
|
||||
* An element that represents a class.
|
||||
*/
|
||||
abstract class ClassElement implements Element {
|
||||
abstract class ClassElement implements TypeDefiningElement {
|
||||
/**
|
||||
* An empty list of class elements.
|
||||
*/
|
||||
|
@ -265,9 +265,7 @@ abstract class ClassElement implements Element {
|
|||
*/
|
||||
InterfaceType get supertype;
|
||||
|
||||
/**
|
||||
* Return the type defined by the class.
|
||||
*/
|
||||
@override
|
||||
InterfaceType get type;
|
||||
|
||||
/**
|
||||
|
@ -2154,16 +2152,14 @@ class DefaultParameterElementImpl extends ParameterElementImpl
|
|||
/**
|
||||
* The synthetic element representing the declaration of the type `dynamic`.
|
||||
*/
|
||||
class DynamicElementImpl extends ElementImpl {
|
||||
class DynamicElementImpl extends ElementImpl implements TypeDefiningElement {
|
||||
/**
|
||||
* Return the unique instance of this class.
|
||||
*/
|
||||
static DynamicElementImpl get instance =>
|
||||
DynamicTypeImpl.instance.element as DynamicElementImpl;
|
||||
|
||||
/**
|
||||
* The type defined by this element.
|
||||
*/
|
||||
@override
|
||||
DynamicTypeImpl type;
|
||||
|
||||
/**
|
||||
|
@ -4371,7 +4367,7 @@ abstract class FunctionType implements ParameterizedType {
|
|||
/**
|
||||
* A function type alias (`typedef`).
|
||||
*/
|
||||
abstract class FunctionTypeAliasElement implements Element {
|
||||
abstract class FunctionTypeAliasElement implements TypeDefiningElement {
|
||||
/**
|
||||
* An empty array of type alias elements.
|
||||
*/
|
||||
|
@ -4394,9 +4390,7 @@ abstract class FunctionTypeAliasElement implements Element {
|
|||
*/
|
||||
DartType get returnType;
|
||||
|
||||
/**
|
||||
* Return the type of function defined by this type alias.
|
||||
*/
|
||||
@override
|
||||
FunctionType get type;
|
||||
|
||||
/**
|
||||
|
@ -9623,6 +9617,16 @@ class TopLevelVariableElementImpl extends PropertyInducingElementImpl
|
|||
getNodeMatching((node) => node is VariableDeclaration);
|
||||
}
|
||||
|
||||
/**
|
||||
* An element that defines a type.
|
||||
*/
|
||||
abstract class TypeDefiningElement implements Element {
|
||||
/**
|
||||
* Return the type defined by this element.
|
||||
*/
|
||||
DartType get type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The abstract class `TypeImpl` implements the behavior common to objects
|
||||
* representing the declared type of elements in the element model.
|
||||
|
|
Loading…
Reference in a new issue