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

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

Issue 3006983002: Fix for using enums as InterfaceType(s) when resynthesize from Kernel. (Closed)
Patch Set: Created 3 years, 4 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 e93f63573437ff5f93617264e8dbe9ae32a2d650..8737595217319b4d5494201d7c89b412340a2e7f 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -772,9 +772,8 @@ class ClassElementImpl extends AbstractClassElementImpl
List<InterfaceType> get interfaces {
if (_interfaces == null) {
if (_kernel != null) {
- _interfaces = _kernel.implementedTypes
- .map((k) => enclosingUnit._kernelContext.getInterfaceType(this, k))
- .toList(growable: false);
+ var context = enclosingUnit._kernelContext;
+ _interfaces = context.getInterfaceTypes(this, _kernel.implementedTypes);
}
if (_unlinkedClass != null) {
ResynthesizerContext context = enclosingUnit.resynthesizerContext;
@@ -909,9 +908,7 @@ class ClassElementImpl extends AbstractClassElementImpl
if (_kernel != null) {
_initializeKernelMixins();
var context = enclosingUnit._kernelContext;
- _mixins = _kernelMixins.map((k) {
- return context.getInterfaceType(this, k);
- }).toList(growable: false);
+ _mixins = context.getInterfaceTypes(this, _kernelMixins);
}
if (_unlinkedClass != null) {
ResynthesizerContext context = enclosingUnit.resynthesizerContext;
@@ -6196,6 +6193,13 @@ abstract class KernelUnitResynthesizerContext {
*/
InterfaceType getInterfaceType(ElementImpl context, kernel.Supertype type);
+ /**
+ * Return the [InterfaceType]s for the given Kernel [types], skipping
+ * the elements that don't correspond to an [InterfaceType].
+ */
+ List<InterfaceType> getInterfaceTypes(
+ ElementImpl context, List<kernel.Supertype> types);
+
/**
* Return the [ConstructorElementImpl] to which the given [kernelConstructor]
* or [kernelFactory] redirects.
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/kernel/resynthesize.dart » ('j') | pkg/analyzer/lib/src/kernel/resynthesize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698