@@ -112,7 +112,7 @@ class ExpectedError {
112112
113113 /// Return `true` if the [error] matches this description of what it's
114114 /// expected to be.
115- bool matches (AnalysisError error) {
115+ bool matches (Diagnostic error) {
116116 if (error.offset != offset ||
117117 error.length != length ||
118118 error.errorCode != code) {
@@ -151,7 +151,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
151151 final bool checkRanges;
152152
153153 /// A list containing the errors that were collected.
154- final List <AnalysisError > _errors = [];
154+ final List <Diagnostic > _errors = [];
155155
156156 /// A table mapping sources to the line information for the source.
157157 final Map <Source , LineInfo > _lineInfoMap = {};
@@ -160,14 +160,14 @@ class GatheringErrorListener implements AnalysisErrorListener {
160160 GatheringErrorListener ({this .checkRanges = true });
161161
162162 /// Return the errors that were collected.
163- List <AnalysisError > get errors => _errors;
163+ List <Diagnostic > get errors => _errors;
164164
165165 /// Return `true` if at least one error has been gathered.
166166 bool get hasErrors => _errors.isNotEmpty;
167167
168168 /// Add the given [errors] to this listener.
169- void addAll (List <AnalysisError > errors) {
170- for (AnalysisError error in errors) {
169+ void addAll (List <Diagnostic > errors) {
170+ for (Diagnostic error in errors) {
171171 onError (error);
172172 }
173173 }
@@ -184,7 +184,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
184184 //
185185 // Match actual errors to expected errors.
186186 //
187- List <AnalysisError > unmatchedActual = errors.toList ();
187+ List <Diagnostic > unmatchedActual = errors.toList ();
188188 List <ExpectedError > unmatchedExpected = expectedErrors.toList ();
189189 int actualIndex = 0 ;
190190 while (actualIndex < unmatchedActual.length) {
@@ -242,7 +242,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
242242 buffer.writeln ();
243243 }
244244 buffer.writeln ('Found but did not expect:' );
245- for (AnalysisError actual in unmatchedActual) {
245+ for (Diagnostic actual in unmatchedActual) {
246246 buffer.write (' ' );
247247 buffer.write (actual.errorCode);
248248 buffer.write (' [' );
@@ -265,7 +265,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
265265 buffer.writeln ('To accept the current state, expect no errors.' );
266266 } else {
267267 buffer.writeln ('To accept the current state, expect:' );
268- for (AnalysisError actual in errors) {
268+ for (Diagnostic actual in errors) {
269269 List <DiagnosticMessage > contextMessages = actual.contextMessages;
270270 buffer.write (' error(' );
271271 buffer.write (actual.errorCode);
@@ -328,11 +328,11 @@ class GatheringErrorListener implements AnalysisErrorListener {
328328 //
329329 // Compute the actual number of each type of error.
330330 //
331- Map <DiagnosticCode , List <AnalysisError >> errorsByCode =
332- < DiagnosticCode , List <AnalysisError >> {};
333- for (AnalysisError error in _errors) {
331+ Map <DiagnosticCode , List <Diagnostic >> errorsByCode =
332+ < DiagnosticCode , List <Diagnostic >> {};
333+ for (Diagnostic error in _errors) {
334334 errorsByCode
335- .putIfAbsent (error.errorCode, () => < AnalysisError > [])
335+ .putIfAbsent (error.errorCode, () => < Diagnostic > [])
336336 .add (error);
337337 }
338338 //
@@ -365,9 +365,9 @@ class GatheringErrorListener implements AnalysisErrorListener {
365365 //
366366 errorsByCode.forEach ((
367367 DiagnosticCode code,
368- List <AnalysisError > actualErrors ,
368+ List <Diagnostic > actualDiagnostics ,
369369 ) {
370- int actualCount = actualErrors .length;
370+ int actualCount = actualDiagnostics .length;
371371 if (buffer.length == 0 ) {
372372 buffer.write ("Expected " );
373373 } else {
@@ -378,8 +378,8 @@ class GatheringErrorListener implements AnalysisErrorListener {
378378 buffer.write (", found " );
379379 buffer.write (actualCount);
380380 buffer.write (" (" );
381- for (int i = 0 ; i < actualErrors .length; i++ ) {
382- AnalysisError error = actualErrors [i];
381+ for (int i = 0 ; i < actualDiagnostics .length; i++ ) {
382+ Diagnostic error = actualDiagnostics [i];
383383 if (i > 0 ) {
384384 buffer.write (", " );
385385 }
@@ -408,7 +408,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
408408 }
409409 int actualErrorCount = 0 ;
410410 int actualWarningCount = 0 ;
411- for (AnalysisError error in _errors) {
411+ for (Diagnostic error in _errors) {
412412 if (error.errorCode.errorSeverity == DiagnosticSeverity .ERROR ) {
413413 actualErrorCount++ ;
414414 } else {
@@ -436,7 +436,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
436436 LineInfo ? getLineInfo (Source source) => _lineInfoMap[source];
437437
438438 @override
439- void onError (AnalysisError error) {
439+ void onError (Diagnostic error) {
440440 _errors.add (error);
441441 }
442442
0 commit comments