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

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

Issue 16097012: Make the StackTrace library better handle core library frames. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 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 4ed1563fe6a8ea349dbb55b8de15c4f439edf2d6..db0e70ba29dabc3a7db8ebf0309ab4c568e2cdc2 100644
--- a/pkg/stack_trace/lib/src/trace.dart
+++ b/pkg/stack_trace/lib/src/trace.dart
@@ -10,7 +10,7 @@ import 'dart:math' as math;
import 'frame.dart';
import 'lazy_trace.dart';
-final _patchRegExp = new RegExp(r"-patch$");
+final _terseRegExp = new RegExp(r"(-patch)?(/.*)?$");
/// A stack trace, comprised of a list of stack frames.
class Trace implements StackTrace {
@@ -79,15 +79,16 @@ class Trace implements StackTrace {
/// native stack traces.
String get fullStackTrace => toString();
- /// Returns a terser version of [this]. This is accomplished by folding
- /// together multiple stack frames from the core library, as in [foldFrames].
- /// Core library patches are also renamed to remove their `-patch` suffix.
+ /// 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.
Trace get terse {
return new Trace(foldFrames((frame) => frame.isCore).frames.map((frame) {
if (!frame.isCore) return frame;
- var library = frame.library.replaceAll(_patchRegExp, '');
- return new Frame(
- Uri.parse(library), frame.line, frame.column, frame.member);
+ 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