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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 2010143002: Resynthesize some more types lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 5e72951c68f2d97ecda4692cb9d9f861873334a6..5dfed4dad1f4ce6eeb724aae4daa7ba7c40d3d3c 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -96,14 +96,12 @@ class ClassElementImpl extends ElementImpl
* A list containing all of the mixins that are applied to the class being
* extended in order to derive the superclass of this class.
*/
- @override
- List<InterfaceType> mixins = InterfaceType.EMPTY_LIST;
+ List<InterfaceType> _mixins;
/**
* A list containing all of the interfaces that are implemented by this class.
*/
- @override
- List<InterfaceType> interfaces = InterfaceType.EMPTY_LIST;
+ List<InterfaceType> _interfaces;
/**
* A list containing all of the methods contained in this class.
@@ -374,6 +372,22 @@ class ClassElementImpl extends ElementImpl
}
@override
+ List<InterfaceType> get interfaces {
+ if (_unlinkedClass != null && _interfaces == null) {
+ ResynthesizerContext context = enclosingUnit.resynthesizerContext;
+ _interfaces = _unlinkedClass.interfaces
+ .map((EntityRef t) => context.resolveTypeRef(t, this))
+ .toList();
+ }
+ return _interfaces ?? const <InterfaceType>[];
+ }
+
+ void set interfaces(List<InterfaceType> interfaces) {
+ assert(_unlinkedClass == null);
+ _interfaces = interfaces;
+ }
+
+ @override
bool get isAbstract {
if (_unlinkedClass != null) {
return _unlinkedClass.isAbstract;
@@ -458,6 +472,22 @@ class ClassElementImpl extends ElementImpl
}
@override
+ List<InterfaceType> get mixins {
+ if (_unlinkedClass != null && _mixins == null) {
+ ResynthesizerContext context = enclosingUnit.resynthesizerContext;
+ _mixins = _unlinkedClass.mixins
+ .map((EntityRef t) => context.resolveTypeRef(t, this))
+ .toList();
+ }
+ return _mixins ?? const <InterfaceType>[];
+ }
+
+ void set mixins(List<InterfaceType> mixins) {
+ assert(_unlinkedClass == null);
+ _mixins = mixins;
+ }
+
+ @override
String get name {
if (_unlinkedClass != null) {
return _unlinkedClass.name;
@@ -3659,7 +3689,7 @@ class FunctionTypeAliasElementImpl extends ElementImpl
/**
* The type of function defined by this type alias.
*/
- FunctionType type;
+ FunctionType _type;
/**
* A list containing all of the type parameters defined for this type.
@@ -3799,6 +3829,19 @@ class FunctionTypeAliasElementImpl extends ElementImpl
}
@override
+ FunctionType get type {
+ if (_unlinkedTypedef != null && _type == null) {
+ _type = new FunctionTypeImpl.forTypedef(this);
+ }
+ return _type;
+ }
+
+ void set type(FunctionType type) {
+ assert(_unlinkedTypedef == null);
+ _type = type;
+ }
+
+ @override
TypeParameterizedElementMixin get typeParameterContext => this;
@override
@@ -5785,6 +5828,22 @@ abstract class NonParameterVariableElementImpl extends VariableElementImpl {
}
return super.nameOffset;
}
+
+ @override
+ DartType get type {
+ if (_unlinkedVariable != null && _type == null) {
+ _type = enclosingUnit.resynthesizerContext.resolveLinkedType(
+ _unlinkedVariable.inferredTypeSlot, typeParameterContext) ??
+ enclosingUnit.resynthesizerContext
+ .resolveTypeRef(_unlinkedVariable.type, typeParameterContext);
+ }
+ return super.type;
+ }
+
+ void set type(DartType type) {
+ assert(_unlinkedVariable == null);
+ _type = type;
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698