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; |
+} |