Chromium Code Reviews| Index: pkg/compiler/lib/src/elements/elements.dart |
| diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart |
| index e854e4d17c07de57c311944412d782f0acef2206..7b7ab77a74362fc385a374178417d285e8ceabad 100644 |
| --- a/pkg/compiler/lib/src/elements/elements.dart |
| +++ b/pkg/compiler/lib/src/elements/elements.dart |
| @@ -128,6 +128,41 @@ abstract class Entity implements Spannable { |
| String get name; |
| } |
| +/// Stripped down super interface for class like entities. |
| +/// |
| +/// Currently only [ClassElement] but later also kernel based Dart classes |
| +/// and/or Dart-in-JS classes. |
| +abstract class ClassLike extends Entity { |
|
Siggi Cherem (dart-lang)
2016/11/03 00:52:30
maybe it is too early to tell, but how much from C
Johnni Winther
2016/11/03 09:55:06
Not much: I plan to move most queries on relations
|
| + bool get isClosure; |
| + void forEachInstanceField(f(ClassLike cls, FieldLike field), |
| + {bool includeSuperAndInjectedMembers: false}); |
| +} |
| + |
| +/// Stripped down super interface for member like entities, that is, |
| +/// constructors, methods, fields etc. |
| +/// |
| +/// Currently only [MemberElement] but later also kernel based Dart members |
| +/// and/or Dart-in-JS properties. |
| +abstract class MemberLike extends Entity { |
| + bool get isField; |
| + bool get isFunction; |
| + bool get isGetter; |
| + bool get isAssignable; |
| + ClassLike get enclosingClass; |
| +} |
| + |
| +/// Stripped down super interface for field like entities. |
| +/// |
| +/// Currently only [FieldElement] but later also kernel based Dart fields |
| +/// and/or Dart-in-JS field-like properties. |
| +abstract class FieldLike extends MemberLike {} |
| + |
| +/// Stripped down super interface for function like entities. |
| +/// |
| +/// Currently only [FieldElement] but later also kernel based Dart constructors |
| +/// and methods and/or Dart-in-JS function-like properties. |
| +abstract class FunctionLike extends MemberLike {} |
|
Siggi Cherem (dart-lang)
2016/11/03 00:52:30
I'm not yet convinced on using the "XLike" names :
Johnni Winther
2016/11/03 09:55:06
Moved to 'entities.dart', use 'Entity' as suffix.
|
| + |
| /** |
| * A declared element of a program. |
| * |
| @@ -1047,7 +1082,8 @@ abstract class ExecutableElement extends Element |
| /// |
| /// A [MemberElement] is the outermost executable element for any executable |
| /// context. |
| -abstract class MemberElement extends Element implements ExecutableElement { |
| +abstract class MemberElement extends Element |
| + implements ExecutableElement, MemberLike { |
| /// The local functions defined within this member. |
| List<FunctionElement> get nestedClosures; |
| @@ -1100,7 +1136,8 @@ abstract class LocalVariableElement extends VariableElement |
| implements LocalElement {} |
| /// A top-level, static or instance field. |
| -abstract class FieldElement extends VariableElement implements MemberElement {} |
| +abstract class FieldElement extends VariableElement |
| + implements MemberElement, FieldLike {} |
| /// A parameter-like element of a function signature. |
| /// |
| @@ -1291,15 +1328,15 @@ class AsyncMarker { |
| } |
| /// A top level, static or instance function. |
| -abstract class MethodElement extends FunctionElement implements MemberElement {} |
| +abstract class MethodElement extends FunctionElement |
| + implements MemberElement, FunctionLike {} |
| /// A local function or closure (anonymous local function). |
| abstract class LocalFunctionElement extends FunctionElement |
| implements LocalElement {} |
| /// A constructor. |
| -abstract class ConstructorElement extends FunctionElement |
| - implements MemberElement { |
| +abstract class ConstructorElement extends MethodElement { |
| /// Returns `true` if [effectiveTarget] has been computed for this |
| /// constructor. |
| bool get hasEffectiveTarget; |
| @@ -1470,7 +1507,7 @@ abstract class TypeDeclarationElement extends GenericElement { |
| } |
| abstract class ClassElement extends TypeDeclarationElement |
| - implements ScopeContainerElement { |
| + implements ScopeContainerElement, ClassLike { |
| /// The length of the longest inheritance path from [:Object:]. |
| int get hierarchyDepth; |