diff --git a/src/bun.js/bindings/JSBundlerPlugin.cpp b/src/bun.js/bindings/JSBundlerPlugin.cpp index 6920897779..a0bef0a8e8 100644 --- a/src/bun.js/bindings/JSBundlerPlugin.cpp +++ b/src/bun.js/bindings/JSBundlerPlugin.cpp @@ -159,11 +159,7 @@ void BundlerPlugin::tombstone() // virtualModulesList will be cleaned up by destructor } -void BundlerPlugin::visitAdditionalChildren(JSC::JSCell* cell, JSC::SlotVisitor& visitor) -{ - deferredPromises.visit(cell, visitor); - virtualModulesList.visit(cell, visitor); -} +// Template implementation moved to header file static const HashTableValue JSBundlerPluginHashTable[] = { { "addFilter"_s, static_cast(JSC::PropertyAttribute::Function | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBundlerPluginFunction_addFilter, 3 } }, diff --git a/src/bun.js/bindings/JSBundlerPlugin.h b/src/bun.js/bindings/JSBundlerPlugin.h index 9ad0896995..4d072e0b71 100644 --- a/src/bun.js/bindings/JSBundlerPlugin.h +++ b/src/bun.js/bindings/JSBundlerPlugin.h @@ -125,7 +125,12 @@ public: JSC::JSObject* getVirtualModule(const String& path); void addVirtualModule(JSC::VM& vm, JSC::JSCell* owner, const String& path, JSC::JSObject* moduleFunction); void tombstone(); - void visitAdditionalChildren(JSC::JSCell*, JSC::SlotVisitor&); + template + void visitAdditionalChildren(JSC::JSCell* cell, Visitor& visitor) + { + deferredPromises.visit(cell, visitor); + virtualModulesList.visit(cell, visitor); + } BundlerPlugin(void* config, BunPluginTarget target, JSBundlerPluginAddErrorCallback addError, JSBundlerPluginOnLoadAsyncCallback onLoadAsync, JSBundlerPluginOnResolveAsyncCallback onResolveAsync) : addError(addError)