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

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

Issue 1448003002: Add StackTrace.current getter. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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: sdk/lib/core/stacktrace.dart
diff --git a/sdk/lib/core/stacktrace.dart b/sdk/lib/core/stacktrace.dart
index c8540dc47bb840aa73fd256b5afd939426a2c440..d670e1e2a81ee98586d1262d52d644202767c616 100644
--- a/sdk/lib/core/stacktrace.dart
+++ b/sdk/lib/core/stacktrace.dart
@@ -31,6 +31,18 @@ abstract class StackTrace {
factory StackTrace.fromString(String stackTraceString) = _StringStackTrace;
/**
+ * Returns a representation of the current stack trace.
+ *
+ * This is similar to what can be achieved by doing:
+ *
+ * try { throw 0; } catch (_, stack) { return stack; }
kevmoo 2015/11/17 18:51:44 Please use ```dart try { throw 0; } ... ``` synta
sra1 2015/11/17 19:13:44 Shouldn't that be the default for Dart documentati
floitsch 2015/11/17 23:22:32 There should be no need to specify "dart" as infor
Lasse Reichstein Nielsen 2015/11/18 10:11:39 I fail to see the improvement of * ```dart * try
+ *
+ * but the getter tries to get the stack without throwing any object
floitsch 2015/11/16 19:30:21 This won't read nice in a formatted output. Just m
Lasse Reichstein Nielsen 2015/11/18 10:11:39 Done.
+ * if it can be avoided.
+ */
+ external static StackTrace get current;
+
+ /**
* Returns a [String] representation of the stack trace.
*
* The string represents the full stack trace starting from

Powered by Google App Engine
This is Rietveld 408576698