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

Unified Diff: lib/src/trace.dart

Issue 962913002: Remove the outermost folded frame for terse stack traces. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « lib/src/chain.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/trace.dart
diff --git a/lib/src/trace.dart b/lib/src/trace.dart
index 53dbe33e4c2e9c1724e806e364bf9f5ac95fc209..e0cb21be8f79c866d7553865f04771f0bc10f6b8 100644
--- a/lib/src/trace.dart
+++ b/lib/src/trace.dart
@@ -202,7 +202,8 @@ class Trace implements StackTrace {
/// This is accomplished by folding together multiple stack frames from the
/// core library or from this package, as in [foldFrames]. Remaining core
/// library frames have their libraries, "-patch" suffixes, and line numbers
- /// removed.
+ /// removed. If the outermost frame of the stack trace is a core library
+ /// frame, it's removed entirely.
///
/// For custom folding, see [foldFrames].
Trace get terse => foldFrames((_) => false, terse: true);
@@ -216,8 +217,8 @@ class Trace implements StackTrace {
/// code and code that's called by user code.
///
/// If [terse] is true, this will also fold together frames from the core
- /// library or from this package, and simplify core library frames as in
- /// [Trace.terse].
+ /// library or from this package, simplify core library frames, and
+ /// potentially remove the outermost frame as in [Trace.terse].
Trace foldFrames(bool predicate(Frame frame), {bool terse: false}) {
if (terse) {
var oldPredicate = predicate;
@@ -255,6 +256,7 @@ class Trace implements StackTrace {
var library = frame.library.replaceAll(_terseRegExp, '');
return new Frame(Uri.parse(library), null, null, frame.member);
}).toList();
+ if (newFrames.first.isCore && newFrames.length > 1) newFrames.removeAt(0);
}
return new Trace(newFrames.reversed);
« no previous file with comments | « lib/src/chain.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698