@@ -19,20 +19,20 @@ import 'package:path/path.dart' as path;
1919///
2020/// Clients may not extend, implement or mix-in this class.
2121class AnalyzerConverter {
22- /// Converts the analysis [error ] from the 'analyzer' package to an analysis
23- /// error defined by the plugin API.
22+ /// Converts the analysis [diagnostic ] from the 'analyzer' package to an
23+ /// analysis error defined by the plugin API.
2424 ///
2525 /// If a [lineInfo] is provided then the error's location will have a start
2626 /// line and start column. If a [severity] is provided, then it will override
2727 /// the severity defined by the error.
2828 plugin.AnalysisError convertAnalysisError (
29- analyzer.AnalysisError error , {
29+ analyzer.Diagnostic diagnostic , {
3030 analyzer.LineInfo ? lineInfo,
3131 analyzer.DiagnosticSeverity ? severity,
3232 }) {
33- var errorCode = error .errorCode;
33+ var errorCode = diagnostic .errorCode;
3434 severity ?? = errorCode.errorSeverity;
35- var offset = error .offset;
35+ var offset = diagnostic .offset;
3636 var startLine = - 1 ;
3737 var startColumn = - 1 ;
3838 var endLine = - 1 ;
@@ -41,36 +41,36 @@ class AnalyzerConverter {
4141 var startLocation = lineInfo.getLocation (offset);
4242 startLine = startLocation.lineNumber;
4343 startColumn = startLocation.columnNumber;
44- var endLocation = lineInfo.getLocation (offset + error .length);
44+ var endLocation = lineInfo.getLocation (offset + diagnostic .length);
4545 endLine = endLocation.lineNumber;
4646 endColumn = endLocation.columnNumber;
4747 }
4848 List <plugin.DiagnosticMessage >? contextMessages;
49- if (error .contextMessages.isNotEmpty) {
50- contextMessages = error .contextMessages
49+ if (diagnostic .contextMessages.isNotEmpty) {
50+ contextMessages = diagnostic .contextMessages
5151 .map ((message) =>
5252 convertDiagnosticMessage (message, lineInfo: lineInfo))
5353 .toList ();
5454 }
5555 return plugin.AnalysisError (
5656 convertErrorSeverity (severity),
5757 convertErrorType (errorCode.type),
58- plugin.Location (
59- error.source.fullName, offset, error.length, startLine, startColumn,
58+ plugin.Location (diagnostic.source.fullName, offset, diagnostic.length,
59+ startLine, startColumn,
6060 endLine: endLine, endColumn: endColumn),
61- error .message,
61+ diagnostic .message,
6262 errorCode.name.toLowerCase (),
6363 contextMessages: contextMessages,
64- correction: error .correctionMessage,
64+ correction: diagnostic .correctionMessage,
6565 hasFix: true );
6666 }
6767
68- /// Converts the list of analysis [errors ] from the 'analyzer' package to a
69- /// list of analysis errors defined by the plugin API.
68+ /// Converts the list of analysis [diagnostics ] from the 'analyzer' package to
69+ /// a list of analysis errors defined by the plugin API.
7070 ///
7171 /// The severities of the errors are altered based on [options] .
7272 List <plugin.AnalysisError > convertAnalysisErrors (
73- List <analyzer.AnalysisError > errors , {
73+ List <analyzer.Diagnostic > diagnostics , {
7474 // TODO(srawlins): Make `lineInfo` required and non-nullable, in a breaking
7575 // change release.
7676 analyzer.LineInfo ? lineInfo,
@@ -79,18 +79,18 @@ class AnalyzerConverter {
7979 analyzer.AnalysisOptions ? options,
8080 }) {
8181 var serverErrors = < plugin.AnalysisError > [];
82- for (var error in errors ) {
83- var processor = analyzer.ErrorProcessor .getProcessor (options, error );
82+ for (var diagnostic in diagnostics ) {
83+ var processor = analyzer.ErrorProcessor .getProcessor (options, diagnostic );
8484 if (processor != null ) {
8585 var severity = processor.severity;
8686 // Errors with null severity are filtered out.
8787 if (severity != null ) {
8888 // Specified severities override.
89- serverErrors.add (convertAnalysisError (error ,
89+ serverErrors.add (convertAnalysisError (diagnostic ,
9090 lineInfo: lineInfo, severity: severity));
9191 }
9292 } else {
93- serverErrors.add (convertAnalysisError (error , lineInfo: lineInfo));
93+ serverErrors.add (convertAnalysisError (diagnostic , lineInfo: lineInfo));
9494 }
9595 }
9696 return serverErrors;
0 commit comments