Skip to content

Commit 52d83dc

Browse files
ingridwangfacebook-github-bot
authored andcommitted
Fixing unreachable-code-return in react-native-github (#56338)
Summary: ## Changelog: [iOS][Fixed] - Addressed -Wunreachable-code-return violations Reviewed By: NickGerleman Differential Revision: D97797196
1 parent 23f7dc4 commit 52d83dc

2 files changed

Lines changed: 20 additions & 23 deletions

File tree

packages/react-native/ReactCommon/jsinspector-modern/tracing/TracingCategory.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ inline std::string tracingCategoryToString(const Category &category)
4444
return "disabled-by-default-devtools.screenshot";
4545
default:
4646
folly::assume_unreachable();
47-
return "unknown";
4847
}
4948
}
5049

packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,10 @@ TEST_P(RuntimeSchedulerTest, scheduleTaskFromTask) {
858858

859859
TEST_P(RuntimeSchedulerTest, handlingError) {
860860
bool didRunTask = false;
861-
auto firstCallback =
862-
createHostFunctionFromLambda([this, &didRunTask](bool /*unused*/) {
861+
auto firstCallback = createHostFunctionFromLambda(
862+
[this, &didRunTask](bool /*unused*/) -> jsi::Value {
863863
didRunTask = true;
864864
throw jsi::JSError(*runtime_, "Test error");
865-
return jsi::Value::undefined();
866865
});
867866

868867
runtimeScheduler_->scheduleTask(
@@ -1169,27 +1168,26 @@ TEST_P(RuntimeSchedulerTest, errorInTaskShouldNotStopMicrotasks) {
11691168
auto microtaskRan = false;
11701169
auto taskRan = false;
11711170

1172-
auto callback = createHostFunctionFromLambda([&](bool /* unused */) {
1173-
taskRan = true;
1174-
1175-
auto microtaskCallback = jsi::Function::createFromHostFunction(
1176-
*runtime_,
1177-
jsi::PropNameID::forUtf8(*runtime_, "microtask1"),
1178-
3,
1179-
[&](jsi::Runtime& /*unused*/,
1180-
const jsi::Value& /*unused*/,
1181-
const jsi::Value* /*arguments*/,
1182-
size_t /*unused*/) -> jsi::Value {
1183-
microtaskRan = true;
1184-
return jsi::Value::undefined();
1185-
});
1186-
1187-
runtime_->queueMicrotask(microtaskCallback);
1171+
auto callback =
1172+
createHostFunctionFromLambda([&](bool /* unused */) -> jsi::Value {
1173+
taskRan = true;
1174+
1175+
auto microtaskCallback = jsi::Function::createFromHostFunction(
1176+
*runtime_,
1177+
jsi::PropNameID::forUtf8(*runtime_, "microtask1"),
1178+
3,
1179+
[&](jsi::Runtime& /*unused*/,
1180+
const jsi::Value& /*unused*/,
1181+
const jsi::Value* /*arguments*/,
1182+
size_t /*unused*/) -> jsi::Value {
1183+
microtaskRan = true;
1184+
return jsi::Value::undefined();
1185+
});
11881186

1189-
throw jsi::JSError(*runtime_, "Test error");
1187+
runtime_->queueMicrotask(microtaskCallback);
11901188

1191-
return jsi::Value::undefined();
1192-
});
1189+
throw jsi::JSError(*runtime_, "Test error");
1190+
});
11931191

11941192
runtimeScheduler_->scheduleTask(
11951193
SchedulerPriority::NormalPriority, std::move(callback));

0 commit comments

Comments
 (0)