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

Unified Diff: packages/dart_style/test/splitting/constructors.unit

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
« no previous file with comments | « packages/dart_style/test/splitting/classes.unit ('k') | packages/dart_style/test/splitting/enums.unit » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/dart_style/test/splitting/constructors.unit
diff --git a/packages/dart_style/test/splitting/constructors.unit b/packages/dart_style/test/splitting/constructors.unit
new file mode 100644
index 0000000000000000000000000000000000000000..4758102d68f380480b7c0318a0d770d94c757279
--- /dev/null
+++ b/packages/dart_style/test/splitting/constructors.unit
@@ -0,0 +1,84 @@
+40 columns |
+>>> Single initializers can be on one line
+class Foo extends Bar {
+ final int b;
+ Foo(int a, this.b) : super(a);
+}
+<<<
+class Foo extends Bar {
+ final int b;
+ Foo(int a, this.b) : super(a);
+}
+>>> (or not)
+class Foo extends Bar {
+ final int b;
+ Foo(int a, this.b): super(aLongIdentifier);
+}
+<<<
+class Foo extends Bar {
+ final int b;
+ Foo(int a, this.b)
+ : super(aLongIdentifier);
+}
+>>> Multiple initializers are one per line
+class Foo extends Bar {
+ final int b;
+ Foo(int a, int b) : super(a), this.b = b == null ? 0 : b;
+}
+<<<
+class Foo extends Bar {
+ final int b;
+ Foo(int a, int b)
+ : super(a),
+ this.b = b == null ? 0 : b;
+}
+>>> try to keep constructor call together
+var longIdentifier = new Thing(
+ argument, argument);
+<<<
+var longIdentifier =
+ new Thing(argument, argument);
+>>> splits before ":" if the parameter list does not fit on one line
+class Foo {
+ Foo(int longArg1, int longArg2, int longArg3) : this._(longArg1);
+}
+<<<
+class Foo {
+ Foo(int longArg1, int longArg2,
+ int longArg3)
+ : this._(longArg1);
+}
+>>> indent parameters more if body is a wrapped =>
+class Foo {
+ Foo(firstArgument, secondArgument, third) => "very long body that must wrap";
+}
+<<<
+class Foo {
+ Foo(firstArgument, secondArgument,
+ third) =>
+ "very long body that must wrap";
+}
+>>> wrap initializers past the ":"
+class Foo {
+ Foo(parameter)
+ : initializer = function(argument, argument),
+ initializer2 = function(argument, argument);
+}
+<<<
+class Foo {
+ Foo(parameter)
+ : initializer = function(
+ argument, argument),
+ initializer2 = function(
+ argument, argument);
+}
+>>> split at "=" in initializer
+class Foo {
+ Foo() : initializer =function(argument, arg);
+}
+<<<
+class Foo {
+ Foo()
+ : initializer =
+ function(argument, arg);
+}
« no previous file with comments | « packages/dart_style/test/splitting/classes.unit ('k') | packages/dart_style/test/splitting/enums.unit » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698