diff --git a/Package.resolved b/Package.resolved index 13645f82e..f4b00bfce 100644 --- a/Package.resolved +++ b/Package.resolved @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "4ad606ba5d7673ea60679a61ff867cc1ff8c8e86", - "version": "1.2.1" + "revision": "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a", + "version": "1.2.2" } }, { @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/peripheryapp/swift-syntax", "state": { "branch": null, - "revision": "a2d31e8880224f5a619f24bf58c122836faf99ff", - "version": "1.0.0" + "revision": "d81f0bfa1e14446a8c42e94ff6d44fddf866d72e", + "version": "1.0.1" } }, { @@ -69,8 +69,8 @@ "repositoryURL": "https://github.com/tuist/xcodeproj", "state": { "branch": null, - "revision": "b6de1bfe021b861c94e7c83821b595083f74b997", - "version": "8.8.0" + "revision": "fae27b48bc14ff3fd9b02902e48c4665ce5a0793", + "version": "8.9.0" } }, { @@ -78,8 +78,8 @@ "repositoryURL": "https://github.com/jpsim/Yams", "state": { "branch": null, - "revision": "01835dc202670b5bb90d07f3eae41867e9ed29f6", - "version": "5.0.1" + "revision": "f47ba4838c30dbd59998a4e4c87ab620ff959e8a", + "version": "5.0.5" } } ] diff --git a/Package.swift b/Package.swift index bd9217a64..c3bab1134 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ var dependencies: [Package.Dependency] = [ .package(url: "https://github.com/tadija/AEXML", from: "4.0.0"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"), .package(url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.0.0"), - .package(url: "https://github.com/peripheryapp/swift-syntax", .exact("1.0.0")) + .package(url: "https://github.com/peripheryapp/swift-syntax", .exact("1.0.1")) ] #if os(macOS) diff --git a/Sources/PeripheryKit/Syntax/DeclarationSyntaxVisitor.swift b/Sources/PeripheryKit/Syntax/DeclarationSyntaxVisitor.swift index bb602963d..fff3f0bb1 100644 --- a/Sources/PeripheryKit/Syntax/DeclarationSyntaxVisitor.swift +++ b/Sources/PeripheryKit/Syntax/DeclarationSyntaxVisitor.swift @@ -290,14 +290,14 @@ final class DeclarationSyntaxVisitor: PeripherySyntaxVisitor { guard node.initializer == nil, let identifier = node.pattern.as(IdentifierPatternSyntax.self)?.identifier, let parentStmt = node.parent?.parent?.parent, - (parentStmt.is(IfStmtSyntax.self) || parentStmt.is(GuardStmtSyntax.self)) + (parentStmt.is(IfExprSyntax.self) || parentStmt.is(GuardStmtSyntax.self)) else { return } letShorthandIdentifiers.insert(identifier.text) } func visit(_ node: FunctionCallExprSyntax) { if let identifierExpr = node.calledExpression.as(IdentifierExprSyntax.self), - identifierExpr.identifier.rawTokenKind == .capitalSelfKeyword { + identifierExpr.identifier.tokenKind == .keyword(.Self) { didVisitCapitalSelfFunctionCall = true } } @@ -317,10 +317,10 @@ final class DeclarationSyntaxVisitor: PeripherySyntaxVisitor { consumeCapitalSelfFunctionCalls: Bool = false, at position: AbsolutePosition ) { - let modifierNames = modifiers?.withoutTrivia().map { $0.name.text } ?? [] + let modifierNames = modifiers?.map { $0.name.text } ?? [] let accessibility = modifierNames.mapFirst { Accessibility(rawValue: $0) } - let attributeNames = attributes?.withoutTrivia().compactMap { - AttributeSyntax($0)?.attributeName.text ?? CustomAttributeSyntax($0)?.attributeName.firstToken?.text + let attributeNames = attributes?.compactMap { + AttributeSyntax($0)?.attributeName.trimmedDescription ?? AttributeSyntax($0)?.attributeName.firstToken?.text } ?? [] let location = sourceLocationBuilder.location(at: position) var letShorthandIdentifiers = Set() diff --git a/Sources/PeripheryKit/Syntax/ImportSyntaxVisitor.swift b/Sources/PeripheryKit/Syntax/ImportSyntaxVisitor.swift index 50baf834f..cad0323a3 100644 --- a/Sources/PeripheryKit/Syntax/ImportSyntaxVisitor.swift +++ b/Sources/PeripheryKit/Syntax/ImportSyntaxVisitor.swift @@ -10,7 +10,7 @@ final class ImportSyntaxVisitor: PeripherySyntaxVisitor { func visit(_ node: ImportDeclSyntax) { let parts = node.path.map { $0.name.text } - let attributes = node.attributes?.compactMap { $0.as(AttributeSyntax.self)?.attributeName.text } ?? [] + let attributes = node.attributes?.compactMap { $0.as(AttributeSyntax.self)?.attributeName.trimmedDescription } ?? [] importStatements.append((parts, attributes.contains("testable"))) } } diff --git a/Sources/PeripheryKit/Syntax/TypeSyntaxInspector.swift b/Sources/PeripheryKit/Syntax/TypeSyntaxInspector.swift index b8bd11bbf..e68d23bec 100644 --- a/Sources/PeripheryKit/Syntax/TypeSyntaxInspector.swift +++ b/Sources/PeripheryKit/Syntax/TypeSyntaxInspector.swift @@ -28,7 +28,7 @@ struct TypeSyntaxInspector { } else if let funcType = typeSyntax.as(FunctionTypeSyntax.self) { // Function type. let locations = funcType.arguments.flatMap { typeLocations(for: $0.type) } - return typeLocations(for: funcType.returnType).union(locations) + return typeLocations(for: funcType.output.returnType).union(locations) } else if let arrayType = typeSyntax.as(ArrayTypeSyntax.self) { // Array type. return typeLocations(for: arrayType.elementType) diff --git a/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift b/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift index 8ad177389..f1f19530b 100644 --- a/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift +++ b/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift @@ -206,7 +206,7 @@ struct UnusedParameterParser { if optBindingCondition.initializer == nil, let pattern = optBindingCondition.pattern.as(IdentifierPatternSyntax.self), let parentStmt = optBindingCondition.parent?.parent?.parent, - (parentStmt.is(IfStmtSyntax.self) || parentStmt.is(GuardStmtSyntax.self)) { + (parentStmt.is(IfExprSyntax.self) || parentStmt.is(GuardStmtSyntax.self)) { // Handle `let x {}` syntax. parsed = parse(identifier: pattern.identifier) } else { @@ -335,7 +335,7 @@ struct UnusedParameterParser { let items = parse(node: body, collector)?.items ?? [] let fullName = buildFullName(for: name, with: params) let genericParamNames = genericParams?.genericParameterList.compactMap { $0.name.text } ?? [] - let attributeNames = attributes?.children(viewMode: .sourceAccurate).compactMap { AttributeSyntax($0)?.attributeName.text } ?? [] + let attributeNames = attributes?.children(viewMode: .sourceAccurate).compactMap { AttributeSyntax($0)?.attributeName.trimmedDescription } ?? [] let function = Function( name: name,