Skip to content

Commit f773702

Browse files
keertipCommit Queue
authored andcommitted
[Elements.migrate] Migrate InScopeCompletionPass.
Change-Id: I5801f9882487e4f3255d75f5e44b7a5e9fdb3b79 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398941 Commit-Queue: Keerti Parthasarathy <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent da3e12f commit f773702

File tree

6 files changed

+168
-97
lines changed

6 files changed

+168
-97
lines changed

pkg/analysis_server/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ lib/src/search/type_hierarchy.dart
3030
lib/src/services/completion/dart/completion_manager.dart
3131
lib/src/services/completion/dart/declaration_helper.dart
3232
lib/src/services/completion/dart/identifier_helper.dart
33-
lib/src/services/completion/dart/in_scope_completion_pass.dart
3433
lib/src/services/completion/dart/visibility_tracker.dart
3534
lib/src/services/correction/dart/import_library.dart
3635
lib/src/services/correction/dart/use_different_division_operator.dart

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ class DeclarationHelper {
173173
}
174174
}
175175

176+
/// Add suggestions for all constructors of [element].
177+
void addConstructorNamesForElement2({required InterfaceElement2 element}) {
178+
addConstructorNamesForElement(element: element.asElement);
179+
}
180+
176181
/// Add suggestions for all of the named constructors in the [type]. If
177182
/// [exclude] is not `null` it is the name of a constructor that should be
178183
/// omitted from the list, typically because suggesting it would result in an
@@ -229,6 +234,11 @@ class DeclarationHelper {
229234
}
230235
}
231236

237+
/// Add suggestions for declarations through [prefixElement].
238+
void addDeclarationsThroughImportPrefix2(PrefixElement2 prefixElement) {
239+
addDeclarationsThroughImportPrefix(prefixElement.asElement);
240+
}
241+
232242
/// Add any fields that can be initialized in the initializer list of the
233243
/// given [constructor]. If a [fieldToInclude] is provided, then it should not
234244
/// be skipped because the cursor is inside that field's name.
@@ -277,6 +287,19 @@ class DeclarationHelper {
277287
}
278288
}
279289

290+
/// Add any fields that can be initialized in the initializer list of the
291+
/// given [constructor]. If a [fieldToInclude] is provided, then it should not
292+
/// be skipped because the cursor is inside that field's name.
293+
void addFieldsForInitializers2(
294+
ConstructorDeclaration constructor,
295+
FieldElement2? fieldToInclude,
296+
) {
297+
addFieldsForInitializers(
298+
constructor,
299+
fieldToInclude == null ? null : fieldToInclude.asElement as FieldElement,
300+
);
301+
}
302+
280303
/// Add suggestions for all of the top-level declarations that are exported
281304
/// from the [library] except for those whose name is in the set of
282305
/// [excludedNames].
@@ -288,6 +311,17 @@ class DeclarationHelper {
288311
}
289312
}
290313

314+
/// Add suggestions for all of the top-level declarations that are exported
315+
/// from the [library] except for those whose name is in the set of
316+
/// [excludedNames].
317+
void addFromLibrary2(LibraryElement2 library, Set<String> excludedNames) {
318+
for (var entry in library.exportNamespace.definedNames.entries) {
319+
if (!excludedNames.contains(entry.key)) {
320+
_addImportedElement(entry.value);
321+
}
322+
}
323+
}
324+
291325
/// Adds suggestions for the getters defined by the [type], except for those
292326
/// whose names are in the set of [excludedGetters].
293327
void addGetters({
@@ -457,6 +491,17 @@ class DeclarationHelper {
457491
}
458492
}
459493

494+
/// Add members from the given [ExtensionElement2].
495+
void addMembersFromExtensionElement2(
496+
ExtensionElement2 extension, {
497+
ImportData? importData,
498+
}) {
499+
addMembersFromExtensionElement(
500+
extension.asElement as ExtensionElement,
501+
importData: importData,
502+
);
503+
}
504+
460505
/// Adds suggestions for any constructors that are visible within the not yet
461506
/// imported [library].
462507
void addNotImportedConstructors(LibraryElement2 library) {
@@ -599,6 +644,18 @@ class DeclarationHelper {
599644
}
600645
}
601646

647+
/// Add suggestions for all of the constructor in the [library] that could be
648+
/// a redirection target for the [redirectingConstructor].
649+
void addPossibleRedirectionsInLibrary2(
650+
ConstructorElement2 redirectingConstructor,
651+
LibraryElement2 library,
652+
) {
653+
addPossibleRedirectionsInLibrary(
654+
redirectingConstructor.asElement,
655+
library.asElement,
656+
);
657+
}
658+
602659
/// Add any static members defined by the given [element].
603660
void addStaticMembersOfElement(Element element) {
604661
if (element is TypeAliasElement) {
@@ -638,6 +695,11 @@ class DeclarationHelper {
638695
}
639696
}
640697

698+
/// Add any static members defined by the given [element].
699+
void addStaticMembersOfElement2(Element2 element) {
700+
addStaticMembersOfElement(element.asElement!);
701+
}
702+
641703
/// Adds suggestions for any constructors that are declared within the
642704
/// [library].
643705
void _addConstructors(LibraryElement library, ImportData importData) {

0 commit comments

Comments
 (0)