[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-08-31 02:34:30 +00:00
committed by GitHub
parent 31ce87f306
commit 8375ef57f9
4 changed files with 12 additions and 13 deletions

View File

@@ -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();

View File

@@ -49,7 +49,7 @@ public:
// Store the JSYogaConfig that was used to create this node
JSC::WriteBarrier<JSC::JSObject> m_config;
// Store children to prevent GC while still part of Yoga tree
// This mirrors React Native's _reactSubviews NSMutableArray pattern
JSC::WriteBarrier<JSC::JSArray> m_children;

View File

@@ -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<JSC::JSArray*>(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<JSC::JSArray*>(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<uint32_t>(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));

View File

@@ -8,7 +8,6 @@
namespace Bun {
Ref<YogaNodeImpl> YogaNodeImpl::create(YGConfigRef config)
{
return adoptRef(*new YogaNodeImpl(config));