this kind of works, but there is a crash when bundling. I think its missing a Stmt.Data.Store.reset()

Former-commit-id: 88aad6aeb1
This commit is contained in:
Jarred Sumner
2021-07-01 05:12:15 -07:00
parent a1d3191b89
commit b7d7fac635
21 changed files with 1547 additions and 485 deletions

View File

@@ -246,3 +246,26 @@ pub const OpaqueJSValue = struct_OpaqueJSValue;
// https://github.com/WebKit/webkit/blob/main/Source/JavaScriptCore/API/JSStringRef.cpp#L62
pub extern fn JSStringCreateWithCharactersNoCopy(string: [*c]const JSChar, numChars: size_t) JSStringRef;
const size_t = usize;
const then_key = "then";
var thenable_string: JSStringRef = null;
pub fn isObjectOfClassAndResolveIfNeeded(ctx: JSContextRef, obj: JSObjectRef, class: JSClassRef) ?JSObjectRef {
if (JSValueIsObjectOfClass(ctx, obj, class)) {
return obj;
}
if (!JSValueIsObject(ctx, obj)) {
return null;
}
if (thenable_string == null) {
thenable_string = JSStringCreateWithUTF8CString(then_key[0.. :0]);
}
var prop = JSObjectGetPropertyForKey(ctx, obj, JSValueMakeString(ctx, thenable_string), null);
if (prop == null) {
return null;
}
}