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

Unified Diff: sdk/lib/core/stacktrace.dart

Issue 1088433004: Add StackTrace.fromString constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 5 years, 8 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 | « no previous file | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/stacktrace.dart
diff --git a/sdk/lib/core/stacktrace.dart b/sdk/lib/core/stacktrace.dart
index ef8cc4dbb4adfac17f33fef5f28d31fe15d45a2c..c8540dc47bb840aa73fd256b5afd939426a2c440 100644
--- a/sdk/lib/core/stacktrace.dart
+++ b/sdk/lib/core/stacktrace.dart
@@ -14,6 +14,22 @@ part of dart.core;
* them programmatically.
*/
abstract class StackTrace {
+ StackTrace(); // In case existing classes extend StackTrace.
+
+ /**
+ * Create a `StackTrace` object from [stackTraceString].
+ *
+ * The created stack trace will have a `toString` method returning
+ * `stackTraceString`.
+ *
+ * The `stackTraceString` can be a string returned by some other
+ * stack trace, or it can be any string at all.
+ * If the string doesn't look like a stack trace, code that interprets
+ * stack traces is likely to fail, so fake stack traces should be used
+ * with care.
+ */
+ factory StackTrace.fromString(String stackTraceString) = _StringStackTrace;
+
/**
* Returns a [String] representation of the stack trace.
*
@@ -25,3 +41,8 @@ abstract class StackTrace {
String toString();
}
+class _StringStackTrace implements StackTrace {
+ final String _stackTrace;
+ _StringStackTrace(this._stackTrace);
+ String toString() => _stackTrace;
+}
« no previous file with comments | « no previous file | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698