Apply clang-format 18

Summary: Previously this code conformed from clang-format 12.

Reviewed By: igorsugak

Differential Revision: D56065247

fbshipit-source-id: f5a985dd8f8b84f2f9e1818b3719b43c5a1b05b3
This commit is contained in:
Andres Suarez
2024-04-14 11:28:32 -07:00
committed by Facebook GitHub Bot
parent 314a919df6
commit a5eeea814d
42 changed files with 211 additions and 205 deletions
@@ -260,13 +260,11 @@
turboModuleEnabled:self.turboModuleEnabled
bridgelessEnabled:self.bridgelessEnabled];
configuration.createRootViewWithBridge = ^UIView *(RCTBridge *bridge, NSString *moduleName, NSDictionary *initProps)
{
configuration.createRootViewWithBridge = ^UIView *(RCTBridge *bridge, NSString *moduleName, NSDictionary *initProps) {
return [weakSelf createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
};
configuration.createBridgeWithDelegate = ^RCTBridge *(id<RCTBridgeDelegate> delegate, NSDictionary *launchOptions)
{
configuration.createBridgeWithDelegate = ^RCTBridge *(id<RCTBridgeDelegate> delegate, NSDictionary *launchOptions) {
return [weakSelf createBridgeWithDelegate:delegate launchOptions:launchOptions];
};
@@ -62,32 +62,31 @@ id<RCTTurboModule> RCTAppSetupDefaultModuleFromClass(Class moduleClass)
{
// private block used to filter out modules depending on protocol conformance
NSArray * (^extractModuleConformingToProtocol)(RCTModuleRegistry *, Protocol *) =
^NSArray *(RCTModuleRegistry *moduleRegistry, Protocol *protocol)
{
NSArray<NSString *> *classNames = @[];
^NSArray *(RCTModuleRegistry *moduleRegistry, Protocol *protocol) {
NSArray<NSString *> *classNames = @[];
#if USE_OSS_CODEGEN
if (protocol == @protocol(RCTImageURLLoader)) {
classNames = [RCTModulesConformingToProtocolsProvider imageURLLoaderClassNames];
} else if (protocol == @protocol(RCTImageDataDecoder)) {
classNames = [RCTModulesConformingToProtocolsProvider imageDataDecoderClassNames];
} else if (protocol == @protocol(RCTURLRequestHandler)) {
classNames = [RCTModulesConformingToProtocolsProvider URLRequestHandlerClassNames];
}
if (protocol == @protocol(RCTImageURLLoader)) {
classNames = [RCTModulesConformingToProtocolsProvider imageURLLoaderClassNames];
} else if (protocol == @protocol(RCTImageDataDecoder)) {
classNames = [RCTModulesConformingToProtocolsProvider imageDataDecoderClassNames];
} else if (protocol == @protocol(RCTURLRequestHandler)) {
classNames = [RCTModulesConformingToProtocolsProvider URLRequestHandlerClassNames];
}
#endif
NSMutableArray *modules = [NSMutableArray new];
NSMutableArray *modules = [NSMutableArray new];
for (NSString *className in classNames) {
const char *cModuleName = [className cStringUsingEncoding:NSUTF8StringEncoding];
id moduleFromLibrary = [moduleRegistry moduleForName:cModuleName];
if (![moduleFromLibrary conformsToProtocol:protocol]) {
continue;
}
[modules addObject:moduleFromLibrary];
}
return modules;
};
for (NSString *className in classNames) {
const char *cModuleName = [className cStringUsingEncoding:NSUTF8StringEncoding];
id moduleFromLibrary = [moduleRegistry moduleForName:cModuleName];
if (![moduleFromLibrary conformsToProtocol:protocol]) {
continue;
}
[modules addObject:moduleFromLibrary];
}
return modules;
};
// Set up the default RCTImageLoader and RCTNetworking modules.
if (moduleClass == RCTImageLoader.class) {
@@ -283,12 +283,10 @@ RCT_EXTERN_C_END
/**
* Like RCT_EXTERN_MODULE, but allows setting a custom JavaScript name.
*/
#define RCT_EXTERN_REMAP_MODULE(js_name, objc_name, objc_supername) \
objc_name: \
objc_supername @ \
end @interface objc_name(RCTExternModule)<RCTBridgeModule> \
@end \
@implementation objc_name (RCTExternModule) \
#define RCT_EXTERN_REMAP_MODULE(js_name, objc_name, objc_supername) \
objc_name : objc_supername @end @interface objc_name(RCTExternModule)<RCTBridgeModule> \
@end \
@implementation objc_name (RCTExternModule) \
RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name)
/**
@@ -31,7 +31,7 @@ int32_t getUniqueId()
static std::atomic<int32_t> counter{0};
return counter++;
}
}
} // namespace
@implementation RCTModuleData {
NSDictionary<NSString *, id> *_constantsToExport;
@@ -36,7 +36,7 @@
RCTBridge *bridge = _bridge;
if (bridge) {
module = [bridge moduleForName:[NSString stringWithUTF8String:moduleName] lazilyLoadIfNecessary:lazilyLoad];
module = [bridge moduleForName: [NSString stringWithUTF8String:moduleName] lazilyLoadIfNecessary:lazilyLoad];
}
id<RCTTurboModuleRegistry> turboModuleRegistry = _turboModuleRegistry;
@@ -40,7 +40,7 @@ extern
NS_ASSUME_NONNULL_BEGIN
NSString *const RCTContentDidAppearNotification;
NSString *const RCTContentDidAppearNotification;
/**
* Native view used to host React-managed views within the app. Can be used just
+4 -4
View File
@@ -71,13 +71,13 @@ RCT_EXTERN BOOL RCTClassOverridesClassMethod(Class cls, SEL selector);
RCT_EXTERN BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector);
// Creates a standardized error object to return in callbacks
RCT_EXTERN NSDictionary<NSString *, id>
*RCTMakeError(NSString *message, id __nullable toStringify, NSDictionary<NSString *, id> *__nullable extraData);
RCT_EXTERN NSDictionary<NSString *, id> *
RCTMakeError(NSString *message, id __nullable toStringify, NSDictionary<NSString *, id> *__nullable extraData);
RCT_EXTERN NSDictionary<NSString *, id> *
RCTMakeAndLogError(NSString *message, id __nullable toStringify, NSDictionary<NSString *, id> *__nullable extraData);
RCT_EXTERN NSDictionary<NSString *, id> *RCTJSErrorFromNSError(NSError *error);
RCT_EXTERN NSDictionary<NSString *, id>
*RCTJSErrorFromCodeMessageAndNSError(NSString *code, NSString *message, NSError *__nullable error);
RCT_EXTERN NSDictionary<NSString *, id> *
RCTJSErrorFromCodeMessageAndNSError(NSString *code, NSString *message, NSError *__nullable error);
// The default error code to use as the `code` property for callback error objects
RCT_EXTERN NSString *const RCTErrorUnspecified;
+4 -4
View File
@@ -468,8 +468,8 @@ BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector)
return NO;
}
NSDictionary<NSString *, id>
*RCTMakeError(NSString *message, id __nullable toStringify, NSDictionary<NSString *, id> *__nullable extraData)
NSDictionary<NSString *, id> *
RCTMakeError(NSString *message, id __nullable toStringify, NSDictionary<NSString *, id> *__nullable extraData)
{
if (toStringify) {
message = [message stringByAppendingString:[toStringify description]];
@@ -496,8 +496,8 @@ NSDictionary<NSString *, id> *RCTJSErrorFromNSError(NSError *error)
}
// TODO: Can we just replace RCTMakeError with this function instead?
NSDictionary<NSString *, id>
*RCTJSErrorFromCodeMessageAndNSError(NSString *code, NSString *message, NSError *__nullable error)
NSDictionary<NSString *, id> *
RCTJSErrorFromCodeMessageAndNSError(NSString *code, NSString *message, NSError *__nullable error)
{
NSString *errorMessage;
NSArray<NSString *> *stackTrace = [NSThread callStackSymbols];
@@ -112,8 +112,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
- (void)setLoadingView:(UIView *)loadingView
{
super.activityIndicatorViewFactory = ^UIView *(void)
{
super.activityIndicatorViewFactory = ^UIView *(void) {
return loadingView;
};
}
@@ -16,7 +16,7 @@ RCT_EXTERN_C_BEGIN
// Only to be used for testing and internal tooling. Do not use this in
// production.
void RCTAccessibilityManagerSetIsVoiceOverEnabled(
RCTAccessibilityManager* accessibilityManager,
RCTAccessibilityManager *accessibilityManager,
BOOL isVoiceOverEnabled);
RCT_EXTERN_C_END
@@ -69,18 +69,20 @@ RCT_EXPORT_MODULE(PlatformConstants)
UIDevice *device = [UIDevice currentDevice];
auto versions = RCTGetReactNativeVersion();
constants = typedConstants<JS::NativePlatformConstantsIOS::Constants>({
.forceTouchAvailable = RCTForceTouchAvailable() ? true : false, .osVersion = [device systemVersion],
.systemName = [device systemName], .interfaceIdiom = interfaceIdiom([device userInterfaceIdiom]),
.isTesting = RCTRunningInTestEnvironment() ? true : false,
.reactNativeVersion = JS::NativePlatformConstantsIOS::ConstantsReactNativeVersion::Builder(
{.minor = [versions[@"minor"] doubleValue],
.major = [versions[@"major"] doubleValue],
.patch = [versions[@"patch"] doubleValue],
.prerelease = [versions[@"prerelease"] isKindOfClass:[NSNull class]]
? std::optional<double>{}
: [versions[@"prerelease"] doubleValue]}),
.forceTouchAvailable = RCTForceTouchAvailable() ? true : false,
.osVersion = [device systemVersion],
.systemName = [device systemName],
.interfaceIdiom = interfaceIdiom([device userInterfaceIdiom]),
.isTesting = RCTRunningInTestEnvironment() ? true : false,
.reactNativeVersion = JS::NativePlatformConstantsIOS::ConstantsReactNativeVersion::Builder(
{.minor = [versions[@"minor"] doubleValue],
.major = [versions[@"major"] doubleValue],
.patch = [versions[@"patch"] doubleValue],
.prerelease = [versions[@"prerelease"] isKindOfClass:[NSNull class]]
? std::optional<double>{}
: [versions[@"prerelease"] doubleValue]}),
#if TARGET_OS_MACCATALYST
.isMacCatalyst = true,
.isMacCatalyst = true,
#else
.isMacCatalyst = false,
#endif
@@ -107,7 +107,7 @@ class GetDescAdapter : public JSExecutorFactory {
std::shared_ptr<JSExecutorFactory> factory_;
};
}
} // namespace
static void mapReactMarkerToPerformanceLogger(
const ReactMarker::ReactMarkerId markerId,
@@ -129,7 +129,7 @@ class RCTObjcExecutor : public JSExecutor {
RCTJavaScriptCallback m_jsCallback;
};
}
} // namespace
RCTObjcExecutorFactory::RCTObjcExecutorFactory(id<RCTJavaScriptExecutor> jse, RCTJavaScriptCompleteBlock errorBlock)
: m_jse(jse), m_errorBlock(errorBlock)
@@ -13,7 +13,7 @@
namespace facebook::xplat::module {
class CxxModule;
} // namespace facebook::react::module
} // namespace facebook::xplat::module
/**
* Subclass RCTCxxModule to use cross-platform CxxModule on iOS.
@@ -19,7 +19,7 @@ class RCTImageResponseObserverProxy final : public ImageResponseObserver {
public:
RCTImageResponseObserverProxy(id<RCTImageResponseDelegate> delegate = nil);
void didReceiveImage(const ImageResponse& imageResponse) const override;
void didReceiveImage(const ImageResponse &imageResponse) const override;
void didReceiveProgress(float progress) const override;
void didReceiveFailure() const override;
@@ -24,7 +24,7 @@ NSString *NSStringFromUTF8StringView(std::string_view view)
{
return [[NSString alloc] initWithBytes:(const char *)view.data() length:view.size() encoding:NSUTF8StringEncoding];
}
}
} // namespace
@interface RCTCxxInspectorWebSocketAdapter () <SRWebSocketDelegate> {
std::weak_ptr<IWebSocketDelegate> _delegate;
SRWebSocket *_webSocket;
@@ -35,50 +35,50 @@
using namespace facebook;
using namespace facebook::react;
//┌── RootShadowNode ─────────────────────────────┐
//│ │
//│┌─── ParagraphShadowNodeA ─────────────────────────┐ │
//││ ┌─AA(AAA) ─────────┐ ┌─AB(ABA) ─┐ ┌─AC(ACA)────┐ │ │
//││ │ Please check out │ │ Facebook │ │ and │ │ │
//││ └──────────────────┘ └──────────┘ └────────────┘ │ │
//││ ┌─AD(ADA) ──┐ ┌──AE(AEA) ──────────────────────┐ │ │
//││ │ Instagram │ │ for a full description. │ │ │
//││ └───────────┘ └────────────────────────────────┘ │ │
//│└──────────────────────────────────────────────────┘ │
//│ │
//│ │
//│┌── ParagraphShadowNodeB ──────────────────────────┐ │
//││ ┌───BA(BAA) ───────────────────────────────────┐ │ │
//││ │ Lorem ipsum dolor sit amet, consectetur │ │ │
//││ │ adipiscing elit. Maecenas ut risus et sapien │ │ │
//││ │ bibendum volutpat. Nulla facilisi. Cras │ │ │
//││ │ imperdiet gravida tincidunt. │ │ │
//││ └──────────────────────────────────────────────┘ │ │
//││ ┌─BB(BBA) ─────────────────────────────────────┐ │ │
//││ │ In tempor, tellus et vestibulum venenatis, │ │ │
//││ │ lorem nunc eleifend lectus, a consectetur │ │ │
//││ │ magna augue at arcu. │ │ │
//││ └──────────────────────────────────────────────┘ │ │
//│└──────────────────────────────────────────────────┘ │
//│ │
//│┌── ParagraphShadowNodeC ──────────────────────────┐ │
//││ ┌─CA(CAA) ────────┐ │ │
//││ │ Lorem ipsum │ │ │
//││ └─────────────────┘ │ │
//││ ┌─CB(CBA) ─────────────────────────────────────┐ │ │
//││ │ dolor sit amet, consectetur adipiscing elit. │ │ │
//││ │Maecenas ut risus et sapien bibendum volutpat.│ │ │
//││ │ Nulla facilisi. Cras imperdiet gravida │ │ │
//││ │ tincidunt. In tempor, tellus et vestibulum │ │ │
//││ │ venenatis, lorem nunc eleifend lectus, a │ │ │
//││ │ consectetur magna augue at arcu. │ │ │
//││ └──────────────────────────────────────────────┘ │ │
//││ ┌─CC(CCA) ────────┐ │ │
//││ │ See Less │ │ │
//││ └─────────────────┘ │ │
//│└──────────────────────────────────────────────────┘ │
//│ │
//└─────────────────────────────────────────────────────┘
// ┌── RootShadowNode ─────────────────────────────┐
// │ │
// │┌─── ParagraphShadowNodeA ─────────────────────────┐ │
// ││ ┌─AA(AAA) ─────────┐ ┌─AB(ABA) ─┐ ┌─AC(ACA)────┐ │ │
// ││ │ Please check out │ │ Facebook │ │ and │ │ │
// ││ └──────────────────┘ └──────────┘ └────────────┘ │ │
// ││ ┌─AD(ADA) ──┐ ┌──AE(AEA) ──────────────────────┐ │ │
// ││ │ Instagram │ │ for a full description. │ │ │
// ││ └───────────┘ └────────────────────────────────┘ │ │
// │└──────────────────────────────────────────────────┘ │
// │ │
// │ │
// │┌── ParagraphShadowNodeB ──────────────────────────┐ │
// ││ ┌───BA(BAA) ───────────────────────────────────┐ │ │
// ││ │ Lorem ipsum dolor sit amet, consectetur │ │ │
// ││ │ adipiscing elit. Maecenas ut risus et sapien │ │ │
// ││ │ bibendum volutpat. Nulla facilisi. Cras │ │ │
// ││ │ imperdiet gravida tincidunt. │ │ │
// ││ └──────────────────────────────────────────────┘ │ │
// ││ ┌─BB(BBA) ─────────────────────────────────────┐ │ │
// ││ │ In tempor, tellus et vestibulum venenatis, │ │ │
// ││ │ lorem nunc eleifend lectus, a consectetur │ │ │
// ││ │ magna augue at arcu. │ │ │
// ││ └──────────────────────────────────────────────┘ │ │
// │└──────────────────────────────────────────────────┘ │
// │ │
// │┌── ParagraphShadowNodeC ──────────────────────────┐ │
// ││ ┌─CA(CAA) ────────┐ │ │
// ││ │ Lorem ipsum │ │ │
// ││ └─────────────────┘ │ │
// ││ ┌─CB(CBA) ─────────────────────────────────────┐ │ │
// ││ │ dolor sit amet, consectetur adipiscing elit. │ │ │
// ││ │Maecenas ut risus et sapien bibendum volutpat.│ │ │
// ││ │ Nulla facilisi. Cras imperdiet gravida │ │ │
// ││ │ tincidunt. In tempor, tellus et vestibulum │ │ │
// ││ │ venenatis, lorem nunc eleifend lectus, a │ │ │
// ││ │ consectetur magna augue at arcu. │ │ │
// ││ └──────────────────────────────────────────────┘ │ │
// ││ ┌─CC(CCA) ────────┐ │ │
// ││ │ See Less │ │ │
// ││ └─────────────────┘ │ │
// │└──────────────────────────────────────────────────┘ │
// │ │
// └─────────────────────────────────────────────────────┘
@implementation RCTParagraphComponentAccessibilityProviderTests {
std::shared_ptr<ComponentBuilder> builder_;
@@ -264,7 +264,7 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...)
* Stripped out of release builds. Uses the current LOG_TAG.
*/
#define FBLOG_ASSERT(cond, ...) FBLOG_FATAL_IF(!(cond), __VA_ARGS__)
//#define LOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
// #define LOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
// ---------------------------------------------------------------------
@@ -319,7 +319,7 @@ inline std::vector<PropNameID> PropNameID::names(
template <size_t N>
inline std::vector<PropNameID> PropNameID::names(
PropNameID(&&propertyNames)[N]) {
PropNameID (&&propertyNames)[N]) {
std::vector<PropNameID> result;
result.reserve(N);
for (auto& name : propertyNames) {
@@ -494,7 +494,7 @@ class JSI_EXPORT PropNameID : public Pointer {
// Creates a vector of given PropNameIDs.
template <size_t N>
static std::vector<PropNameID> names(PropNameID(&&propertyNames)[N]);
static std::vector<PropNameID> names(PropNameID (&&propertyNames)[N]);
/// Copies the data in a PropNameID as utf8 into a C++ string.
std::string utf8(Runtime& runtime) const {
@@ -40,8 +40,8 @@ std::string jsonError(
}
return folly::toJson(
(id ? folly::dynamic::object("id", *id)
: folly::dynamic::object(
"id", nullptr))("error", std::move(dynamicError)));
: folly::dynamic::object("id", nullptr))(
"error", std::move(dynamicError)));
}
std::string jsonResult(RequestId id, const folly::dynamic& result) {
@@ -62,8 +62,8 @@ void FallbackRuntimeAgentDelegate::sendWarningLogEntry(std::string_view text) {
"timestamp",
duration_cast<milliseconds>(
system_clock::now().time_since_epoch())
.count())("source", "other")(
"level", "warning")("text", text))));
.count())("source", "other")("level", "warning")(
"text", text))));
}
} // namespace facebook::react::jsinspector_modern
@@ -191,8 +191,8 @@ void HostAgent::sendInfoLogEntry(
"timestamp",
duration_cast<milliseconds>(
system_clock::now().time_since_epoch())
.count())("source", "other")(
"level", "info")("text", text)("args", std::move(argsArray)))));
.count())("source", "other")("level", "info")("text", text)(
"args", std::move(argsArray)))));
}
void HostAgent::setCurrentInstanceAgent(
@@ -132,11 +132,14 @@ void InstanceAgent::sendConsoleMessageImmediately(
"Runtime.consoleAPICalled",
folly::dynamic::object("type", consoleMessageTypeName(message.type))(
"timestamp", message.timestamp)("args", std::move(argsParam))(
"executionContextId", runtimeAgent_->getExecutionContextDescription().id)(
// We use the @cdp Runtime.consoleAPICalled `context` parameter to
// mark synthetic messages generated by the backend, i.e. not originating
// in a real `console.*` API call.
"context", runtimeAgent_->getExecutionContextDescription().name + "#InstanceAgent")));
"executionContextId",
runtimeAgent_->getExecutionContextDescription().id)(
// We use the @cdp Runtime.consoleAPICalled `context` parameter to
// mark synthetic messages generated by the backend, i.e. not
// originating in a real `console.*` API call.
"context",
runtimeAgent_->getExecutionContextDescription().name +
"#InstanceAgent")));
}
void InstanceAgent::maybeSendPendingConsoleMessages() {
@@ -69,8 +69,7 @@ TEST_F(BridgingTest, callFromJsTest) {
then.callWithThis(
rt,
promise,
bridging::toJs(
rt, [&](std::string res) { result = res; }, invoker));
bridging::toJs(rt, [&](std::string res) { result = res; }, invoker));
flushQueue();
EXPECT_EQ("hi"s, result);
@@ -84,8 +83,7 @@ TEST_F(BridgingTest, callFromJsTest) {
.utf8(rt));
bool called = false;
func = bridging::toJs(
rt, [&] { called = true; }, invoker);
func = bridging::toJs(rt, [&] { called = true; }, invoker);
bridging::callFromJs<void>(
rt, &TestClass::callAsync, invoker, &instance, func);
@@ -31,7 +31,7 @@ class Instance;
namespace TurboModuleConvertUtils {
jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value);
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker);
}
} // namespace TurboModuleConvertUtils
/**
* ObjC++ specific TurboModule base class.
@@ -227,7 +227,7 @@ static jsi::Value convertJSErrorDetailsToJSRuntimeError(jsi::Runtime &runtime, N
return jsError;
}
}
} // namespace TurboModuleConvertUtils
jsi::Value ObjCTurboModule::createPromise(jsi::Runtime &runtime, std::string methodName, PromiseInvocationBlock invoke)
{
@@ -813,5 +813,5 @@ void ObjCTurboModule::setMethodArgConversionSelector(NSString *methodName, size_
methodArgConversionSelectors_[methodName][argIndex] = selectorValue;
}
}
} // namespace facebook::react
} // namespace react
} // namespace facebook
@@ -165,7 +165,7 @@ bool isTurboModuleInstance(id module)
{
return isTurboModuleClass([module class]);
}
}
} // namespace
// Fallback lookup since RCT class prefix is sometimes stripped in the existing NativeModule system.
// This will be removed in the future.
@@ -578,9 +578,8 @@ typedef struct {
if (!strongSelf) {
return;
}
module = [strongSelf _createAndSetUpObjCModule:moduleClass
moduleName:moduleName
moduleId:moduleHolder->getModuleId()];
module = [strongSelf _createAndSetUpObjCModule:moduleClass moduleName:moduleName moduleId:moduleHolder
->getModuleId()];
};
if ([self _requiresMainQueueSetup:moduleClass]) {
@@ -186,7 +186,7 @@ LayoutAnimationKeyFrameManager::pullTransaction(
};
#endif
// DEBUG ONLY: list existing inflight animations
// DEBUG ONLY: list existing inflight animations
#ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
LOG(ERROR) << "BEGINNING DISPLAYING ONGOING inflightAnimations_!";
int i = 0;
@@ -21,7 +21,7 @@
// Get hash at compile-time. sizeof(str) - 1 == strlen
#define CONSTEXPR_RAW_PROPS_KEY_HASH(s) \
([]() constexpr->RawPropsPropNameHash { \
([]() constexpr -> RawPropsPropNameHash { \
CLANG_PRAGMA("clang diagnostic push") \
CLANG_PRAGMA("clang diagnostic ignored \"-Wshadow\"") \
return RAW_PROPS_KEY_HASH(s); \
@@ -240,10 +240,9 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypes) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
auto raw = RawProps(
folly::dynamic::object("intValue", (int)42)("doubleValue", (double)17.42)(
"floatValue",
(float)66.67)("stringValue", "helloworld")("boolValue", true));
auto raw = RawProps(folly::dynamic::object("intValue", (int)42)(
"doubleValue", (double)17.42)("floatValue", (float)66.67)(
"stringValue", "helloworld")("boolValue", true));
auto parser = RawPropsParser();
parser.prepare<PropsPrimitiveTypes>();
@@ -262,10 +261,9 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetTwice) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
auto raw = RawProps(
folly::dynamic::object("intValue", (int)42)("doubleValue", (double)17.42)(
"floatValue",
(float)66.67)("stringValue", "helloworld")("boolValue", true));
auto raw = RawProps(folly::dynamic::object("intValue", (int)42)(
"doubleValue", (double)17.42)("floatValue", (float)66.67)(
"stringValue", "helloworld")("boolValue", true));
auto parser = RawPropsParser();
parser.prepare<PropsPrimitiveTypes>();
@@ -292,10 +290,9 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetOutOfOrder) {
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
auto raw = RawProps(
folly::dynamic::object("intValue", (int)42)("doubleValue", (double)17.42)(
"floatValue",
(float)66.67)("stringValue", "helloworld")("boolValue", true));
auto raw = RawProps(folly::dynamic::object("intValue", (int)42)(
"doubleValue", (double)17.42)("floatValue", (float)66.67)(
"stringValue", "helloworld")("boolValue", true));
auto parser = RawPropsParser();
parser.prepare<PropsPrimitiveTypes>();
@@ -83,8 +83,9 @@ enum class CSSKeyword : uint8_t {
* Represents a contrained set of CSS keywords.
*/
template <typename T>
concept CSSKeywordSet = std::is_enum_v<T> && std::
is_same_v<std::underlying_type_t<T>, std::underlying_type_t<CSSKeyword>>;
concept CSSKeywordSet = std::is_enum_v<T> &&
std::is_same_v<std::underlying_type_t<T>,
std::underlying_type_t<CSSKeyword>>;
/**
* CSS-wide keywords.
@@ -120,7 +120,8 @@ class CSSValueVariant {
public:
using Keyword = typename PackedKeywordSet<AllowedTypesT...>::Type;
constexpr CSSValueVariant() requires(canRepresent<CSSWideKeyword>())
constexpr CSSValueVariant()
requires(canRepresent<CSSWideKeyword>())
: CSSValueVariant(CSSValueType::CSSWideKeyword, CSSWideKeyword::Unset) {}
static constexpr CSSValueVariant cssWideKeyword(CSSWideKeyword keyword) {
@@ -129,30 +130,33 @@ class CSSValueVariant {
}
template <CSSKeywordSet KeywordT>
static constexpr CSSValueVariant keyword(KeywordT keyword) requires(
canRepresent<KeywordT>()) {
static constexpr CSSValueVariant keyword(KeywordT keyword)
requires(canRepresent<KeywordT>())
{
return CSSValueVariant(CSSValueType::Keyword, KeywordT{keyword});
}
static constexpr CSSValueVariant length(
float value,
CSSLengthUnit unit) requires(canRepresent<CSSLength>()) {
static constexpr CSSValueVariant length(float value, CSSLengthUnit unit)
requires(canRepresent<CSSLength>())
{
return CSSValueVariant(CSSValueType::Length, CSSLength{value, unit});
}
static constexpr CSSValueVariant number(float value) requires(
canRepresent<CSSNumber>()) {
static constexpr CSSValueVariant number(float value)
requires(canRepresent<CSSNumber>())
{
return CSSValueVariant(CSSValueType::Number, CSSNumber{value});
}
static constexpr CSSValueVariant percentage(float value) requires(
canRepresent<CSSPercentage>()) {
static constexpr CSSValueVariant percentage(float value)
requires(canRepresent<CSSPercentage>())
{
return CSSValueVariant(CSSValueType::Percentage, CSSPercentage{value});
}
static constexpr CSSValueVariant ratio(
float numerator,
float denominator) requires(canRepresent<CSSRatio>()) {
static constexpr CSSValueVariant ratio(float numerator, float denominator)
requires(canRepresent<CSSRatio>())
{
return CSSValueVariant(
CSSValueType::Ratio, CSSRatio{numerator, denominator});
}
@@ -162,33 +166,44 @@ class CSSValueVariant {
}
constexpr CSSWideKeyword getCSSWideKeyword() const
requires(canRepresent<CSSWideKeyword>()) {
requires(canRepresent<CSSWideKeyword>())
{
return getIf<CSSValueType::CSSWideKeyword, CSSWideKeyword>();
}
constexpr Keyword getKeyword() const
requires(hasKeywordSet<AllowedTypesT...>()) {
requires(hasKeywordSet<AllowedTypesT...>())
{
return getIf<CSSValueType::Keyword, Keyword>();
}
constexpr CSSLength getLength() const requires(canRepresent<CSSLength>()) {
constexpr CSSLength getLength() const
requires(canRepresent<CSSLength>())
{
return getIf<CSSValueType::Length, CSSLength>();
}
constexpr CSSNumber getNumber() const requires(canRepresent<CSSNumber>()) {
constexpr CSSNumber getNumber() const
requires(canRepresent<CSSNumber>())
{
return getIf<CSSValueType::Number, CSSNumber>();
}
constexpr CSSPercentage getPercentage() const
requires(canRepresent<CSSPercentage>()) {
requires(canRepresent<CSSPercentage>())
{
return getIf<CSSValueType::Percentage, CSSPercentage>();
}
constexpr CSSRatio getRatio() const requires(canRepresent<CSSRatio>()) {
constexpr CSSRatio getRatio() const
requires(canRepresent<CSSRatio>())
{
return getIf<CSSValueType::Ratio, CSSRatio>();
}
constexpr operator bool() const requires(canRepresent<CSSWideKeyword>()) {
constexpr operator bool() const
requires(canRepresent<CSSWideKeyword>())
{
return type() != CSSValueType::CSSWideKeyword ||
getCSSWideKeyword() != CSSWideKeyword::Unset;
}
@@ -17,11 +17,11 @@
//
// Enables verbose logging for the LayoutAnimations subsystem.
//#define LAYOUT_ANIMATION_VERBOSE_LOGGING 1
// #define LAYOUT_ANIMATION_VERBOSE_LOGGING 1
// Logs information before running `assert` in LayoutAnimations. More useful on
// Android vs other platforms.
//#define VERBOSE_LAYOUT_ANIMATION_ASSERTS 1
// #define VERBOSE_LAYOUT_ANIMATION_ASSERTS 1
// Enables some Shadow Tree introspection features (maintains a StubViewTree,
// and logs prev/next tree and mutations if there are any discrepancies). If you
@@ -38,9 +38,9 @@
// Enables *very* verbose, noisy logs in the differ. Useful for debugging
// specifically the differ, but not much else.
//#define DEBUG_LOGS_DIFFER
// #define DEBUG_LOGS_DIFFER
// Uncomment to enable verbose StubViewTree debug logs. This ensures that errors
// are logged to console before the `assert` is fired. More useful on Android vs
// other platforms.
//#define STUB_VIEW_TREE_VERBOSE 1
// #define STUB_VIEW_TREE_VERBOSE 1
@@ -1087,8 +1087,8 @@ static void calculateShadowViewMutationsV2(
DEBUG_LOGS({
LOG(ERROR) << "Differ Branch 1.1: Tags Different: ["
<< oldChildPair.shadowView.tag << "] ["
<< newChildPair.shadowView.tag << "]"
<< " with parent: [" << parentShadowView.tag << "]";
<< newChildPair.shadowView.tag << "]" << " with parent: ["
<< parentShadowView.tag << "]";
});
// Totally different nodes, updating is impossible.
@@ -1152,8 +1152,8 @@ static void calculateShadowViewMutationsV2(
DEBUG_LOGS({
LOG(ERROR) << "Differ Branch 2: Deleting Tag/Tree: ["
<< oldChildPair.shadowView.tag << "]"
<< " with parent: [" << parentShadowView.tag << "]";
<< oldChildPair.shadowView.tag << "]" << " with parent: ["
<< parentShadowView.tag << "]";
});
if (!oldChildPair.isConcreteView) {
@@ -1214,8 +1214,8 @@ static void calculateShadowViewMutationsV2(
DEBUG_LOGS({
LOG(ERROR) << "Differ Branch 3: Creating Tag/Tree: ["
<< newChildPair.shadowView.tag << "]"
<< " with parent: [" << parentShadowView.tag << "]";
<< newChildPair.shadowView.tag << "]" << " with parent: ["
<< parentShadowView.tag << "]";
});
if (!newChildPair.isConcreteView) {
@@ -160,8 +160,7 @@ static void testShadowNodeTreeLifeCycle(
<< getDebugDescription(
rebuiltViewTree.getRootStubView(), {});
LOG(ERROR) << "Mutations:"
<< "\n"
LOG(ERROR) << "Mutations:" << "\n"
<< getDebugDescription(mutations, {});
#endif
@@ -312,8 +311,7 @@ static void testShadowNodeTreeLifeCycleExtensiveFlatteningUnflattening(
<< getDebugDescription(
rebuiltViewTree.getRootStubView(), {});
LOG(ERROR) << "Mutations:"
<< "\n"
LOG(ERROR) << "Mutations:" << "\n"
<< getDebugDescription(mutations, {});
#endif
@@ -49,7 +49,7 @@ class DummyShadowTreeDelegate : public ShadowTreeDelegate {
void shadowTreeDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) const override{};
bool mountSynchronously) const override {};
};
namespace {
@@ -14,6 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Returns UIFont instance corresponded to given font properties.
*/
UIFont* RCTFontWithFontProperties(RCTFontProperties fontProperties);
UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties);
NS_ASSUME_NONNULL_END
@@ -141,22 +141,23 @@ void UIManagerBinding::dispatchEventToJS(
return;
}
auto instanceHandle = eventTarget != nullptr
? [&]() {
auto instanceHandle = eventTarget->getInstanceHandle(runtime);
if (instanceHandle.isUndefined()) {
return jsi::Value::null();
}
auto instanceHandle = eventTarget != nullptr ? [&]() {
auto instanceHandle = eventTarget->getInstanceHandle(runtime);
if (instanceHandle.isUndefined()) {
return jsi::Value::null();
}
// Mixing `target` into `payload`.
if (!payload.isObject()) {
LOG(ERROR) << "payload for dispatchEvent is not an object: " << eventTarget->getTag();
}
react_native_assert(payload.isObject());
payload.asObject(runtime).setProperty(runtime, "target", eventTarget->getTag());
return instanceHandle;
}()
: jsi::Value::null();
// Mixing `target` into `payload`.
if (!payload.isObject()) {
LOG(ERROR) << "payload for dispatchEvent is not an object: "
<< eventTarget->getTag();
}
react_native_assert(payload.isObject());
payload.asObject(runtime).setProperty(
runtime, "target", eventTarget->getTag());
return instanceHandle;
}()
: jsi::Value::null();
if (instanceHandle.isNull()) {
// Do not log all missing instanceHandles to avoid log spam
@@ -115,8 +115,7 @@ class RCTHostHostTargetDelegate : public facebook::react::jsinspector_modern::Ho
_launchOptions = [launchOptions copy];
__weak RCTHost *weakSelf = self;
auto bundleURLGetter = ^NSURL *()
{
auto bundleURLGetter = ^NSURL *() {
RCTHost *strongSelf = weakSelf;
if (!strongSelf) {
return nil;
@@ -129,8 +128,7 @@ class RCTHostHostTargetDelegate : public facebook::react::jsinspector_modern::Ho
[weakSelf _setBundleURL:bundleURL_];
};
auto defaultBundleURLGetter = ^NSURL *()
{
auto defaultBundleURLGetter = ^NSURL *() {
RCTHost *strongSelf = weakSelf;
if (!strongSelf || !strongSelf->_bundleURLProvider) {
return nil;
@@ -34,7 +34,7 @@ namespace detail {
*/
void wrappedManagedObjectDeleter(void *cfPointer) noexcept;
}
} // namespace detail
/*
* `wrapManagedObject` and `unwrapManagedObject` are wrapper functions that
@@ -208,7 +208,7 @@ RCT_EXPORT_MODULE()
__block RCTTestCustomSetBridgeModule *module;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
module = [self->_bridge moduleForClass:[RCTTestCustomSetBridgeModule class]];
module = [self->_bridge moduleForClass: [RCTTestCustomSetBridgeModule class]];
});
RCT_RUN_RUNLOOP_WHILE(!module);
@@ -236,7 +236,7 @@ RCT_EXPORT_MODULE()
__block RCTLazyInitModule *module;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
module = [self->_bridge moduleForClass:[RCTLazyInitModule class]];
module = [self->_bridge moduleForClass: [RCTLazyInitModule class]];
});
RCT_RUN_RUNLOOP_WHILE(!module);