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

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

Issue 2034473002: Delay 'supertype' for ClassElementImpl and EnumElementImpl. (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
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 25e5ede2c97e483a82d2dd454f38330f0fce49b3..e42f809d98f76569012509d0e01a3c9f1e5f5eaa 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -80,7 +80,7 @@ abstract class AbstractClassElementImpl extends ElementImpl
* explicit superclass.
*/
@override
- InterfaceType supertype;
+ InterfaceType _supertype;
/**
* The type defined by the class.
@@ -1138,6 +1138,26 @@ class ClassElementImpl extends AbstractClassElementImpl {
}
@override
+ InterfaceType get supertype {
+ if (_unlinkedClass != null && _supertype == null) {
+ if (_unlinkedClass.supertype != null) {
+ _supertype = enclosingUnit.resynthesizerContext
+ .resolveTypeRef(_unlinkedClass.supertype, this);
+ } else if (_unlinkedClass.hasNoSupertype) {
+ return null;
+ } else {
+ _supertype = context.typeProvider.objectType;
+ }
+ }
+ return _supertype;
+ }
+
+ void set supertype(InterfaceType supertype) {
+ assert(_unlinkedClass == null);
+ _supertype = supertype;
+ }
+
+ @override
List<TypeParameterElement> get typeParameters {
if (_unlinkedClass != null) {
return resynthesizedTypeParameters;
@@ -3056,6 +3076,9 @@ class EnumElementImpl extends AbstractClassElementImpl {
}
@override
+ InterfaceType get supertype => context.typeProvider.objectType;
+
+ @override
List<TypeParameterElement> get typeParameters =>
const <TypeParameterElement>[];

Powered by Google App Engine
This is Rietveld 408576698