mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 19:38:58 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user