Skip to content

Commit

Permalink
Support Swift 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
noah_martin committed Oct 4, 2020
1 parent 80d0508 commit 6efdcaf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"package": "IndexStoreDB",
"repositoryURL": "https://github.com/apple/indexstore-db.git",
"state": {
"branch": "swift-5.2-branch",
"revision": "99472b2b84b1e72f0bf4b55f2ba0b921b16ed945",
"branch": "release/5.3",
"revision": "58b306e0274155911dd4957945fd7e630798fec5",
"version": null
}
},
Expand All @@ -24,8 +24,8 @@
"repositoryURL": "https://github.com/apple/swift-syntax.git",
"state": {
"branch": null,
"revision": "0688b9cfc4c3dd234e4f55f1f056b2affc849873",
"version": "0.50200.0"
"revision": "844574d683f53d0737a9c6d706c3ef31ed2955eb",
"version": "0.50300.0"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ let package = Package(
.executable(name: "pecker", targets: ["Pecker"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50200.0")),
.package(url: "https://github.com/apple/indexstore-db.git", .branch("swift-5.2-branch")),
.package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50300.0")),
.package(url: "https://github.com/apple/indexstore-db.git", .branch("release/5.3")),
.package(url: "https://github.com/apple/swift-tools-support-core.git", .branch("master")),
.package(url: "https://github.com/jpsim/Yams.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", .branch("master")),
Expand Down
19 changes: 11 additions & 8 deletions Sources/PeckerKit/SourceCollector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ class SourceCollector {
let files = computeContents()
let safeSources = ThreadSafe<[SourceDetail]>([])
DispatchQueue.concurrentPerform(iterations: files.count) { index in
guard let syntax = try? SyntaxParser.parse(files[index].asURL) else {
return
}
let context = CollectContext(configuration: configuration,
let fileURL = files[index].asURL
do {
let syntax = try SyntaxParser.parse(fileURL)
let context = CollectContext(configuration: configuration,
filePath: files[index].description,
sourceFileSyntax: syntax)
let pipeline = SwiftSourceCollectVisitor(context: context)
pipeline.walk(syntax)
safeSources.atomically { $0 += pipeline.sources }
sourceExtensions.atomically { $0 += pipeline.sourceExtensions }
let pipeline = SwiftSourceCollectVisitor(context: context)
pipeline.walk(syntax)
safeSources.atomically { $0 += pipeline.sources }
sourceExtensions.atomically { $0 += pipeline.sourceExtensions }
} catch {
fputs("Error parsing \(fileURL) \(error)", stderr)
}
}
sources = safeSources.value
}
Expand Down

0 comments on commit 6efdcaf

Please sign in to comment.