Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d169af6

Browse files
srawlinscommit-bot@chromium.org
authored andcommitted
Analyzer: remove unnecessary this
Change-Id: I85a769e0c32159ac2a6422d3a60d160bda40d9b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156488 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent ad5bcf1 commit d169af6

36 files changed

+239
-255
lines changed

pkg/analyzer/analysis_options.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ analyzer:
1111
omit_local_variable_types: ignore
1212
# There are currently 3360 violations in lib/.
1313
prefer_single_quotes: ignore
14-
# There are currently 2000 violations in lib/.
15-
unnecessary_this: ignore
1614

1715
# "strict-inference" is enabled, but "unused" parameters named '_' are
1816
# still reported. Re-evaluate after

pkg/analyzer/lib/error/error.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ class AnalysisError implements Diagnostic {
884884
String message = formatList(errorCode.message, arguments);
885885
String correctionTemplate = errorCode.correction;
886886
if (correctionTemplate != null) {
887-
this._correction = formatList(correctionTemplate, arguments);
887+
_correction = formatList(correctionTemplate, arguments);
888888
}
889889
_problemMessage = DiagnosticMessageImpl(
890890
filePath: source?.fullName,

pkg/analyzer/lib/error/listener.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ErrorReporter {
6767
} else if (_defaultSource == null) {
6868
throw ArgumentError("A default source must be provided");
6969
}
70-
this._source = _defaultSource;
70+
_source = _defaultSource;
7171
}
7272

7373
Source get source => _source;
@@ -76,7 +76,7 @@ class ErrorReporter {
7676
/// Setting the source to `null` will cause the default source to be used.
7777
@Deprecated('Create separate reporters for separate files')
7878
set source(Source source) {
79-
this._source = source ?? _defaultSource;
79+
_source = source ?? _defaultSource;
8080
}
8181

8282
/// Report the given [error].

pkg/analyzer/lib/exception/exception.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CaughtException implements Exception {
4848
/// [stackTrace], and [message].
4949
CaughtException.withMessage(
5050
this.message, this.exception, StackTrace stackTrace)
51-
: this.stackTrace = stackTrace ?? StackTrace.current;
51+
: stackTrace = stackTrace ?? StackTrace.current;
5252

5353
/// Recursively unwrap this [CaughtException] if it itself contains a
5454
/// [CaughtException].

pkg/analyzer/lib/src/dart/analysis/context_locator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ContextLocatorImpl implements ContextLocator {
4747
/// supplied, it will be used to access the file system. Otherwise the default
4848
/// resource provider will be used.
4949
ContextLocatorImpl({ResourceProvider resourceProvider})
50-
: this.resourceProvider =
50+
: resourceProvider =
5151
resourceProvider ?? PhysicalResourceProvider.INSTANCE;
5252

5353
@deprecated

pkg/analyzer/lib/src/dart/analysis/file_state.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class FileState {
296296
/// Return the signature of the file, based on API signatures of the
297297
/// transitive closure of imported / exported files.
298298
String get transitiveSignature {
299-
this.libraryCycle; // sets _transitiveSignature
299+
libraryCycle; // sets _transitiveSignature
300300
return _transitiveSignature;
301301
}
302302

pkg/analyzer/lib/src/dart/analysis/library_context.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ class LibraryContext {
6565
@required SourceFactory sourceFactory,
6666
@required this.externalSummaries,
6767
@required FileState targetLibrary,
68-
}) : this.logger = logger,
69-
this.byteStore = byteStore,
70-
this.analysisSession = session {
68+
}) : logger = logger,
69+
byteStore = byteStore,
70+
analysisSession = session {
7171
var synchronousSession =
7272
SynchronousSession(analysisOptions, declaredVariables);
7373
analysisContext = AnalysisContextImpl(synchronousSession, sourceFactory);

pkg/analyzer/lib/src/dart/analysis/session.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class SynchronousSession {
231231
AnalysisOptionsImpl get analysisOptions => _analysisOptions;
232232

233233
set analysisOptions(AnalysisOptionsImpl analysisOptions) {
234-
this._analysisOptions = analysisOptions;
234+
_analysisOptions = analysisOptions;
235235

236236
_typeSystemLegacy?.updateOptions(
237237
implicitCasts: analysisOptions.implicitCasts,

pkg/analyzer/lib/src/dart/ast/extensions.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import 'package:analyzer/src/dart/ast/ast.dart';
77

88
extension ListOfFormalParameterExtension on List<FormalParameter> {
99
Iterable<FormalParameterImpl> get asImpl {
10-
return this.cast<FormalParameterImpl>();
10+
return cast<FormalParameterImpl>();
1111
}
1212
}

0 commit comments

Comments
 (0)