From 8375ef57f94dfb4c4c911c0492dab22158dca4ef Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 31 Aug 2025 02:34:30 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- src/bun.js/bindings/JSYogaNode.cpp | 4 ++-- src/bun.js/bindings/JSYogaNode.h | 2 +- src/bun.js/bindings/JSYogaPrototype.cpp | 18 +++++++++--------- src/bun.js/bindings/YogaNodeImpl.cpp | 1 - 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/bun.js/bindings/JSYogaNode.cpp b/src/bun.js/bindings/JSYogaNode.cpp index 9d956c2592..8ec982bd82 100644 --- a/src/bun.js/bindings/JSYogaNode.cpp +++ b/src/bun.js/bindings/JSYogaNode.cpp @@ -62,7 +62,7 @@ void JSYogaNode::finishCreation(JSC::VM& vm, YGConfigRef config, JSYogaConfig* j if (jsConfig) { m_config.set(vm, this, jsConfig); } - + // Initialize children array to maintain strong references // This mirrors React Native's _reactSubviews NSMutableArray JSC::JSGlobalObject* globalObject = this->globalObject(); @@ -77,7 +77,7 @@ void JSYogaNode::finishCreation(JSC::VM& vm) m_impl->setJSWrapper(this); // No JSYogaConfig in this path - it's only set when explicitly provided - + // Initialize children array to maintain strong references // This mirrors React Native's _reactSubviews NSMutableArray JSC::JSGlobalObject* globalObject = this->globalObject(); diff --git a/src/bun.js/bindings/JSYogaNode.h b/src/bun.js/bindings/JSYogaNode.h index 473f2cf3a1..342de8f598 100644 --- a/src/bun.js/bindings/JSYogaNode.h +++ b/src/bun.js/bindings/JSYogaNode.h @@ -49,7 +49,7 @@ public: // Store the JSYogaConfig that was used to create this node JSC::WriteBarrier m_config; - + // Store children to prevent GC while still part of Yoga tree // This mirrors React Native's _reactSubviews NSMutableArray pattern JSC::WriteBarrier m_children; diff --git a/src/bun.js/bindings/JSYogaPrototype.cpp b/src/bun.js/bindings/JSYogaPrototype.cpp index 53e8e39a18..83be076fc0 100644 --- a/src/bun.js/bindings/JSYogaPrototype.cpp +++ b/src/bun.js/bindings/JSYogaPrototype.cpp @@ -1179,7 +1179,7 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncRemoveChild, (JSC::JSGlobalObject * // Remove from Yoga tree YGNodeRemoveChild(thisObject->impl().yogaNode(), childNode->impl().yogaNode()); - + // Remove strong reference from children array to allow GC // This mirrors React Native's [_reactSubviews removeObject:subview] pattern JSC::JSArray* childrenArray = jsCast(thisObject->m_children.get()); @@ -1198,7 +1198,7 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncRemoveChild, (JSC::JSGlobalObject * } } } - + return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -2356,7 +2356,7 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncInsertChild, (JSC::JSGlobalObject * // Insert into Yoga tree YGNodeInsertChild(thisObject->impl().yogaNode(), child->impl().yogaNode(), index); - + // Add strong reference to children array to prevent GC // This mirrors React Native's [_reactSubviews insertObject:subview atIndex:atIndex] pattern JSC::JSArray* childrenArray = jsCast(thisObject->m_children.get()); @@ -2364,20 +2364,20 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncInsertChild, (JSC::JSGlobalObject * // Insert at the specified index by shifting existing elements uint32_t length = childrenArray->length(); uint32_t insertIndex = std::min(static_cast(index), length); - + // Grow array by 1 childrenArray->setLength(globalObject, length + 1); - + // Shift elements to make room for (uint32_t i = length; i > insertIndex; i--) { JSC::JSValue element = childrenArray->getIndex(globalObject, i - 1); childrenArray->putDirectIndex(globalObject, i, element); } - + // Insert the new child childrenArray->putDirectIndex(globalObject, insertIndex, child); } - + return JSC::JSValue::encode(JSC::jsUndefined()); } @@ -3122,7 +3122,7 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncClone, (JSC::JSGlobalObject * global // Create YogaNodeImpl directly with the cloned node to avoid double creation auto clonedImpl = YogaNodeImpl::create(nullptr); clonedImpl->replaceYogaNode(clonedNode); - + // Create JSYogaNode wrapper with the impl JSYogaNode* jsClonedNode = JSYogaNode::create(vm, structure, WTFMove(clonedImpl)); @@ -3155,7 +3155,7 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncClone, (JSC::JSGlobalObject * global // Create YogaNodeImpl directly with cloned child to avoid double creation auto clonedChildImpl = YogaNodeImpl::create(nullptr); clonedChildImpl->replaceYogaNode(clonedChild); - + // Create JS wrapper for cloned child JSYogaNode* jsClonedChild = JSYogaNode::create(vm, structure, WTFMove(clonedChildImpl)); diff --git a/src/bun.js/bindings/YogaNodeImpl.cpp b/src/bun.js/bindings/YogaNodeImpl.cpp index 27efd9a78b..734b5882f5 100644 --- a/src/bun.js/bindings/YogaNodeImpl.cpp +++ b/src/bun.js/bindings/YogaNodeImpl.cpp @@ -8,7 +8,6 @@ namespace Bun { - Ref YogaNodeImpl::create(YGConfigRef config) { return adoptRef(*new YogaNodeImpl(config));