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

Unified Diff: packages/stack_trace/lib/src/chain.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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 | « packages/stack_trace/CHANGELOG.md ('k') | packages/stack_trace/lib/src/trace.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/stack_trace/lib/src/chain.dart
diff --git a/packages/stack_trace/lib/src/chain.dart b/packages/stack_trace/lib/src/chain.dart
index acd17e9d59ea516498fc50ed89b0ecea07290658..2e07d4bb9c776b81e50647d60a9e449cdbd89ad0 100644
--- a/packages/stack_trace/lib/src/chain.dart
+++ b/packages/stack_trace/lib/src/chain.dart
@@ -16,10 +16,6 @@ import 'utils.dart';
/// A function that handles errors in the zone wrapped by [Chain.capture].
typedef void ChainHandler(error, Chain chain);
-/// The line used in the string representation of stack chains to represent
-/// the gap between traces.
-const _gap = '===== asynchronous gap ===========================\n';
-
/// A chain of stack traces.
///
/// A stack chain is a collection of one or more stack traces that collectively
@@ -119,11 +115,15 @@ class Chain implements StackTrace {
/// Parses a string representation of a stack chain.
///
- /// Specifically, this parses the output of [Chain.toString].
+ /// If [chain] is the output of a call to [Chain.toString], it will be parsed
+ /// as a full stack chain. Otherwise, it will be parsed as in [Trace.parse]
+ /// and returned as a single-trace chain.
factory Chain.parse(String chain) {
if (chain.isEmpty) return new Chain([]);
+ if (!chain.contains(chainGap)) return new Chain([new Trace.parse(chain)]);
+
return new Chain(
- chain.split(_gap).map((trace) => new Trace.parseFriendly(trace)));
+ chain.split(chainGap).map((trace) => new Trace.parseFriendly(trace)));
}
/// Returns a new [Chain] comprised of [traces].
@@ -191,6 +191,6 @@ class Chain implements StackTrace {
return trace.frames.map((frame) {
return '${padRight(frame.location, longest)} ${frame.member}\n';
}).join();
- }).join(_gap);
+ }).join(chainGap);
}
}
« no previous file with comments | « packages/stack_trace/CHANGELOG.md ('k') | packages/stack_trace/lib/src/trace.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698