OLD | NEW |
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 /// Internal debugging utilities. | 5 /// Internal debugging utilities. |
6 library dart_style.src.debug; | 6 library dart_style.src.debug; |
7 | 7 |
8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
9 | 9 |
10 import 'chunk.dart'; | 10 import 'chunk.dart'; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (chunk.isBlock) addSpans(chunk.block.chunks); | 79 if (chunk.isBlock) addSpans(chunk.block.chunks); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 addSpans(chunks); | 83 addSpans(chunks); |
84 | 84 |
85 var spans = spanSet.toList(); | 85 var spans = spanSet.toList(); |
86 var rules = | 86 var rules = |
87 chunks.map((chunk) => chunk.rule).where((rule) => rule != null).toSet(); | 87 chunks.map((chunk) => chunk.rule).where((rule) => rule != null).toSet(); |
88 | 88 |
89 var rows = []; | 89 var rows = <List<String>>[]; |
90 | 90 |
91 addChunk(List<Chunk> chunks, String prefix, int index) { | 91 addChunk(List<Chunk> chunks, String prefix, int index) { |
92 var row = []; | 92 var row = <String>[]; |
93 row.add("$prefix$index:"); | 93 row.add("$prefix$index:"); |
94 | 94 |
95 var chunk = chunks[index]; | 95 var chunk = chunks[index]; |
96 if (chunk.text.length > 70) { | 96 if (chunk.text.length > 70) { |
97 row.add(chunk.text.substring(0, 70)); | 97 row.add(chunk.text.substring(0, 70)); |
98 } else { | 98 } else { |
99 row.add(chunk.text); | 99 row.add(chunk.text); |
100 } | 100 } |
101 | 101 |
102 if (spans.length <= 20) { | 102 if (spans.length <= 20) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 if (chunk.spaceWhenUnsplit) buffer.write(" "); | 254 if (chunk.spaceWhenUnsplit) buffer.write(" "); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 buffer.write(chunks.last.text); | 258 buffer.write(chunks.last.text); |
259 log(buffer); | 259 log(buffer); |
260 } | 260 } |
261 | 261 |
262 String _color(String ansiEscape) => useAnsiColors ? ansiEscape : ""; | 262 String _color(String ansiEscape) => useAnsiColors ? ansiEscape : ""; |
OLD | NEW |