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

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

Issue 756483002: Exchanging operands of a comparision operator should invert the operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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/assist_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 18370246705f739091bfbd4f0b7936161ee84241..0c338f1e9c549d727763dc33cb4e56b59c23e1e8 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -609,6 +609,26 @@ class AssistProcessor {
SourceRange rightRange = rangeStartEnd(rightOperand, binaryExpression);
_addReplaceEdit(leftRange, _getRangeText(rightRange));
_addReplaceEdit(rightRange, _getRangeText(leftRange));
+ // maybe replace the operator
+ {
+ Token operator = binaryExpression.operator;
+ // prepare a new operator
+ String newOperator = null;
+ TokenType operatorType = operator.type;
+ if (operatorType == TokenType.LT) {
+ newOperator = '>=';
+ } else if (operatorType == TokenType.LT_EQ) {
+ newOperator = '>';
+ } else if (operatorType == TokenType.GT) {
+ newOperator = '<=';
+ } else if (operatorType == TokenType.GT_EQ) {
+ newOperator = '<';
+ }
+ // replace the operator
+ if (newOperator != null) {
+ _addReplaceEdit(rangeToken(operator), newOperator);
+ }
+ }
}
// add proposal
_addAssist(AssistKind.EXCHANGE_OPERANDS, []);
« no previous file with comments | « no previous file | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698