File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ public struct DiagnosticsFormatter {
190190 tree: SyntaxType ,
191191 diags: [ Diagnostic ] ,
192192 indentString: String ,
193- suffixTexts: [ ( AbsolutePosition , String ) ] ,
193+ suffixTexts: [ AbsolutePosition : String ] ,
194194 sourceLocationConverter: SourceLocationConverter ? = nil
195195 ) -> String {
196196 let slc = sourceLocationConverter ?? SourceLocationConverter ( file: fileName ?? " " , tree: tree)
@@ -320,7 +320,7 @@ public struct DiagnosticsFormatter {
320320 tree: tree,
321321 diags: diags,
322322 indentString: " " ,
323- suffixTexts: [ ]
323+ suffixTexts: [ : ]
324324 )
325325 }
326326
Original file line number Diff line number Diff line change @@ -149,14 +149,16 @@ extension GroupedDiagnostics {
149149
150150 let childPadding = String ( slc. sourceLines. count + 1 ) . count + 1 ;
151151
152- let childSources : [ ( AbsolutePosition , String ) ] = sourceFiles [ sourceFileID. id] . children. map { childBufferID in
152+ // Collect the child sources.
153+ var childSources : [ AbsolutePosition : String ] = [ : ]
154+ for childBufferID in sourceFiles [ sourceFileID. id] . children {
153155 let childSource = annotateSource (
154156 childBufferID,
155157 formatter: formatter,
156158 indentString: indentString + String( repeating: " " , count: childPadding) + " │ "
157159 )
158160
159- return ( sourceFiles [ childBufferID. id] . parent!. 1 , childSource)
161+ childSources [ sourceFiles [ childBufferID. id] . parent!. 1 , default : " " ] . append ( childSource)
160162 }
161163
162164 // If this is a nested source file, draw a box around it.
Original file line number Diff line number Diff line change 1212
1313/// An absolute position in a source file as text - the absolute utf8Offset from
1414/// the start of the file.
15- public struct AbsolutePosition : Comparable {
15+ public struct AbsolutePosition : Comparable , Hashable {
1616 public let utf8Offset : Int
1717
1818 static let startOfFile = AbsolutePosition ( utf8Offset: 0 )
You can’t perform that action at this time.
0 commit comments