Index: lib/src/source_visitor.dart |
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart |
index 42e2fc61c3a6daccad8601f6401c1e11a58ba2aa..ba3ba5e08e688ffa463738598c740ec65a897c5f 100644 |
--- a/lib/src/source_visitor.dart |
+++ b/lib/src/source_visitor.dart |
@@ -1012,8 +1012,18 @@ class SourceVisitor implements AstVisitor { |
visit(node.target); |
} |
+ finishIndexExpression(node); |
+ |
+ builder.unnest(); |
+ } |
+ |
+ /// Visit the index part of [node], excluding the target. |
+ /// |
+ /// Called by [CallChainVisitor] to handle index expressions in the middle of |
+ /// call chains. |
+ void finishIndexExpression(IndexExpression node) { |
if (node.target is IndexExpression) { |
- // Corner case: On a chain of [] accesses, allow splitting between them. |
+ // Edge case: On a chain of [] accesses, allow splitting between them. |
// Produces nicer output in cases like: |
// |
// someJson['property']['property']['property']['property']... |
@@ -1026,7 +1036,6 @@ class SourceVisitor implements AstVisitor { |
visit(node.index); |
token(node.rightBracket); |
builder.endSpan(); |
- builder.unnest(); |
} |
visitInstanceCreationExpression(InstanceCreationExpression node) { |