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

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

Issue 1393953002: Add 'Add != null' quick fix. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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 ba774a99ffbf17a48cb12eedc0edd43435943896..52e82a291cab54fac5a4d52859915a3f65b71bf9 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -271,6 +271,9 @@ class FixProcessor {
if (errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION) {
_addFix_removeParentheses_inGetterInvocation();
}
+ if (errorCode == StaticTypeWarningCode.NON_BOOL_CONDITION) {
+ _addFix_nonBoolCondition_addNotNull();
+ }
if (errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT) {
_addFix_importLibrary_withType();
_addFix_createClass();
@@ -1518,6 +1521,11 @@ class FixProcessor {
_addFix(DartFixKind.MAKE_CLASS_ABSTRACT, [className]);
}
+ void _addFix_nonBoolCondition_addNotNull() {
+ _addInsertEdit(error.offset + error.length, ' != null');
+ _addFix(DartFixKind.ADD_NE_NULL, []);
+ }
+
void _addFix_removeDeadCode() {
AstNode coveringNode = this.coveredNode;
if (coveringNode is Expression) {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix.dart ('k') | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698