From 70338b1a25b3863039e37321d654ddc10a2e7ae5 Mon Sep 17 00:00:00 2001 From: Jake Heiser Date: Thu, 29 Mar 2018 21:10:04 -1000 Subject: [PATCH] Fix docs mismatch --- Sources/BeakCore/SwiftParser.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/BeakCore/SwiftParser.swift b/Sources/BeakCore/SwiftParser.swift index 21c3af5..487f477 100644 --- a/Sources/BeakCore/SwiftParser.swift +++ b/Sources/BeakCore/SwiftParser.swift @@ -16,8 +16,11 @@ public struct SwiftParser { // merge docs into structure var subStructure = structure.dictionary.substructure let swiftDocs = SwiftDocs(file: file, arguments: [])! - for (index, docStructure) in swiftDocs.docsDictionary.substructure.enumerated() { - subStructure[index][SwiftDocKey.documentationComment.rawValue] = docStructure[SwiftDocKey.documentationComment.rawValue] + + for docStructure in swiftDocs.docsDictionary.substructure { + if let index = subStructure.index(where: { $0.int(.nameOffset) == docStructure.int(.nameOffset) }) { + subStructure[index][SwiftDocKey.documentationComment.rawValue] = docStructure[SwiftDocKey.documentationComment.rawValue] + } } return try subStructure .filter { $0.kind == .functionFree && $0.accessibility == .public }