Skip to content

Commit 15846ff

Browse files
FMorschelCommit Queue
authored andcommitted
[DAS] Differentiates tearoff fixes from invocation fixes for methods and functions
This is mostly a no-op change to make clear to anyone reading the tests that we should probably make sure both cases are covered. This is a step towards #61186 (comment) which will be handled in a separate CL. Bug: #61186 Change-Id: Ib651e2d1126a7fd54ba37fe3a806d843c0f29ca4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444384 Reviewed-by: Samuel Rawlins <[email protected]> Auto-Submit: Felipe Morschel <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent cb835a6 commit 15846ff

File tree

4 files changed

+1193
-1157
lines changed

4 files changed

+1193
-1157
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ class CreateMethodOrFunction extends ResolvedCorrectionProducer {
2727

2828
factory CreateMethodOrFunction({required CorrectionProducerContext context}) {
2929
if (context is StubCorrectionProducerContext) {
30-
return CreateMethodOrFunction._(context: context);
30+
return CreateMethodOrFunction._(
31+
context: context,
32+
fixKind: DartFixKind.CREATE_FUNCTION_TEAROFF,
33+
);
3134
}
3235

3336
if (context.node case SimpleIdentifier node) {
@@ -54,18 +57,21 @@ class CreateMethodOrFunction extends ResolvedCorrectionProducer {
5457
targetElement: targetElement,
5558
fixKind:
5659
targetElement is InterfaceElement
57-
? DartFixKind.CREATE_METHOD
58-
: DartFixKind.CREATE_FUNCTION,
60+
? DartFixKind.CREATE_METHOD_TEAROFF
61+
: DartFixKind.CREATE_FUNCTION_TEAROFF,
5962
);
6063
}
6164

62-
return CreateMethodOrFunction._(context: context);
65+
return CreateMethodOrFunction._(
66+
context: context,
67+
fixKind: DartFixKind.CREATE_FUNCTION_TEAROFF,
68+
);
6369
}
6470

6571
CreateMethodOrFunction._({
6672
required super.context,
6773
Element? targetElement,
68-
this.fixKind = DartFixKind.CREATE_METHOD,
74+
required this.fixKind,
6975
}) : _targetElement = targetElement;
7076

7177
@override

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,11 @@ abstract final class DartFixKind {
808808
DartFixKindPriority.standard - 1,
809809
"Create function '{0}'",
810810
);
811+
static const CREATE_FUNCTION_TEAROFF = FixKind(
812+
'dart.fix.create.function.tearoff',
813+
DartFixKindPriority.standard - 1,
814+
"Create function '{0}'",
815+
);
811816
static const CREATE_GETTER = FixKind(
812817
'dart.fix.create.getter',
813818
DartFixKindPriority.standard,
@@ -823,6 +828,11 @@ abstract final class DartFixKind {
823828
DartFixKindPriority.standard,
824829
"Create method '{0}'",
825830
);
831+
static const CREATE_METHOD_TEAROFF = FixKind(
832+
'dart.fix.create.method.tearoff',
833+
DartFixKindPriority.standard,
834+
"Create method '{0}'",
835+
);
826836

827837
// TODO(pq): used by LintNames.hash_and_equals; consider removing.
828838
static const CREATE_METHOD_MULTI = FixKind(

0 commit comments

Comments
 (0)