diff --git a/src/bun.js/bindings/BakeAdditionsToGlobalObject.cpp b/src/bun.js/bindings/BakeAdditionsToGlobalObject.cpp index 7512fd284b..71ed085f4d 100644 --- a/src/bun.js/bindings/BakeAdditionsToGlobalObject.cpp +++ b/src/bun.js/bindings/BakeAdditionsToGlobalObject.cpp @@ -46,33 +46,33 @@ extern "C" SYSV_ABI EncodedJSValue Bake__createDevServerFrameworkRequestArgsObje extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getAsyncLocalStorage(JSC::JSGlobalObject* globalObject) { - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); auto value = zig->bakeAdditions().getAsyncLocalStorage(zig); return JSValue::encode(value); } extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getEnsureAsyncLocalStorageInstanceJSFunction(JSC::JSGlobalObject* globalObject) { - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); return JSValue::encode(zig->bakeAdditions().ensureAsyncLocalStorageInstanceJSFunction(globalObject)); } extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getSSRResponseConstructor(JSC::JSGlobalObject* globalObject) { - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); return JSValue::encode(zig->bakeAdditions().JSBakeResponseConstructor(globalObject)); } BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeGetAsyncLocalStorage, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); return JSValue::encode(zig->bakeAdditions().getAsyncLocalStorage(zig)); } BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeEnsureAsyncLocalStorage, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); if (callframe->argumentCount() < 1) { Bun::throwError(globalObject, scope, ErrorCode::ERR_MISSING_ARGS, "bakeEnsureAsyncLocalStorage requires at least one argument"_s); return JSValue::encode(jsUndefined()); @@ -84,7 +84,7 @@ BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeEnsureAsyncLocalStorage, (JSC::JSGlobalOb extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getBundleNewRouteJSFunction(JSC::JSGlobalObject* globalObject) { - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); auto value = zig->bakeAdditions().getBundleNewRouteJSFunction(zig); return JSValue::encode(value); } @@ -124,7 +124,7 @@ BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeGetBundleNewRouteJSFunction, (JSC::JSGlob extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getNewRouteParamsJSFunction(JSC::JSGlobalObject* globalObject) { - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); auto value = zig->bakeAdditions().getNewRouteParamsJSFunction(zig); return JSValue::encode(value); } diff --git a/src/bun.js/bindings/BunDebugger.cpp b/src/bun.js/bindings/BunDebugger.cpp index 0cfc8066a7..0dd40e4822 100644 --- a/src/bun.js/bindings/BunDebugger.cpp +++ b/src/bun.js/bindings/BunDebugger.cpp @@ -99,7 +99,7 @@ public: this->status = ConnectionStatus::Connected; auto* globalObject = context.jsGlobalObject(); if (this->unrefOnDisconnect) { - Bun__eventLoop__incrementRefConcurrently(reinterpret_cast(globalObject)->bunVM(), 1); + Bun__eventLoop__incrementRefConcurrently(static_cast(globalObject)->bunVM(), 1); } globalObject->setInspectable(true); auto& inspector = globalObject->inspectorDebuggable(); @@ -129,7 +129,7 @@ public: }; } - this->receiveMessagesOnInspectorThread(context, reinterpret_cast(globalObject), false); + this->receiveMessagesOnInspectorThread(context, static_cast(globalObject), false); } void connect() @@ -187,7 +187,7 @@ public: if (connection->unrefOnDisconnect) { connection->unrefOnDisconnect = false; - Bun__eventLoop__incrementRefConcurrently(reinterpret_cast(context.jsGlobalObject())->bunVM(), -1); + Bun__eventLoop__incrementRefConcurrently(static_cast(context.jsGlobalObject())->bunVM(), -1); } }); } @@ -207,7 +207,7 @@ public: static void runWhilePaused(JSGlobalObject& globalObject, bool& isDoneProcessingEvents) { - Zig::GlobalObject* global = reinterpret_cast(&globalObject); + Zig::GlobalObject* global = static_cast(&globalObject); Vector connections; { Locker locker(inspectorConnectionsLock); @@ -333,7 +333,7 @@ public: if (this->debuggerThreadMessageScheduledCount++ == 0) { debuggerScriptExecutionContext->postTaskConcurrently([connection = this](ScriptExecutionContext& context) { - connection->receiveMessagesOnDebuggerThread(context, reinterpret_cast(context.jsGlobalObject())); + connection->receiveMessagesOnDebuggerThread(context, static_cast(context.jsGlobalObject())); }); } } @@ -349,7 +349,7 @@ public: this->jsWaitForMessageFromInspectorLock.unlock(); } else if (this->jsThreadMessageScheduledCount++ == 0) { ScriptExecutionContext::postTaskTo(scriptExecutionContextIdentifier, [connection = this](ScriptExecutionContext& context) { - connection->receiveMessagesOnInspectorThread(context, reinterpret_cast(context.jsGlobalObject()), true); + connection->receiveMessagesOnInspectorThread(context, static_cast(context.jsGlobalObject()), true); }); } } @@ -365,7 +365,7 @@ public: this->jsWaitForMessageFromInspectorLock.unlock(); } else if (this->jsThreadMessageScheduledCount++ == 0) { ScriptExecutionContext::postTaskTo(scriptExecutionContextIdentifier, [connection = this](ScriptExecutionContext& context) { - connection->receiveMessagesOnInspectorThread(context, reinterpret_cast(context.jsGlobalObject()), true); + connection->receiveMessagesOnInspectorThread(context, static_cast(context.jsGlobalObject()), true); }); } } diff --git a/src/bun.js/bindings/BunPlugin.cpp b/src/bun.js/bindings/BunPlugin.cpp index 4c831054f1..c7f463c0da 100644 --- a/src/bun.js/bindings/BunPlugin.cpp +++ b/src/bun.js/bindings/BunPlugin.cpp @@ -940,7 +940,7 @@ JSC::JSValue runVirtualModule(Zig::GlobalObject* globalObject, BunString* specif BUN_DEFINE_HOST_FUNCTION(jsFunctionBunPluginClear, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { - Zig::GlobalObject* global = reinterpret_cast(globalObject); + Zig::GlobalObject* global = static_cast(globalObject); global->onLoadPlugins.fileNamespace.clear(); global->onResolvePlugins.fileNamespace.clear(); global->onLoadPlugins.groups.clear(); diff --git a/src/bun.js/bindings/BunProcess.cpp b/src/bun.js/bindings/BunProcess.cpp index b8a515e1d4..8d5ac77f68 100644 --- a/src/bun.js/bindings/BunProcess.cpp +++ b/src/bun.js/bindings/BunProcess.cpp @@ -372,7 +372,7 @@ extern "C" bool Bun__VM__allowAddons(void* vm); JSC_DEFINE_HOST_FUNCTION(Process_functionDlopen, (JSC::JSGlobalObject * globalObject_, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = reinterpret_cast(globalObject_); + Zig::GlobalObject* globalObject = static_cast(globalObject_); auto callCountAtStart = globalObject->napiModuleRegisterCallCount; auto scope = DECLARE_THROW_SCOPE(JSC::getVM(globalObject)); auto& vm = JSC::getVM(globalObject); @@ -776,7 +776,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionExit, (JSC::JSGlobalObject * globalObje JSC_DEFINE_HOST_FUNCTION(Process_setUncaughtExceptionCaptureCallback, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) { - auto* globalObject = reinterpret_cast(lexicalGlobalObject); + auto* globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); auto arg0 = callFrame->argument(0); @@ -814,7 +814,7 @@ extern "C" uint64_t Bun__readOriginTimer(void*); JSC_DEFINE_HOST_FUNCTION(Process_functionHRTime, (JSC::JSGlobalObject * globalObject_, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = reinterpret_cast(globalObject_); + Zig::GlobalObject* globalObject = static_cast(globalObject_); auto& vm = JSC::getVM(globalObject); auto throwScope = DECLARE_THROW_SCOPE(vm); @@ -866,7 +866,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionHRTime, (JSC::JSGlobalObject * globalOb JSC_DEFINE_HOST_FUNCTION(Process_functionHRTimeBigInt, (JSC::JSGlobalObject * globalObject_, JSC::CallFrame* callFrame)) { - Zig::GlobalObject* globalObject = reinterpret_cast(globalObject_); + Zig::GlobalObject* globalObject = static_cast(globalObject_); return JSC::JSValue::encode(JSValue(JSC::JSBigInt::createFrom(globalObject, Bun__readOriginTimer(globalObject->bunVM())))); } @@ -2106,7 +2106,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionWriteReport, (JSGlobalObject * globalOb static JSValue constructProcessReportObject(VM& vm, JSObject* processObject) { auto* globalObject = processObject->globalObject(); - // auto* globalObject = reinterpret_cast(lexicalGlobalObject); + // auto* globalObject = static_cast(lexicalGlobalObject); auto process = jsCast(processObject); auto* report = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 10); diff --git a/src/bun.js/bindings/JSBakeResponse.cpp b/src/bun.js/bindings/JSBakeResponse.cpp index 7c3480cfec..ce48f5e105 100644 --- a/src/bun.js/bindings/JSBakeResponse.cpp +++ b/src/bun.js/bindings/JSBakeResponse.cpp @@ -43,7 +43,7 @@ extern JSC_CALLCONV size_t Response__estimatedSize(void* ptr); bool isJSXElement(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject) { - auto* zigGlobal = reinterpret_cast(globalObject); + auto* zigGlobal = static_cast(globalObject); auto& vm = JSC::getVM(globalObject); // React does this: @@ -236,7 +236,7 @@ public: static JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES call(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame) { - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); JSC::VM& vm = globalObject->vm(); auto scope = DECLARE_THROW_SCOPE(vm); @@ -300,7 +300,7 @@ Structure* createJSBakeResponseStructure(JSC::VM& vm, Zig::GlobalObject* globalO void setupJSBakeResponseClassStructure(JSC::LazyClassStructure::Initializer& init) { - auto* zigGlobal = reinterpret_cast(init.global); + auto* zigGlobal = static_cast(init.global); auto* prototype = JSC::constructEmptyObject(zigGlobal, zigGlobal->JSResponsePrototype()); auto* constructorStructure = JSBakeResponseConstructor::createStructure(init.vm, init.global, init.global->functionPrototype()); diff --git a/src/bun.js/bindings/JSBufferList.cpp b/src/bun.js/bindings/JSBufferList.cpp index 3ff38d965a..61650c0c11 100644 --- a/src/bun.js/bindings/JSBufferList.cpp +++ b/src/bun.js/bindings/JSBufferList.cpp @@ -161,7 +161,7 @@ JSC::JSValue JSBufferList::_getString(JSC::VM& vm, JSC::JSGlobalObject* lexicalG JSC::JSValue JSBufferList::_getBuffer(JSC::VM& vm, JSC::JSGlobalObject* lexicalGlobalObject, size_t total) { auto throwScope = DECLARE_THROW_SCOPE(vm); - auto* subclassStructure = reinterpret_cast(lexicalGlobalObject)->JSBufferSubclassStructure(); + auto* subclassStructure = static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(); if (total <= 0 || length() == 0) { // Buffer.alloc(0) @@ -442,7 +442,7 @@ JSC::EncodedJSValue JSBufferListConstructor::construct(JSC::JSGlobalObject* lexi { auto& vm = JSC::getVM(lexicalGlobalObject); JSBufferList* bufferList = JSBufferList::create( - vm, lexicalGlobalObject, reinterpret_cast(lexicalGlobalObject)->JSBufferListStructure()); + vm, lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferListStructure()); return JSC::JSValue::encode(bufferList); } @@ -454,7 +454,7 @@ const ClassInfo JSBufferListConstructor::s_info = { "BufferList"_s, &Base::s_inf JSValue getBufferList(Zig::GlobalObject* globalObject) { - return reinterpret_cast(globalObject)->JSBufferList(); + return static_cast(globalObject)->JSBufferList(); } } // namespace Zig diff --git a/src/bun.js/bindings/JSDOMFile.cpp b/src/bun.js/bindings/JSDOMFile.cpp index f8111c4706..ac3e0588cf 100644 --- a/src/bun.js/bindings/JSDOMFile.cpp +++ b/src/bun.js/bindings/JSDOMFile.cpp @@ -73,7 +73,7 @@ public: if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast( + auto* functionGlobalObject = static_cast( // ShadowRealm functions belong to a different global object. getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); diff --git a/src/bun.js/bindings/JSMockFunction.cpp b/src/bun.js/bindings/JSMockFunction.cpp index c705e01bf1..9b9e0731c1 100644 --- a/src/bun.js/bindings/JSMockFunction.cpp +++ b/src/bun.js/bindings/JSMockFunction.cpp @@ -1329,7 +1329,7 @@ DEFINE_VISIT_CHILDREN(MockWithImplementationCleanupData); MockWithImplementationCleanupData* MockWithImplementationCleanupData::create(JSC::JSGlobalObject* globalObject, JSMockFunction* fn, JSValue impl, JSValue tail, JSValue fallback) { - auto* obj = create(globalObject->vm(), reinterpret_cast(globalObject)->mockModule.mockWithImplementationCleanupDataStructure.getInitializedOnMainThread(globalObject)); + auto* obj = create(globalObject->vm(), static_cast(globalObject)->mockModule.mockWithImplementationCleanupDataStructure.getInitializedOnMainThread(globalObject)); obj->finishCreation(globalObject->vm(), fn, impl, tail, fallback); return obj; } diff --git a/src/bun.js/bindings/JSStringDecoder.cpp b/src/bun.js/bindings/JSStringDecoder.cpp index 4795880fdf..14b8e51da4 100644 --- a/src/bun.js/bindings/JSStringDecoder.cpp +++ b/src/bun.js/bindings/JSStringDecoder.cpp @@ -485,7 +485,7 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi JSStringDecoder* castedThis = jsStringDecoderCast(lexicalGlobalObject, JSC::JSValue::decode(thisValue), "lastChar"_s); RETURN_IF_EXCEPTION(scope, {}); auto buffer = ArrayBuffer::create({ castedThis->m_lastChar, 4 }); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); + auto* globalObject = static_cast(lexicalGlobalObject); JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buffer), 0, 4); RELEASE_AND_RETURN(scope, JSC::JSValue::encode(uint8Array)); } diff --git a/src/bun.js/bindings/ModuleLoader.cpp b/src/bun.js/bindings/ModuleLoader.cpp index 9d5050f01e..7727c7411b 100644 --- a/src/bun.js/bindings/ModuleLoader.cpp +++ b/src/bun.js/bindings/ModuleLoader.cpp @@ -198,7 +198,7 @@ DEFINE_VISIT_CHILDREN(PendingVirtualModuleResult); PendingVirtualModuleResult* PendingVirtualModuleResult::create(JSC::JSGlobalObject* globalObject, const WTF::String& specifier, const WTF::String& referrer, bool wasModuleLock) { - auto* virtualModule = create(globalObject->vm(), reinterpret_cast(globalObject)->pendingVirtualModuleResultStructure()); + auto* virtualModule = create(globalObject->vm(), static_cast(globalObject)->pendingVirtualModuleResultStructure()); virtualModule->finishCreation(globalObject->vm(), specifier, referrer); virtualModule->wasModuleMock = wasModuleLock; return virtualModule; @@ -1153,7 +1153,7 @@ BUN_DEFINE_HOST_FUNCTION(jsFunctionOnLoadObjectResultResolve, (JSC::JSGlobalObje bool wasModuleMock = pendingModule->wasModuleMock; - JSC::JSValue result = handleVirtualModuleResult(reinterpret_cast(globalObject), objectResult, &res, &specifier, &referrer, wasModuleMock); + JSC::JSValue result = handleVirtualModuleResult(static_cast(globalObject), objectResult, &res, &specifier, &referrer, wasModuleMock); if (!scope.exception() && !res.success) [[unlikely]] { throwException(globalObject, scope, result); } diff --git a/src/bun.js/bindings/NapiClass.cpp b/src/bun.js/bindings/NapiClass.cpp index 10d437682f..605c90b29a 100644 --- a/src/bun.js/bindings/NapiClass.cpp +++ b/src/bun.js/bindings/NapiClass.cpp @@ -107,7 +107,7 @@ void NapiClass::finishCreation(VM& vm, NativeExecutable* executable, const Strin Base::finishCreation(vm, executable, 0, name); ASSERT(inherits(info())); this->m_constructor = constructor; - auto globalObject = reinterpret_cast(this->globalObject()); + auto globalObject = static_cast(this->globalObject()); this->putDirect(vm, vm.propertyNames->name, jsString(vm, name), JSC::PropertyAttribute::DontEnum | 0); diff --git a/src/bun.js/bindings/NodeFSStatBinding.cpp b/src/bun.js/bindings/NodeFSStatBinding.cpp index 7a1ee3586b..3eba0311b5 100644 --- a/src/bun.js/bindings/NodeFSStatBinding.cpp +++ b/src/bun.js/bindings/NodeFSStatBinding.cpp @@ -822,7 +822,7 @@ inline JSValue constructJSStatsObject(JSC::JSGlobalObject* lexicalGlobalObject, if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast( + auto* functionGlobalObject = static_cast( // ShadowRealm functions belong to a different global object. getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); diff --git a/src/bun.js/bindings/NodeFSStatFSBinding.cpp b/src/bun.js/bindings/NodeFSStatFSBinding.cpp index 8e3040ea57..42278a6f1e 100644 --- a/src/bun.js/bindings/NodeFSStatFSBinding.cpp +++ b/src/bun.js/bindings/NodeFSStatFSBinding.cpp @@ -369,7 +369,7 @@ inline JSValue constructJSStatFSObject(JSC::JSGlobalObject* lexicalGlobalObject, if (constructor != newTarget) { auto scope = DECLARE_THROW_SCOPE(vm); - auto* functionGlobalObject = reinterpret_cast( + auto* functionGlobalObject = static_cast( // ShadowRealm functions belong to a different global object. getFunctionRealm(lexicalGlobalObject, newTarget)); RETURN_IF_EXCEPTION(scope, {}); diff --git a/src/bun.js/bindings/ScriptExecutionContext.cpp b/src/bun.js/bindings/ScriptExecutionContext.cpp index 5df9f5986d..e546e7fc29 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.cpp +++ b/src/bun.js/bindings/ScriptExecutionContext.cpp @@ -369,18 +369,18 @@ ScriptExecutionContext* executionContext(JSC::JSGlobalObject* globalObject) void ScriptExecutionContext::postTaskConcurrently(Function&& lambda) { auto* task = new EventLoopTask(WTFMove(lambda)); - reinterpret_cast(m_globalObject)->queueTaskConcurrently(task); + static_cast(m_globalObject)->queueTaskConcurrently(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(Function&& lambda) { auto* task = new EventLoopTask(WTFMove(lambda)); - reinterpret_cast(m_globalObject)->queueTask(task); + static_cast(m_globalObject)->queueTask(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(EventLoopTask* task) { - reinterpret_cast(m_globalObject)->queueTask(task); + static_cast(m_globalObject)->queueTask(task); } // Zig bindings diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 378e747beb..0311fd6f3e 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -2549,7 +2549,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionCheckBufferRead, (JSC::JSGlobalObject * globa } extern "C" EncodedJSValue Bun__assignStreamIntoResumableSink(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue stream, JSC::EncodedJSValue sink) { - Zig::GlobalObject* globalThis = reinterpret_cast(globalObject); + Zig::GlobalObject* globalThis = static_cast(globalObject); return globalThis->assignStreamToResumableSink(JSValue::decode(stream), JSValue::decode(sink)); } EncodedJSValue GlobalObject::assignStreamToResumableSink(JSValue stream, JSValue sink) diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 2127fa2ecb..985a46e4b9 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -575,7 +575,7 @@ template static void handlePromise(PromiseType* promise, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue ctx, Zig::FFIFunction resolverFunction, Zig::FFIFunction rejecterFunction) { - auto globalThis = reinterpret_cast(globalObject); + auto globalThis = static_cast(globalObject); if constexpr (!isInternal) { JSFunction* performPromiseThenFunction = globalObject->performPromiseThenFunction(); @@ -1805,7 +1805,7 @@ WebCore::FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC::JSGlobalObject* JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* lexicalGlobalObject) { - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); ASSERT_NO_PENDING_EXCEPTION(globalObject); bool needsMemoryCost = headers->hasOneRef(); @@ -1823,7 +1823,7 @@ JSC::EncodedJSValue WebCore__FetchHeaders__toJS(WebCore::FetchHeaders* headers, JSC::EncodedJSValue WebCore__FetchHeaders__clone(WebCore::FetchHeaders* headers, JSC::JSGlobalObject* arg1) { auto throwScope = DECLARE_THROW_SCOPE(arg1->vm()); - Zig::GlobalObject* globalObject = reinterpret_cast(arg1); + Zig::GlobalObject* globalObject = static_cast(arg1); auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); WebCore::propagateException(*arg1, throwScope, clone->fill(*headers)); return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTFMove(clone))); @@ -2030,7 +2030,7 @@ JSC::EncodedJSValue WebCore__FetchHeaders__createValue(JSC::JSGlobalObject* arg0 Ref headers = WebCore::FetchHeaders::create(); WebCore::propagateException(*arg0, throwScope, headers->fill(WebCore::FetchHeaders::Init(WTFMove(pairs)))); - JSValue value = WebCore::toJSNewlyCreated(arg0, reinterpret_cast(arg0), WTFMove(headers)); + JSValue value = WebCore::toJSNewlyCreated(arg0, static_cast(arg0), WTFMove(headers)); JSFetchHeaders* fetchHeaders = jsCast(value); fetchHeaders->computeMemoryCost(); @@ -5349,7 +5349,7 @@ extern "C" size_t JSC__VM__externalMemorySize(JSC::VM* vm) extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4) { - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); + Zig::GlobalObject* globalObject = static_cast(arg0); JSValue microtaskArgs[] = { JSValue::decode(JSValue1), globalObject->m_asyncContextData.get()->getInternalField(0), @@ -5662,7 +5662,7 @@ extern "C" void DOMFormData__toQueryString( CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, ZigString* arg1) { - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); + Zig::GlobalObject* globalObject = static_cast(arg0); // don't need to copy the string because it internally does. auto formData = DOMFormData::create(globalObject->scriptExecutionContext(), toString(*arg1)); return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTFMove(formData))); @@ -5670,7 +5670,7 @@ CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlo CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__create(JSC::JSGlobalObject* arg0) { - Zig::GlobalObject* globalObject = reinterpret_cast(arg0); + Zig::GlobalObject* globalObject = static_cast(arg0); auto formData = DOMFormData::create(globalObject->scriptExecutionContext()); return JSValue::encode(toJSNewlyCreated(arg0, globalObject, WTFMove(formData))); } @@ -5761,18 +5761,18 @@ extern "C" EncodedJSValue JSC__createRangeError(JSC::JSGlobalObject* globalObjec extern "C" EncodedJSValue ExpectMatcherUtils__getSingleton(JSC::JSGlobalObject* globalObject_) { - Zig::GlobalObject* globalObject = reinterpret_cast(globalObject_); + Zig::GlobalObject* globalObject = static_cast(globalObject_); return JSValue::encode(globalObject->m_testMatcherUtilsObject.getInitializedOnMainThread(globalObject)); } extern "C" EncodedJSValue Expect__getPrototype(JSC::JSGlobalObject* globalObject) { - return JSValue::encode(reinterpret_cast(globalObject)->JSExpectPrototype()); + return JSValue::encode(static_cast(globalObject)->JSExpectPrototype()); } extern "C" EncodedJSValue ExpectStatic__getPrototype(JSC::JSGlobalObject* globalObject) { - return JSValue::encode(reinterpret_cast(globalObject)->JSExpectStaticPrototype()); + return JSValue::encode(static_cast(globalObject)->JSExpectStaticPrototype()); } extern "C" EncodedJSValue JSFunction__createFromZig( diff --git a/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp b/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp index 06cb1c4671..e490ebfabd 100644 --- a/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp +++ b/src/bun.js/bindings/node/crypto/node_crypto_binding.cpp @@ -197,7 +197,7 @@ JSC_DEFINE_HOST_FUNCTION(jsCertExportChallenge, (JSC::JSGlobalObject * lexicalGl return JSValue::encode(jsEmptyString(vm)); } - auto* bufferResult = JSC::JSUint8Array::create(lexicalGlobalObject, reinterpret_cast(lexicalGlobalObject)->JSBufferSubclassStructure(), WTFMove(result), 0, cert.len); + auto* bufferResult = JSC::JSUint8Array::create(lexicalGlobalObject, static_cast(lexicalGlobalObject)->JSBufferSubclassStructure(), WTFMove(result), 0, cert.len); RETURN_IF_EXCEPTION(scope, {}); return JSValue::encode(bufferResult); diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp index 516b7cba4f..d79e683678 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp @@ -1598,7 +1598,7 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementPrepareStatementFunction, (JSC::JSGlobalO int64_t memoryChange = sqlite_malloc_amount - currentMemoryUsage; JSSQLStatement* sqlStatement = JSSQLStatement::create( - reinterpret_cast(lexicalGlobalObject), statement, databases()[handle], memoryChange); + static_cast(lexicalGlobalObject), statement, databases()[handle], memoryChange); if (internalFlagsValue.isInt32()) { const int32_t internalFlags = internalFlagsValue.asInt32(); @@ -1859,7 +1859,7 @@ void JSSQLStatementConstructor::finishCreation(VM& vm) Base::finishCreation(vm); // TODO: use LazyClassStructure? - auto* instanceObject = JSSQLStatement::create(reinterpret_cast(globalObject()), nullptr, nullptr); + auto* instanceObject = JSSQLStatement::create(static_cast(globalObject()), nullptr, nullptr); JSValue proto = instanceObject->getPrototype(globalObject()); this->putDirect(vm, vm.propertyNames->prototype, proto, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); diff --git a/src/bun.js/bindings/webcore/JSEventEmitter.cpp b/src/bun.js/bindings/webcore/JSEventEmitter.cpp index 679832e39c..1ff73c6a2e 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitter.cpp +++ b/src/bun.js/bindings/webcore/JSEventEmitter.cpp @@ -151,7 +151,7 @@ template<> JSC::EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSEventEmitterDOMConstru } Structure* structure = JSEventEmitter::createStructure(vm, lexicalGlobalObject, jsValue); JSEventEmitter* instance - = JSEventEmitter::create(structure, reinterpret_cast(lexicalGlobalObject), object.copyRef()); + = JSEventEmitter::create(structure, static_cast(lexicalGlobalObject), object.copyRef()); RETURN_IF_EXCEPTION(throwScope, {}); RELEASE_AND_RETURN(throwScope, JSValue::encode(instance)); } diff --git a/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp b/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp index 1bd1fc8a4e..3a174ce480 100644 --- a/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp +++ b/src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp @@ -67,7 +67,7 @@ JSEventEmitter* jsEventEmitterCastFast(VM& vm, JSC::JSGlobalObject* lexicalGloba // TODO: properly propagate exception upwards (^ getIfPropertyExists) auto scope = DECLARE_CATCH_SCOPE(vm); - auto* globalObject = reinterpret_cast(lexicalGlobalObject); + auto* globalObject = static_cast(lexicalGlobalObject); auto impl = EventEmitter::create(*globalObject->scriptExecutionContext()); impl->setThisObject(thisObject); diff --git a/src/bun.js/bindings/webcore/JSPerformance.cpp b/src/bun.js/bindings/webcore/JSPerformance.cpp index eb9f5ab174..813a973501 100644 --- a/src/bun.js/bindings/webcore/JSPerformance.cpp +++ b/src/bun.js/bindings/webcore/JSPerformance.cpp @@ -285,7 +285,7 @@ void JSPerformance::finishCreation(VM& vm) this->putDirect( vm, JSC::Identifier::fromString(vm, "timeOrigin"_s), - jsNumber(Bun__readOriginTimerStart(reinterpret_cast(this->globalObject())->bunVM())), + jsNumber(Bun__readOriginTimerStart(static_cast(this->globalObject())->bunVM())), PropertyAttribute::ReadOnly | 0); } diff --git a/src/bun.js/bindings/webcore/WebSocket.cpp b/src/bun.js/bindings/webcore/WebSocket.cpp index 3804cc24ed..ce9fff153c 100644 --- a/src/bun.js/bindings/webcore/WebSocket.cpp +++ b/src/bun.js/bindings/webcore/WebSocket.cpp @@ -1186,7 +1186,7 @@ void WebSocket::didReceiveBinaryData(const AtomString& eventName, const std::spa context->postTask([name = eventName, buffer = WTFMove(arrayBuffer), protectedThis = Ref { *this }](ScriptExecutionContext& context) { size_t length = buffer->byteLength(); auto* globalObject = context.jsGlobalObject(); - auto* subclassStructure = reinterpret_cast(globalObject)->JSBufferSubclassStructure(); + auto* subclassStructure = static_cast(globalObject)->JSBufferSubclassStructure(); JSUint8Array* uint8array = JSUint8Array::create(globalObject, subclassStructure, buffer.copyRef(), 0, length); JSC::EnsureStillAliveScope ensureStillAlive(uint8array); MessageEvent::Init init; diff --git a/src/bun.js/modules/AbortControllerModuleModule.h b/src/bun.js/modules/AbortControllerModuleModule.h index 3216a54f1a..0f97df6ddc 100644 --- a/src/bun.js/modules/AbortControllerModuleModule.h +++ b/src/bun.js/modules/AbortControllerModuleModule.h @@ -14,7 +14,7 @@ inline void generateNativeModule_AbortControllerModule( JSC::MarkedArgumentBuffer& exportValues) { - Zig::GlobalObject* globalObject = reinterpret_cast(lexicalGlobalObject); + Zig::GlobalObject* globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto* abortController = WebCore::JSAbortController::getConstructor(vm, globalObject).getObject(); diff --git a/src/bun.js/modules/BunAppModule.h b/src/bun.js/modules/BunAppModule.h index 047ec7fe2b..e4c82f4e5e 100644 --- a/src/bun.js/modules/BunAppModule.h +++ b/src/bun.js/modules/BunAppModule.h @@ -12,7 +12,7 @@ DEFINE_NATIVE_MODULE(BunApp) { INIT_NATIVE_MODULE(1); - auto* zig = reinterpret_cast(globalObject); + auto* zig = static_cast(globalObject); JSValue ssrResponseConstructor = zig->bakeAdditions().JSBakeResponseConstructor(zig); put(JSC::Identifier::fromString(vm, "Response"_s), ssrResponseConstructor); diff --git a/src/bun.js/modules/NodeBufferModule.h b/src/bun.js/modules/NodeBufferModule.h index bb554a9696..6722d13a86 100644 --- a/src/bun.js/modules/NodeBufferModule.h +++ b/src/bun.js/modules/NodeBufferModule.h @@ -139,13 +139,13 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNotImplemented, JSC_DEFINE_CUSTOM_GETTER(jsGetter_INSPECT_MAX_BYTES, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, PropertyName propertyName)) { - auto globalObject = reinterpret_cast(lexicalGlobalObject); + auto globalObject = static_cast(lexicalGlobalObject); return JSValue::encode(jsNumber(globalObject->INSPECT_MAX_BYTES)); } JSC_DEFINE_CUSTOM_SETTER(jsSetter_INSPECT_MAX_BYTES, (JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue value, PropertyName propertyName)) { - auto globalObject = reinterpret_cast(lexicalGlobalObject); + auto globalObject = static_cast(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); auto scope = DECLARE_THROW_SCOPE(vm); auto val = JSValue::decode(value); diff --git a/src/bun.js/modules/_NativeModule.h b/src/bun.js/modules/_NativeModule.h index 159ec9580e..70b19153ba 100644 --- a/src/bun.js/modules/_NativeModule.h +++ b/src/bun.js/modules/_NativeModule.h @@ -80,7 +80,7 @@ #define INIT_NATIVE_MODULE(numberOfExportNames) \ Zig::GlobalObject *globalObject = \ - reinterpret_cast(lexicalGlobalObject); \ + static_cast(lexicalGlobalObject); \ JSC::VM &vm = globalObject->vm(); \ JSC::JSObject *defaultObject = JSC::constructEmptyObject( \ globalObject, globalObject->objectPrototype(), numberOfExportNames); \