Remove inlining cascades with the same method name
diff --git a/lib/src/source_visitor.dart b/lib/src/source_visitor.dart
index 7ad10c9..0fb0ca1 100644
--- a/lib/src/source_visitor.dart
+++ b/lib/src/source_visitor.dart
@@ -676,22 +676,7 @@
if (node.cascadeSections.length < 2) return true;
- var name;
- // We could be more forgiving about what constitutes sections with
- // consistent names but for now we require all sections to have the same
- // method name.
- for (var expression in node.cascadeSections) {
- if (expression is MethodInvocation) {
- if (name == null) {
- name = expression.methodName.name;
- } else if (name != expression.methodName.name) {
- return false;
- }
- } else {
- return false;
- }
- }
- return true;
+ return false;
}
@override
diff --git a/test/splitting/invocations.stmt b/test/splitting/invocations.stmt
index 6650f93..f569ffa 100644
--- a/test/splitting/invocations.stmt
+++ b/test/splitting/invocations.stmt
@@ -131,7 +131,9 @@
>>> unsplit cascade unsplit method
object.method().method()..c()..c();
<<<
-object.method().method()..c()..c();
+object.method().method()
+ ..c()
+ ..c();
>>> split cascade unsplit method
object.method().method()..cascade()..cascade();
<<<
diff --git a/test/whitespace/cascades.stmt b/test/whitespace/cascades.stmt
index 03377d2..c34560d 100644
--- a/test/whitespace/cascades.stmt
+++ b/test/whitespace/cascades.stmt
@@ -14,7 +14,9 @@
..add("baz")
..add("bar");
<<<
-list..add("baz")..add("bar");
+list
+ ..add("baz")
+ ..add("bar");
>>> cascades indent contained blocks (and force multi-line) multiple cascades get their own line when method names are different
foo..fooBar()..toString();
<<<
@@ -148,7 +150,9 @@
?..add("baz")
..add("bar");
<<<
-list?..add("baz")..add("bar");
+list
+ ?..add("baz")
+ ..add("bar");
>>> mixed
foo?..a()..b()..c();
<<<
diff --git a/test/whitespace/functions.unit b/test/whitespace/functions.unit
index e17e716..a58d0ed 100644
--- a/test/whitespace/functions.unit
+++ b/test/whitespace/functions.unit
@@ -35,7 +35,9 @@
..add(1)
..add(2);
<<<
-fish() => []..add(1)..add(2);
+fish() => []
+ ..add(1)
+ ..add(2);
>>>
fish() => []..add(1);
<<<