Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 93b33c1

Browse files
committed
Remove initializer clauses from variable and enumeration case declarations
Fixes #46
1 parent 663e239 commit 93b33c1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Sources/SwiftDoc/SourceFile.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,14 @@ public struct SourceFile: Hashable, Codable {
112112
}
113113

114114
override func visit(_ node: EnumCaseDeclSyntax) -> SyntaxVisitorContinueKind {
115-
for `case` in Enumeration.Case.cases(from: node) {
115+
let cases = node.elements.compactMap { element in
116+
Enumeration.Case(element.withRawValue(nil))
117+
}
118+
119+
for `case` in cases {
116120
push(symbol(node, api: `case`))
117121
}
122+
118123
return .skipChildren
119124
}
120125

@@ -179,9 +184,14 @@ public struct SourceFile: Hashable, Codable {
179184
}
180185

181186
override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind {
182-
for variable in Variable.variables(from: node) {
187+
let variables = node.bindings.compactMap { binding in
188+
Variable(binding.withInitializer(nil))
189+
}
190+
191+
for variable in variables {
183192
push(symbol(node, api: variable))
184193
}
194+
185195
return .skipChildren
186196
}
187197

0 commit comments

Comments
 (0)