Skip to content

Commit bc3e0ad

Browse files
srawlinsCommit Queue
authored andcommitted
Remove deprecated elements of AnalysisRule
* All callers are migrated off of `AbstractAnalysisRule.lintCodes` and `.reporter`. * All callers are migrated off of `AnalysisRule.lintCode`. Change-Id: I4123250c33ff1d0a488bd4457cfe5fc13160e829 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429121 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent ac26e94 commit bc3e0ad

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

pkg/analyzer/lib/src/lint/linter.dart

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,13 @@ sealed class AbstractAnalysisRule {
5959
/// A list of incompatible rule ids.
6060
List<String> get incompatibleRules => const [];
6161

62-
/// The lint codes associated with this analysis rule.
63-
@Deprecated("Use 'diagnosticCodes' instead.")
64-
List<DiagnosticCode> get lintCodes => diagnosticCodes;
65-
6662
/// Returns a visitor that visits a [Pubspec] to perform analysis.
6763
///
6864
/// Diagnostics are reported via this [LintRule]'s error [reporter].
6965
PubspecVisitor? get pubspecVisitor => null;
7066

71-
@protected
72-
// Protected so that analysis rule visitors do not access this directly.
73-
// TODO(srawlins): With the new availability of an ErrorReporter on
74-
// LinterContextUnit, we should probably remove this reporter. But whatever
75-
// the new API would be is not yet decided. It might also change with the
76-
// notion of post-processing lint rules that have access to all unit
77-
// reporters at once.
78-
ErrorReporter get reporter => _reporter;
79-
67+
/// Sets the [ErrorReporter] for the [CompilationUnit] currently being
68+
/// visited.
8069
set reporter(ErrorReporter value) => _reporter = value;
8170

8271
/// Registers node processors in the given [registry].
@@ -95,7 +84,7 @@ sealed class AbstractAnalysisRule {
9584
required DiagnosticCode diagnosticCode,
9685
}) {
9786
if (node != null && !node.isSynthetic) {
98-
reporter.atNode(
87+
_reporter.atNode(
9988
node,
10089
diagnosticCode,
10190
arguments: arguments,
@@ -111,7 +100,7 @@ sealed class AbstractAnalysisRule {
111100
List<Object> arguments = const [],
112101
List<DiagnosticMessage>? contextMessages,
113102
}) {
114-
reporter.atOffset(
103+
_reporter.atOffset(
115104
offset: offset,
116105
length: length,
117106
errorCode: diagnosticCode,
@@ -135,7 +124,7 @@ sealed class AbstractAnalysisRule {
135124
arguments: arguments,
136125
contextMessages: contextMessages,
137126
);
138-
reporter.reportError(diagnostic);
127+
_reporter.reportError(diagnostic);
139128
}
140129

141130
void _reportAtToken(
@@ -145,7 +134,7 @@ sealed class AbstractAnalysisRule {
145134
List<DiagnosticMessage>? contextMessages,
146135
}) {
147136
if (!token.isSynthetic) {
148-
reporter.atToken(
137+
_reporter.atToken(
149138
token,
150139
diagnosticCode,
151140
arguments: arguments,
@@ -166,10 +155,6 @@ abstract class AnalysisRule extends AbstractAnalysisRule {
166155
@override
167156
List<DiagnosticCode> get diagnosticCodes => [diagnosticCode];
168157

169-
/// The code to report for a violation.
170-
@Deprecated("Use 'diagnosticCode' instead.")
171-
DiagnosticCode get lintCode => diagnosticCode;
172-
173158
/// Reports a diagnostic at [node] with message [arguments] and
174159
/// [contextMessages].
175160
void reportAtNode(
@@ -436,7 +421,7 @@ abstract class MultiAnalysisRule extends AbstractAnalysisRule {
436421
arguments: arguments,
437422
contextMessages: contextMessages,
438423
);
439-
reporter.reportError(error);
424+
_reporter.reportError(error);
440425
}
441426

442427
/// Reports [errorCode] at [token], with message [arguments] and

0 commit comments

Comments
 (0)