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

Side by Side Diff: lib/src/nesting.dart

Issue 1182953003: Eat some dogfood! (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart_style.src.nesting; 5 library dart_style.src.nesting;
6 6
7 /// A single level of expression nesting. 7 /// A single level of expression nesting.
8 /// 8 ///
9 /// When a line is split in the middle of an expression, this tracks the 9 /// When a line is split in the middle of an expression, this tracks the
10 /// context of where in the expression that split occurs. It ensures that the 10 /// context of where in the expression that split occurs. It ensures that the
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 var lastLengthStart = 0; 251 var lastLengthStart = 0;
252 var lastLengthEnd = subsets.length; 252 var lastLengthEnd = subsets.length;
253 253
254 // Generate subsets in order of increasing length. 254 // Generate subsets in order of increasing length.
255 for (var length = 1; length <= max - min + 1; length++) { 255 for (var length = 1; length <= max - min + 1; length++) {
256 // Start with each subset containing one fewer element. 256 // Start with each subset containing one fewer element.
257 for (var i = lastLengthStart; i < lastLengthEnd; i++) { 257 for (var i = lastLengthStart; i < lastLengthEnd; i++) {
258 var previousSubset = subsets[i]; 258 var previousSubset = subsets[i];
259 259
260 var start = previousSubset.isNotEmpty ? previousSubset.last + 1 : min + 1; 260 var start =
261 previousSubset.isNotEmpty ? previousSubset.last + 1 : min + 1;
261 262
262 // Then for each value in the remainer, make a new subset that is the 263 // Then for each value in the remainer, make a new subset that is the
263 // union of the shorter subset and that value. 264 // union of the shorter subset and that value.
264 for (var j = start; j < max; j++) { 265 for (var j = start; j < max; j++) {
265 var subset = previousSubset.toList()..add(j); 266 var subset = previousSubset.toList()..add(j);
266 subsets.add(subset); 267 subsets.add(subset);
267 } 268 }
268 } 269 }
269 270
270 // Move on to the next length range. 271 // Move on to the next length range.
(...skipping 16 matching lines...) Expand all
287 String toString() { 288 String toString() {
288 var result = ""; 289 var result = "";
289 290
290 for (var nesting = this; nesting._depth != 0; nesting = nesting._parent) { 291 for (var nesting = this; nesting._depth != 0; nesting = nesting._parent) {
291 result = "|${nesting._depth}$result"; 292 result = "|${nesting._depth}$result";
292 } 293 }
293 294
294 return result; 295 return result;
295 } 296 }
296 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698