Skip to content

Commit c48772a

Browse files
author
Dart CI
committed
Version 3.10.0-78.0.dev
Merge cb835a6 into dev
2 parents e55de8c + cb835a6 commit c48772a

File tree

27 files changed

+1311
-348
lines changed

27 files changed

+1311
-348
lines changed

DEPS

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,31 @@ vars = {
126126
# and land the review.
127127
#
128128
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
129-
"dart_style_rev": "5d2ad56bf523cd017febe54514e72c41e86520ee", # rolled manually
129+
"dart_style_rev": "00b5f3f5256cb179bc340c1e60bb52fd1c2ae1ac", # rolled manually
130130

131131
### /third_party/pkg dependencies
132132
# 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an
133133
# EOL comment after a dependency to instead pin at the current revision.
134134
"ai_rev": "72a9283b421e5ee85c089822ddf6735aade849da",
135135
"core_rev": "b59ecf4ceebe6153e1c0166b7c9a7fdd9458a89d",
136-
"dartdoc_rev": "82b48b53128a474221269a05a947bae28e2d7ac6",
137-
"ecosystem_rev": "4543c38a67919958539dec8366d8c9414179741f",
136+
"dartdoc_rev": "414953ed17ea534078f26a8526909ab014c1ad09",
137+
"ecosystem_rev": "2fe3618849cbcfcb798e4e001f042423b602e549",
138138
"flute_rev": "d5adc4d6439572db5da71a9261b9bf0c7c96daa4",
139139
"http_rev": "afda3102b7ed5467f435b9ad4a29a1032f195156",
140-
"i18n_rev": "25cdb1b44b18544e0c988cc1734adc4810a65099",
140+
"i18n_rev": "c45e050426bdeaaa120e5ce856abb486863d0476",
141141
"leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # rolled manually
142142
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
143143
"native_rev": "16ae2d8619e23fc2bd83fbff087a26ac032a1145", # rolled manually while native assets are experimental
144144
"protobuf_rev": "0b73b0d64c15e34d35f6e5f9036aac52e4a64033",
145145
"pub_rev": "c3e50919d11896f014cb971e1776d00a0e2d18b3", # rolled manually
146-
"shelf_rev": "2a46b4ffe1f095909c3b14bdf62da40cbdbd82e9",
146+
"shelf_rev": "082d3ac2d13a98700d8148e8fad8f3e12a6fd0e1",
147147
"sync_http_rev": "c07f96f89a7eec7e3daac641fa6c587224fcfbaa",
148148
"tar_rev": "5a1ea943e70cdf3fa5e1102cdbb9418bd9b4b81a",
149-
"test_rev": "9354f239b0eb42a459200b432893d7d026056391",
150-
"tools_rev": "1b52e89e0b4ef70e004383c1cf781ad4182f380b",
149+
"test_rev": "5aef9719ad9b598260c062b2a90a50d2f50a78f3",
150+
"tools_rev": "5e977d6f0698a220279a50538c89a440d56b0c44",
151151
"vector_math_rev": "3939545edc38ed657381381d33acde02c49ff827",
152-
"web_rev": "f3c960f57cd88afad6e20d80ed453d722d3610b7",
153-
"webdev_rev": "94c172cc862d0c39c72158c6537f1e20b4432e0e",
152+
"web_rev": "1d5771b74a97f8d59375daa3029617ce2cd1bae8",
153+
"webdev_rev": "7ff2d0795727402c7658ea8ee026884b023099d8",
154154
"webdriver_rev": "595649d890f69b9d05a596426ca93681b1921132",
155155
"webkit_inspection_protocol_rev": "effa75205516757795683d527c3dea9546eb0c32",
156156

pkg/_fe_analyzer_shared/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: _fe_analyzer_shared
22
# See the release policy for managing this version number at
33
# pkg/analyzer/doc/implementation/releasing.md.
4-
version: 86.0.0
4+
version: 87.0.0
55
description: Logic that is shared between the front_end and analyzer packages.
66
repository: https://github.com/dart-lang/sdk/tree/main/pkg/_fe_analyzer_shared
77

pkg/analysis_server/lib/src/services/correction/dart/import_library.dart

Lines changed: 27 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ class ImportLibrary extends MultiCorrectionProducer {
227227
String name,
228228
List<ElementKind> kinds, {
229229
String? prefix,
230+
bool canBePrefixed = true,
230231
}) async {
231232
// Ignore the element if the name is private.
232233
if (name.startsWith('_')) {
@@ -252,7 +253,6 @@ class ImportLibrary extends MultiCorrectionProducer {
252253
if (!kinds.contains(element.kind)) {
253254
continue;
254255
}
255-
var importPrefix = import.prefix?.element;
256256
// Maybe update a "show"/"hide" directive.
257257
var (
258258
combinatorProducer,
@@ -265,7 +265,8 @@ class ImportLibrary extends MultiCorrectionProducer {
265265
prefix: prefix,
266266
);
267267
// Maybe apply a prefix.
268-
if (importPrefix != null) {
268+
var importPrefix = import.prefix?.element;
269+
if (canBePrefixed && importPrefix != null) {
269270
producers.add(
270271
_ImportLibraryPrefix(
271272
libraryElement,
@@ -397,74 +398,52 @@ class ImportLibrary extends MultiCorrectionProducer {
397398
// additional analysis.
398399
var foundImport = false;
399400
var names = <_PrefixedName>[];
401+
var extensionsInLibrary =
402+
<LibraryImport?, List<InstantiatedExtensionWithMember>>{};
400403
for (var import in unitResult.libraryFragment.libraryImports) {
401-
// prepare element
402404
var importedLibrary = import.importedLibrary;
403405
if (importedLibrary == null || importedLibrary != libraryToImport) {
404406
continue;
405407
}
406408
foundImport = true;
407-
var instantiatedExtensions = importedLibrary.exportedExtensions
409+
extensionsInLibrary[import] = importedLibrary.exportedExtensions
408410
.havingMemberWithBaseName(memberName)
409411
.applicableTo(
410412
targetLibrary: libraryElement2,
411413
targetType: targetType as TypeImpl,
412414
);
413-
for (var instantiatedExtension in instantiatedExtensions) {
414-
// If the import has a combinator that needs to be updated, then offer
415-
// to update it.
416-
var libraryElement = import.importedLibrary;
417-
if (libraryElement == null) {
418-
continue;
419-
}
415+
}
416+
417+
// If the library at the URI is not already imported, we return a correction
418+
// producer that will either add an import or not based on the result of
419+
// analyzing the library.
420+
if (!foundImport) {
421+
extensionsInLibrary[null] = libraryToImport.exportedExtensions
422+
.havingMemberWithBaseName(memberName)
423+
.applicableTo(
424+
targetLibrary: libraryElement2,
425+
targetType: targetType as TypeImpl,
426+
);
427+
}
428+
for (var entry in extensionsInLibrary.entries) {
429+
var extensionsInLibrary = entry.value;
430+
for (var instantiatedExtension in extensionsInLibrary) {
420431
names.add(
421432
_PrefixedName(
422433
name: instantiatedExtension.extension.name!,
423434
ignorePrefix: true,
424435
producerGenerators: (prefix, name) async {
425-
var producers = <ResolvedCorrectionProducer>[];
426-
var (
427-
importLibraryCombinator,
428-
importLibraryCombinatorMultiple,
429-
) = await _importEditCombinators(
430-
import,
431-
libraryElement,
432-
libraryToImport.uri.toString(),
436+
return await _importLibraryForElement(
433437
name,
438+
prefix: prefix,
439+
canBePrefixed: false,
440+
[ElementKind.EXTENSION],
434441
);
435-
if (importLibraryCombinator != null) {
436-
producers.add(importLibraryCombinator);
437-
if (importLibraryCombinatorMultiple != null) {
438-
producers.add(importLibraryCombinatorMultiple);
439-
}
440-
}
441-
return producers;
442442
},
443443
),
444444
);
445445
}
446446
}
447-
448-
// If the library at the URI is not already imported, we return a correction
449-
// producer that will either add an import or not based on the result of
450-
// analyzing the library.
451-
if (!foundImport) {
452-
names.add(
453-
_PrefixedName(
454-
name: memberName.name,
455-
producerGenerators: (prefix, name) async {
456-
return [
457-
_ImportLibraryContainingExtension(
458-
libraryToImport,
459-
targetType,
460-
memberName,
461-
context: context,
462-
),
463-
];
464-
},
465-
),
466-
);
467-
}
468447
return names;
469448
}
470449

@@ -914,8 +893,7 @@ class _ImportLibraryCombinatorMultiple extends ResolvedCorrectionProducer {
914893
if (names.isNotEmpty) {
915894
newCombinatorCode = ' ${keyword.lexeme} ${names.join(', ')}';
916895
}
917-
var libraryPath =
918-
unitResult.libraryElement.firstFragment.source.fullName;
896+
var libraryPath = unitResult.libraryElement.firstFragment.source.fullName;
919897
await builder.addDartFileEdit(libraryPath, (builder) {
920898
builder.addSimpleReplacement(
921899
SourceRange(offset - 1, length + 1),
@@ -940,55 +918,6 @@ class _ImportLibraryCombinatorMultiple extends ResolvedCorrectionProducer {
940918
}
941919
}
942920

943-
/// A correction processor that can add an import of a library containing an
944-
/// extension, but which does so only if the extension applies to a given type.
945-
class _ImportLibraryContainingExtension extends ResolvedCorrectionProducer {
946-
/// The library defining the extension.
947-
LibraryElement library;
948-
949-
/// The type of the target that the extension must apply to.
950-
DartType targetType;
951-
952-
/// The name of the member that the extension must declare.
953-
Name memberName;
954-
955-
/// The URI that is being proposed for the import directive.
956-
String _uriText = '';
957-
958-
_ImportLibraryContainingExtension(
959-
this.library,
960-
this.targetType,
961-
this.memberName, {
962-
required super.context,
963-
});
964-
965-
@override
966-
CorrectionApplicability get applicability =>
967-
// TODO(applicability): comment on why.
968-
CorrectionApplicability.singleLocation;
969-
970-
@override
971-
List<String> get fixArguments => [_uriText];
972-
973-
@override
974-
FixKind get fixKind => DartFixKind.IMPORT_LIBRARY_PROJECT1;
975-
976-
@override
977-
Future<void> compute(ChangeBuilder builder) async {
978-
var instantiatedExtensions = library.exportedExtensions
979-
.havingMemberWithBaseName(memberName)
980-
.applicableTo(
981-
targetLibrary: libraryElement2,
982-
targetType: targetType as TypeImpl,
983-
);
984-
if (instantiatedExtensions.isNotEmpty) {
985-
await builder.addDartFileEdit(file, (builder) {
986-
_uriText = builder.importLibrary(library.uri);
987-
});
988-
}
989-
}
990-
}
991-
992921
/// A correction processor that can add a prefix to an identifier defined in a
993922
/// library that is already imported but that is imported with a prefix.
994923
class _ImportLibraryPrefix extends ResolvedCorrectionProducer {

pkg/analysis_server/lib/src/services/correction/fix.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,61 +910,91 @@ abstract final class DartFixKind {
910910
DartFixKindPriority.standard + 5,
911911
"Use imported library '{0}' with prefix '{1}'",
912912
);
913+
914+
/// {@template dart.fix.import.libraryProject1}
915+
/// Import defining library.
916+
/// {@endtemplate}
913917
static const IMPORT_LIBRARY_PROJECT1 = FixKind(
914918
'dart.fix.import.libraryProject1',
915919
DartFixKindPriority.standard + 3,
916920
"Import library '{0}'",
917921
);
922+
923+
/// {@macro dart.fix.import.libraryProject1}
918924
static const IMPORT_LIBRARY_PROJECT1_PREFIXED = FixKind(
919925
'dart.fix.import.libraryProject1Prefixed',
920926
DartFixKindPriority.standard + 3,
921927
"Import library '{0}' with prefix '{1}'",
922928
);
929+
930+
/// {@macro dart.fix.import.libraryProject1}
923931
static const IMPORT_LIBRARY_PROJECT1_PREFIXED_SHOW = FixKind(
924932
'dart.fix.import.libraryProject1PrefixedShow',
925933
DartFixKindPriority.standard + 3,
926934
"Import library '{0}' with prefix '{1}' and 'show'",
927935
);
936+
937+
/// {@macro dart.fix.import.libraryProject1}
928938
static const IMPORT_LIBRARY_PROJECT1_SHOW = FixKind(
929939
'dart.fix.import.libraryProject1Show',
930940
DartFixKindPriority.standard + 3,
931941
"Import library '{0}' with 'show'",
932942
);
943+
944+
/// {@template dart.fix.import.libraryProject2}
945+
/// Import export library.
946+
/// {@endtemplate}
933947
static const IMPORT_LIBRARY_PROJECT2 = FixKind(
934948
'dart.fix.import.libraryProject2',
935949
DartFixKindPriority.standard + 2,
936950
"Import library '{0}'",
937951
);
952+
953+
/// {@macro dart.fix.import.libraryProject2}
938954
static const IMPORT_LIBRARY_PROJECT2_PREFIXED = FixKind(
939955
'dart.fix.import.libraryProject2Prefixed',
940956
DartFixKindPriority.standard + 2,
941957
"Import library '{0}' with prefix '{1}'",
942958
);
959+
960+
/// {@macro dart.fix.import.libraryProject2}
943961
static const IMPORT_LIBRARY_PROJECT2_PREFIXED_SHOW = FixKind(
944962
'dart.fix.import.libraryProject2PrefixedShow',
945963
DartFixKindPriority.standard + 2,
946964
"Import library '{0}' with prefix '{1}' and 'show'",
947965
);
966+
967+
/// {@macro dart.fix.import.libraryProject2}
948968
static const IMPORT_LIBRARY_PROJECT2_SHOW = FixKind(
949969
'dart.fix.import.libraryProject2Show',
950970
DartFixKindPriority.standard + 2,
951971
"Import library '{0}' with 'show'",
952972
);
973+
974+
/// {@template dart.fix.import.libraryProject3}
975+
/// Import non-API.
976+
/// {@endtemplate}
953977
static const IMPORT_LIBRARY_PROJECT3 = FixKind(
954978
'dart.fix.import.libraryProject3',
955979
DartFixKindPriority.standard + 1,
956980
"Import library '{0}'",
957981
);
982+
983+
/// {@macro dart.fix.import.libraryProject3}
958984
static const IMPORT_LIBRARY_PROJECT3_PREFIXED = FixKind(
959985
'dart.fix.import.libraryProject3Prefixed',
960986
DartFixKindPriority.standard + 1,
961987
"Import library '{0}' with prefix '{1}'",
962988
);
989+
990+
/// {@macro dart.fix.import.libraryProject3}
963991
static const IMPORT_LIBRARY_PROJECT3_PREFIXED_SHOW = FixKind(
964992
'dart.fix.import.libraryProject3PrefixedShow',
965993
DartFixKindPriority.standard + 1,
966994
"Import library '{0}' with prefix '{1}' and 'show'",
967995
);
996+
997+
/// {@macro dart.fix.import.libraryProject3}
968998
static const IMPORT_LIBRARY_PROJECT3_SHOW = FixKind(
969999
'dart.fix.import.libraryProject3Show',
9701000
DartFixKindPriority.standard + 1,

0 commit comments

Comments
 (0)