analyzer: Deprecate AnalysisResultWithErrors in favor of AnalysisResultWithDiagnostics
Change-Id: Iddad83a42a22cef32c0e36d01a9232b71862cb98 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435360 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
60fecac3d1
commit
712d77637f
@@ -1151,7 +1151,7 @@ abstract class CommonServerContextManagerCallbacks
|
||||
analysisServer.sendLspNotification(message);
|
||||
}
|
||||
|
||||
if (result is AnalysisResultWithErrors) {
|
||||
if (result is AnalysisResultWithDiagnostics) {
|
||||
if (analysisServer.isAnalyzed(path)) {
|
||||
var serverErrors = server.doAnalysisError_listFromEngine(result);
|
||||
recordAnalysisErrors(path, serverErrors);
|
||||
|
||||
@@ -32,7 +32,7 @@ export 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
/// Returns a list of AnalysisErrors corresponding to the given list of Engine
|
||||
/// errors.
|
||||
List<AnalysisError> doAnalysisError_listFromEngine(
|
||||
engine.AnalysisResultWithErrors result,
|
||||
engine.AnalysisResultWithDiagnostics result,
|
||||
) {
|
||||
return mapEngineErrors(
|
||||
result,
|
||||
@@ -111,10 +111,10 @@ String? getReturnTypeString(engine.Element element) {
|
||||
|
||||
/// Translates engine errors through the ErrorProcessor.
|
||||
List<T> mapEngineErrors<T>(
|
||||
engine.AnalysisResultWithErrors result,
|
||||
engine.AnalysisResultWithDiagnostics result,
|
||||
List<engine.Diagnostic> diagnostics,
|
||||
T Function(
|
||||
engine.AnalysisResultWithErrors result,
|
||||
engine.AnalysisResultWithDiagnostics result,
|
||||
engine.Diagnostic diagnostic, [
|
||||
engine.DiagnosticSeverity severity,
|
||||
])
|
||||
@@ -144,7 +144,7 @@ List<T> mapEngineErrors<T>(
|
||||
/// If an [diagnosticSeverity] is specified, it will override the one in
|
||||
/// [diagnostic].
|
||||
AnalysisError newAnalysisError_fromEngine(
|
||||
engine.AnalysisResultWithErrors result,
|
||||
engine.AnalysisResultWithDiagnostics result,
|
||||
engine.Diagnostic diagnostic, [
|
||||
engine.DiagnosticSeverity? diagnosticSeverity,
|
||||
]) {
|
||||
@@ -212,7 +212,7 @@ AnalysisError newAnalysisError_fromEngine(
|
||||
|
||||
/// Create a DiagnosticMessage based on an [engine.DiagnosticMessage].
|
||||
DiagnosticMessage newDiagnosticMessage(
|
||||
engine.AnalysisResultWithErrors result,
|
||||
engine.AnalysisResultWithDiagnostics result,
|
||||
engine.DiagnosticMessage message,
|
||||
) {
|
||||
var file = message.filePath;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* Deprecate `RecordingErrorListener.errors`; use
|
||||
`RecordingDiagnosticListener.diagnostics` instead.
|
||||
* Deprecate `RecordingErrorListener.getErrorsForSource`; no longer supported.
|
||||
* Deprecate `AnalysisResultWithErrors`; use `AnalysisResultWithDiagnostics`
|
||||
instead.
|
||||
* Deprecate `AnalysisResultWithErrors.errors`; use
|
||||
`AnalysisResultWithErrors.diagnostics` instead.
|
||||
* Deprecate `ErrorType`; use `DiagnosticType` instead.
|
||||
|
||||
@@ -444,8 +444,8 @@ package:analyzer/dart/analysis/results.dart:
|
||||
AnalysisResult (class extends Object):
|
||||
new (constructor: AnalysisResult Function())
|
||||
session (getter: AnalysisSession)
|
||||
AnalysisResultWithErrors (class extends Object implements FileResult):
|
||||
new (constructor: AnalysisResultWithErrors Function())
|
||||
AnalysisResultWithDiagnostics (class extends Object implements FileResult):
|
||||
new (constructor: AnalysisResultWithDiagnostics Function())
|
||||
diagnostics (getter: List<Diagnostic>)
|
||||
errors (getter: List<Diagnostic>, deprecated)
|
||||
CannotResolveUriResult (class extends Object implements InvalidResult, SomeLibraryElementResult, SomeParsedLibraryResult, SomeResolvedLibraryResult):
|
||||
@@ -458,7 +458,7 @@ package:analyzer/dart/analysis/results.dart:
|
||||
node (getter: AstNode)
|
||||
parsedUnit (getter: ParsedUnitResult?)
|
||||
resolvedUnit (getter: ResolvedUnitResult?)
|
||||
ErrorsResult (class extends Object implements SomeErrorsResult, AnalysisResultWithErrors):
|
||||
ErrorsResult (class extends Object implements SomeErrorsResult, AnalysisResultWithDiagnostics):
|
||||
new (constructor: ErrorsResult Function())
|
||||
FileResult (class extends Object implements SomeFileResult, AnalysisResult):
|
||||
new (constructor: FileResult Function())
|
||||
@@ -500,7 +500,7 @@ package:analyzer/dart/analysis/results.dart:
|
||||
units (getter: List<ParsedUnitResult>)
|
||||
getElementDeclaration2 (method: ElementDeclarationResult? Function(Fragment), deprecated, experimental)
|
||||
getFragmentDeclaration (method: FragmentDeclarationResult? Function(Fragment), experimental)
|
||||
ParsedUnitResult (class extends Object implements SomeParsedUnitResult, AnalysisResultWithErrors):
|
||||
ParsedUnitResult (class extends Object implements SomeParsedUnitResult, AnalysisResultWithDiagnostics):
|
||||
new (constructor: ParsedUnitResult Function())
|
||||
unit (getter: CompilationUnit)
|
||||
ResolvedLibraryResult (class extends Object implements ParsedLibraryResult, SomeResolvedLibraryResult):
|
||||
@@ -539,6 +539,7 @@ package:analyzer/dart/analysis/results.dart:
|
||||
new (constructor: UnspecifiedInvalidResult Function())
|
||||
UriOfExternalLibraryResult (class extends Object implements InvalidResult, SomeParsedLibraryResult, SomeResolvedLibraryResult):
|
||||
new (constructor: UriOfExternalLibraryResult Function())
|
||||
AnalysisResultWithErrors (type alias for AnalysisResultWithDiagnostics, deprecated)
|
||||
package:analyzer/dart/analysis/session.dart:
|
||||
AnalysisSession (class extends Object):
|
||||
new (constructor: AnalysisSession Function())
|
||||
|
||||
@@ -13,6 +13,9 @@ import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/line_info.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
@Deprecated('Use AnalysisResultWithDiagnostics instead')
|
||||
typedef AnalysisResultWithErrors = AnalysisResultWithDiagnostics;
|
||||
|
||||
/// The result of performing some kind of analysis on a single file. Every
|
||||
/// result that implements this interface will also implement a sub-interface.
|
||||
///
|
||||
@@ -22,10 +25,10 @@ abstract class AnalysisResult {
|
||||
AnalysisSession get session;
|
||||
}
|
||||
|
||||
/// An analysis result that includes the errors computed during analysis.
|
||||
/// An analysis result that includes the diagnostics computed during analysis.
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class AnalysisResultWithErrors implements FileResult {
|
||||
abstract class AnalysisResultWithDiagnostics implements FileResult {
|
||||
/// The diagnostics that were computed during analysis.
|
||||
List<Diagnostic> get diagnostics;
|
||||
|
||||
@@ -83,7 +86,7 @@ abstract class ElementDeclarationResult {
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class ErrorsResult
|
||||
implements SomeErrorsResult, AnalysisResultWithErrors {}
|
||||
implements SomeErrorsResult, AnalysisResultWithDiagnostics {}
|
||||
|
||||
/// The result of computing some cheap information for a single file, when full
|
||||
/// parsed file is not required, so [ParsedUnitResult] is not necessary.
|
||||
@@ -239,7 +242,7 @@ abstract class ParsedLibraryResult
|
||||
///
|
||||
/// Clients may not extend, implement or mix-in this class.
|
||||
abstract class ParsedUnitResult
|
||||
implements SomeParsedUnitResult, AnalysisResultWithErrors {
|
||||
implements SomeParsedUnitResult, AnalysisResultWithDiagnostics {
|
||||
/// The parsed, unresolved compilation unit for the [content].
|
||||
CompilationUnit get unit;
|
||||
}
|
||||
|
||||
@@ -1583,9 +1583,9 @@ class AnalysisDriver {
|
||||
events.GetErrorsFromBytes(file: file, library: library),
|
||||
);
|
||||
var unit = AnalysisDriverResolvedUnit.fromBuffer(bytes);
|
||||
var errors = _getDiagnosticsFromSerialized(file, unit.errors);
|
||||
_updateHasErrorOrWarningFlag(file, errors);
|
||||
var result = _createErrorsResultImpl(file: file, diagnostics: errors);
|
||||
var diagnostics = _getDiagnosticsFromSerialized(file, unit.errors);
|
||||
_updateHasErrorOrWarningFlag(file, diagnostics);
|
||||
var result = _createErrorsResultImpl(file: file, diagnostics: diagnostics);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1694,9 +1694,9 @@ class AnalysisDriver {
|
||||
) {
|
||||
List<Diagnostic> diagnostics = <Diagnostic>[];
|
||||
for (AnalysisDriverUnitError error in serialized) {
|
||||
var analysisError = ErrorEncoding.decode(file.source, error);
|
||||
if (analysisError != null) {
|
||||
diagnostics.add(analysisError);
|
||||
var diagnostic = ErrorEncoding.decode(file.source, error);
|
||||
if (diagnostic != null) {
|
||||
diagnostics.add(diagnostic);
|
||||
}
|
||||
}
|
||||
return diagnostics;
|
||||
|
||||
Reference in New Issue
Block a user