Index: pkg/compiler/lib/src/serialization/modelz.dart |
diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart |
index 2bfb6e13987cb7c3029e9e077c9940ef56bbdeb6..c7a347a1635086928df517c249a0cdcb560f1f66 100644 |
--- a/pkg/compiler/lib/src/serialization/modelz.dart |
+++ b/pkg/compiler/lib/src/serialization/modelz.dart |
@@ -64,17 +64,12 @@ abstract class ElementZ extends Element with ElementCommon { |
FunctionElement asFunctionElement() => null; |
@override |
- Scope buildScope() => _unsupported('analyzableElement'); |
+ Scope buildScope() => _unsupported('buildScope'); |
@override |
ClassElement get enclosingClass => null; |
@override |
- Element get enclosingClassOrCompilationUnit { |
- return _unsupported('enclosingClassOrCompilationUnit'); |
- } |
- |
- @override |
LibraryElement get implementationLibrary => library; |
@override |
@@ -110,9 +105,8 @@ abstract class ElementZ extends Element with ElementCommon { |
@override |
bool get isStatic => false; |
- // TODO(johnniwinther): Find a more precise semantics for this. |
@override |
- bool get isSynthesized => true; |
+ bool get isSynthesized => false; |
@override |
bool get isTopLevel => false; |
@@ -133,10 +127,14 @@ abstract class DeserializedElementZ extends ElementZ { |
@override |
String get name => _decoder.getString(Key.NAME); |
+ // TODO(johnniwinther): Should this be cached? |
+ @override |
+ int get sourceOffset => _decoder.getInt(Key.OFFSET, isOptional: true); |
+ |
@override |
SourceSpan get sourcePosition { |
// TODO(johnniwinther): Should this be cached? |
- int offset = _decoder.getInt(Key.OFFSET, isOptional: true); |
+ int offset = sourceOffset; |
if (offset == null) return null; |
Uri uri = _decoder.getUri(Key.URI, isOptional: true); |
if (uri == null) { |
@@ -328,6 +326,9 @@ class AbstractFieldElementZ extends ElementZ implements AbstractFieldElement { |
Element get enclosingElement => _canonicalElement.enclosingElement; |
@override |
+ int get sourceOffset => _canonicalElement.sourceOffset; |
+ |
+ @override |
SourceSpan get sourcePosition => _canonicalElement.sourcePosition; |
@override |
@@ -768,23 +769,9 @@ abstract class ClassElementMixin implements ElementZ, ClassElement { |
ElementKind get kind => ElementKind.CLASS; |
@override |
- void addBackendMember(Element element) => _unsupported('addBackendMember'); |
- |
- @override |
- void forEachBackendMember(void f(Element member)) { |
- _unsupported('forEachBackendMember'); |
- } |
- |
- @override |
- bool get hasBackendMembers => _unsupported('hasBackendMembers'); |
- |
- @override |
bool get hasConstructor => _unsupported('hasConstructor'); |
@override |
- bool hasFieldShadowedBy(Element fieldMember) => _unsupported(''); |
- |
- @override |
bool get hasIncompleteHierarchy => _unsupported('hasIncompleteHierarchy'); |
@override |
@@ -794,11 +781,6 @@ abstract class ClassElementMixin implements ElementZ, ClassElement { |
bool get isEnumClass => false; |
@override |
- Element lookupBackendMember(String memberName) { |
- return _unsupported('lookupBackendMember'); |
- } |
- |
- @override |
ConstructorElement lookupDefaultConstructor() { |
ConstructorElement constructor = lookupConstructor(""); |
if (constructor != null && constructor.parameters.isEmpty) { |
@@ -808,9 +790,6 @@ abstract class ClassElementMixin implements ElementZ, ClassElement { |
} |
@override |
- void reverseBackendMembers() => _unsupported('reverseBackendMembers'); |
- |
- @override |
ClassElement get superclass => supertype != null ? supertype.element : null; |
@override |
@@ -1035,6 +1014,9 @@ class UnnamedMixinApplicationElementZ extends ElementZ |
InterfaceType get mixinType => interfaces.head; |
@override |
+ int get sourceOffset => _subclass.sourceOffset; |
+ |
+ @override |
SourceSpan get sourcePosition => _subclass.sourcePosition; |
} |
@@ -1064,7 +1046,10 @@ abstract class ConstructorElementZ extends DeserializedElementZ |
ParametersMixin, |
TypedElementMixin, |
MemberElementMixin |
- implements ConstructorElement { |
+ implements |
+ ConstructorElement, |
+ // TODO(johnniwinther): Sort out whether a constructor is a method. |
+ MethodElement { |
ConstantConstructor _constantConstructor; |
ConstructorElement _effectiveTarget; |
@@ -1129,13 +1114,13 @@ abstract class ConstructorElementZ extends DeserializedElementZ |
@override |
ConstructorElement get immediateRedirectionTarget => null; |
+ // TODO(johnniwinther): Should serialization support erroneous element |
+ // relations? |
@override |
- bool get isEffectiveTargetMalformed { |
- return _unsupported('isEffectiveTargetMalformed'); |
- } |
+ bool get isEffectiveTargetMalformed => false; |
@override |
- bool get isCyclicRedirection => _unsupported('isCyclicRedirection'); |
+ bool get isCyclicRedirection => false; |
@override |
bool get isRedirectingFactory => false; |
@@ -1158,6 +1143,9 @@ class GenerativeConstructorElementZ extends ConstructorElementZ { |
@override |
bool get isRedirectingGenerative => _decoder.getBool(Key.IS_REDIRECTING); |
+ |
+ @override |
+ bool get isSynthesized => definingConstructor != null; |
} |
class FactoryConstructorElementZ extends ConstructorElementZ { |
@@ -1298,6 +1286,9 @@ class ForwardingConstructorElementZ extends ElementZ |
bool get isRedirectingGenerative => false; |
@override |
+ bool get isSynthesized => true; |
+ |
+ @override |
ElementKind get kind => ElementKind.GENERATIVE_CONSTRUCTOR; |
@override |
@@ -1327,6 +1318,9 @@ class ForwardingConstructorElementZ extends ElementZ |
PrefixElement get redirectionDeferredPrefix => null; |
@override |
+ int get sourceOffset => enclosingClass.sourceOffset; |
+ |
+ @override |
SourceSpan get sourcePosition => enclosingClass.sourcePosition; |
@override |
@@ -1806,6 +1800,9 @@ class SyntheticTypeVariableElementZ extends ElementZ |
LibraryElement get library => typeDeclaration.library; |
@override |
+ int get sourceOffset => typeDeclaration.sourceOffset; |
+ |
+ @override |
SourceSpan get sourcePosition => typeDeclaration.sourcePosition; |
} |