Skip to content

Commit 24fbe71

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Use DiagnosticCode instead of ErrorCode in tests
Change-Id: I6b70bda2e678777efdfde7c0cb9dca4ec85b27e9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425686 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent a913c61 commit 24fbe71

36 files changed

+229
-208
lines changed

pkg/analyzer/lib/error/listener.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,19 @@ class ErrorReporter {
9090
}
9191
}
9292

93-
/// Report an error with the given [errorCode] and [arguments].
93+
/// Report an error with the given [diagnosticCode] and [arguments].
9494
/// The [element] is used to compute the location of the error.
9595
@experimental
9696
void atElement2(
9797
Element element2,
98-
ErrorCode errorCode, {
98+
ErrorCode diagnosticCode, {
9999
List<Object>? arguments,
100100
List<DiagnosticMessage>? contextMessages,
101101
Object? data,
102102
}) {
103103
var nonSynthetic = element2.nonSynthetic2;
104104
atOffset(
105-
errorCode: errorCode,
105+
errorCode: diagnosticCode,
106106
offset: nonSynthetic.firstFragment.nameOffset2 ?? -1,
107107
length: nonSynthetic.name3?.length ?? 0,
108108
arguments: arguments,
@@ -130,17 +130,17 @@ class ErrorReporter {
130130
);
131131
}
132132

133-
/// Report an error with the given [errorCode] and [arguments].
133+
/// Report an error with the given [diagnosticCode] and [arguments].
134134
/// The [node] is used to compute the location of the error.
135135
void atNode(
136136
AstNode node,
137-
ErrorCode errorCode, {
137+
ErrorCode diagnosticCode, {
138138
List<Object>? arguments,
139139
List<DiagnosticMessage>? contextMessages,
140140
Object? data,
141141
}) {
142142
atOffset(
143-
errorCode: errorCode,
143+
errorCode: diagnosticCode,
144144
offset: node.offset,
145145
length: node.length,
146146
arguments: arguments,
@@ -213,17 +213,17 @@ class ErrorReporter {
213213
);
214214
}
215215

216-
/// Report an error with the given [errorCode] and [arguments]. The [token] is
216+
/// Report an error with the given [diagnosticCode] and [arguments]. The [token] is
217217
/// used to compute the location of the error.
218218
void atToken(
219219
Token token,
220-
ErrorCode errorCode, {
220+
ErrorCode diagnosticCode, {
221221
List<Object>? arguments,
222222
List<DiagnosticMessage>? contextMessages,
223223
Object? data,
224224
}) {
225225
atOffset(
226-
errorCode: errorCode,
226+
errorCode: diagnosticCode,
227227
offset: token.offset,
228228
length: token.length,
229229
arguments: arguments,

pkg/analyzer/test/generated/collection_literal_parser_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ main() {
2020
class CollectionLiteralParserTest extends FastaParserTestCase {
2121
Expression parseCollectionLiteral(
2222
String source, {
23-
List<ErrorCode>? codes,
23+
List<DiagnosticCode>? codes,
2424
List<ExpectedError>? errors,
2525
int? expectedEndOffset,
2626
bool inAsync = false,

pkg/analyzer/test/generated/complex_parser_test.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,9 @@ void f() {
593593

594594
void _validate_assignableExpression_arguments_normal_chain_typeArguments(
595595
String code, [
596-
List<ErrorCode> errorCodes = const <ErrorCode>[],
596+
List<DiagnosticCode> codes = const <DiagnosticCode>[],
597597
]) {
598-
var propertyAccess1 =
599-
parseExpression(code, codes: errorCodes) as PropertyAccess;
598+
var propertyAccess1 = parseExpression(code, codes: codes) as PropertyAccess;
600599
expect(propertyAccess1.propertyName.name, "f");
601600
//
602601
// a<E>(b)<F>(c).d<G>(e)

pkg/analyzer/test/generated/formal_parameter_parser_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ class C {
10651065
void test_parseNormalFormalParameter_field_const_noType() {
10661066
NormalFormalParameter parameter = parseNormalFormalParameter(
10671067
'const this.a',
1068-
errorCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
1068+
diagnosticCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
10691069
);
10701070
expect(parameter, isNotNull);
10711071
expect(parameter, isFieldFormalParameter);
@@ -1079,7 +1079,7 @@ class C {
10791079
void test_parseNormalFormalParameter_field_const_type() {
10801080
NormalFormalParameter parameter = parseNormalFormalParameter(
10811081
'const A this.a',
1082-
errorCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
1082+
diagnosticCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
10831083
);
10841084
expect(parameter, isNotNull);
10851085
expect(parameter, isFieldFormalParameter);
@@ -1347,7 +1347,7 @@ class C {
13471347
void test_parseNormalFormalParameter_simple_const_noType() {
13481348
NormalFormalParameter parameter = parseNormalFormalParameter(
13491349
'const a',
1350-
errorCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
1350+
diagnosticCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
13511351
);
13521352
expect(parameter, isNotNull);
13531353
expect(parameter, isSimpleFormalParameter);
@@ -1360,7 +1360,7 @@ class C {
13601360
void test_parseNormalFormalParameter_simple_const_type() {
13611361
NormalFormalParameter parameter = parseNormalFormalParameter(
13621362
'const A a',
1363-
errorCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
1363+
diagnosticCodes: [ParserErrorCode.EXTRANEOUS_MODIFIER],
13641364
);
13651365
expect(parameter, isNotNull);
13661366
expect(parameter, isSimpleFormalParameter);

pkg/analyzer/test/generated/nnbd_parser_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class NNBDParserTest extends FastaParserTestCase {
2626
@override
2727
CompilationUnitImpl parseCompilationUnit(
2828
String content, {
29-
List<ErrorCode>? codes,
29+
List<DiagnosticCode>? codes,
3030
List<ExpectedError>? errors,
3131
FeatureSet? featureSet,
3232
}) => super.parseCompilationUnit(

0 commit comments

Comments
 (0)