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 {
190
190
tree: SyntaxType ,
191
191
diags: [ Diagnostic ] ,
192
192
indentString: String ,
193
- suffixTexts: [ ( AbsolutePosition , String ) ] ,
193
+ suffixTexts: [ AbsolutePosition : String ] ,
194
194
sourceLocationConverter: SourceLocationConverter ? = nil
195
195
) -> String {
196
196
let slc = sourceLocationConverter ?? SourceLocationConverter ( file: fileName ?? " " , tree: tree)
@@ -320,7 +320,7 @@ public struct DiagnosticsFormatter {
320
320
tree: tree,
321
321
diags: diags,
322
322
indentString: " " ,
323
- suffixTexts: [ ]
323
+ suffixTexts: [ : ]
324
324
)
325
325
}
326
326
Original file line number Diff line number Diff line change @@ -149,14 +149,16 @@ extension GroupedDiagnostics {
149
149
150
150
let childPadding = String ( slc. sourceLines. count + 1 ) . count + 1 ;
151
151
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 {
153
155
let childSource = annotateSource (
154
156
childBufferID,
155
157
formatter: formatter,
156
158
indentString: indentString + String( repeating: " " , count: childPadding) + " │ "
157
159
)
158
160
159
- return ( sourceFiles [ childBufferID. id] . parent!. 1 , childSource)
161
+ childSources [ sourceFiles [ childBufferID. id] . parent!. 1 , default : " " ] . append ( childSource)
160
162
}
161
163
162
164
// If this is a nested source file, draw a box around it.
Original file line number Diff line number Diff line change 12
12
13
13
/// An absolute position in a source file as text - the absolute utf8Offset from
14
14
/// the start of the file.
15
- public struct AbsolutePosition : Comparable {
15
+ public struct AbsolutePosition : Comparable , Hashable {
16
16
public let utf8Offset : Int
17
17
18
18
static let startOfFile = AbsolutePosition ( utf8Offset: 0 )
You can’t perform that action at this time.
0 commit comments