Skip to content

Commit 3133d0e

Browse files
authored
fix: Objc conversion analyzer protocol handling (#6215)
1 parent 72a8746 commit 3133d0e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

SwiftConversion/objc_conversion_analyzer.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,15 @@ def extract_classes(content)
8787
def extract_protocols(content)
8888
protocols = []
8989

90-
# Look for @protocol declarations
91-
content.scan(/@protocol\s+(\w+)/).each do |match|
92-
protocols << match[0]
90+
# Look for @protocol declarations, but skip forward declarations ending with semicolon
91+
content.scan(/@protocol\s+(\w+)(.*)/).each do |match|
92+
protocol_name = match[0]
93+
remaining_line = match[1]
94+
95+
# Skip forward declarations (those that end with semicolon immediately after the name)
96+
next if remaining_line.strip == ";"
97+
98+
protocols << protocol_name
9399
end
94100

95101
protocols.uniq

0 commit comments

Comments
 (0)