Skip to content

Commit

Permalink
Rename to flattenedToList2/flattenedToSet2
Browse files Browse the repository at this point in the history
We might get it into package:collection
dart-archive/collection#328

So, I rename it in the analyzer to prevent future conflict.

Change-Id: I8cee41e76cb0f3c7147eda2b7284cec9f57aea92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346163
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
  • Loading branch information
scheglov authored and Commit Queue committed Jan 16, 2024
1 parent e9983a5 commit 5b3c943
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PluginCodeActionsProducer extends AbstractCodeActionsProducer {
.map((response) => plugin.EditGetFixesResult.fromResponse(response))
.expand((response) => response.fixes)
.map(_convertFixes)
.flattenedToList;
.flattenedToList2;
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class AbstractSemanticTokensHandler<T>

return toSourceRangeNullable(lineInfo, range).mapResult((range) async {
final serverTokens = await getServerResult(path, range);
final pluginHighlightRegions = getPluginResults(path).flattenedToList;
final pluginHighlightRegions = getPluginResults(path).flattenedToList2;

if (token.isCancellationRequested) {
return cancelled();
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/lib/src/lsp/mapping.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ List<lsp.DocumentHighlight> toHighlights(
.map((occurrence) => occurrence.offsets.map((offset) =>
lsp.DocumentHighlight(
range: toRange(lineInfo, offset, occurrence.length))))
.flattenedToSet
.flattenedToSet2
.toList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SemanticTokenLegendLookup {
.followedBy(CustomSemanticTokenTypes.values))
.toList();
_usedTokenModifiers = Set.of(highlightRegionTokenModifiers
.values.flattenedToList
.values.flattenedToList2
.followedBy(CustomSemanticTokenModifiers.values))
.toList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void sendAnalysisNotificationAnalyzedFiles(LegacyAnalysisServer server) {
_sendNotification(server, () {
var analyzedFiles = server.driverMap.values
.map((driver) => driver.knownFiles)
.flattenedToSet;
.flattenedToSet2;

// Exclude *.yaml files because IDEA Dart plugin attempts to index
// all the files in folders which contain analyzed files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class TransformSetParser {
if (firstEntry == null) {
if (required) {
var validKeysList =
translators.keys.flattenedToList.quotedAndCommaSeparatedWithOr;
translators.keys.flattenedToList2.quotedAndCommaSeparatedWithOr;
_reportError(TransformSetErrorCode.missingOneOfMultipleKeys, errorNode,
[validKeysList]);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/lib/src/utilities/import_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class _ReferenceFinder extends RecursiveAstVisitor<void> {
// Extensions can be used without a prefix, so we can use any import that
// brings in the extension.
if (import == null && prefix == null && element is ExtensionElement) {
import = _importsByPrefix.values.flattenedToList
import = _importsByPrefix.values.flattenedToList2
.where((import) =>
// Because we don't know what prefix we're looking for (any is
// allowed), use the imports own prefix when checking for the
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,7 @@ class _DiscoverAvailableFilesTask {
// Discover files in package/lib folders.
var packageMap = driver._sourceFactory.packageMap;
if (packageMap != null) {
folderIterator = packageMap.values.flattenedToList.iterator;
folderIterator = packageMap.values.flattenedToList2.iterator;
} else {
folderIterator = <Folder>[].iterator;
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/library_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class _LibraryNode extends graph.Node<_LibraryNode> {
.whereType<LibraryExportWithFile>()
.map((export) => export.exportedLibrary),
])
.flattenedToList
.flattenedToList2
.whereNotNull()
.toSet();

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class GenericInferrer {
.values
.where((l) =>
l.every((c) => c.isSatisfiedBy(_typeSystem, inferred)) == expected)
.flattenedToList;
.flattenedToList2;

String unsatisfied = _formatConstraints(isSatisfied(false));
String satisfied = _formatConstraints(isSatisfied(true));
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/fasta/ast_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3080,7 +3080,7 @@ class AstBuilder extends StackListener {
debugEvent("SwitchBlock");

var membersList = popTypedList2<List<SwitchMemberImpl>>(caseCount);
var members = membersList.flattenedToList;
var members = membersList.flattenedToList2;

Set<String> labels = <String>{};
for (var member in members) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/summary2/library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ class LibraryBuilder {
}

final augmentationCode = macroApplier.buildAugmentationLibraryCode(
_macroResults.flattenedToList,
_macroResults.flattenedToList2,
);
if (augmentationCode == null) {
return;
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/utilities/extensions/collection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ extension IterableIterableExtension<T> on Iterable<Iterable<T>> {
/// At the moment of writing, this method is `2.75` times faster than
/// `expand((e) => e)`, and `3.5` faster than `flattened` from
/// `package:collection`.
List<T> get flattenedToList {
List<T> get flattenedToList2 {
return [
for (final elements in this) ...elements,
];
}

/// Elements of each iterable in this iterable.
Set<T> get flattenedToSet {
Set<T> get flattenedToSet2 {
return {
for (final elements in this) ...elements,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3023,7 +3023,7 @@ class _InterfacePrinter {
String name,
Map<Name, List<ExecutableElement>> map,
) {
final isEmpty = map.values.flattenedToList.where((element) {
final isEmpty = map.values.flattenedToList2.where((element) {
if (_configuration.withObjectMembers) return true;
return !element.isObjectMember;
}).isEmpty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class IterableIterableExtensionTest {
[0],
[1, 2],
[3, 3]
].flattenedToList,
].flattenedToList2,
[0, 1, 2, 3, 3],
);
}
Expand All @@ -41,7 +41,7 @@ class IterableIterableExtensionTest {
[0, 0],
[1, 2, 1],
[3, 3]
].flattenedToSet,
].flattenedToSet2,
{0, 1, 2, 3},
);
}
Expand Down

0 comments on commit 5b3c943

Please sign in to comment.