@@ -586,10 +586,6 @@ napi_value TryCallHermesObjCMemberFastImpl(
586586 : nullptr ;
587587
588588 if (frameDirectReturnInvoker != nullptr ) {
589- if (handled != nullptr ) {
590- *handled = true ;
591- }
592-
593589 EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame (
594590 env, member->bridgeState , needsRoundTripFrame);
595591
@@ -611,6 +607,9 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
611607 env, cif, reinterpret_cast <void *>(objc_msgSend), self,
612608 descriptor->selector , returnContext, hermesArgsBase,
613609 &directResult)) {
610+ if (handled != nullptr ) {
611+ *handled = true ;
612+ }
614613 return directResult;
615614 }
616615 } @catch (NSException * exception) {
@@ -656,10 +655,6 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
656655 : nullptr ;
657656
658657 if (directReturnInvoker != nullptr ) {
659- if (handled != nullptr ) {
660- *handled = true ;
661- }
662-
663658 EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame (
664659 env, member->bridgeState , needsRoundTripFrame);
665660
@@ -684,6 +679,9 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
684679 env, cif, reinterpret_cast <void *>(objc_msgSend), self,
685680 descriptor->selector , returnContext, directArgs,
686681 &directResult)) {
682+ if (handled != nullptr ) {
683+ *handled = true ;
684+ }
687685 return directResult;
688686 }
689687 } @catch (NSException * exception) {
@@ -704,10 +702,6 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
704702 return nullptr ;
705703 }
706704
707- if (handled != nullptr ) {
708- *handled = true ;
709- }
710-
711705 EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame (
712706 env, member->bridgeState , needsRoundTripFrame);
713707
@@ -744,6 +738,10 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
744738 return nullptr ;
745739 }
746740
741+ if (handled != nullptr ) {
742+ *handled = true ;
743+ }
744+
747745 return makeHermesObjCReturnValue (
748746 env, member, descriptor, cif, self, receiverIsClass, jsThis, rvalue,
749747 kind != EngineDirectMemberKind::Method );
@@ -803,10 +801,6 @@ napi_value TryCallHermesCFunctionFastImpl(
803801 : nullptr ;
804802
805803 if (frameDirectReturnInvoker != nullptr ) {
806- if (handled != nullptr ) {
807- *handled = true ;
808- }
809-
810804 EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame (
811805 env, bridgeState, needsRoundTripCacheFrame (cif));
812806
@@ -815,6 +809,9 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
815809 NativeCallRuntimeUnlockScope unlockRuntime (env);
816810 if (frameDirectReturnInvoker (env, cif, function->fnptr , hermesArgsBase,
817811 &directResult)) {
812+ if (handled != nullptr ) {
813+ *handled = true ;
814+ }
818815 return directResult;
819816 }
820817 } @catch (NSException * exception) {
@@ -859,10 +856,6 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
859856 : nullptr ;
860857
861858 if (directReturnInvoker != nullptr ) {
862- if (handled != nullptr ) {
863- *handled = true ;
864- }
865-
866859 EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame (
867860 env, bridgeState, needsRoundTripCacheFrame (cif));
868861
@@ -874,6 +867,9 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
874867 NativeCallRuntimeUnlockScope unlockRuntime (env);
875868 if (directReturnInvoker (env, cif, function->fnptr , directArgs,
876869 &directResult)) {
870+ if (handled != nullptr ) {
871+ *handled = true ;
872+ }
877873 return directResult;
878874 }
879875 } @catch (NSException * exception) {
@@ -884,10 +880,6 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
884880 }
885881 }
886882
887- if (handled != nullptr ) {
888- *handled = true ;
889- }
890-
891883 EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame (
892884 env, bridgeState, needsRoundTripCacheFrame (cif));
893885
@@ -927,6 +919,10 @@ EngineDirectRoundTripCacheFrameGuard roundTripCacheFrame(
927919 return nullptr ;
928920 }
929921
922+ if (handled != nullptr ) {
923+ *handled = true ;
924+ }
925+
930926 return makeHermesCFunctionReturnValue (env, function, cif, perCallRValue);
931927}
932928
0 commit comments