This repository was archived by the owner on Oct 17, 2021. It is now read-only.
File tree 4 files changed +77
-0
lines changed
Sources/SwiftSemantics/Declarations
4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [ Unreleased]
9
9
10
+ ### Added
11
+
12
+ - Added support for Swift 5.4 and 5.5.
13
+ #12 by @compnerd and @mattt .
14
+
10
15
## [ 0.2.0] - 2020-11-11
11
16
12
17
### Added
Original file line number Diff line number Diff line change
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
+ )
Original file line number Diff line number Diff line change
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
+ )
Original file line number Diff line number Diff line change @@ -71,7 +71,13 @@ extension Class: ExpressibleBySyntax {
71
71
public init ( _ node: ClassDeclSyntax ) {
72
72
attributes = node. attributes? . compactMap { $0. as ( AttributeSyntax . self) } . map { Attribute ( $0) } ?? [ ]
73
73
modifiers = node. modifiers? . map { Modifier ( $0) } ?? [ ]
74
+
75
+ #if swift(>=5.5)
76
+ keyword = node. classOrActorKeyword. text. trimmed
77
+ #else
74
78
keyword = node. classKeyword. text. trimmed
79
+ #endif
80
+
75
81
name = node. identifier. text. trimmed
76
82
inheritance = node. inheritanceClause? . inheritedTypeCollection. map { $0. typeName. description. trimmed } ?? [ ]
77
83
genericParameters = node. genericParameterClause? . genericParameterList. map { GenericParameter ( $0) } ?? [ ]
You can’t perform that action at this time.
0 commit comments