From 222b12c37a64ba0cb11dc4ea872036e3ba1d6e9f Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 25 Jan 2026 10:03:34 +0800 Subject: [PATCH] BridgeJS: Remove adhoc `exportedProtocolNameByKey` recording TypeDeclResolver should be responsible for handling this --- Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift | 8 -------- .../BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift | 6 ++++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index bb51ebafc..d9564aff4 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -26,7 +26,6 @@ public class ExportSwift { private var exportedEnums: [ExportedEnum] = [] private var exportedStructs: [ExportedStruct] = [] private var exportedProtocols: [ExportedProtocol] = [] - private var exportedProtocolNameByKey: [String: String] = [:] private var typeDeclResolver: TypeDeclResolver = TypeDeclResolver() private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] @@ -1136,8 +1135,6 @@ public class ExportSwift { stateStack.pop() - parent.exportedProtocolNameByKey[protocolUniqueKey] = name - return .skipChildren } @@ -1598,11 +1595,6 @@ public class ExportSwift { return primitiveType } - let protocolKey = typeName - if let protocolName = exportedProtocolNameByKey[protocolKey] { - return .swiftProtocol(protocolName) - } - guard let typeDecl = typeDeclResolver.resolve(type) else { return nil } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift index 33e36a4a2..975c0c9dc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/TypeDeclResolver.swift @@ -63,6 +63,12 @@ class TypeDeclResolver { override func visitPost(_ node: EnumDeclSyntax) { visitPostNominalDecl() } + override func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind { + return visitNominalDecl(node) + } + override func visitPost(_ node: ProtocolDeclSyntax) { + visitPostNominalDecl() + } override func visit(_ node: TypeAliasDeclSyntax) -> SyntaxVisitorContinueKind { let name = node.name.text