commit | e3a2e59f18d667978c1ed65be6ad3f70e938a369 | [log] [tgz] |
---|---|---|
author | Konstantin Shcheglov <scheglov@google.com> | Tue Jan 25 06:41:09 2022 +0000 |
committer | Commit Bot <commit-bot@chromium.org> | Tue Jan 25 06:41:09 2022 +0000 |
tree | 6744ca71ef45f0f5290dae06efae89cdcaf71d3b | |
parent | e8d500884384bfb102c1ef5d9b3925a1e6ae975d [diff] |
Don't use 'whereType' in NotImportedContributor. Bug: https://github.com/dart-lang/sdk/issues/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>
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart index d814bb5..8bbff4f 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
@@ -92,7 +92,7 @@ } extensionContributor.addExtensions( - exportElements.whereType<ExtensionElement>().toList(), + _extensions(exportElements), ); builder.isNotImportedLibrary = false; @@ -109,4 +109,17 @@ } } } + + /// This function intentionally does not use `whereType` for performance. + /// + /// https://github.com/dart-lang/sdk/issues/47680 + static List<ExtensionElement> _extensions(List<Element> elements) { + var extensions = <ExtensionElement>[]; + for (var element in elements) { + if (element is ExtensionElement) { + extensions.add(element); + } + } + return extensions; + } }