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

Unified Diff: frog/leg/native_emitter.dart

Issue 9722031: Check for null when invoking a native method. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « client/tests/client/client-leg.status ('k') | frog/tests/native/src/NativeNullFrogTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/native_emitter.dart
===================================================================
--- frog/leg/native_emitter.dart (revision 5622)
+++ frog/leg/native_emitter.dart (working copy)
@@ -156,11 +156,15 @@
}
var proto = Object.getPrototypeOf(obj);
+ var nullCheckMethod = function() {
+ var res = method.apply(this, Array.prototype.slice.call(arguments));
+ return res === null ? (void 0) : res;
+ }
if (!proto.hasOwnProperty(name)) {
- $defPropName(proto, name, method);
+ $defPropName(proto, name, nullCheckMethod);
}
- return method.apply(this, Array.prototype.slice.call(arguments));
+ return nullCheckMethod.apply(this, Array.prototype.slice.call(arguments));
};
dynamicBind.methods = methods;
$defPropName(Object.prototype, name, dynamicBind);
« no previous file with comments | « client/tests/client/client-leg.status ('k') | frog/tests/native/src/NativeNullFrogTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698