Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 2827863003: Revert "New Lint quick-fix: prefer_collection_literals (#29378)" (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix.dart ('k') | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 5c7bc062d258c442bfc3e182d5b866ae4b563933..4f31c58f198444444820ee3f29a59d71f80055db 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -381,15 +381,12 @@ class FixProcessor {
if (errorCode.name == LintNames.annotate_overrides) {
_addLintFixAddOverrideAnnotation();
}
- if (errorCode.name == LintNames.avoid_init_to_null) {
- _addFix_removeInitializer();
- }
- if (errorCode.name == LintNames.prefer_collection_literals) {
- _addFix_replaceWithLiteral();
- }
if (errorCode.name == LintNames.unnecessary_brace_in_string_interp) {
_addLintRemoveInterpolationBraces();
}
+ if (errorCode.name == LintNames.avoid_init_to_null) {
+ _addFix_removeInitializer();
+ }
}
// done
return fixes;
@@ -1902,24 +1899,6 @@ class FixProcessor {
}
}
- void _addFix_replaceWithLiteral() {
- final InstanceCreationExpression instanceCreation =
- node.getAncestor((node) => node is InstanceCreationExpression);
- final InterfaceType type = instanceCreation.staticType;
- final buffer = new StringBuffer();
- final generics = instanceCreation.constructorName.type.typeArguments;
- if (generics != null) {
- buffer.write(utils.getNodeText(generics));
- }
- if (type.name == 'List') {
- buffer.write('[]');
- } else {
- buffer.write('{}');
- }
- _addReplaceEdit(rf.rangeNode(instanceCreation), buffer.toString());
- _addFix(DartFixKind.REPLACE_WITH_LITERAL, []);
- }
-
void _addFix_undefinedClass_useSimilar() {
AstNode node = this.node;
// Prepare the optional import prefix name.
@@ -3037,7 +3016,6 @@ class FixProcessor {
class LintNames {
static const String annotate_overrides = 'annotate_overrides';
static const String avoid_init_to_null = 'avoid_init_to_null';
- static const String prefer_collection_literals = 'prefer_collection_literals';
static const String unnecessary_brace_in_string_interp =
'unnecessary_brace_in_string_interp';
}
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix.dart ('k') | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698