Index: runtime/vm/native_entry.h |
diff --git a/runtime/vm/native_entry.h b/runtime/vm/native_entry.h |
index c5578f92635e9cd21368785136c8eb8c4a178ffb..2e90ffce1eb93760b384d25bc7c9ee2a6647ee6d 100644 |
--- a/runtime/vm/native_entry.h |
+++ b/runtime/vm/native_entry.h |
@@ -71,15 +71,16 @@ typedef void (*NativeFunction)(NativeArguments* arguments); |
NativeArguments* arguments) |
+// Helper that throws an argument exception. |
+void DartNativeThrowArgumentException(const Instance& instance); |
+ |
// Natives should throw an exception if an illegal argument or null is passed. |
// type name = value. |
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value) \ |
const Instance& __##name##_instance__ = \ |
Instance::CheckedHandle(zone, value); \ |
if (!__##name##_instance__.Is##type()) { \ |
- const Array& __args__ = Array::Handle(Array::New(1)); \ |
- __args__.SetAt(0, __##name##_instance__); \ |
- Exceptions::ThrowByType(Exceptions::kArgument, __args__); \ |
+ DartNativeThrowArgumentException(__##name##_instance__); \ |
} \ |
const type& name = type::Cast(__##name##_instance__); |
@@ -92,9 +93,7 @@ typedef void (*NativeFunction)(NativeArguments* arguments); |
type& name = type::Handle(zone); \ |
if (!__##name##_instance__.IsNull()) { \ |
if (!__##name##_instance__.Is##type()) { \ |
- const Array& __args__ = Array::Handle(Array::New(1)); \ |
- __args__.SetAt(0, __##name##_instance__); \ |
- Exceptions::ThrowByType(Exceptions::kArgument, __args__); \ |
+ DartNativeThrowArgumentException(__##name##_instance__); \ |
} \ |
} \ |
name ^= value; |
siva
2016/02/18 16:55:22
Not sure why we did it this way and not as:
const
Cutch
2016/02/18 17:04:41
That doesn't compile without first doing a RawCast
siva
2016/05/27 23:47:24
Got it.
|