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

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

Issue 967633002: Remove the line number and file information from *all* folded frames. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Fix a README thing. Created 5 years, 9 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
« no previous file with comments | « README.md ('k') | test/chain_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 trace; 5 library trace;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'chain.dart'; 10 import 'chain.dart';
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (!predicate(frame)) { 245 if (!predicate(frame)) {
246 newFrames.add(frame); 246 newFrames.add(frame);
247 } else if (newFrames.isEmpty || !predicate(newFrames.last)) { 247 } else if (newFrames.isEmpty || !predicate(newFrames.last)) {
248 newFrames.add(new Frame( 248 newFrames.add(new Frame(
249 frame.uri, frame.line, frame.column, frame.member)); 249 frame.uri, frame.line, frame.column, frame.member));
250 } 250 }
251 } 251 }
252 252
253 if (terse) { 253 if (terse) {
254 newFrames = newFrames.map((frame) { 254 newFrames = newFrames.map((frame) {
255 if (!frame.isCore) return frame; 255 if (!predicate(frame)) return frame;
256 var library = frame.library.replaceAll(_terseRegExp, ''); 256 var library = frame.library.replaceAll(_terseRegExp, '');
257 return new Frame(Uri.parse(library), null, null, frame.member); 257 return new Frame(Uri.parse(library), null, null, frame.member);
258 }).toList(); 258 }).toList();
259 if (newFrames.first.isCore && newFrames.length > 1) newFrames.removeAt(0); 259 if (newFrames.first.isCore && newFrames.length > 1) newFrames.removeAt(0);
260 } 260 }
261 261
262 return new Trace(newFrames.reversed); 262 return new Trace(newFrames.reversed);
263 } 263 }
264 264
265 /// Returns a human-readable string representation of [this]. 265 /// Returns a human-readable string representation of [this].
266 String toString() { 266 String toString() {
267 // Figure out the longest path so we know how much to pad. 267 // Figure out the longest path so we know how much to pad.
268 var longest = frames.map((frame) => frame.location.length) 268 var longest = frames.map((frame) => frame.location.length)
269 .fold(0, math.max); 269 .fold(0, math.max);
270 270
271 // Print out the stack trace nicely formatted. 271 // Print out the stack trace nicely formatted.
272 return frames.map((frame) { 272 return frames.map((frame) {
273 return '${padRight(frame.location, longest)} ${frame.member}\n'; 273 return '${padRight(frame.location, longest)} ${frame.member}\n';
274 }).join(); 274 }).join();
275 } 275 }
276 } 276 }
OLDNEW
« no previous file with comments | « README.md ('k') | test/chain_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698