Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions Sources/SwiftSyntax/DiagnosticEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,39 @@ public class DiagnosticEngine {
public init() {
}

private var consumersQueue = DispatchQueue(
label: "com.apple.SwiftSyntax.DiagnosticEngine.consumers", attributes: .concurrent)
private var _consumers = [DiagnosticConsumer]()
/// The list of consumers of the diagnostic passing through this engine.
internal var consumers = [DiagnosticConsumer]()
private var consumers: [DiagnosticConsumer] {
get {
consumersQueue.sync {
_consumers
}
}

public private(set) var diagnostics = [Diagnostic]()
set {
consumersQueue.async(flags: .barrier) {
self._consumers = newValue
}
}
}

private var diagnosticsQueue = DispatchQueue(
label: "com.apple.SwiftSyntax.DiagnosticEngine.diagnostics", attributes: .concurrent)
private var _diagnostics = [Diagnostic]()
public private(set) var diagnostics: [Diagnostic] {
get {
diagnosticsQueue.sync {
_diagnostics
}
}
set {
diagnosticsQueue.async(flags: .barrier) {
self._diagnostics = newValue
}
}
}

internal var needsLineColumn: Bool {
// Check if any consumer is interested in line and column.
Expand Down