Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit e8d6a99

Browse files
compnerdmattt
andauthored
SwiftSemantics: update keyword (#12)
* SwiftSemantics: update keyword Update for changes to upstream to build against the top of tree. This is needed to build swift-doc on Windows. * Conditionalize classOrActorKeyword for Swift >= 5.5 * Add version-specific manifests for Swift 5.4 and 5.5 * Add changelog entry for #12 Co-authored-by: Mattt <[email protected]>
1 parent 5113d16 commit e8d6a99

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added support for Swift 5.4 and 5.5.
13+
#12 by @compnerd and @mattt.
14+
1015
## [0.2.0] - 2020-11-11
1116

1217
### Added

[email protected]

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "SwiftSemantics",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "SwiftSemantics",
12+
targets: ["SwiftSemantics"]
13+
),
14+
],
15+
dependencies: [
16+
// Dependencies declare other packages that this package depends on.
17+
.package(name: "SwiftSyntax",
18+
url: "https://github.com/apple/swift-syntax.git",
19+
.revision("release/5.4")),
20+
],
21+
targets: [
22+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
23+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
24+
.target(
25+
name: "SwiftSemantics",
26+
dependencies: ["SwiftSyntax"]
27+
),
28+
.testTarget(
29+
name: "SwiftSemanticsTests",
30+
dependencies: ["SwiftSemantics"]
31+
),
32+
]
33+
)

[email protected]

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "SwiftSemantics",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "SwiftSemantics",
12+
targets: ["SwiftSemantics"]
13+
),
14+
],
15+
dependencies: [
16+
// Dependencies declare other packages that this package depends on.
17+
.package(name: "SwiftSyntax",
18+
url: "https://github.com/apple/swift-syntax.git",
19+
.revision("release/5.5")),
20+
],
21+
targets: [
22+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
23+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
24+
.target(
25+
name: "SwiftSemantics",
26+
dependencies: ["SwiftSyntax"]
27+
),
28+
.testTarget(
29+
name: "SwiftSemanticsTests",
30+
dependencies: ["SwiftSemantics"]
31+
),
32+
]
33+
)

Sources/SwiftSemantics/Declarations/Class.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ extension Class: ExpressibleBySyntax {
7171
public init(_ node: ClassDeclSyntax) {
7272
attributes = node.attributes?.compactMap{ $0.as(AttributeSyntax.self) }.map { Attribute($0) } ?? []
7373
modifiers = node.modifiers?.map { Modifier($0) } ?? []
74+
75+
#if swift(>=5.5)
76+
keyword = node.classOrActorKeyword.text.trimmed
77+
#else
7478
keyword = node.classKeyword.text.trimmed
79+
#endif
80+
7581
name = node.identifier.text.trimmed
7682
inheritance = node.inheritanceClause?.inheritedTypeCollection.map { $0.typeName.description.trimmed } ?? []
7783
genericParameters = node.genericParameterClause?.genericParameterList.map { GenericParameter($0) } ?? []

0 commit comments

Comments
 (0)