From 34b42e02e6eb6f1ea24bccd8113868d1b3512424 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sat, 17 Oct 2026 09:23:32 +0000 Subject: [PATCH] Remove dead code from Exception.h, ExceptionOr.h, ErrorCode.h, InspectorHTTPServerAgent.cpp, and JSBuffer.cpp Delete five declarations that nothing references: - ExceptionOr.h: the free function isolatedCopy(ExceptionOr&&) - Exception.h: the free function isolatedCopy(Exception&&), whose one caller was the function above - ErrorCode.h: the alias ErrorCodeCache::Field - InspectorHTTPServerAgent.cpp: the typedefs RouteId and RequestId - JSBuffer.cpp: the member JSBuffer::typeRange --- src/jsc/bindings/ErrorCode.h | 1 - src/jsc/bindings/Exception.h | 7 ------- src/jsc/bindings/ExceptionOr.h | 9 --------- src/jsc/bindings/InspectorHTTPServerAgent.cpp | 2 -- src/jsc/bindings/JSBuffer.cpp | 2 -- 5 files changed, 21 deletions(-) diff --git a/src/jsc/bindings/ErrorCode.h b/src/jsc/bindings/ErrorCode.h index 84761a1c0f77..a94c268d9905 100644 --- a/src/jsc/bindings/ErrorCode.h +++ b/src/jsc/bindings/ErrorCode.h @@ -58,7 +58,6 @@ void throwTypeErrorOrOutOfMemory(JSC::JSGlobalObject*, JSC::ThrowScope&, const W class ErrorCodeCache : public JSC::JSInternalFieldObjectImpl { public: using Base = JSInternalFieldObjectImpl; - using Field = ErrorCode; DECLARE_EXPORT_INFO; diff --git a/src/jsc/bindings/Exception.h b/src/jsc/bindings/Exception.h index c14e1d7ba8b4..ed3a6262696e 100644 --- a/src/jsc/bindings/Exception.h +++ b/src/jsc/bindings/Exception.h @@ -56,8 +56,6 @@ class Exception { String m_extra; }; -Exception isolatedCopy(Exception&&); - inline Exception::Exception(ExceptionCode code, String message, String extra) : m_code { code } , m_message { WTF::move(message) } @@ -65,9 +63,4 @@ inline Exception::Exception(ExceptionCode code, String message, String extra) { } -inline Exception isolatedCopy(Exception&& value) -{ - return Exception { value.code(), value.releaseMessage().isolatedCopy(), value.releaseExtra().isolatedCopy() }; -} - } diff --git a/src/jsc/bindings/ExceptionOr.h b/src/jsc/bindings/ExceptionOr.h index 4f31f30a44d4..e81256f74212 100644 --- a/src/jsc/bindings/ExceptionOr.h +++ b/src/jsc/bindings/ExceptionOr.h @@ -89,8 +89,6 @@ template<> class ExceptionOr { std::expected m_value; }; -ExceptionOr isolatedCopy(ExceptionOr&&); - template inline ExceptionOr::ExceptionOr(Exception&& exception) : m_value(makeUnexpected(WTF::move(exception))) { @@ -186,13 +184,6 @@ inline Exception ExceptionOr::releaseException() return WTF::move(m_value.error()); } -inline ExceptionOr isolatedCopy(ExceptionOr&& value) -{ - if (value.hasException()) - return isolatedCopy(value.releaseException()); - return {}; -} - template inline constexpr bool IsExceptionOr = WTF::IsTemplate, ExceptionOr>::value; template> struct TypeOrExceptionOrUnderlyingTypeImpl; diff --git a/src/jsc/bindings/InspectorHTTPServerAgent.cpp b/src/jsc/bindings/InspectorHTTPServerAgent.cpp index 279715252049..b454c9ec2e0f 100644 --- a/src/jsc/bindings/InspectorHTTPServerAgent.cpp +++ b/src/jsc/bindings/InspectorHTTPServerAgent.cpp @@ -141,8 +141,6 @@ extern "C" { typedef int ServerId; typedef int HotReloadId; -typedef int RouteId; -typedef int RequestId; [[ZIG_EXPORT(nothrow)]] void Bun__HTTPServerAgent__notifyServerStarted(Inspector::InspectorHTTPServerAgent* agent, ServerId serverId, HotReloadId hotReloadId, const BunString* address, double startTime, void* serverInstance) { diff --git a/src/jsc/bindings/JSBuffer.cpp b/src/jsc/bindings/JSBuffer.cpp index c0325e63b350..7c7954f4c329 100644 --- a/src/jsc/bindings/JSBuffer.cpp +++ b/src/jsc/bindings/JSBuffer.cpp @@ -2763,8 +2763,6 @@ JSC_ANNOTATE_HOST_FUNCTION(JSBufferConstructorConstruct, JSBufferConstructor::co class JSBuffer : public JSC::JSNonFinalObject { DECLARE_INFO; - - static constexpr JSC::JSTypeRange typeRange = { Uint8ArrayType, Uint8ArrayType }; }; const ClassInfo JSBuffer::s_info = {