Silence warnings about member function pointers
The base ClassDefinition defines its constructor member as null, but some subclass have a static constructor function. This allows both cases to be handled without a warning.
This commit is contained in:
parent
43f7329047
commit
6d524107e0
|
@ -169,7 +169,7 @@ inline JSClassRef ObjectWrap<ClassType>::create_constructor_class() {
|
||||||
// This must be set for `typeof constructor` to be 'function'.
|
// This must be set for `typeof constructor` to be 'function'.
|
||||||
definition.callAsFunction = call;
|
definition.callAsFunction = call;
|
||||||
|
|
||||||
if (s_class.constructor) {
|
if (reinterpret_cast<void*>(s_class.constructor)) {
|
||||||
definition.callAsConstructor = construct;
|
definition.callAsConstructor = construct;
|
||||||
}
|
}
|
||||||
if (!s_class.static_methods.empty()) {
|
if (!s_class.static_methods.empty()) {
|
||||||
|
@ -226,7 +226,7 @@ inline JSValueRef ObjectWrap<ClassType>::call(JSContextRef ctx, JSObjectRef func
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classes without a constructor should still be subclassable.
|
// Classes without a constructor should still be subclassable.
|
||||||
if (s_class.constructor) {
|
if (reinterpret_cast<void*>(s_class.constructor)) {
|
||||||
try {
|
try {
|
||||||
s_class.constructor(ctx, this_object, argc, arguments);
|
s_class.constructor(ctx, this_object, argc, arguments);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ inline JSValueRef ObjectWrap<ClassType>::call(JSContextRef ctx, JSObjectRef func
|
||||||
|
|
||||||
template<typename ClassType>
|
template<typename ClassType>
|
||||||
inline JSObjectRef ObjectWrap<ClassType>::construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef arguments[], JSValueRef* exception) {
|
inline JSObjectRef ObjectWrap<ClassType>::construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef arguments[], JSValueRef* exception) {
|
||||||
if (!s_class.constructor) {
|
if (!reinterpret_cast<void*>(s_class.constructor)) {
|
||||||
*exception = jsc::Exception::value(ctx, s_class.name + " is not a constructor");
|
*exception = jsc::Exception::value(ctx, s_class.name + " is not a constructor");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ inline void ObjectWrap<ClassType>::construct(Nan::NAN_METHOD_ARGS_TYPE info) {
|
||||||
if (!info.IsConstructCall()) {
|
if (!info.IsConstructCall()) {
|
||||||
Nan::ThrowError("Constructor must be called with new");
|
Nan::ThrowError("Constructor must be called with new");
|
||||||
}
|
}
|
||||||
if (s_class.constructor) {
|
if (reinterpret_cast<void*>(s_class.constructor)) {
|
||||||
auto isolate = info.GetIsolate();
|
auto isolate = info.GetIsolate();
|
||||||
auto arguments = get_arguments(info);
|
auto arguments = get_arguments(info);
|
||||||
v8::Local<v8::Object> this_object = info.This();
|
v8::Local<v8::Object> this_object = info.This();
|
||||||
|
|
Loading…
Reference in New Issue