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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/js_helper.dart

Issue 2869463002: Better stack trace support (Closed)
Patch Set: Address comments Created 3 years, 7 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 | « pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
index 1cb146ddcc3931bb5737e64d69aaffd85c1060f0..f9c3ec082e69e4240f96b50834e1216e4d266c76 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
@@ -492,9 +492,8 @@ class Primitives {
JS('void', '#[#] = #', object, key, value);
}
- static StackTrace extractStackTrace(Error error) {
- return getTraceFromException(JS('', r'#.$thrownJsError', error));
- }
+ static StackTrace extractStackTrace(Error error) =>
+ getTraceFromException(error);
}
/**
@@ -627,10 +626,18 @@ class UnknownJsTypeError extends Error {
}
/**
- * Called by generated code to fetch the stack trace from an
+ * Called by generated code to fetch the stack trace from a Dart
* exception. Should never return null.
*/
-StackTrace getTraceFromException(exception) => new _StackTrace(exception);
+final _stackTrace = JS('', 'Symbol("_stackTrace")');
+StackTrace getTraceFromException(exception) {
+ var error = JS('', 'dart.recordJsError(#)', exception);
+ var trace = JS('StackTrace', '#[#]', error, _stackTrace);
+ if (trace != null) return trace;
+ trace = new _StackTrace(error);
+ JS('', '#[#] = #', error, _stackTrace, trace);
+ return trace;
+}
class _StackTrace implements StackTrace {
var _exception;
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698