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

Unified Diff: dart/frog/leg/lib/js_helper.dart

Issue 9429047: Implement operator-is for interfaces' supertypes and String's supertypes. Also, improve stack trace… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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: dart/frog/leg/lib/js_helper.dart
diff --git a/dart/frog/leg/lib/js_helper.dart b/dart/frog/leg/lib/js_helper.dart
index f6964164e1db7280779dc946c3c62350d1def362..145a72243d65e7440d98f639eda9b4a3f637e5ca 100644
--- a/dart/frog/leg/lib/js_helper.dart
+++ b/dart/frog/leg/lib/js_helper.dart
@@ -1172,3 +1172,19 @@ builtin$hashCode$0(receiver) {
// TODO(ahe): Dynamic may be overridden.
builtin$get$dynamic(receiver) => receiver;
+
+/**
+ * Called by generated code to capture the stacktrace before throwing
+ * an exception.
+ */
+captureStackTrace(ex) {
+ return ex;
ngeoffray 2012/02/22 11:12:36 Remove this line.
ahe 2012/02/22 21:51:24 Done.
+ if (ex === null) return ex;
ngeoffray 2012/02/22 11:12:36 You could change that to: if (JS('bool', @'typeof
ahe 2012/02/22 21:51:24 Great idea!
+ if (JS('bool', @'typeof $0 === "object"', ex)) {
+ var hasCapture = JS('bool', @'!!(Error.captureStackTrace)');
+ if (hasCapture) {
+ JS('Object', @'Error.captureStackTrace($0)', ex);
+ }
+ }
+ return ex;
+}

Powered by Google App Engine
This is Rietveld 408576698