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

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

Issue 2329483003: Keep only InterfaceType(s) in resynthesized lists of interfaces and mixins. (Closed)
Patch Set: Replace not InterfaceType supertype with Object. Created 4 years, 3 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/test/src/summary/resynthesize_test.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 820a132f4dd188683e1ae12fb7864224d3b777c8..84d7523ced04269d27fd4e2fd58e17436735b50a 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -743,6 +743,7 @@ class ClassElementImpl extends AbstractClassElementImpl
ResynthesizerContext context = enclosingUnit.resynthesizerContext;
_interfaces = _unlinkedClass.interfaces
.map((EntityRef t) => context.resolveTypeRef(t, this))
+ .where((DartType type) => type is InterfaceType)
.toList(growable: false);
}
return _interfaces ?? const <InterfaceType>[];
@@ -849,6 +850,7 @@ class ClassElementImpl extends AbstractClassElementImpl
ResynthesizerContext context = enclosingUnit.resynthesizerContext;
_mixins = _unlinkedClass.mixins
.map((EntityRef t) => context.resolveTypeRef(t, this))
+ .where((DartType type) => type is InterfaceType)
.toList(growable: false);
}
return _mixins ?? const <InterfaceType>[];
@@ -879,8 +881,13 @@ class ClassElementImpl extends AbstractClassElementImpl
InterfaceType get supertype {
if (_unlinkedClass != null && _supertype == null) {
if (_unlinkedClass.supertype != null) {
- _supertype = enclosingUnit.resynthesizerContext
+ DartType type = enclosingUnit.resynthesizerContext
.resolveTypeRef(_unlinkedClass.supertype, this);
+ if (type is InterfaceType) {
+ _supertype = type;
+ } else {
+ _supertype = context.typeProvider.objectType;
+ }
} else if (_unlinkedClass.hasNoSupertype) {
return null;
} else {
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698