Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e3a2e59

Browse files
scheglovCommit Bot
authored andcommitted
Don't use 'whereType' in NotImportedContributor.
Bug: dart-lang/sdk#47680 Change-Id: I7e90f52e7658eef4b9280f485b457d86ac0f4e9a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229820 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent e8d5008 commit e3a2e59

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class NotImportedContributor extends DartCompletionContributor {
9292
}
9393

9494
extensionContributor.addExtensions(
95-
exportElements.whereType<ExtensionElement>().toList(),
95+
_extensions(exportElements),
9696
);
9797

9898
builder.isNotImportedLibrary = false;
@@ -109,4 +109,17 @@ class NotImportedContributor extends DartCompletionContributor {
109109
}
110110
}
111111
}
112+
113+
/// This function intentionally does not use `whereType` for performance.
114+
///
115+
/// https://github.com/dart-lang/sdk/issues/47680
116+
static List<ExtensionElement> _extensions(List<Element> elements) {
117+
var extensions = <ExtensionElement>[];
118+
for (var element in elements) {
119+
if (element is ExtensionElement) {
120+
extensions.add(element);
121+
}
122+
}
123+
return extensions;
124+
}
112125
}

0 commit comments

Comments
 (0)