@@ -724,57 +724,19 @@ struct StackCodegen {
724724 switch type {
725725 case . string, . int, . uint, . bool, . float, . double,
726726 . jsObject( nil ) , . jsValue, . swiftStruct, . swiftHeapObject, . unsafePointer,
727- . swiftProtocol, . caseEnum, . associatedValueEnum, . rawValueEnum, . array:
727+ . swiftProtocol, . caseEnum, . associatedValueEnum, . rawValueEnum, . array, . dictionary :
728728 return " \( raw: type. swiftType) .bridgeJSStackPop() "
729729 case . jsObject( let className? ) :
730730 return " \( raw: className) (unsafelyWrapping: JSObject.bridgeJSStackPop()) "
731731 case . nullable( let wrappedType, let kind) :
732732 return liftNullableExpression ( wrappedType: wrappedType, kind: kind)
733- case . dictionary( let valueType) :
734- return liftDictionaryExpression ( valueType: valueType)
735733 case . closure:
736734 return " JSObject.bridgeJSStackPop() "
737735 case . void, . namespaceEnum:
738736 return " () "
739737 }
740738 }
741739
742- func liftDictionaryExpression( valueType: BridgeType ) -> ExprSyntax {
743- switch valueType {
744- case . jsObject( let className? ) where className != " JSObject " :
745- return """
746- {
747- let __dict = [String: JSObject].bridgeJSStackPop()
748- return __dict.mapValues { \( raw: className) (unsafelyWrapping: $0) }
749- }()
750- """
751- case . nullable, . closure:
752- return liftDictionaryExpressionInline ( valueType: valueType)
753- case . void, . namespaceEnum:
754- fatalError ( " Invalid dictionary value type: \( valueType) " )
755- default :
756- return " [String: \( raw: valueType. swiftType) ].bridgeJSStackPop() "
757- }
758- }
759-
760- private func liftDictionaryExpressionInline( valueType: BridgeType ) -> ExprSyntax {
761- let valueLift = liftExpression ( for: valueType)
762- let swiftTypeName = valueType. swiftType
763- return """
764- {
765- let __count = Int(_swift_js_pop_i32())
766- var __result: [String: \( raw: swiftTypeName) ] = [:]
767- __result.reserveCapacity(__count)
768- for _ in 0..<__count {
769- let __value = \( valueLift)
770- let __key = String.bridgeJSStackPop()
771- __result[__key] = __value
772- }
773- return __result
774- }()
775- """
776- }
777-
778740 private func liftNullableExpression( wrappedType: BridgeType , kind: JSOptionalKind ) -> ExprSyntax {
779741 let typeName = kind == . null ? " Optional " : " JSUndefinedOr "
780742 switch wrappedType {
0 commit comments