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

Unified Diff: packages/dart_style/test/splitting/invocations.stmt

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.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: packages/dart_style/test/splitting/invocations.stmt
diff --git a/packages/dart_style/test/splitting/invocations.stmt b/packages/dart_style/test/splitting/invocations.stmt
new file mode 100644
index 0000000000000000000000000000000000000000..3d2a5032d43c525b6e9249a4827e1f3af5538758
--- /dev/null
+++ b/packages/dart_style/test/splitting/invocations.stmt
@@ -0,0 +1,162 @@
+40 columns |
+>>> split all chained calls if they don't fit on one line
+compiler.something().something().something();
+<<<
+compiler
+ .something()
+ .something()
+ .something();
+>>> do not split chained calls if not needed
+compiler.something().something().some();
+<<<
+compiler.something().something().some();
+>>> don't split before implicit receiver
+return
+ call({'type': type, 'id': id})
+ .then(deserializeAsset);
+<<<
+return call({'type': type, 'id': id})
+ .then(deserializeAsset);
+>>> allows chained calls on one line with multi-line last argument list
+compiler
+ .run(script)
+ .then((_) {
+ body;
+});
+<<<
+compiler.run(script).then((_) {
+ body;
+});
+>>> allow inline chains before and after a hard newline
+compiler.a().b((_) {
+ body;
+}).c().d();
+<<<
+compiler.a().b((_) {
+ body;
+}).c().d();
+>>> allow an inline chain before a hard newline but not after
+compiler.a().b((_) {
+ body;
+}).somethingLong().somethingLong().somethingLong();
+<<<
+compiler.a().b((_) {
+ body;
+})
+ .somethingLong()
+ .somethingLong()
+ .somethingLong();
+>>> allow an inline chain after a hard newline but not before
+compiler.somethingLong().somethingLong().somethingLong((_) {
+ body;
+}).a().b();
+<<<
+compiler
+ .somethingLong()
+ .somethingLong()
+ .somethingLong((_) {
+ body;
+}).a().b();
+>>> nest calls one more than target
+someVeryLongExpression = someVeryLongExpression.someLongMethod();
+<<<
+someVeryLongExpression =
+ someVeryLongExpression
+ .someLongMethod();
+>>> split properties after a method chain
+compiler.method().method().method().property.property;
+<<<
+compiler
+ .method()
+ .method()
+ .method()
+ .property
+ .property;
+>>> split properties in a method chain
+compiler.method().property.method().property.method();
+<<<
+compiler
+ .method()
+ .property
+ .method()
+ .property
+ .method();
+>>> do not split leading properties in a chain
+compiler.property.property.method().method().method();
+<<<
+compiler.property.property
+ .method()
+ .method()
+ .method();
+>>> do not split leading properties even if others splits
+compiler.property.method().property.method();
+<<<
+compiler.property
+ .method()
+ .property
+ .method();
+>>> split between a pair of properties
+avian.bovine.canine.equine.feline.piscine.orycteropodian.camelid;
+<<<
+avian.bovine.canine.equine.feline
+ .piscine.orycteropodian.camelid;
+>>> split before all properties if they don't fit on two lines
+avian.bovine.canine.equine.feline.piscine.orycteropodian.camelid
+.rangiferine;
+<<<
+avian
+ .bovine
+ .canine
+ .equine
+ .feline
+ .piscine
+ .orycteropodian
+ .camelid
+ .rangiferine;
+>>> unsplit cascade unsplit method
+object.method().method()..c()..c();
+<<<
+object.method().method()..c()..c();
+>>> split cascade unsplit method
+object.method().method()..cascade()..cascade();
+<<<
+object.method().method()
+ ..cascade()
+ ..cascade();
+>>> unsplit cascade split method
+object.method().method().method().method()..cascade()..cascade();
+<<<
+object
+ .method()
+ .method()
+ .method()
+ .method()..cascade()..cascade();
+>>> split cascade split method
+object.method().method().method().method()..cascade()..cascade()..cascade();
+<<<
+object
+ .method()
+ .method()
+ .method()
+ .method()
+ ..cascade()
+ ..cascade()
+ ..cascade();
+>>> cascade setters on method chain
+object.method().method().method().method()..x=1..y=2;
+<<<
+object
+ .method()
+ .method()
+ .method()
+ .method()
+ ..x = 1
+ ..y = 2;
+>>> conditional invocation
+object?.method().method()?.method().method();
+<<<
+object
+ ?.method()
+ .method()
+ ?.method()
+ .method();
« no previous file with comments | « packages/dart_style/test/splitting/imports.unit ('k') | packages/dart_style/test/splitting/list_arguments.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698