Skip to content

Commit 8642ff0

Browse files
DanTupCommit Queue
authored andcommitted
[analysis_server] Make fix/assists consistently use "initializing formal" instead of "field formal"
There was a mix of the term "field formal" and "initializing formal" in fixes and assists. This changes those that used "field formal" to "initializing formal" (which seems to be the term used most here and on the website). I did not update all places that use this (for example there are many in the analyzer, including classes). Change-Id: Ia4a1095a756adb35ca7faa8dc06c541abb04bfcc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413781 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 0d1fe0f commit 8642ff0

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

pkg/analysis_server/lib/src/computer/computer_documentation.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class DartDocumentationComputer {
2323
_ => elementBeingDocumented,
2424
};
2525
if (element == null) {
26-
// This can happen when the code is invalid, such as having a field formal
27-
// parameter for a field that does not exist.
26+
// This can happen when the code is invalid, such as having an
27+
// initializing formal parameter for a field that does not exist.
2828
return null;
2929
}
3030

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ abstract final class DartAssistKind {
106106
DartAssistKindPriority.DEFAULT,
107107
'Convert to double quoted string',
108108
);
109-
static const CONVERT_TO_FIELD_PARAMETER = AssistKind(
110-
'dart.assist.convert.toConstructorFieldParameter',
109+
static const CONVERT_TO_INITIALIZING_FORMAL = AssistKind(
110+
'dart.assist.convert.toInitializingFormal',
111111
DartAssistKindPriority.DEFAULT,
112-
'Convert to field formal parameter',
112+
'Convert to initializing formal parameter',
113113
);
114114
static const CONVERT_TO_FOR_ELEMENT = AssistKind(
115115
'dart.assist.convert.toForElement',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AddFieldFormalParameters extends ResolvedCorrectionProducer {
2020
CorrectionApplicability.singleLocation;
2121

2222
@override
23-
FixKind get fixKind => DartFixKind.ADD_FIELD_FORMAL_PARAMETERS;
23+
FixKind get fixKind => DartFixKind.ADD_INITIALIZING_FORMAL_PARAMETERS;
2424

2525
@override
2626
Future<void> compute(ChangeBuilder builder) async {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConvertToFieldParameter extends ResolvedCorrectionProducer {
2222
CorrectionApplicability.singleLocation;
2323

2424
@override
25-
AssistKind get assistKind => DartAssistKind.CONVERT_TO_FIELD_PARAMETER;
25+
AssistKind get assistKind => DartAssistKind.CONVERT_TO_INITIALIZING_FORMAL;
2626

2727
@override
2828
Future<void> compute(ChangeBuilder builder) async {

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,18 +730,18 @@ CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER:
730730
CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR:
731731
status: needsFix
732732
notes: |-
733-
Replace the field formal parameter with a normal parameter.
733+
Replace the initializing formal parameter with a normal parameter.
734734
CompileTimeErrorCode.FIELD_INITIALIZER_NOT_ASSIGNABLE:
735735
status: noFix
736736
CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR:
737737
status: needsFix
738738
notes: |-
739-
Replace the field formal parameter with a normal parameter and add an
740-
assignment to the field in the method.
739+
Replace the initializing formal parameter with a normal parameter and
740+
add an assignment to the field in the method.
741741
CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR:
742742
status: needsFix
743743
notes: |-
744-
Replace the field formal parameter with a normal parameter.
744+
Replace the initializing formal parameter with a normal parameter.
745745
CompileTimeErrorCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE:
746746
status: noFix
747747
CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY:

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ abstract final class DartFixKind {
157157
DartFixKindPriority.inFile,
158158
'Add cast everywhere in file',
159159
);
160-
static const ADD_FIELD_FORMAL_PARAMETERS = FixKind(
161-
'dart.fix.add.fieldFormalParameters',
160+
static const ADD_INITIALIZING_FORMAL_PARAMETERS = FixKind(
161+
'dart.fix.add.initializingFormalParameters',
162162
70,
163-
'Add final field formal parameters',
163+
'Add final initializing formal parameters',
164164
);
165165
static const ADD_KEY_TO_CONSTRUCTORS = FixKind(
166166
'dart.fix.add.keyToConstructors',

pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void main() {
1717
@reflectiveTest
1818
class ConvertToFieldParameterTest extends AssistProcessorTest {
1919
@override
20-
AssistKind get kind => DartAssistKind.CONVERT_TO_FIELD_PARAMETER;
20+
AssistKind get kind => DartAssistKind.CONVERT_TO_INITIALIZING_FORMAL;
2121

2222
Future<void> test_additionalUse() async {
2323
await resolveTestCode('''

pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void main() {
1717
@reflectiveTest
1818
class AddFieldFormalParametersTest extends FixProcessorTest {
1919
@override
20-
FixKind get kind => DartFixKind.ADD_FIELD_FORMAL_PARAMETERS;
20+
FixKind get kind => DartFixKind.ADD_INITIALIZING_FORMAL_PARAMETERS;
2121

2222
Future<void> test_flutter_nullable() async {
2323
writeTestPackageConfig(flutter: true);

pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_dart.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ abstract class DartEditBuilder implements EditBuilder {
6767
/// parameters (enclosing parenthesis are written for you). Otherwise, if an
6868
/// [argumentList] is provided then the constructor will have parameters that
6969
/// match the given arguments. If no argument list is given, but a list of
70-
/// [fieldNames] is provided, then field formal parameters will be created for
71-
/// each of the field names. If an [initializerWriter] is provided then it is
72-
/// used to write the constructor initializers (the ` : ` prefix is written
73-
/// for you). If a [bodyWriter] is provided then it is used to write the
74-
/// constructor body, otherwise an empty body is written.
70+
/// [fieldNames] is provided, then initializing formal parameters will be
71+
/// created for each of the field names. If an [initializerWriter] is provided
72+
/// then it is used to write the constructor initializers (the ` : ` prefix is
73+
/// written for you). If a [bodyWriter] is provided then it is used to write
74+
/// the constructor body, otherwise an empty body is written.
7575
void writeConstructorDeclaration(String className,
7676
{ArgumentList? argumentList,
7777
void Function()? bodyWriter,

0 commit comments

Comments
 (0)