Chromium Code Reviews| 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; |
| +} |