Skip to content

Commit a093843

Browse files
stereotype441Commit Queue
authored andcommitted
[messages] Convert classInstantiationAccessTo(Static|Instance)Member to use literate diagnostic API.
Converts the code that reports the diagnostic codes `classInstantiationAccessToStaticMember` and `classInstantiationAccessToInstanceMember` to use the literate diagnostic reporting API. Change-Id: I6a6a6964690435bde5e4c39bc6a95c2a3d01104f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467741 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent 5d445b7 commit a093843

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ class ConstructorReferenceResolver {
6868
var error = method.isStatic
6969
? diag.classInstantiationAccessToStaticMember
7070
: diag.classInstantiationAccessToInstanceMember;
71-
_resolver.diagnosticReporter.atNode(
72-
node,
73-
error,
74-
arguments: [name.name],
71+
_resolver.diagnosticReporter.report(
72+
error.withArguments(name: name.name).at(node),
7573
);
7674
} else if (!name.isSynthetic) {
7775
_resolver.diagnosticReporter.atNode(

pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,9 +1448,9 @@ const DiagnosticWithoutArguments classInClass = DiagnosticWithoutArgumentsImpl(
14481448
);
14491449

14501450
/// Parameters:
1451-
/// String p0: the name of the member
1451+
/// String name: the name of the member
14521452
const DiagnosticWithArguments<
1453-
LocatableDiagnostic Function({required String p0})
1453+
LocatableDiagnostic Function({required String name})
14541454
>
14551455
classInstantiationAccessToInstanceMember = DiagnosticWithArguments(
14561456
name: 'class_instantiation_access_to_member',
@@ -1465,9 +1465,9 @@ classInstantiationAccessToInstanceMember = DiagnosticWithArguments(
14651465
);
14661466

14671467
/// Parameters:
1468-
/// String p0: the name of the member
1468+
/// String name: the name of the member
14691469
const DiagnosticWithArguments<
1470-
LocatableDiagnostic Function({required String p0})
1470+
LocatableDiagnostic Function({required String name})
14711471
>
14721472
classInstantiationAccessToStaticMember = DiagnosticWithArguments(
14731473
name: 'class_instantiation_access_to_member',
@@ -18036,19 +18036,19 @@ LocatableDiagnostic _withArgumentsCastToNonType({required String p0}) {
1803618036
}
1803718037

1803818038
LocatableDiagnostic _withArgumentsClassInstantiationAccessToInstanceMember({
18039-
required String p0,
18039+
required String name,
1804018040
}) {
1804118041
return LocatableDiagnosticImpl(
1804218042
diag.classInstantiationAccessToInstanceMember,
18043-
[p0],
18043+
[name],
1804418044
);
1804518045
}
1804618046

1804718047
LocatableDiagnostic _withArgumentsClassInstantiationAccessToStaticMember({
18048-
required String p0,
18048+
required String name,
1804918049
}) {
1805018050
return LocatableDiagnosticImpl(diag.classInstantiationAccessToStaticMember, [
18051-
p0,
18051+
name,
1805218052
]);
1805318053
}
1805418054

pkg/analyzer/messages.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,9 +2554,9 @@ CompileTimeErrorCode:
25542554
classInstantiationAccessToInstanceMember:
25552555
type: compileTimeError
25562556
parameters:
2557-
String p0: the name of the member
2557+
String name: the name of the member
25582558
sharedName: classInstantiationAccessToMember
2559-
problemMessage: "The instance member '#p0' can't be accessed on a class instantiation."
2559+
problemMessage: "The instance member '#name' can't be accessed on a class instantiation."
25602560
correctionMessage: Try changing the member name to the name of a constructor.
25612561
hasPublishedDocs: false
25622562
classInstantiationAccessToUnknownMember:
@@ -2571,9 +2571,9 @@ CompileTimeErrorCode:
25712571
classInstantiationAccessToStaticMember:
25722572
type: compileTimeError
25732573
parameters:
2574-
String p0: the name of the member
2574+
String name: the name of the member
25752575
sharedName: classInstantiationAccessToMember
2576-
problemMessage: "The static member '#p0' can't be accessed on a class instantiation."
2576+
problemMessage: "The static member '#name' can't be accessed on a class instantiation."
25772577
correctionMessage: Try removing the type arguments from the class name, or changing the member name to the name of a constructor.
25782578
hasPublishedDocs: false
25792579
nonConstGenerativeEnumConstructor:

0 commit comments

Comments
 (0)