@@ -818,18 +818,16 @@ struct StackCodegen {
818818
819819 func liftArrayExpression( elementType: BridgeType ) -> ExprSyntax {
820820 switch elementType {
821- case . int, . uint, . float, . double, . string, . bool, . jsValue,
822- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
823- . unsafePointer, . rawValueEnum, . associatedValueEnum:
824- return " [ \( raw: elementType. swiftType) ].bridgeJSLiftParameter() "
825- case . jsObject( _? ) :
821+ case . jsObject( let className? ) where className != " JSObject " :
826822 return liftArrayExpressionInline ( elementType: elementType)
827823 case . swiftProtocol( let protocolName) :
828824 return " [Any \( raw: protocolName) ].bridgeJSLiftParameter() "
829- case . nullable, . array , . closure, . dictionary :
825+ case . nullable, . closure:
830826 return liftArrayExpressionInline ( elementType: elementType)
831827 case . void, . namespaceEnum:
832828 fatalError ( " Invalid array element type: \( elementType) " )
829+ default :
830+ return " [ \( raw: elementType. swiftType) ].bridgeJSLiftParameter() "
833831 }
834832 }
835833
@@ -852,11 +850,7 @@ struct StackCodegen {
852850
853851 func liftDictionaryExpression( valueType: BridgeType ) -> ExprSyntax {
854852 switch valueType {
855- case . int, . uint, . float, . double, . string, . bool, . jsValue,
856- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
857- . unsafePointer, . rawValueEnum, . associatedValueEnum:
858- return " [String: \( raw: valueType. swiftType) ].bridgeJSLiftParameter() "
859- case . jsObject( let className? ) :
853+ case . jsObject( let className? ) where className != " JSObject " :
860854 return """
861855 {
862856 let __dict = [String: JSObject].bridgeJSLiftParameter()
@@ -870,10 +864,12 @@ struct StackCodegen {
870864 return __dict.mapValues { $0 as! Any \( raw: protocolName) }
871865 }()
872866 """
873- case . nullable, . array , . dictionary , . closure:
867+ case . nullable, . closure:
874868 return liftDictionaryExpressionInline ( valueType: valueType)
875869 case . void, . namespaceEnum:
876870 fatalError ( " Invalid dictionary value type: \( valueType) " )
871+ default :
872+ return " [String: \( raw: valueType. swiftType) ].bridgeJSLiftParameter() "
877873 }
878874 }
879875
@@ -953,22 +949,20 @@ struct StackCodegen {
953949 varPrefix: String
954950 ) -> [ CodeBlockItemSyntax ] {
955951 switch elementType {
956- case . int, . uint, . float, . double, . string, . bool, . jsValue,
957- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
958- . unsafePointer, . rawValueEnum, . associatedValueEnum:
959- return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
960- case . jsObject( _? ) :
952+ case . jsObject( let className? ) where className != " JSObject " :
961953 return [ " \( raw: accessor) .map { $0.jsObject }.bridgeJSLowerReturn() " ]
962954 case . swiftProtocol( let protocolName) :
963955 return [ " \( raw: accessor) .map { $0 as! Any \( raw: protocolName) }.bridgeJSLowerReturn() " ]
964- case . nullable, . array , . closure, . dictionary :
956+ case . nullable, . closure:
965957 return lowerArrayStatementsInline (
966958 elementType: elementType,
967959 accessor: accessor,
968960 varPrefix: varPrefix
969961 )
970962 case . void, . namespaceEnum:
971963 fatalError ( " Invalid array element type: \( elementType) " )
964+ default :
965+ return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
972966 }
973967 }
974968
@@ -1002,22 +996,20 @@ struct StackCodegen {
1002996 varPrefix: String
1003997 ) -> [ CodeBlockItemSyntax ] {
1004998 switch valueType {
1005- case . int, . uint, . float, . double, . string, . bool, . jsValue,
1006- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
1007- . unsafePointer, . rawValueEnum, . associatedValueEnum:
1008- return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
1009- case . jsObject( _? ) :
999+ case . jsObject( let className? ) where className != " JSObject " :
10101000 return [ " \( raw: accessor) .mapValues { $0.jsObject }.bridgeJSLowerReturn() " ]
10111001 case . swiftProtocol( let protocolName) :
10121002 return [ " \( raw: accessor) .mapValues { $0 as! Any \( raw: protocolName) }.bridgeJSLowerReturn() " ]
1013- case . nullable, . array , . dictionary , . closure:
1003+ case . nullable, . closure:
10141004 return lowerDictionaryStatementsInline (
10151005 valueType: valueType,
10161006 accessor: accessor,
10171007 varPrefix: varPrefix
10181008 )
10191009 case . void, . namespaceEnum:
10201010 fatalError ( " Invalid dictionary value type: \( valueType) " )
1011+ default :
1012+ return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
10211013 }
10221014 }
10231015
0 commit comments