Index: tool/input_sdk/patch/core_patch.dart |
diff --git a/tool/input_sdk/patch/core_patch.dart b/tool/input_sdk/patch/core_patch.dart |
index 549c5df7b3ba8589e339bde8e9f448927399ae48..d557375c54b5bf3662b5ce40c99891fcc627bc14 100644 |
--- a/tool/input_sdk/patch/core_patch.dart |
+++ b/tool/input_sdk/patch/core_patch.dart |
@@ -452,3 +452,24 @@ class Uri { |
throw new UnsupportedError("'Uri.base' is not supported"); |
} |
} |
+ |
+@patch |
+class StackTrace { |
+ @patch |
+ @NoInline() |
Jennifer Messerly
2016/02/19 22:23:56
I think I've been removing these, they're meaningl
|
+ static StackTrace get current { |
+ var error = JS('', 'new Error()'); |
+ var stack = JS('String|Null', '#.stack', error); |
+ if (stack is String) return new StackTrace.fromString(stack); |
+ if (JS('', 'Error.captureStackTrace') != null) { |
+ JS('void', 'Error.captureStackTrace(#)', error); |
+ var stack = JS('String|Null', '#.stack', error); |
+ if (stack is String) return new StackTrace.fromString(stack); |
+ } |
+ try { |
+ throw 0; |
+ } catch (_, stackTrace) { |
+ return stackTrace; |
+ } |
+ } |
+} |