commit | 254595ea9e288c530696cf8d90111d7a44d0f6fa | [log] [tgz] |
---|---|---|
author | Dart CI <dart-luci-ci-builder@dart-ci.iam.gserviceaccount.com> | Mon Jan 18 02:05:10 2021 -0800 |
committer | Dart CI <dart-luci-ci-builder@dart-ci.iam.gserviceaccount.com> | Mon Jan 18 02:05:10 2021 -0800 |
tree | 2a1348bcd5c8eec07f8a31c29b3c66520a296150 | |
parent | d86a2d6dab059ccf02fba9d347ff5b634612502b [diff] | |
parent | e8d4569e37cdffd89015f5fa1f49971dcc0b0140 [diff] |
Version 2.12.0-239.0.dev Merge commit 'e8d4569e37cdffd89015f5fa1f49971dcc0b0140' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart index 5120c45..e3b5cf2 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart
@@ -50,6 +50,19 @@ return; } + var isCovered = false; + for (var other in sourceRanges) { + if (other.covers(sourceRange)) { + isCovered = true; + } else if (other.intersects(sourceRange)) { + return; + } + } + + if (isCovered) { + continue; + } + sourceRanges.add(sourceRange); }
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart index c73b174..dac33f8 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart
@@ -20,6 +20,21 @@ @override FixKind get kind => DartFixKind.REMOVE_UNUSED_LOCAL_VARIABLE; + Future<void> test_assignmentInAssignment() async { + await resolveTestCode(r''' +main() { + var v = 1; + v = (v = 2); + print(0); +} +'''); + await assertHasFix(r''' +main() { + print(0); +} +'''); + } + Future<void> test_inArgumentList() async { await resolveTestCode(r''' main() {
diff --git a/tools/VERSION b/tools/VERSION index 7ce15e2..af6f28b 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -27,5 +27,5 @@ MAJOR 2 MINOR 12 PATCH 0 -PRERELEASE 238 +PRERELEASE 239 PRERELEASE_PATCH 0 \ No newline at end of file