#define CYFromFFI_(Type_) \
template <> \
JSValueRef Primitive<Type_>::FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const { \
- return CYCastJSValue(context, *reinterpret_cast<Type_ *>(data)); \
+ JSValueRef value(CYCastJSValue(context, *reinterpret_cast<Type_ *>(data))); \
+ JSObjectRef typed(_jsccall(JSObjectCallAsConstructor, context, CYGetCachedObject(context, CYJSString("Number")), 1, &value)); \
+ CYSetProperty(context, typed, cyt_s, CYMakeType(context, *this), kJSPropertyAttributeDontEnum); \
+ return typed; \
}
-CYFromFFI_(bool)
CYFromFFI_(wchar_t)
CYFromFFI_(float)
CYFromFFI_(double)
CYFromFFI_(unsigned __int128)
#endif
+template <>
+JSValueRef Primitive<bool>::FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const {
+ return CYCastJSValue(context, *reinterpret_cast<bool *>(data));
+}
+
template <>
JSValueRef Primitive<char>::FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const {
uint16_t string(uint8_t(*reinterpret_cast<char *>(data)));
type->PoolFFI(buffer, context, ffi, data, arguments[0]);
JSValueRef value(type->FromFFI(context, ffi, data, false, buffer));
-
- if (JSValueGetType(context, value) == kJSTypeNumber) {
- JSObjectRef typed(_jsccall(JSObjectCallAsConstructor, context, CYGetCachedObject(context, CYJSString("Number")), 1, &value));
- CYSetProperty(context, typed, cyt_s, object, kJSPropertyAttributeDontEnum);
- value = typed;
- }
-
return value;
} CYCatch(NULL) }