mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
remove unused argument from RawProps (#41565)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41565 changelog: [internal] this argument is never used, let's remove it. Reviewed By: christophpurrer Differential Revision: D51468580 fbshipit-source-id: aec029bc78b5490686a36ac8a5f5d0342bd28d50
This commit is contained in:
committed by
Facebook GitHub Bot
parent
16ad818d21
commit
1e43d2b9bd
+1
-1
@@ -29,7 +29,7 @@ Props::Shared UnimplementedViewComponentDescriptor::cloneProps(
|
||||
// We have to clone `Props` object one more time to make sure that we have
|
||||
// an unshared (and non-`const`) copy of it which we can mutate.
|
||||
RawProps emptyRawProps{};
|
||||
emptyRawProps.parse(rawPropsParser_, context);
|
||||
emptyRawProps.parse(rawPropsParser_);
|
||||
auto unimplementedViewProps = std::make_shared<UnimplementedViewProps>(
|
||||
context,
|
||||
static_cast<const UnimplementedViewProps&>(*clonedProps),
|
||||
|
||||
@@ -105,7 +105,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
|
||||
return ShadowNodeT::defaultSharedProps();
|
||||
}
|
||||
|
||||
rawProps.parse(rawPropsParser_, context);
|
||||
rawProps.parse(rawPropsParser_);
|
||||
|
||||
// Call old-style constructor
|
||||
auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props);
|
||||
|
||||
@@ -47,9 +47,7 @@ RawProps::RawProps(folly::dynamic dynamic) noexcept {
|
||||
dynamic_ = std::move(dynamic);
|
||||
}
|
||||
|
||||
void RawProps::parse(
|
||||
const RawPropsParser& parser,
|
||||
const PropsParserContext& /*unused*/) const noexcept {
|
||||
void RawProps::parse(const RawPropsParser& parser) const noexcept {
|
||||
react_native_assert(parser_ == nullptr && "A parser was already assigned.");
|
||||
parser_ = &parser;
|
||||
parser.preparse(*this);
|
||||
|
||||
@@ -70,8 +70,7 @@ class RawProps final {
|
||||
RawProps(const RawProps& other) noexcept = delete;
|
||||
RawProps& operator=(const RawProps& other) noexcept = delete;
|
||||
|
||||
void parse(const RawPropsParser& parser, const PropsParserContext&)
|
||||
const noexcept;
|
||||
void parse(const RawPropsParser& parser) const noexcept;
|
||||
|
||||
/*
|
||||
* Deprecated. Do not use.
|
||||
|
||||
@@ -46,7 +46,7 @@ class RawPropsParser final {
|
||||
ContextContainer contextContainer{};
|
||||
PropsParserContext parserContext{-1, contextContainer};
|
||||
|
||||
emptyRawProps.parse(*this, parserContext);
|
||||
emptyRawProps.parse(*this);
|
||||
PropsT(parserContext, {}, emptyRawProps);
|
||||
postPrepare();
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ TEST(RawPropsTest, handleProps) {
|
||||
const auto& raw = RawProps(folly::dynamic::object("nativeID", "abc"));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<Props>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
auto props = std::make_shared<Props>(parserContext, Props(), raw);
|
||||
|
||||
@@ -171,7 +171,7 @@ TEST(RawPropsTest, handleRawPropsSingleString) {
|
||||
const auto& raw = RawProps(folly::dynamic::object("nativeID", "abc"));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<Props>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
std::string value = (std::string)*raw.at("nativeID", nullptr, nullptr);
|
||||
|
||||
@@ -186,7 +186,7 @@ TEST(RawPropsTest, handleRawPropsSingleFloat) {
|
||||
RawProps(folly::dynamic::object("floatValue", (float)42.42));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsSingleFloat>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
auto value = (float)*raw.at("floatValue", nullptr, nullptr);
|
||||
|
||||
@@ -201,7 +201,7 @@ TEST(RawPropsTest, handleRawPropsSingleDouble) {
|
||||
RawProps(folly::dynamic::object("doubleValue", (double)42.42));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsSingleDouble>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
auto value = (double)*raw.at("doubleValue", nullptr, nullptr);
|
||||
|
||||
@@ -215,7 +215,7 @@ TEST(RawPropsTest, handleRawPropsSingleInt) {
|
||||
const auto& raw = RawProps(folly::dynamic::object("intValue", (int)42.42));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsSingleInt>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
int value = (int)*raw.at("intValue", nullptr, nullptr);
|
||||
|
||||
@@ -229,7 +229,7 @@ TEST(RawPropsTest, handleRawPropsSingleIntGetManyTimes) {
|
||||
const auto& raw = RawProps(folly::dynamic::object("intValue", (int)42.42));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsSingleInt>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
@@ -247,7 +247,7 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypes) {
|
||||
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsPrimitiveTypes>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001);
|
||||
@@ -269,7 +269,7 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetTwice) {
|
||||
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsPrimitiveTypes>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001);
|
||||
@@ -299,7 +299,7 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesGetOutOfOrder) {
|
||||
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsPrimitiveTypes>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
EXPECT_NEAR((double)*raw.at("doubleValue", nullptr, nullptr), 17.42, 0.0001);
|
||||
@@ -326,7 +326,7 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncomplete) {
|
||||
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsPrimitiveTypes>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
EXPECT_EQ((int)*raw.at("intValue", nullptr, nullptr), 42);
|
||||
EXPECT_EQ(raw.at("doubleValue", nullptr, nullptr), nullptr);
|
||||
@@ -346,7 +346,7 @@ TEST(RawPropsTest, handleRawPropsPrimitiveTypesIncorrectLookup) {
|
||||
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsPrimitiveTypes>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
// Before D18662135, looking up an invalid key would trigger
|
||||
// an infinite loop. This is out of contract, so we should only
|
||||
@@ -363,7 +363,7 @@ TEST(RawPropsTest, handlePropsMultiLookup) {
|
||||
const auto& raw = RawProps(folly::dynamic::object("floatValue", (float)10.0));
|
||||
auto parser = RawPropsParser();
|
||||
parser.prepare<PropsMultiLookup>();
|
||||
raw.parse(parser, parserContext);
|
||||
raw.parse(parser);
|
||||
|
||||
auto props = std::make_shared<PropsMultiLookup>(
|
||||
parserContext, PropsMultiLookup(), raw);
|
||||
|
||||
Reference in New Issue
Block a user