Skip to content

Commit

Permalink
Merge pull request #8 from sidepelican/swiftsyntax509
Browse files Browse the repository at this point in the history
Update SwiftSyntax to 509
  • Loading branch information
omochi authored Oct 7, 2023
2 parents b3df977 + 410ed94 commit b660db1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
36 changes: 18 additions & 18 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1",
"version" : "1.1.4"
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
},
{
"identity" : "swift-format",
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-format",
"location" : "https://github.com/apple/swift-cmark.git",
"state" : {
"revision" : "3330aaa0a97fe07e764a4dc9bb032b23df3a948f",
"version" : "508.0.0"
"revision" : "29d9c97e6310b87c4799268eaa2fc76164b2dbd8",
"version" : "0.2.0"
}
},
{
"identity" : "swift-syntax",
"identity" : "swift-format",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"location" : "https://github.com/apple/swift-format",
"state" : {
"revision" : "cd793adf5680e138bf2bcbaacc292490175d0dcd",
"version" : "508.0.0"
"revision" : "83248b4fa37919f78ffbd4650946759bcc54c2b5",
"version" : "509.0.0"
}
},
{
"identity" : "swift-system",
"identity" : "swift-markdown",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"location" : "https://github.com/apple/swift-markdown.git",
"state" : {
"revision" : "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version" : "1.1.1"
"revision" : "68b2fed9fb12fb71ac81e537f08bed430b189e35",
"version" : "0.2.0"
}
},
{
"identity" : "swift-tools-support-core",
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-tools-support-core.git",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "93784c59434dbca8e8a9e4b700d0d6d94551da6a",
"version" : "0.5.2"
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let package = Package(
.plugin(name: "CodegenKitPlugin", targets: ["CodegenKitPlugin"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-format", from: "508.0.0"),
.package(url: "https://github.com/apple/swift-syntax", from: "508.0.0"),
.package(url: "https://github.com/apple/swift-format", from: "509.0.0"),
.package(url: "https://github.com/apple/swift-syntax", from: "509.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.1.4")
],
targets: [
Expand Down
18 changes: 9 additions & 9 deletions Sources/CodegenKitCLI/ManifestoCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ struct ManifestoCode {
try source.write(to: file, atomically: true, encoding: .utf8)
}

func nameArg() throws -> TupleExprElementSyntax? {
func nameArg() throws -> LabeledExprSyntax? {
return try self.nameArg(packageCall: self.packageCall())
}

func defaultLocalizationArg() throws -> TupleExprElementSyntax? {
func defaultLocalizationArg() throws -> LabeledExprSyntax? {
return try self.defaultLocalizationArg(packageCall: self.packageCall())
}

func platformsArg() throws -> TupleExprElementSyntax? {
func platformsArg() throws -> LabeledExprSyntax? {
return try self.packageCall().arg(name: "platforms")
}

Expand Down Expand Up @@ -93,8 +93,8 @@ struct ManifestoCode {
override func visit(_ node: FunctionCallExprSyntax) -> SyntaxVisitorContinueKind {
guard result == nil else { return .skipChildren }

if let ident = node.calledExpression.as(IdentifierExprSyntax.self),
ident.identifier.text == "Package"
if let ident = node.calledExpression.as(DeclReferenceExprSyntax.self),
ident.baseName.text == "Package"
{
self.result = node
return .skipChildren
Expand All @@ -109,11 +109,11 @@ struct ManifestoCode {
return try v.result.unwrap("Package call")
}

private func nameArg(packageCall: FunctionCallExprSyntax) -> TupleExprElementSyntax? {
private func nameArg(packageCall: FunctionCallExprSyntax) -> LabeledExprSyntax? {
return packageCall.arg(name: "name")
}

private func defaultLocalizationArg(packageCall: FunctionCallExprSyntax) -> TupleExprElementSyntax? {
private func defaultLocalizationArg(packageCall: FunctionCallExprSyntax) -> LabeledExprSyntax? {
return packageCall.arg(name: "defaultLocalization")
}

Expand All @@ -137,7 +137,7 @@ struct ManifestoCode {
guard let call = target.expression.as(FunctionCallExprSyntax.self),
let member = call.calledExpression.as(MemberAccessExprSyntax.self),
member.base == nil else { return nil }
for arg in call.argumentList {
for arg in call.arguments {
if arg.label?.text == "name" {
guard let string = arg.expression.as(StringLiteralExprSyntax.self),
string.segments.count == 1,
Expand Down Expand Up @@ -169,7 +169,7 @@ struct ManifestoCode {
) throws {
let packageCall = try self.packageCall()

let frontArg: TupleExprElementSyntax = try {
let frontArg: LabeledExprSyntax = try {
if let arg = self.defaultLocalizationArg(packageCall: packageCall) {
return arg
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/CodegenKitCLI/SyntaxEx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension AbsolutePosition {
}

extension FunctionCallExprSyntax {
func arg(name: String) -> TupleExprElementSyntax? {
return argumentList.first { $0.label?.text == name }
func arg(name: String) -> LabeledExprSyntax? {
return arguments.first { $0.label?.text == name }
}
}

0 comments on commit b660db1

Please sign in to comment.