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

Unified Diff: lib/src/chain.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 | « CHANGELOG.md ('k') | lib/src/trace.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/chain.dart
diff --git a/lib/src/chain.dart b/lib/src/chain.dart
index 99726f38916b49218d6f398262b435a7839676f5..9555e76fa0938202f53cb34300adef6cd395a88f 100644
--- a/lib/src/chain.dart
+++ b/lib/src/chain.dart
@@ -155,9 +155,14 @@ class Chain implements StackTrace {
var foldedTraces = traces.map(
(trace) => trace.foldFrames(predicate, terse: terse));
var nonEmptyTraces = foldedTraces.where((trace) {
- // Ignore traces that contain only folded frames. These traces will be
- // folded into a single frame each.
- return trace.frames.length > 1;
+ // Ignore traces that contain only folded frames.
+ if (trace.frames.length > 1) return true;
+
+ // In terse mode, the trace may have removed an outer folded frame,
+ // leaving a single non-folded frame. We can detect a folded frame because
+ // it has no line information.
+ if (!terse) return false;
+ return trace.frames.single.line != null;
});
// If all the traces contain only internal processing, preserve the last
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/trace.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698