Skip to content

Commit

Permalink
Migrate postfix_completion.dart, statement_completion.dart.
Browse files Browse the repository at this point in the history
Change-Id: Ib3723395354822f010f207393ddebcc0b93cf289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397982
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Keerti Parthasarathy <[email protected]>
  • Loading branch information
keertip authored and Commit Queue committed Dec 2, 2024
1 parent ed49d04 commit 05696d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions pkg/analysis_server/analyzer_use_new_elements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<StatementCompletion> compute() async {
var node = _selectedNode();
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 05696d5

Please sign in to comment.