mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove unused ReactCommon/TurboModuleUtils functions #deepCopyJSIObject and #deepCopyJSIArray (#52443)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52443 Changelog: [General][Breaking] Remove unused ReactCommon/TurboModuleUtils functions #deepCopyJSIObject and #deepCopyJSIArray Those are not used anymore Reviewed By: cortinico Differential Revision: D77771186 fbshipit-source-id: e1f5e34238567241b4204d58ff85fd9067e321df
This commit is contained in:
committed by
Facebook GitHub Bot
parent
625f69f284
commit
ead669ade3
-53
@@ -9,59 +9,6 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value deepCopyJSIValue(jsi::Runtime& rt, const jsi::Value& value) {
|
||||
if (value.isNull()) {
|
||||
return jsi::Value::null();
|
||||
}
|
||||
|
||||
if (value.isBool()) {
|
||||
return jsi::Value(value.getBool());
|
||||
}
|
||||
|
||||
if (value.isNumber()) {
|
||||
return jsi::Value(value.getNumber());
|
||||
}
|
||||
|
||||
if (value.isString()) {
|
||||
return value.getString(rt);
|
||||
}
|
||||
|
||||
if (value.isObject()) {
|
||||
jsi::Object o = value.getObject(rt);
|
||||
if (o.isArray(rt)) {
|
||||
return deepCopyJSIArray(rt, o.getArray(rt));
|
||||
}
|
||||
if (o.isFunction(rt)) {
|
||||
return o.getFunction(rt);
|
||||
}
|
||||
return deepCopyJSIObject(rt, o);
|
||||
}
|
||||
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
jsi::Object deepCopyJSIObject(jsi::Runtime& rt, const jsi::Object& obj) {
|
||||
jsi::Object copy(rt);
|
||||
jsi::Array propertyNames = obj.getPropertyNames(rt);
|
||||
size_t size = propertyNames.size(rt);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
jsi::String name = propertyNames.getValueAtIndex(rt, i).getString(rt);
|
||||
jsi::Value value = obj.getProperty(rt, name);
|
||||
copy.setProperty(rt, name, deepCopyJSIValue(rt, value));
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
jsi::Array deepCopyJSIArray(jsi::Runtime& rt, const jsi::Array& arr) {
|
||||
size_t size = arr.size(rt);
|
||||
jsi::Array copy(rt, size);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
copy.setValueAtIndex(
|
||||
rt, i, deepCopyJSIValue(rt, arr.getValueAtIndex(rt, i)));
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
Promise::Promise(jsi::Runtime& rt, jsi::Function resolve, jsi::Function reject)
|
||||
: LongLivedObject(rt),
|
||||
resolve_(std::move(resolve)),
|
||||
|
||||
+3
-7
@@ -7,18 +7,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/bridging/LongLivedObject.h>
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/bridging/CallbackWrapper.h>
|
||||
#include <react/bridging/LongLivedObject.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
jsi::Object deepCopyJSIObject(jsi::Runtime& rt, const jsi::Object& obj);
|
||||
jsi::Array deepCopyJSIArray(jsi::Runtime& rt, const jsi::Array& arr);
|
||||
|
||||
struct Promise : public LongLivedObject {
|
||||
Promise(jsi::Runtime& rt, jsi::Function resolve, jsi::Function reject);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user