Skip to content

Commit c5d380f

Browse files
Avoid static_pointer_cast in GenerateModuleH.js (#44889)
Summary: Pull Request resolved: #44889 Avoid static_pointer_cast. It provides no type-safety, and requires increasing the shared_ptr ## Changelog: [Internal] [Fixed] - Avoid static_pointer_cast in GenerateModuleH.js Reviewed By: javache Differential Revision: D58449748 fbshipit-source-id: 4d46b4e18fc28758296a67271182a471a99b5d83
1 parent 20462ca commit c5d380f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react-native-codegen/src/generators/modules/GenerateModuleH.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,9 @@ function translateEventEmitterToCpp(
568568
isArray ? `std::vector<${templateName}>` : templateName
569569
}, ${jsiType}>, "value cannnot be converted to ${jsiType}");`
570570
}
571-
std::static_pointer_cast<AsyncEventEmitter<${
571+
static_cast<AsyncEventEmitter<${
572572
isVoidTypeAnnotation ? '' : 'jsi::Value'
573-
}>>(delegate_.eventEmitterMap_["${eventEmitter.name}"])->emit(${
573+
}>&>(*delegate_.eventEmitterMap_["${eventEmitter.name}"]).emit(${
574574
isVoidTypeAnnotation
575575
? ''
576576
: `[jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {

0 commit comments

Comments
 (0)