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

Unified Diff: pkg/stack_trace/lib/src/trace.dart

Issue 75863004: Add a stack chain class to the stack trace package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: pkg/stack_trace/lib/src/trace.dart
diff --git a/pkg/stack_trace/lib/src/trace.dart b/pkg/stack_trace/lib/src/trace.dart
index c3db43ecd0eb243f7d092f9ba2de1aaccded502c..3f514430869b4912c39d1e1d3a04264bf7bb0eb9 100644
--- a/pkg/stack_trace/lib/src/trace.dart
+++ b/pkg/stack_trace/lib/src/trace.dart
@@ -172,9 +172,14 @@ class Trace implements StackTrace {
.where((line) => line != '[native code]')
.map((line) => new Frame.parseFirefox(line)));
- /// Parses this package's a string representation of a stack trace.
+ /// Parses this package's string representation of a stack trace.
+ ///
+ /// This also parses string representations of [Chain]s. They parse to the
+ /// same trace that [Chain.toTrace] would return.
Trace.parseFriendly(String trace)
: this(trace.trim().split("\n")
+ // Filter out asynchronous gaps from [Chain]s.
+ .where((line) => !line.startsWith('====='))
.map((line) => new Frame.parseFriendly(line)));
/// Returns a new [Trace] comprised of [frames].
@@ -191,10 +196,13 @@ class Trace implements StackTrace {
/// Returns a terser version of [this].
///
/// This is accomplished by folding together multiple stack frames from the
- /// core library, as in [foldFrames]. Remaining core library frames have their
- /// libraries, "-patch" suffixes, and line numbers removed.
+ /// core library or from this package, as in [foldFrames]. Remaining core
+ /// library frames have their libraries, "-patch" suffixes, and line numbers
+ /// removed.
Trace get terse {
- return new Trace(foldFrames((frame) => frame.isCore).frames.map((frame) {
+ return new Trace(foldFrames((frame) {
+ return frame.isCore || frame.package == 'stack_trace';
+ }).frames.map((frame) {
if (!frame.isCore) return frame;
var library = frame.library.replaceAll(_terseRegExp, '');
return new Frame(Uri.parse(library), null, null, frame.member);

Powered by Google App Engine
This is Rietveld 408576698