| 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:
|
|
|