Index: frog/leg/lib/js_helper.dart |
=================================================================== |
--- frog/leg/lib/js_helper.dart (revision 5171) |
+++ frog/leg/lib/js_helper.dart (working copy) |
@@ -1273,6 +1273,8 @@ |
* returned unmodified. |
*/ |
unwrapException(ex) { |
+ // Note that we are checking if the object has the property. If it |
+ // has, it could be set null if the thrown value is null. |
ahe
2012/03/08 18:32:02
"set null" -> "null"
|
if (JS('bool', @'"dartException" in $0', ex)) { |
return JS('Object', @'$0.dartException', ex); |
} else if (JS('bool', @'$0 instanceof TypeError', ex)) { |
@@ -1333,7 +1335,9 @@ |
* closure when the Dart closure is passed to the DOM. |
*/ |
convertDartClosureToJS(closure) { |
- return JS("var", @"""function() { |
+ var function = JS('var', @'$0.$identity', closure); |
+ if (JS('bool', @'!!$0', function)) return function; |
+ function = JS("var", @"""function() { |
var dartClosure = $0; |
switch (arguments.length) { |
case 0: return $1(dartClosure); |
@@ -1347,6 +1351,8 @@ |
callClosure0, |
callClosure1, |
callClosure2); |
+ JS('void', @'$0.$identity = $1', closure, function); |
+ return function; |
} |
/** |