Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1063)

Unified Diff: pkg/compiler/lib/src/serialization/modelz.dart

Issue 1970703002: Store ResolvedAst on AstElement (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 82d02af543c8d63ae3e934af3a2e81527828fc21..3c10292cf4e2079c6d044f9dc1d819f0af9b7bb2 100644
--- a/pkg/compiler/lib/src/serialization/modelz.dart
+++ b/pkg/compiler/lib/src/serialization/modelz.dart
@@ -249,20 +249,32 @@ abstract class AnalyzableElementMixin implements AnalyzableElement, ElementZ {
TreeElements get treeElements => _unsupported('treeElements');
}
-abstract class AstElementMixin implements AstElement, ElementZ {
+abstract class AstElementMixinZ implements AstElement, ElementZ {
+ ResolvedAst _resolvedAst;
+
// TODO(johnniwinther): This is needed for the token invariant assertion. Find
// another way to bypass the test for modelz.
@override
bool get hasNode => false;
@override
- bool get hasResolvedAst => _unsupported('hasResolvedAst');
+ bool get hasResolvedAst => _resolvedAst != null;
@override
get node => _unsupported('node');
@override
- ResolvedAst get resolvedAst => _unsupported('resolvedAst');
+ ResolvedAst get resolvedAst {
+ assert(invariant(this, _resolvedAst != null,
+ message: "ResolvedAst has not been set for $this."));
+ return _resolvedAst;
+ }
+
+ void set resolvedAst(ResolvedAst value) {
+ assert(invariant(this, _resolvedAst == null,
+ message: "ResolvedAst has already been set for $this."));
+ _resolvedAst = value;
+ }
}
abstract class ContainerMixin
@@ -801,7 +813,7 @@ abstract class ClassElementMixin implements ElementZ, ClassElement {
class ClassElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
ClassElementCommon,
class_members.ClassMemberMixin,
ContainerMixin,
@@ -922,7 +934,7 @@ class UnnamedMixinApplicationElementZ extends ElementZ
class_members.ClassMemberMixin,
TypeDeclarationMixin<InterfaceType>,
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
MixinApplicationElementCommon,
MixinApplicationElementMixin {
final String name;
@@ -1043,7 +1055,7 @@ class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
abstract class ConstructorElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
ClassMemberMixin,
FunctionTypedElementMixin,
ParametersMixin,
@@ -1224,7 +1236,7 @@ class RedirectingFactoryConstructorElementZ extends ConstructorElementZ {
}
class ForwardingConstructorElementZ extends ElementZ
- with AnalyzableElementMixin, AstElementMixin
+ with AnalyzableElementMixin, AstElementMixinZ
implements ConstructorElement {
final MixinApplicationElement enclosingClass;
final ConstructorElement definingConstructor;
@@ -1359,7 +1371,7 @@ abstract class MemberElementMixin
abstract class FieldElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
TypedElementMixin,
MemberElementMixin
implements FieldElement {
@@ -1426,7 +1438,7 @@ class InstanceFieldElementZ extends FieldElementZ
abstract class FunctionElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
ParametersMixin,
FunctionTypedElementMixin,
TypedElementMixin,
@@ -1505,7 +1517,7 @@ abstract class LocalExecutableMixin
class LocalFunctionElementZ extends DeserializedElementZ
with
LocalExecutableMixin,
- AstElementMixin,
+ AstElementMixinZ,
ParametersMixin,
FunctionTypedElementMixin,
TypedElementMixin
@@ -1529,7 +1541,7 @@ class LocalFunctionElementZ extends DeserializedElementZ
abstract class GetterElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
FunctionTypedElementMixin,
ParametersMixin,
TypedElementMixin,
@@ -1569,7 +1581,7 @@ class InstanceGetterElementZ extends GetterElementZ
abstract class SetterElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
FunctionTypedElementMixin,
ParametersMixin,
TypedElementMixin,
@@ -1661,7 +1673,7 @@ abstract class TypeDeclarationMixin<T extends GenericType>
class TypedefElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
LibraryMemberMixin,
ParametersMixin,
TypeDeclarationMixin<TypedefType>
@@ -1703,7 +1715,7 @@ class TypedefElementZ extends DeserializedElementZ
}
class TypeVariableElementZ extends DeserializedElementZ
- with AnalyzableElementMixin, AstElementMixin, TypedElementMixin
+ with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
implements TypeVariableElement {
TypeDeclarationElement _typeDeclaration;
TypeVariableType _type;
@@ -1761,7 +1773,7 @@ class TypeVariableElementZ extends DeserializedElementZ
}
class SyntheticTypeVariableElementZ extends ElementZ
- with AnalyzableElementMixin, AstElementMixin
+ with AnalyzableElementMixin, AstElementMixinZ
implements TypeVariableElement {
final TypeDeclarationElement typeDeclaration;
final int index;
@@ -1825,7 +1837,7 @@ class SyntheticTypeVariableElementZ extends ElementZ
}
abstract class ParameterElementZ extends DeserializedElementZ
- with AnalyzableElementMixin, AstElementMixin, TypedElementMixin
+ with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
implements ParameterElement {
FunctionElement _functionDeclaration;
ConstantExpression _constant;
@@ -1938,7 +1950,7 @@ class InitializingFormalElementZ extends ParameterElementZ
class LocalVariableElementZ extends DeserializedElementZ
with
AnalyzableElementMixin,
- AstElementMixin,
+ AstElementMixinZ,
LocalExecutableMixin,
TypedElementMixin
implements LocalVariableElement {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698