Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 0 additions & 7 deletions Plugins/BridgeJS/Sources/BridgeJSCore/BridgeJSCoreError.swift

This file was deleted.

23 changes: 0 additions & 23 deletions Plugins/BridgeJS/Sources/BridgeJSCore/DiagnosticError.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
// MARK: - ProgressReporting

public struct ProgressReporting {
let print: (String) -> Void

public init(verbose: Bool) {
self.init(print: verbose ? { Swift.print($0) } : { _ in })
}

private init(print: @escaping (String) -> Void) {
self.print = print
}

public static var silent: ProgressReporting {
return ProgressReporting(print: { _ in })
}

public func print(_ message: String) {
self.print(message)
}
}

// MARK: - DiagnosticError

import SwiftSyntax

struct DiagnosticError: Error {
let node: Syntax
let message: String
let hint: String?

init(node: some SyntaxProtocol, message: String, hint: String? = nil) {
self.node = Syntax(node)
self.message = message
self.hint = hint
}

func formattedDescription(fileName: String) -> String {
let locationConverter = SourceLocationConverter(fileName: fileName, tree: node.root)
let location = locationConverter.location(for: node.position)
var description = "\(fileName):\(location.line):\(location.column): error: \(message)"
if let hint {
description += "\nHint: \(hint)"
}
return description
}
}

// MARK: - BridgeJSCoreError

public struct BridgeJSCoreError: Swift.Error, CustomStringConvertible {
public let description: String

public init(_ message: String) {
self.description = message
}
}

// MARK: - BridgeJSConfig

import struct Foundation.URL
import struct Foundation.Data
import class Foundation.FileManager
Expand Down
19 changes: 0 additions & 19 deletions Plugins/BridgeJS/Sources/BridgeJSCore/ProgressReporting.swift

This file was deleted.