Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added support for Swift 5.4 and 5.5.
#12 by @compnerd and @mattt.

## [0.2.0] - 2020-11-11

### Added
Expand Down
33 changes: 33 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftSemantics",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SwiftSemantics",
targets: ["SwiftSemantics"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(name: "SwiftSyntax",
url: "https://github.com/apple/swift-syntax.git",
.revision("release/5.4")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SwiftSemantics",
dependencies: ["SwiftSyntax"]
),
.testTarget(
name: "SwiftSemanticsTests",
dependencies: ["SwiftSemantics"]
),
]
)
33 changes: 33 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftSemantics",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SwiftSemantics",
targets: ["SwiftSemantics"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(name: "SwiftSyntax",
url: "https://github.com/apple/swift-syntax.git",
.revision("release/5.5")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SwiftSemantics",
dependencies: ["SwiftSyntax"]
),
.testTarget(
name: "SwiftSemanticsTests",
dependencies: ["SwiftSemantics"]
),
]
)
6 changes: 6 additions & 0 deletions Sources/SwiftSemantics/Declarations/Class.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ extension Class: ExpressibleBySyntax {
public init(_ node: ClassDeclSyntax) {
attributes = node.attributes?.compactMap{ $0.as(AttributeSyntax.self) }.map { Attribute($0) } ?? []
modifiers = node.modifiers?.map { Modifier($0) } ?? []

#if swift(>=5.5)
keyword = node.classOrActorKeyword.text.trimmed
#else
keyword = node.classKeyword.text.trimmed
#endif

name = node.identifier.text.trimmed
inheritance = node.inheritanceClause?.inheritedTypeCollection.map { $0.typeName.description.trimmed } ?? []
genericParameters = node.genericParameterClause?.genericParameterList.map { GenericParameter($0) } ?? []
Expand Down