Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
index 67e59fb1ac5726e4a22ec604be93a9954c7e94ff..571a86779da773f372a0b60963acb702a0a92be0 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
@@ -898,10 +898,14 @@ $throw(ex) { |
* Wrapper class for throwing exceptions. |
*/ |
class DartError { |
- /// The Dart object (or primitive JavaScript value) which was thrown. |
- final dartException; |
- |
- DartError(this.dartException) { |
+ /// The Dart object (or primitive JavaScript value) which was thrown is |
+ /// attached to this object as a field named 'dartException'. We do this |
+ /// only in raw JS so that we can use the 'in' operator and so that the |
+ /// minifier does not rename the field. Therefore it is not declared as a |
+ /// real field. |
+ |
+ DartError(var dartException) { |
+ JS('void', '#.dartException = #', this, dartException); |
ahe
2013/02/13 12:54:07
Sorry about that, I didn't think too carefully abo
|
// Install a toString method that the JavaScript system will call |
// to format uncaught exceptions. |
JS('void', '#.toString = #', this, DART_CLOSURE_TO_JS(toStringWrapper)); |
@@ -931,6 +935,7 @@ class DartError { |
// trace and Chrome even applies source maps to the stack |
// trace. Remeber, this method is only ever invoked by the browser |
// when an uncaught exception occurs. |
+ var dartException = JS('var', r'#.dartException', this); |
if (JS('bool', '!!Error.captureStackTrace') || (stack == null)) { |
return dartException.toString(); |
} else { |