| Index: pkg/analysis_server/lib/src/services/correction/util.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
|
| index 3ff5405bb4147157fda838eec4b7b09393672f04..2e73715e74333551b069e6ef61ec3a653912cef7 100644
|
| --- a/pkg/analysis_server/lib/src/services/correction/util.dart
|
| +++ b/pkg/analysis_server/lib/src/services/correction/util.dart
|
| @@ -317,9 +317,17 @@ int getExpressionParentPrecedence(AstNode node) {
|
| AstNode parent = node.parent;
|
| if (parent is ParenthesizedExpression) {
|
| return 0;
|
| - }
|
| - if (parent is IndexExpression && parent.index == node) {
|
| + } else if (parent is IndexExpression && parent.index == node) {
|
| return 0;
|
| + } else if (parent is AssignmentExpression &&
|
| + node == parent.rightHandSide &&
|
| + parent.parent is CascadeExpression) {
|
| + // This is a hack to allow nesting of cascade expressions within other
|
| + // cascade expressions. The problem is that if the precedence of two
|
| + // expressions are equal it sometimes means that we don't need parentheses
|
| + // (such as replacing the `b` in `a + b` with `c + d`) and sometimes do
|
| + // (such as replacing the `v` in `..f = v` with `a..b`).
|
| + return 3;
|
| }
|
| return getExpressionPrecedence(parent);
|
| }
|
|
|