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

Unified Diff: runtime/vm/native_entry.h

Issue 11468016: Rename GET_NATIVE_ARGUMENT macro to GET_NON_NULL_NATIVE_ARGUMENT. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « runtime/vm/code_generator_test.cc ('k') | runtime/vm/native_entry_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_entry.h
===================================================================
--- runtime/vm/native_entry.h (revision 15918)
+++ runtime/vm/native_entry.h (working copy)
@@ -51,9 +51,9 @@
NativeArguments* arguments)
-// Natives should throw an exception if an illegal argument is passed.
+// Natives should throw an exception if an illegal argument or null is passed.
// type name = value.
-#define GET_NATIVE_ARGUMENT(type, name, value) \
+#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value) \
const Instance& __##name##_instance__ = \
Instance::CheckedHandle(isolate, value); \
if (!__##name##_instance__.Is##type()) { \
@@ -64,7 +64,22 @@
const type& name = type::Cast(__##name##_instance__);
+// Natives should throw an exception if an illegal argument is passed.
+// type name = value.
+#define GET_NATIVE_ARGUMENT(type, name, value) \
+ const Instance& __##name##_instance__ = \
+ Instance::CheckedHandle(isolate, value); \
+ type& name = type::Handle(isolate); \
+ if (!__##name##_instance__.IsNull()) { \
+ if (!__##name##_instance__.Is##type()) { \
+ GrowableArray<const Object*> __args__; \
+ __args__.Add(&__##name##_instance__); \
+ Exceptions::ThrowByType(Exceptions::kArgument, __args__); \
+ } \
+ } \
+ name ^= value;
+
// Helper class for resolving and handling native functions.
class NativeEntry : public AllStatic {
public:
« no previous file with comments | « runtime/vm/code_generator_test.cc ('k') | runtime/vm/native_entry_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698