Skip to content

Commit

Permalink
Merge pull request #8 from joehzli/upgrade-swift-syntax
Browse files Browse the repository at this point in the history
Upgrade SwiftSyntax to 5.6
  • Loading branch information
rudro authored Jun 29, 2022
2 parents 4e1f26a + a29e2c8 commit b586387
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"package": "SwiftSyntax",
"repositoryURL": "https://github.com/apple/swift-syntax.git",
"state": {
"branch": "swift-5.5-RELEASE",
"revision": "cf40be70deaf4ce7d44eb1a7e14299c391e2363f",
"branch": "swift-5.6-RELEASE",
"revision": "87d6d0af3d2db26ce0d6014cd953e546d45f63c6",
"version": null
}
}
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.0.2")),
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .branch("swift-5.5-RELEASE"))
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .branch("swift-5.6-RELEASE"))
],
targets: [
.target(
Expand All @@ -25,6 +25,7 @@ let package = Package(
name: "SwiftCodeSanKit",
dependencies: [
.product(name: "SwiftSyntax", package: "SwiftSyntax"),
.product(name: "SwiftSyntaxParser", package: "SwiftSyntax"),
]
),
.testTarget(
Expand Down
1 change: 1 addition & 0 deletions Sources/SwiftCodeSanKit/FileParsers/DeclParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import Foundation
import SwiftSyntax
import SwiftSyntaxParser

public class DeclParser {

Expand Down
1 change: 1 addition & 0 deletions Sources/SwiftCodeSanKit/FileUpdaters/DeclUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import Foundation
import SwiftSyntax
import SwiftSyntaxParser

final class DeclUpdater {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@

import Foundation
import SwiftSyntax
import SwiftSyntaxParser

extension SyntaxParser {
public static func parse(_ fileData: Data, path: String,
diagnosticEngine: DiagnosticEngine? = nil) throws -> SourceFileSyntax {
diagnosticHandler: ((Diagnostic) -> Void)? = nil) throws -> SourceFileSyntax {
// Avoid using `String(contentsOf:)` because it creates a wrapped NSString.
let source = fileData.withUnsafeBytes { buf in
return String(decoding: buf.bindMemory(to: UInt8.self), as: UTF8.self)
}
return try parse(source: source, filenameForDiagnostics: path,
diagnosticEngine: diagnosticEngine)
diagnosticHandler: diagnosticHandler)
}

public static func parse(_ path: String) throws -> SourceFileSyntax {
Expand Down

0 comments on commit b586387

Please sign in to comment.