From 410ed94860783d5d1de37554e6f9a5b7e4036772 Mon Sep 17 00:00:00 2001 From: kenta okamura Date: Sat, 7 Oct 2023 17:37:47 +0900 Subject: [PATCH] Update SwiftSyntax to 509 --- Package.resolved | 36 +++++++++++------------ Package.swift | 4 +-- Sources/CodegenKitCLI/ManifestoCode.swift | 18 ++++++------ Sources/CodegenKitCLI/SyntaxEx.swift | 4 +-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Package.resolved b/Package.resolved index 37b4610..c8e5500 100644 --- a/Package.resolved +++ b/Package.resolved @@ -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" } } ], diff --git a/Package.swift b/Package.swift index da0d1ba..8662a32 100644 --- a/Package.swift +++ b/Package.swift @@ -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: [ diff --git a/Sources/CodegenKitCLI/ManifestoCode.swift b/Sources/CodegenKitCLI/ManifestoCode.swift index 1917472..be53c44 100644 --- a/Sources/CodegenKitCLI/ManifestoCode.swift +++ b/Sources/CodegenKitCLI/ManifestoCode.swift @@ -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") } @@ -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 @@ -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") } @@ -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, @@ -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 } diff --git a/Sources/CodegenKitCLI/SyntaxEx.swift b/Sources/CodegenKitCLI/SyntaxEx.swift index 4be9307..5c8ef21 100644 --- a/Sources/CodegenKitCLI/SyntaxEx.swift +++ b/Sources/CodegenKitCLI/SyntaxEx.swift @@ -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 } } }