@@ -1487,6 +1487,34 @@ throw JSError(
14871487 return prepared;
14881488}
14891489
1490+ bool isPreparedStaticAppearanceSelector (
1491+ const NativeApiPreparedObjCInvocation& prepared) {
1492+ return prepared.receiverClass != Nil &&
1493+ prepared.selectorName .rfind (" appearance" , 0 ) == 0 ;
1494+ }
1495+
1496+ Value tagPreparedStaticAppearanceSelectorResult (
1497+ Runtime& runtime, const std::shared_ptr<NativeApiBridge>& bridge,
1498+ id receiver, const NativeApiPreparedObjCInvocation& prepared,
1499+ Value result) {
1500+ return tagStaticAppearanceSelectorResult (
1501+ runtime, bridge, receiver, isPreparedStaticAppearanceSelector (prepared),
1502+ prepared.selectorName , std::move (result));
1503+ }
1504+
1505+ void tagPreparedStaticAppearanceNativeReturn (
1506+ Runtime& runtime, const std::shared_ptr<NativeApiBridge>& bridge,
1507+ id receiver, const NativeApiPreparedObjCInvocation& prepared,
1508+ const NativeApiType& returnType, void * returnData) {
1509+ if (!isPreparedStaticAppearanceSelector (prepared) ||
1510+ !isObjectiveCObjectType (returnType) || returnData == nullptr ) {
1511+ return ;
1512+ }
1513+ tagStaticAppearanceNativeResult (
1514+ runtime, bridge, static_cast <Class >(receiver),
1515+ *static_cast <id *>(returnData));
1516+ }
1517+
14901518Value callPreparedObjCSelector (
14911519 Runtime& runtime, const std::shared_ptr<NativeApiBridge>& bridge,
14921520 id receiver, bool receiverIsClass,
@@ -1503,11 +1531,13 @@ throw JSError(runtime,
15031531 if (tryCallGeneratedEngineObjCSelector (runtime, bridge, receiver, prepared,
15041532 args, count, dispatchSuperClass,
15051533 &fastResult)) {
1506- return fastResult;
1534+ return tagPreparedStaticAppearanceSelectorResult (
1535+ runtime, bridge, receiver, prepared, std::move (fastResult));
15071536 }
15081537 if (tryCallFastEngineObjCSelector (runtime, bridge, receiver, prepared, args,
15091538 count, dispatchSuperClass, &fastResult)) {
1510- return fastResult;
1539+ return tagPreparedStaticAppearanceSelectorResult (
1540+ runtime, bridge, receiver, prepared, std::move (fastResult));
15111541 }
15121542
15131543 NativeApiArgumentFrame frame (signature.argumentTypes .size ());
@@ -1594,8 +1624,10 @@ NativeApiReturnStorage returnStorage(
15941624 throw JSError (
15951625 runtime, errorMessage != nullptr ? errorMessage : " Unknown NSError" );
15961626 }
1597- return convertNativeReturnValue (runtime, bridge, returnType,
1598- returnStorage.data ());
1627+ Value result = convertNativeReturnValue (runtime, bridge, returnType,
1628+ returnStorage.data ());
1629+ return tagPreparedStaticAppearanceSelectorResult (
1630+ runtime, bridge, receiver, prepared, std::move (result));
15991631}
16001632
16011633Value callObjCSelector (Runtime& runtime,
@@ -1666,12 +1698,16 @@ throw JSError(
16661698 if (tryCallGeneratedEngineObjCSelector (runtime, bridge, receiver,
16671699 engineInvocation, args, count,
16681700 dispatchSuperClass, &fastResult)) {
1669- return fastResult;
1701+ return tagStaticAppearanceSelectorResult (
1702+ runtime, bridge, receiver, receiverIsClass, selectorName,
1703+ std::move (fastResult));
16701704 }
16711705 if (tryCallFastEngineObjCSelector (runtime, bridge, receiver,
16721706 engineInvocation, args, count,
16731707 dispatchSuperClass, &fastResult)) {
1674- return fastResult;
1708+ return tagStaticAppearanceSelectorResult (
1709+ runtime, bridge, receiver, receiverIsClass, selectorName,
1710+ std::move (fastResult));
16751711 }
16761712
16771713 NativeApiArgumentFrame frame (signature->argumentTypes .size ());
@@ -1759,6 +1795,9 @@ NativeApiReturnStorage returnStorage(
17591795 throw JSError (
17601796 runtime, errorMessage != nullptr ? errorMessage : " Unknown NSError" );
17611797 }
1762- return convertNativeReturnValue (runtime, bridge, returnType,
1763- returnStorage.data ());
1798+ Value result = convertNativeReturnValue (runtime, bridge, returnType,
1799+ returnStorage.data ());
1800+ return tagStaticAppearanceSelectorResult (
1801+ runtime, bridge, receiver, receiverIsClass, selectorName,
1802+ std::move (result));
17641803}
0 commit comments