Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit cd59d39

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Remove some unused code from the fix support
Change-Id: Ia5f04d51e92d0dea0f1b44878a3f268f1f629f96 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218670 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
1 parent 0908835 commit cd59d39

File tree

2 files changed

+4
-46
lines changed

2 files changed

+4
-46
lines changed

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
66
import 'package:analysis_server/plugin/edit/assist/assist_dart.dart';
7-
import 'package:analysis_server/src/services/correction/assist.dart';
87
import 'package:analysis_server/src/services/correction/base_processor.dart';
98
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
109
import 'package:analysis_server/src/services/correction/dart/add_diagnostic_property_reference.dart';
@@ -171,46 +170,6 @@ class AssistProcessor extends BaseProcessor {
171170
return assists;
172171
}
173172

174-
Future<List<Assist>> computeAssist(AssistKind assistKind) async {
175-
var context = CorrectionProducerContext.create(
176-
selectionOffset: selectionOffset,
177-
selectionLength: selectionLength,
178-
resolvedResult: resolvedResult,
179-
workspace: workspace,
180-
);
181-
if (context == null) {
182-
return assists;
183-
}
184-
185-
Future<void> compute(CorrectionProducer producer) async {
186-
producer.configure(context);
187-
188-
var builder = ChangeBuilder(
189-
workspace: context.workspace, eol: context.utils.endOfLine);
190-
await producer.compute(builder);
191-
192-
var assistKind = producer.assistKind;
193-
if (assistKind != null) {
194-
_addAssistFromBuilder(builder, assistKind,
195-
args: producer.assistArguments);
196-
}
197-
}
198-
199-
// Calculate only specific assists for edit.dartFix
200-
if (assistKind == DartAssistKind.CONVERT_CLASS_TO_MIXIN) {
201-
await compute(ConvertClassToMixin());
202-
} else if (assistKind == DartAssistKind.CONVERT_TO_INT_LITERAL) {
203-
await compute(ConvertToIntLiteral());
204-
} else if (assistKind == DartAssistKind.CONVERT_TO_SPREAD) {
205-
await compute(ConvertAddAllToSpread());
206-
} else if (assistKind == DartAssistKind.CONVERT_TO_FOR_ELEMENT) {
207-
await compute(ConvertMapFromIterableToForLiteral());
208-
} else if (assistKind == DartAssistKind.CONVERT_TO_IF_ELEMENT) {
209-
await compute(ConvertConditionalExpressionToIfElement());
210-
}
211-
return assists;
212-
}
213-
214173
void _addAssistFromBuilder(ChangeBuilder builder, AssistKind kind,
215174
{List<Object>? args}) {
216175
var change = builder.sourceChange;

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@ class FixInFileProcessor {
229229
dartFixContext: context,
230230
diagnostic: error,
231231
resolvedResult: resolveResult,
232-
selectionOffset: context.error.offset,
233-
selectionLength: context.error.length,
232+
selectionOffset: error.offset,
233+
selectionLength: error.length,
234234
workspace: workspace,
235235
);
236236
if (correctionContext == null) {
237237
return const <Fix>[];
238238
}
239239

240-
var generators = _getGenerators(error.errorCode, correctionContext);
240+
var generators = _getGenerators(error.errorCode);
241241

242242
var fixes = <Fix>[];
243243
for (var generator in generators) {
@@ -309,8 +309,7 @@ class FixInFileProcessor {
309309
}
310310
}
311311

312-
List<ProducerGenerator> _getGenerators(
313-
ErrorCode errorCode, CorrectionProducerContext context) {
312+
List<ProducerGenerator> _getGenerators(ErrorCode errorCode) {
314313
if (errorCode is LintCode) {
315314
return FixProcessor.lintProducerMap[errorCode.name] ?? [];
316315
} else {

0 commit comments

Comments
 (0)