| Index: pkg/compiler/lib/src/elements/modelx.dart
|
| diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
|
| index e25f55588208995d2a5b01562cc9ed073b0f0a76..e19d722c69abb4b785ade4722be2ba69607a1e67 100644
|
| --- a/pkg/compiler/lib/src/elements/modelx.dart
|
| +++ b/pkg/compiler/lib/src/elements/modelx.dart
|
| @@ -171,7 +171,7 @@ abstract class ElementX extends Element {
|
|
|
| Name get memberName => new Name(name, library);
|
|
|
| - LibraryElement get implementationLibrary {
|
| + LibraryElementX get implementationLibrary {
|
| Element element = this;
|
| while (!identical(element.kind, ElementKind.LIBRARY)) {
|
| element = element.enclosingElement;
|
| @@ -429,10 +429,6 @@ class ErroneousConstructorElementX extends ErroneousElementX
|
| throw new UnsupportedError("redirectionDeferredPrefix=");
|
| }
|
|
|
| - bool get hasNoBody => false;
|
| -
|
| - bool get _hasNoBody => false;
|
| -
|
| void set effectiveTarget(_) {
|
| throw new UnsupportedError("effectiveTarget=");
|
| }
|
| @@ -623,7 +619,7 @@ class ScopeX {
|
| * element, they are enclosed by the class or compilation unit, as is the
|
| * abstract field.
|
| */
|
| - void addAccessor(FunctionElementX accessor,
|
| + void addAccessor(AccessorElementX accessor,
|
| Element existing,
|
| DiagnosticListener listener) {
|
| void reportError(Element other) {
|
| @@ -681,7 +677,7 @@ class CompilationUnitElementX extends ElementX
|
| PartOf partTag;
|
| Link<Element> localMembers = const Link<Element>();
|
|
|
| - CompilationUnitElementX(Script script, LibraryElement library)
|
| + CompilationUnitElementX(Script script, LibraryElementX library)
|
| : this.script = script,
|
| super(script.name,
|
| ElementKind.COMPILATION_UNIT,
|
| @@ -689,6 +685,9 @@ class CompilationUnitElementX extends ElementX
|
| library.addCompilationUnit(this);
|
| }
|
|
|
| + @override
|
| + LibraryElementX get library => enclosingElement.declaration;
|
| +
|
| void forEachLocalMember(f(Element element)) {
|
| localMembers.forEach(f);
|
| }
|
| @@ -940,6 +939,7 @@ class LibraryElementX
|
| return tagsCache;
|
| }
|
|
|
| + /// Record which element an import or export tag resolved to.
|
| void recordResolvedTag(LibraryDependency tag, LibraryElement library) {
|
| assert(tagMapping[tag] == null);
|
| tagMapping[tag] = library;
|
| @@ -1686,8 +1686,8 @@ class ErroneousInitializingFormalElementX extends ParameterElementX
|
| }
|
|
|
| class AbstractFieldElementX extends ElementX implements AbstractFieldElement {
|
| - FunctionElementX getter;
|
| - FunctionElementX setter;
|
| + GetterElementX getter;
|
| + SetterElementX setter;
|
|
|
| AbstractFieldElementX(String name, Element enclosing)
|
| : super(name, ElementKind.ABSTRACT_FIELD, enclosing);
|
| @@ -1845,26 +1845,18 @@ abstract class BaseFunctionElementX
|
|
|
| FunctionSignature functionSignatureCache;
|
|
|
| - final bool _hasNoBody;
|
| -
|
| - AbstractFieldElement abstractField;
|
| -
|
| AsyncMarker asyncMarker = AsyncMarker.SYNC;
|
|
|
| BaseFunctionElementX(String name,
|
| ElementKind kind,
|
| Modifiers this.modifiers,
|
| - Element enclosing,
|
| - bool hasNoBody)
|
| - : super(name, kind, enclosing),
|
| - _hasNoBody = hasNoBody {
|
| + Element enclosing)
|
| + : super(name, kind, enclosing) {
|
| assert(modifiers != null);
|
| }
|
|
|
| bool get isExternal => modifiers.isExternal;
|
|
|
| - bool get hasNoBody => _hasNoBody;
|
| -
|
| bool get isInstanceMember {
|
| return isClassMember
|
| && !isConstructor
|
| @@ -1919,11 +1911,7 @@ abstract class BaseFunctionElementX
|
| }
|
| }
|
|
|
| - bool get isAbstract {
|
| - return !modifiers.isExternal &&
|
| - (isFunction || isAccessor) &&
|
| - _hasNoBody;
|
| - }
|
| + bool get isAbstract => false;
|
|
|
| accept(ElementVisitor visitor, arg) {
|
| return visitor.visitFunctionElement(this, arg);
|
| @@ -1935,12 +1923,12 @@ abstract class BaseFunctionElementX
|
|
|
| abstract class FunctionElementX extends BaseFunctionElementX
|
| with AnalyzableElementX implements MethodElement {
|
| +
|
| FunctionElementX(String name,
|
| ElementKind kind,
|
| Modifiers modifiers,
|
| - Element enclosing,
|
| - bool hasNoBody)
|
| - : super(name, kind, modifiers, enclosing, hasNoBody);
|
| + Element enclosing)
|
| + : super(name, kind, modifiers, enclosing);
|
|
|
| MemberElement get memberContext => this;
|
|
|
| @@ -1952,6 +1940,55 @@ abstract class FunctionElementX extends BaseFunctionElementX
|
| }
|
| }
|
|
|
| +abstract class MethodElementX extends FunctionElementX {
|
| + final bool hasBody;
|
| +
|
| + MethodElementX(String name,
|
| + ElementKind kind,
|
| + Modifiers modifiers,
|
| + Element enclosing,
|
| + // TODO(15101): Make this a named parameter.
|
| + this.hasBody)
|
| + : super(name, kind, modifiers, enclosing);
|
| +
|
| + @override
|
| + bool get isAbstract {
|
| + return !modifiers.isExternal && !hasBody;
|
| + }
|
| +}
|
| +
|
| +abstract class AccessorElementX extends MethodElementX
|
| + implements AccessorElement {
|
| + AbstractFieldElement abstractField;
|
| +
|
| + AccessorElementX(String name,
|
| + ElementKind kind,
|
| + Modifiers modifiers,
|
| + Element enclosing,
|
| + bool hasBody)
|
| + : super(name, kind, modifiers, enclosing, hasBody);
|
| +}
|
| +
|
| +abstract class GetterElementX extends AccessorElementX
|
| + implements GetterElement {
|
| +
|
| + GetterElementX(String name,
|
| + Modifiers modifiers,
|
| + Element enclosing,
|
| + bool hasBody)
|
| + : super(name, ElementKind.GETTER, modifiers, enclosing, hasBody);
|
| +}
|
| +
|
| +abstract class SetterElementX extends AccessorElementX
|
| + implements SetterElement {
|
| +
|
| + SetterElementX(String name,
|
| + Modifiers modifiers,
|
| + Element enclosing,
|
| + bool hasBody)
|
| + : super(name, ElementKind.SETTER, modifiers, enclosing, hasBody);
|
| +}
|
| +
|
| class LocalFunctionElementX extends BaseFunctionElementX
|
| implements LocalFunctionElement {
|
| final FunctionExpression node;
|
| @@ -1961,7 +1998,7 @@ class LocalFunctionElementX extends BaseFunctionElementX
|
| ElementKind kind,
|
| Modifiers modifiers,
|
| ExecutableElement enclosing)
|
| - : super(name, kind, modifiers, enclosing, false);
|
| + : super(name, kind, modifiers, enclosing);
|
|
|
| ExecutableElement get executableContext => enclosingElement;
|
|
|
| @@ -2015,7 +2052,7 @@ abstract class ConstructorElementX extends FunctionElementX
|
| ElementKind kind,
|
| Modifiers modifiers,
|
| Element enclosing)
|
| - : super(name, kind, modifiers, enclosing, false);
|
| + : super(name, kind, modifiers, enclosing);
|
|
|
| FunctionElement immediateRedirectionTarget;
|
| PrefixElement redirectionDeferredPrefix;
|
| @@ -2051,20 +2088,25 @@ abstract class ConstructorElementX extends FunctionElementX
|
| return effectiveTargetType.substByContext(newType);
|
| }
|
|
|
| + accept(ElementVisitor visitor, arg) {
|
| + return visitor.visitConstructorElement(this, arg);
|
| + }
|
| +
|
| ConstructorElement get definingConstructor => null;
|
|
|
| ClassElement get enclosingClass => enclosingElement;
|
| }
|
|
|
| -class DeferredLoaderGetterElementX extends FunctionElementX {
|
| +class DeferredLoaderGetterElementX extends GetterElementX
|
| + implements GetterElement {
|
| final PrefixElement prefix;
|
|
|
| DeferredLoaderGetterElementX(PrefixElement prefix)
|
| : this.prefix = prefix,
|
| super("loadLibrary",
|
| - ElementKind.FUNCTION,
|
| Modifiers.EMPTY,
|
| - prefix, true);
|
| + prefix,
|
| + false);
|
|
|
| FunctionSignature computeSignature(Compiler compiler) {
|
| if (functionSignatureCache != null) return functionSignature;
|
| @@ -2081,12 +2123,8 @@ class DeferredLoaderGetterElementX extends FunctionElementX {
|
|
|
| bool get isSynthesized => true;
|
|
|
| - bool get isFunction => false;
|
| -
|
| bool get isDeferredLoaderGetter => true;
|
|
|
| - bool get isGetter => true;
|
| -
|
| bool get isTopLevel => true;
|
| // By having position null, the enclosing elements location is printed in
|
| // error messages.
|
| @@ -2097,18 +2135,21 @@ class DeferredLoaderGetterElementX extends FunctionElementX {
|
| bool get hasNode => false;
|
|
|
| FunctionExpression get node => null;
|
| +
|
| + @override
|
| + SetterElement get setter => null;
|
| }
|
|
|
| class ConstructorBodyElementX extends BaseFunctionElementX
|
| implements ConstructorBodyElement {
|
| - ConstructorElement constructor;
|
| + ConstructorElementX constructor;
|
|
|
| - ConstructorBodyElementX(FunctionElement constructor)
|
| + ConstructorBodyElementX(ConstructorElementX constructor)
|
| : this.constructor = constructor,
|
| super(constructor.name,
|
| ElementKind.GENERATIVE_CONSTRUCTOR_BODY,
|
| Modifiers.EMPTY,
|
| - constructor.enclosingElement, false) {
|
| + constructor.enclosingElement) {
|
| functionSignatureCache = constructor.functionSignature;
|
| }
|
|
|
| @@ -2846,18 +2887,14 @@ class EnumConstructorElementX extends ConstructorElementX {
|
| FunctionExpression parseNode(Compiler compiler) => node;
|
| }
|
|
|
| -class EnumMethodElementX extends FunctionElementX {
|
| +class EnumMethodElementX extends MethodElementX {
|
| final FunctionExpression node;
|
|
|
| EnumMethodElementX(String name,
|
| EnumClassElementX enumClass,
|
| Modifiers modifiers,
|
| this.node)
|
| - : super(name,
|
| - ElementKind.FUNCTION,
|
| - modifiers,
|
| - enumClass,
|
| - false);
|
| + : super(name, ElementKind.FUNCTION, modifiers, enumClass, true);
|
|
|
| @override
|
| bool get hasNode => true;
|
|
|