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

Unified Diff: lib/runtime/dart/core.js

Issue 1720473002: Support StackTrace.current (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 10 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
Index: lib/runtime/dart/core.js
diff --git a/lib/runtime/dart/core.js b/lib/runtime/dart/core.js
index 1633425ebb865fe622087e816207f09cce6a99d7..89b755c08d3c56957656a59765dbc4fea9ce0b60 100644
--- a/lib/runtime/dart/core.js
+++ b/lib/runtime/dart/core.js
@@ -1501,7 +1501,25 @@ dart_library.library('dart/core', null, /* Imports */[
return Sink;
});
let Sink = Sink$();
- class StackTrace extends Object {}
+ class StackTrace extends Object {
+ static get current() {
+ let error = new Error();
+ let stack = error.stack;
+ if (typeof stack == 'string') return new StackTrace.fromString(stack);
+ if (Error.captureStackTrace != null) {
+ Error.captureStackTrace(error);
+ let stack = error.stack;
+ if (typeof stack == 'string') return new StackTrace.fromString(stack);
+ }
+ try {
+ dart.throw(0);
+ } catch (_) {
+ let stackTrace = dart.stackTrace(_);
+ return stackTrace;
+ }
+
+ }
+ }
const _stop = dart.JsSymbol('_stop');
class Stopwatch extends Object {
get frequency() {
« no previous file with comments | « no previous file | test/codegen/expect/collection/src/queue_list.txt » ('j') | tool/input_sdk/patch/core_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698