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

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

Issue 834353002: camelCase constants. Down with ALL_CAPS! (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 11 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 import 'chunk.dart'; 7 import 'chunk.dart';
8 import 'line_splitter.dart'; 8 import 'line_splitter.dart';
9 9
10 /// Maintains a stack of nested expressions that have currently been split. 10 /// Maintains a stack of nested expressions that have currently been split.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // though LineSplitter._findBestSplits() will early out of looping over 140 // though LineSplitter._findBestSplits() will early out of looping over
141 // them. Optimize by generating these only as needed. 141 // them. Optimize by generating these only as needed.
142 142
143 // Going deeper, so try every indentating for every subset of expression 143 // Going deeper, so try every indentating for every subset of expression
144 // nesting levels between the old and new one. 144 // nesting levels between the old and new one.
145 return _intermediateDepths(_depth, split.nesting).map((depths) { 145 return _intermediateDepths(_depth, split.nesting).map((depths) {
146 var result = this; 146 var result = this;
147 147
148 for (var depth in depths) { 148 for (var depth in depths) {
149 result = new NestingStack._( 149 result = new NestingStack._(
150 result, depth, result.indent + INDENTS_PER_NEST); 150 result, depth, result.indent + indentsPerNest);
151 } 151 }
152 152
153 return new NestingStack._( 153 return new NestingStack._(
154 result, split.nesting, result.indent + INDENTS_PER_NEST); 154 result, split.nesting, result.indent + indentsPerNest);
155 }).toList(); 155 }).toList();
156 } 156 }
157 157
158 /// Given [min] and [max], generates all of the subsets of numbers in that 158 /// Given [min] and [max], generates all of the subsets of numbers in that
159 /// range (exclusive), including the empty set. 159 /// range (exclusive), including the empty set.
160 /// 160 ///
161 /// This is used for determine what sets of intermediate nesting levels to 161 /// This is used for determine what sets of intermediate nesting levels to
162 /// consider when jumping from a shallow nesting level to a much deeper one. 162 /// consider when jumping from a shallow nesting level to a much deeper one.
163 /// Subsets are generated in order of increasing length. For example, `(2, 6)` 163 /// Subsets are generated in order of increasing length. For example, `(2, 6)`
164 /// yields: 164 /// yields:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 var nesting = this; 206 var nesting = this;
207 var levels = []; 207 var levels = [];
208 while (nesting != null) { 208 while (nesting != null) {
209 levels.add("${nesting._depth}:${nesting.indent}"); 209 levels.add("${nesting._depth}:${nesting.indent}");
210 nesting = nesting._parent; 210 nesting = nesting._parent;
211 } 211 }
212 212
213 return levels.join(" "); 213 return levels.join(" ");
214 } 214 }
215 } 215 }
OLDNEW
« example/format.dart ('K') | « lib/src/line_writer.dart ('k') | lib/src/source_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698