diff --git a/pkg/analysis_server/analyzer_use_new_elements.txt b/pkg/analysis_server/analyzer_use_new_elements.txt index 0d550e2301e6..583622729518 100644 --- a/pkg/analysis_server/analyzer_use_new_elements.txt +++ b/pkg/analysis_server/analyzer_use_new_elements.txt @@ -33,8 +33,6 @@ lib/src/services/completion/dart/identifier_helper.dart lib/src/services/completion/dart/in_scope_completion_pass.dart lib/src/services/completion/dart/not_imported_completion_pass.dart lib/src/services/completion/dart/visibility_tracker.dart -lib/src/services/completion/postfix/postfix_completion.dart -lib/src/services/completion/statement/statement_completion.dart lib/src/services/correction/dart/add_extension_override.dart lib/src/services/correction/dart/create_extension_member.dart lib/src/services/correction/dart/import_library.dart diff --git a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart index 13f32b2c9d52..9d71e3ad6b46 100644 --- a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart +++ b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart @@ -8,7 +8,7 @@ import 'package:analysis_server_plugin/edit/correction_utils.dart'; import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/analysis/session.dart'; import 'package:analyzer/dart/ast/ast.dart'; -import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/element2.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:analyzer/dart/element/type_provider.dart'; @@ -620,7 +620,7 @@ final class PostfixCompletionProcessor { } Expression? _findOuterExpression(AstNode? start, InterfaceType builtInType) { - if (start is SimpleIdentifier && start.staticElement is PrefixElement) { + if (start is SimpleIdentifier && start.element is PrefixElement2) { return null; } diff --git a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart index 93c340eb26ef..05476c358de0 100644 --- a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart +++ b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart @@ -10,7 +10,7 @@ import 'package:analysis_server_plugin/edit/correction_utils.dart'; import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/token.dart'; -import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/element2.dart'; import 'package:analyzer/error/error.dart' as engine; import 'package:analyzer/error/error.dart'; import 'package:analyzer/source/line_info.dart'; @@ -158,11 +158,11 @@ class StatementCompletionProcessor { int get selectionOffset => statementContext.selectionOffset; - Source get source => unitElement.source; + Source get source => unitFragment.source; CompilationUnit get unit => statementContext.resolveResult.unit; - CompilationUnitElement get unitElement => unit.declaredElement!; + LibraryFragment get unitFragment => unit.declaredFragment!; Future compute() async { var node = _selectedNode(); @@ -232,7 +232,7 @@ class StatementCompletionProcessor { void _addInsertEdit(int offset, String text) { var edit = SourceEdit(offset, 0, text); - doSourceChange_addElementEdit(change, unitElement, edit); + doSourceChange_addFragmentEdit(change, unitFragment, edit); } void _addReplaceEdit(SourceRange range, String text) { @@ -243,7 +243,7 @@ class StatementCompletionProcessor { // the edits are applied. The implementation needs to be cleaned up in // order to prevent the conflicting edit from being generated. // doSourceChange_addElementEdit(change, unitElement, edit); - var fileEdit = change.getFileEdit(unitElement.source.fullName); + var fileEdit = change.getFileEdit(unitFragment.source.fullName); if (fileEdit == null) { fileEdit = SourceFileEdit(file, 0); change.addFileEdit(fileEdit);