| 802 | } |
| 803 | if (opaque == nullptr) { |
| 804 | exceptionTracker.onError("Native class opaque object cannot be null"); |
| 805 | return Valdi::JSValueRef(); |
| 806 | } |
| 807 | |
| 808 | auto prototype = checkCallAndGetValue(exceptionTracker, JS_GetPropertyStr(_context, clsValue, "prototype")); |
| 809 | if (!exceptionTracker) { |
| 810 | return Valdi::JSValueRef(); |
| 811 | } |
| 812 | |
| 813 | auto object = checkCallAndGetValue( |
| 814 | exceptionTracker, JS_NewObjectProtoClass(_context, fromValdiJSValue(prototype.get()), _wrappedObjectClassID)); |
| 815 | if (!exceptionTracker) { |
| 816 | return Valdi::JSValueRef(); |
| 817 | } |
| 818 | |
| 819 | auto instanceData = Valdi::makeShared<Valdi::JSNativeClassInstanceData>(nativeClass, opaque); |
| 820 | setObjectWrappedObject(fromValdiJSValue(object.get()), instanceData); |
nothing calls this directly
no test coverage detected