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

Side by Side Diff: packages/dart_style/test/splitting/invocations.stmt

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 40 columns | 1 40 columns |
2 >>> split all chained calls if they don't fit on one line 2 >>> split all chained calls if they don't fit on one line
3 compiler.something().something().something(); 3 compiler.something().something().something();
4 <<< 4 <<<
5 compiler 5 compiler
6 .something() 6 .something()
7 .something() 7 .something()
8 .something(); 8 .something();
9 >>> do not split chained calls if not needed 9 >>> do not split chained calls if not needed
10 compiler.something().something().some(); 10 compiler.something().something().some();
11 <<< 11 <<<
12 compiler.something().something().some(); 12 compiler.something().something().some();
13 >>> don't split before implicit receiver 13 >>> don't split before implicit receiver
14 return 14 return
15 call({'type': type, 'id': id}) 15 call({'type': type, 'id': id})
16 .then(deserializeAsset); 16 .then(deserializeAsset);
17 <<< 17 <<<
18 return call({'type': type, 'id': id}) 18 return call({'type': type, 'id': id})
19 .then(deserializeAsset); 19 .then(deserializeAsset);
20 >>> allows chained calls on one line with multi-line last argument list 20 >>> trailing functions in a chain do not force it to split
21 compiler 21 compiler
22 .run(script) 22 .run(script)
23 .then((_) { 23 .then((_) {
24 body; 24 body;
25 }); 25 });
26 <<< 26 <<<
27 compiler.run(script).then((_) { 27 compiler.run(script).then((_) {
28 body; 28 body;
29 }); 29 });
30 >>> allow inline chains before and after a hard newline 30 >>> a function in the middle of a chain is indented
31 compiler.a().b((_) { 31 compiler.a().b((_) {body;}).c().d();
32 body;
33 }).c().d();
34 <<< 32 <<<
35 compiler.a().b((_) { 33 compiler
36 body; 34 .a()
37 }).c().d(); 35 .b((_) {
38 >>> allow an inline chain before a hard newline but not after 36 body;
39 compiler.a().b((_) { 37 })
40 body; 38 .c()
41 }).somethingLong().somethingLong().somethingLong(); 39 .d();
40 >>> a function in the middle of a chain is indented
41 compiler.a().b((_) {body;}).somethingLong().somethingLong().somethingLong();
42 <<< 42 <<<
43 compiler.a().b((_) { 43 compiler
44 body; 44 .a()
45 }) 45 .b((_) {
46 body;
47 })
46 .somethingLong() 48 .somethingLong()
47 .somethingLong() 49 .somethingLong()
48 .somethingLong(); 50 .somethingLong();
49 >>> allow an inline chain after a hard newline but not before 51 >>> a function in the middle of a chain is indented
50 compiler.somethingLong().somethingLong().somethingLong((_) { 52 compiler.somethingLong().somethingLong().somethingLong((_) {
51 body; 53 body;
52 }).a().b(); 54 }).a().b();
53 <<< 55 <<<
54 compiler 56 compiler
55 .somethingLong() 57 .somethingLong()
56 .somethingLong() 58 .somethingLong()
57 .somethingLong((_) { 59 .somethingLong((_) {
60 body;
61 })
62 .a()
63 .b();
64 >>> one trailing call does not force function to indent
65 compiler.somethingLong().somethingLong().somethingLong((_) {
66 body;
67 }).a();
68 <<<
69 compiler
70 .somethingLong()
71 .somethingLong()
72 .somethingLong((_) {
58 body; 73 body;
59 }).a().b(); 74 }).a();
60 >>> nest calls one more than target 75 >>> nest calls one more than target
61 someVeryLongExpression = someVeryLongExpression.someLongMethod(); 76 someVeryLongExpression = someVeryLongExpression.someLongMethod();
62 <<< 77 <<<
63 someVeryLongExpression = 78 someVeryLongExpression =
64 someVeryLongExpression 79 someVeryLongExpression
65 .someLongMethod(); 80 .someLongMethod();
66 >>> split properties after a method chain 81 >>> split properties after a method chain
67 compiler.method().method().method().property.property; 82 compiler.method().method().method().property.property;
68 <<< 83 <<<
69 compiler 84 compiler
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 .method() 167 .method()
153 ..x = 1 168 ..x = 1
154 ..y = 2; 169 ..y = 2;
155 >>> conditional invocation 170 >>> conditional invocation
156 object?.method().method()?.method().method(); 171 object?.method().method()?.method().method();
157 <<< 172 <<<
158 object 173 object
159 ?.method() 174 ?.method()
160 .method() 175 .method()
161 ?.method() 176 ?.method()
162 .method(); 177 .method();
178 >>> index in property chain
179 someReceiverObject.property1.property2
180 .property3[0]
181 .property4
182 .property5
183 .property6;
184 <<<
185 someReceiverObject
186 .property1
187 .property2
188 .property3[0]
189 .property4
190 .property5
191 .property6;
192 >>> chained indexes
193 someReceiverObject.property1.property2
194 .property3[argument]
195 [argument][argument]
196 .property4
197 .property5
198 .property6;
199 <<<
200 someReceiverObject
201 .property1
202 .property2
203 .property3[argument][argument]
204 [argument]
205 .property4
206 .property5
207 .property6;
208 >>> index on method call
209 someReceiverObject.property1.property2
210 .method3()[0]
211 .property4
212 .property5
213 .property6;
214 <<<
215 someReceiverObject.property1.property2
216 .method3()[0]
217 .property4
218 .property5
219 .property6;
220 >>> target splits more deeply than method chain
221 someTargetFunction(argument, argument, argument).method().method();
222 <<<
223 someTargetFunction(
224 argument, argument, argument)
225 .method()
226 .method();
227 >>> splitting the target forces methods to split
228 someVeryLongTargetFunction(argument, argument).one().two();
229 <<<
230 someVeryLongTargetFunction(
231 argument, argument)
232 .one()
233 .two();
234 >>> target splits more deeply than property chain
235 someTargetFunction(argument, argument, argument).property.property;
236 <<<
237 someTargetFunction(
238 argument, argument, argument)
239 .property
240 .property;
241 >>> splitting the target forces methods to split
242 someVeryLongTargetFunction(argument, argument).one.two;
243 <<<
244 someVeryLongTargetFunction(
245 argument, argument)
246 .one
247 .two;
248 >>> do not split on "." when target is list
249 [element, element, element, element, element].someLongMethod();
250 <<<
251 [
252 element,
253 element,
254 element,
255 element,
256 element
257 ].someLongMethod();
258 >>> do not split on "." when target is map
259 {"key": "value", "another": "another value"}.someLongMethod();
260 <<<
261 {
262 "key": "value",
263 "another": "another value"
264 }.someLongMethod();
265 >>> do not split on "." when target is function literal passed to method
266 method(() {;}).someLongMethod();
267 <<<
268 method(() {
269 ;
270 }).someLongMethod();
271 >>> do not split on "." when target is function literal passed to constructor
272 new Foo(() {;}).someLongMethod();
273 <<<
274 new Foo(() {
275 ;
276 }).someLongMethod();
277 >>> do not split on "." when target is function literal passed to function
278 (function)(() {;}).someLongMethod();
279 <<<
280 (function)(() {
281 ;
282 }).someLongMethod();
OLDNEW
« no previous file with comments | « packages/dart_style/test/splitting/expressions.stmt ('k') | packages/dart_style/test/splitting/list_arguments.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698