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

Unified Diff: packages/dart_style/test/splitting/mixed.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
« no previous file with comments | « packages/dart_style/test/splitting/members.unit ('k') | packages/dart_style/test/splitting/parameters.stmt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/dart_style/test/splitting/mixed.stmt
diff --git a/packages/dart_style/test/splitting/mixed.stmt b/packages/dart_style/test/splitting/mixed.stmt
new file mode 100644
index 0000000000000000000000000000000000000000..0ef02fd935a2615cf5849fa29e3f91ade716c971
--- /dev/null
+++ b/packages/dart_style/test/splitting/mixed.stmt
@@ -0,0 +1,196 @@
+40 columns |
+>>> keeps map on one line if possible
+sendPort.send({'type': 'error', 'error': 'oops'});
+<<<
+sendPort.send(
+ {'type': 'error', 'error': 'oops'});
+>>> prefers to wrap before "."
+new Future.sync(() => callback('msg')).then(
+ (result) => replyTo.send()).catchError((error) {});
+<<<
+new Future.sync(() => callback('msg'))
+ .then((result) => replyTo.send())
+ .catchError((error) {});
+>>>
+Stream readInput(AssetId id) => future((input) => input.read());
+<<<
+Stream readInput(AssetId id) =>
+ future((input) => input.read());
+>>> nested expression indentation
+someFunctionName(argument, argument, argument,
+ someOtherFunction(argument, argument, arg));
+<<<
+someFunctionName(
+ argument,
+ argument,
+ argument,
+ someOtherFunction(
+ argument, argument, arg));
+>>> does not extra indent when multiple levels of nesting happen on one line
+someFunctionName(argument, argument, argument,
+ some(other(function(argument, argument, arg))));
+<<<
+someFunctionName(
+ argument,
+ argument,
+ argument,
+ some(other(function(
+ argument, argument, arg))));
+>>> forces extra indent and lines, if later line needs it
+callSomeMethod(innerFunction(argument, argument, argument), argument, argument, argument);
+<<<
+callSomeMethod(
+ innerFunction(
+ argument, argument, argument),
+ argument,
+ argument,
+ argument);
+>>> function inside a collection
+[item, obj.method(argument).method(argument).method(() {body;}).another().another()];
+<<<
+[
+ item,
+ obj
+ .method(argument)
+ .method(argument)
+ .method(() {
+ body;
+ }).another().another()
+];
+>>> function inside an argument list
+function(argument, obj.method(argument).method(argument).method(() {body;}).another().another());
+<<<
+function(
+ argument,
+ obj
+ .method(argument)
+ .method(argument)
+ .method(() {
+ body;
+ }).another().another());
+>>> unnested function inside nested expression
+function(argument, function(() {;}));
+<<<
+function(argument, function(() {
+ ;
+}));
+>>> nested function inside nested expression
+function(argument, function(() {;}, argument, () {;}));
+<<<
+function(
+ argument,
+ function(
+ () {
+ ;
+ },
+ argument,
+ () {
+ ;
+ }));
+>>> wrap before =>
+receiver.firstMethod().next((parameter) => longIdentifier == veryLongIdentifier);
+<<<
+receiver.firstMethod().next(
+ (parameter) => longIdentifier ==
+ veryLongIdentifier);
+>>> wrap after =>
+receiver.firstMethod().next(() => veryveryveryverylongIdentifier == veryLongIdentifier);
+<<<
+receiver.firstMethod().next(() =>
+ veryveryveryverylongIdentifier ==
+ veryLongIdentifier);
+>>> wrap at nested binary operator
+receiver.firstMethod().next(longIdentifier == veryLongIdentifier);
+<<<
+receiver.firstMethod().next(
+ longIdentifier ==
+ veryLongIdentifier);
+>>> list inside method chain
+receiver.first([listItem, secondItem, thirdItem]).second();
+<<<
+receiver.first([
+ listItem,
+ secondItem,
+ thirdItem
+]).second();
+>>> list at end of method chain
+receiver.first().second([listItem, secondItem, thirdItem, fourthItem]);
+<<<
+receiver.first().second([
+ listItem,
+ secondItem,
+ thirdItem,
+ fourthItem
+]);
+>>> binary operators in ascending precedence
+{
+ b___________________ || a______________ && a______________ == a______________ > a______________ + a______________;
+}
+<<<
+{
+ b___________________ ||
+ a______________ &&
+ a______________ ==
+ a______________ >
+ a______________ +
+ a______________;
+}
+>>> binary operators in descending precedence
+{
+ b___________________ + a______________ > a______________ == a______________ && a______________ || a______________;
+}
+<<<
+{
+ b___________________ +
+ a______________ >
+ a______________ ==
+ a______________ &&
+ a______________ ||
+ a______________;
+}
+>>> mixed multiplicative operators
+longName * longName / longName % longName ~/ longName;
+<<<
+longName *
+ longName /
+ longName %
+ longName ~/
+ longName;
+>>> mixed additive operators
+longName + longName - longName + longName - longName;
+<<<
+longName +
+ longName -
+ longName +
+ longName -
+ longName;
+>>> mixed shift operators
+longName >> longName << longName >> longName << longName;
+<<<
+longName >>
+ longName <<
+ longName >>
+ longName <<
+ longName;
+>>> mixture of same and different precedence
+veryLongIdentifier + veryLongIdentifier / veryLongIdentifier *
+veryLongIdentifier - veryLongIdentifier * veryLongIdentifier +
+veryLongIdentifier / veryLongIdentifier - veryLongIdentifier;
+<<<
+veryLongIdentifier +
+ veryLongIdentifier /
+ veryLongIdentifier *
+ veryLongIdentifier -
+ veryLongIdentifier *
+ veryLongIdentifier +
+ veryLongIdentifier /
+ veryLongIdentifier -
+ veryLongIdentifier;
+>>> choose extra nesting if it leads to better solution
+longIdentifier +
+ (longIdentifier ? 0 :
+ 1) == identifier;
+<<<
+longIdentifier +
+ (longIdentifier ? 0 : 1) ==
+ identifier;
« no previous file with comments | « packages/dart_style/test/splitting/members.unit ('k') | packages/dart_style/test/splitting/parameters.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698