From ee35109bd2da6f8c7b4c18883309bf724bfbb0dc Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sat, 28 Dec 2024 20:11:17 -0800 Subject: [PATCH] fixup --- src/bun.js/bindings/JSDOMFile.cpp | 10 +++++----- src/bun.js/bindings/JSS3File.cpp | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bun.js/bindings/JSDOMFile.cpp b/src/bun.js/bindings/JSDOMFile.cpp index 6b6f980062a2fa..c67cf8f62f6bcb 100644 --- a/src/bun.js/bindings/JSDOMFile.cpp +++ b/src/bun.js/bindings/JSDOMFile.cpp @@ -42,7 +42,7 @@ class JSDOMFile : public JSC::InternalFunction { static JSDOMFile* create(JSC::VM& vm, JSGlobalObject* globalObject) { - auto* zigGlobal = reinterpret_cast(globalObject); + auto* zigGlobal = defaultGlobalObject(globalObject); auto structure = createStructure(vm, globalObject, zigGlobal->functionPrototype()); auto* object = new (NotNull, JSC::allocateCell(vm)) JSDOMFile(vm, structure); object->finishCreation(vm); @@ -65,7 +65,7 @@ class JSDOMFile : public JSC::InternalFunction { static JSC_HOST_CALL_ATTRIBUTES JSC::EncodedJSValue construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + auto* globalObject = defaultGlobalObject(lexicalGlobalObject); JSC::VM& vm = globalObject->vm(); JSObject* newTarget = asObject(callFrame->newTarget()); auto* constructor = globalObject->JSDOMFileConstructor(); @@ -75,15 +75,15 @@ class JSDOMFile : public JSC::InternalFunction { auto* functionGlobalObject = reinterpret_cast( // ShadowRealm functions belong to a different global object. - getFunctionRealm(globalObject, newTarget)); + getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); structure = InternalFunction::createSubclassStructure( - globalObject, + lexicalGlobalObject, newTarget, functionGlobalObject->JSBlobStructure()); } - void* ptr = JSDOMFile__construct(globalObject, callFrame); + void* ptr = JSDOMFile__construct(lexicalGlobalObject, callFrame); if (UNLIKELY(!ptr)) { return JSValue::encode(JSC::jsUndefined()); diff --git a/src/bun.js/bindings/JSS3File.cpp b/src/bun.js/bindings/JSS3File.cpp index fb0637a33c1d15..07b0ab94299c82 100644 --- a/src/bun.js/bindings/JSS3File.cpp +++ b/src/bun.js/bindings/JSS3File.cpp @@ -36,9 +36,8 @@ extern "C" { JSC::EncodedJSValue BUN__createJSS3FileConstructor(JSGlobalObject* lexicalGlobalObject) { - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); - return JSValue::encode(globalObject->JSS3FileConstructor()); + return JSValue::encode(defaultGlobalObject(lexicalGlobalObject)->JSS3FileConstructor()); } } @@ -74,7 +73,7 @@ class JSS3File : public JSC::InternalFunction { static JSS3File* create(JSC::VM& vm, JSGlobalObject* globalObject) { - auto* zigGlobal = reinterpret_cast(globalObject); + auto* zigGlobal = defaultGlobalObject(globalObject); auto structure = createStructure(vm, globalObject, zigGlobal->functionPrototype()); auto* object = new (NotNull, JSC::allocateCell(vm)) JSS3File(vm, structure); object->finishCreation(vm);