-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format binary expressions with the new back-end. (#1267)
Format binary expressions with the new back-end. This includes all arithmetic, logic, comparison, relational, type test, and bitwise operators. It doesn't include assignment operators, because those are right associative and need some special handling for how the RHS is indented.
- Loading branch information
1 parent
251e094
commit cf8aef9
Showing
6 changed files
with
236 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
40 columns | | ||
>>> Multiplicative operators. | ||
1*2/3~/4%5; | ||
<<< | ||
1 * 2 / 3 ~/ 4 % 5; | ||
>>> Additive operators. | ||
1+2-3; | ||
<<< | ||
1 + 2 - 3; | ||
>>> Shift operators. | ||
1<<2>>3>>>4; | ||
<<< | ||
1 << 2 >> 3 >>> 4; | ||
>>> Bitwise operators. | ||
1&2^3|4; | ||
<<< | ||
1 & 2 ^ 3 | 4; | ||
>>> Relation operators (which are not associative in Dart). | ||
1<2; | ||
<<< | ||
1 < 2; | ||
>>> | ||
1>2; | ||
<<< | ||
1 > 2; | ||
>>> | ||
1<=2; | ||
<<< | ||
1 <= 2; | ||
>>> | ||
1>=2; | ||
<<< | ||
1 >= 2; | ||
>>> Equality operators (which are not associative in Dart). | ||
1==2; | ||
<<< | ||
1 == 2; | ||
>>> Equality operators. | ||
1!=2; | ||
<<< | ||
1 != 2; | ||
>>> Logical operators. | ||
1&&2||3; | ||
<<< | ||
1 && 2 || 3; | ||
>>> If-null operator. | ||
foo??bar; | ||
<<< | ||
foo ?? bar; | ||
>>> Unsplit operators with mixed precedence. | ||
1+2/3-4*5%6<<7; | ||
<<< | ||
1 + 2 / 3 - 4 * 5 % 6 << 7; | ||
>>> If any operator splits, they all do. | ||
operand1 + operand2 + operand3 + operand4; | ||
<<< | ||
operand1 + | ||
operand2 + | ||
operand3 + | ||
operand4; | ||
>>> Mixed multiplicative operators split together. | ||
longName * longName / longName % longName ~/ longName; | ||
<<< | ||
longName * | ||
longName / | ||
longName % | ||
longName ~/ | ||
longName; | ||
>>> Mixed additive operators split together. | ||
longName + longName - longName + longName - longName; | ||
<<< | ||
longName + | ||
longName - | ||
longName + | ||
longName - | ||
longName; | ||
>>> Mixed shift operators split together. | ||
longName >> longName << longName >> longName >>> longName; | ||
<<< | ||
longName >> | ||
longName << | ||
longName >> | ||
longName >>> | ||
longName; | ||
>>> Mixed ascending precedence. | ||
b___________________ || a______________ && a______________ == a______________ > | ||
a______________ + a______________; | ||
<<< | ||
b___________________ || | ||
a______________ && | ||
a______________ == | ||
a______________ > | ||
a______________ + | ||
a______________; | ||
>>> Mixed descending precedence. | ||
b___________________ + a_______________ > a______________ == a______________ && | ||
a______________ || a______________; | ||
<<< | ||
b___________________ + | ||
a_______________ > | ||
a______________ == | ||
a______________ && | ||
a______________ || | ||
a______________; | ||
>>> Mixture of same and different precedence. | ||
veryLongIdentifier + veryLongIdentifier / veryLongIdentifier * | ||
veryLongIdentifier - veryLongIdentifier * veryLongIdentifier + | ||
veryLongIdentifier / veryLongIdentifier - veryLongIdentifier; | ||
<<< | ||
veryLongIdentifier + | ||
veryLongIdentifier / | ||
veryLongIdentifier * | ||
veryLongIdentifier - | ||
veryLongIdentifier * | ||
veryLongIdentifier + | ||
veryLongIdentifier / | ||
veryLongIdentifier - | ||
veryLongIdentifier; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
40 columns | | ||
>>> | ||
foo as Bar; | ||
<<< | ||
foo as Bar; | ||
>>> | ||
foo is Bar; | ||
<<< | ||
foo is Bar; | ||
>>> | ||
foo is ! Bar; | ||
<<< | ||
foo is! Bar; | ||
>>> Split `as` before operator. | ||
extremelyLongIdentifier as VeryLongTypeName; | ||
<<< | ||
extremelyLongIdentifier | ||
as VeryLongTypeName; | ||
>>> Split `is` before operator. | ||
extremelyLongIdentifier is VeryLongTypeName; | ||
<<< | ||
extremelyLongIdentifier | ||
is VeryLongTypeName; | ||
>>> Split `is!` before operator. | ||
extremelyLongIdentifier is ! VeryLongTypeName; | ||
<<< | ||
extremelyLongIdentifier | ||
is! VeryLongTypeName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
40 columns | | ||
>>> No space before ";". | ||
expression ; | ||
<<< | ||
expression; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters