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

Unified Diff: lib/src/trace.dart

Issue 921553006: Fold empty async frames when generating a terse stack trace. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Code review changes 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') | 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 2690ece17a2fac811a86413328eb2fd3fd7a1b58..5cd09e9bb7fe0774e06ac6297667597dfb19e57e 100644
--- a/lib/src/trace.dart
+++ b/lib/src/trace.dart
@@ -205,7 +205,18 @@ class Trace implements StackTrace {
/// removed.
Trace get terse {
return new Trace(foldFrames((frame) {
- return frame.isCore || frame.package == 'stack_trace';
+ if (frame.isCore) return true;
+ if (frame.package == 'stack_trace') return true;
+
+ // Ignore async stack frames without any line or column information. These
+ // come from the VM's async/await implementation and represent internal
+ // frames. They only ever show up in stack chains and are always
+ // surrounded by other traces that are actually useful, so we can just get
+ // rid of them.
+ // TODO(nweiz): Get rid of this logic some time after issue 22009 is
+ // fixed.
+ if (!frame.member.contains('<async>')) return false;
+ return frame.line == null;
}).frames.map((frame) {
if (!frame.isCore) return frame;
var library = frame.library.replaceAll(_terseRegExp, '');
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698