@@ -838,18 +838,16 @@ struct StackCodegen {
838838
839839 func liftArrayExpression( elementType: BridgeType ) -> ExprSyntax {
840840 switch elementType {
841- case . int, . uint, . float, . double, . string, . bool, . jsValue,
842- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
843- . unsafePointer, . rawValueEnum, . associatedValueEnum:
844- return " [ \( raw: elementType. swiftType) ].bridgeJSLiftParameter() "
845- case . jsObject( _? ) :
841+ case . jsObject( let className? ) where className != " JSObject " :
846842 return liftArrayExpressionInline ( elementType: elementType)
847843 case . swiftProtocol( let protocolName) :
848844 return " [Any \( raw: protocolName) ].bridgeJSLiftParameter() "
849- case . nullable, . array , . closure, . dictionary :
845+ case . nullable, . closure:
850846 return liftArrayExpressionInline ( elementType: elementType)
851847 case . void, . namespaceEnum:
852848 fatalError ( " Invalid array element type: \( elementType) " )
849+ default :
850+ return " [ \( raw: elementType. swiftType) ].bridgeJSLiftParameter() "
853851 }
854852 }
855853
@@ -872,11 +870,7 @@ struct StackCodegen {
872870
873871 func liftDictionaryExpression( valueType: BridgeType ) -> ExprSyntax {
874872 switch valueType {
875- case . int, . uint, . float, . double, . string, . bool, . jsValue,
876- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
877- . unsafePointer, . rawValueEnum, . associatedValueEnum:
878- return " [String: \( raw: valueType. swiftType) ].bridgeJSLiftParameter() "
879- case . jsObject( let className? ) :
873+ case . jsObject( let className? ) where className != " JSObject " :
880874 return """
881875 {
882876 let __dict = [String: JSObject].bridgeJSLiftParameter()
@@ -890,10 +884,12 @@ struct StackCodegen {
890884 return __dict.mapValues { $0 as! Any \( raw: protocolName) }
891885 }()
892886 """
893- case . nullable, . array , . dictionary , . closure:
887+ case . nullable, . closure:
894888 return liftDictionaryExpressionInline ( valueType: valueType)
895889 case . void, . namespaceEnum:
896890 fatalError ( " Invalid dictionary value type: \( valueType) " )
891+ default :
892+ return " [String: \( raw: valueType. swiftType) ].bridgeJSLiftParameter() "
897893 }
898894 }
899895
@@ -1005,22 +1001,20 @@ struct StackCodegen {
10051001 varPrefix: String
10061002 ) -> [ CodeBlockItemSyntax ] {
10071003 switch elementType {
1008- case . int, . uint, . float, . double, . string, . bool, . jsValue,
1009- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
1010- . unsafePointer, . rawValueEnum, . associatedValueEnum:
1011- return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
1012- case . jsObject( _? ) :
1004+ case . jsObject( let className? ) where className != " JSObject " :
10131005 return [ " \( raw: accessor) .map { $0.jsObject }.bridgeJSLowerReturn() " ]
10141006 case . swiftProtocol( let protocolName) :
10151007 return [ " \( raw: accessor) .map { $0 as! Any \( raw: protocolName) }.bridgeJSLowerReturn() " ]
1016- case . nullable, . array , . closure, . dictionary :
1008+ case . nullable, . closure:
10171009 return lowerArrayStatementsInline (
10181010 elementType: elementType,
10191011 accessor: accessor,
10201012 varPrefix: varPrefix
10211013 )
10221014 case . void, . namespaceEnum:
10231015 fatalError ( " Invalid array element type: \( elementType) " )
1016+ default :
1017+ return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
10241018 }
10251019 }
10261020
@@ -1054,22 +1048,20 @@ struct StackCodegen {
10541048 varPrefix: String
10551049 ) -> [ CodeBlockItemSyntax ] {
10561050 switch valueType {
1057- case . int, . uint, . float, . double, . string, . bool, . jsValue,
1058- . jsObject( nil ) , . swiftStruct, . caseEnum, . swiftHeapObject,
1059- . unsafePointer, . rawValueEnum, . associatedValueEnum:
1060- return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
1061- case . jsObject( _? ) :
1051+ case . jsObject( let className? ) where className != " JSObject " :
10621052 return [ " \( raw: accessor) .mapValues { $0.jsObject }.bridgeJSLowerReturn() " ]
10631053 case . swiftProtocol( let protocolName) :
10641054 return [ " \( raw: accessor) .mapValues { $0 as! Any \( raw: protocolName) }.bridgeJSLowerReturn() " ]
1065- case . nullable, . array , . dictionary , . closure:
1055+ case . nullable, . closure:
10661056 return lowerDictionaryStatementsInline (
10671057 valueType: valueType,
10681058 accessor: accessor,
10691059 varPrefix: varPrefix
10701060 )
10711061 case . void, . namespaceEnum:
10721062 fatalError ( " Invalid dictionary value type: \( valueType) " )
1063+ default :
1064+ return [ " \( raw: accessor) .bridgeJSLowerReturn() " ]
10731065 }
10741066 }
10751067
0 commit comments