Skip to content

Commit

Permalink
Mark AST value type nodes as Sendable
Browse files Browse the repository at this point in the history
Why not.
  • Loading branch information
helje5 committed Apr 7, 2024
1 parent 26e2c0d commit 35ca3ff
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions Plugins/Libraries/LighterCodeGenAST/Nodes/Expression.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
* An AST node for various Swift expressions.
*/
public indirect enum Expression: Equatable {
public indirect enum Expression: Equatable, Sendable {

/// The operators for ``compare(lhs:operator:rhs:)`` expressions.
public enum Operator: String {
public enum Operator: String, Sendable {
case equal = "=="
case notEqual = "!="
case greaterThanOrEqual = ">="
Expand Down Expand Up @@ -82,12 +82,12 @@ public indirect enum Expression: Equatable {
*
* Used as the value for ``Expression/functionCall(_:)``.
*/
public struct FunctionCall: Equatable {
public struct FunctionCall: Equatable, Sendable {

/**
* A parameter passed as part of the function call.
*/
public struct Parameter: Equatable {
public struct Parameter: Equatable, Sendable {

/// The keyword/label of the parameter, can be `nil` if it is a wildcard
/// (unlabled) parameter.
Expand All @@ -105,7 +105,7 @@ public struct FunctionCall: Equatable {
/**
* A trailing closure attached to a function call.
*/
public struct TrailingClosure: Equatable {
public struct TrailingClosure: Equatable, Sendable {

/// The parameter list of the trailing closure (e.g. `( a, b ) in`).
public let parameters: [ String ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
* A comment for a function.
*
* Has all the function specific things, like parameters and such.
*/
public struct FunctionComment: Equatable {
public struct FunctionComment: Equatable, Sendable {

/// A comment for a function parameter.
public struct Parameter: Equatable {
public struct Parameter: Equatable, Sendable {

/// The name of the function parameter being documented.
public var name : String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
Expand All @@ -19,7 +19,7 @@
* where C1: SQLColumn, C2: SQLColumn, T == C1.T, T == C2.T
* ```
*/
public struct FunctionDeclaration: Equatable {
public struct FunctionDeclaration: Equatable, Sendable {

/// Is the function public?
public let `public` : Bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
Expand All @@ -9,7 +9,7 @@
*
* Plus extra annotations like ``inlinable`` and the ``comment``.
*/
public struct FunctionDefinition: Equatable {
public struct FunctionDefinition: Equatable, Sendable {

/// Whether the definition is `@inlinable` (included in the module header).
public var inlinable : Bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

public extension FunctionDeclaration {

/// A parameter, like `from table: KeyPath<Self.RecordTypes, T.Type>`
/// Or: `limit: Int? = nil`
struct Parameter: Equatable {
struct Parameter: Equatable, Sendable {

/// The "label" of the parameter, e.g. the `from` in `select(from table:)`.
/// Can be `nil` for a wildcard (`_`).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
* A generic constraint attached to a ``FunctionDeclaration`` generic parameter
* or an ``Extension``.
*/
public enum GenericConstraint: Equatable {
public enum GenericConstraint: Equatable, Sendable {

/// `C1: SQLColumn`
case conformance(name: String, type: TypeReference)
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Libraries/LighterCodeGenAST/Nodes/Literal.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
* A Swift literal
*
* E.g. as used in default values like: `limit: Int? = nil` (the `nil`).
*/
public enum Literal: Equatable {
public enum Literal: Equatable, Sendable {

/// `nil`
case `nil`
Expand Down
6 changes: 3 additions & 3 deletions Plugins/Libraries/LighterCodeGenAST/Nodes/Statement.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
* An AST node for a Swift statement.
*/
public enum Statement: Equatable {
public enum Statement: Equatable, Sendable {

/**
* A pair for an `if`, `else if` statement, consisting of a condition and the
* associated ``Statement``s.
*/
public struct ConditionStatementPair: Equatable {
public struct ConditionStatementPair: Equatable, Sendable {

/// The condition that must be true to have the ``statements`` executed.
public var condition : Expression
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Libraries/LighterCodeGenAST/Nodes/TypeReference.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//
// Created by Helge Heß.
// Copyright © 2022 ZeeZide GmbH.
// Copyright © 2022-2024 ZeeZide GmbH.
//

/**
* A reference to some type, e.g. `Void` or `Person` or `Int`.
*/
public indirect enum TypeReference: Equatable {
public indirect enum TypeReference: Equatable, Sendable {

/// `Void`
case void
Expand Down

0 comments on commit 35ca3ff

Please sign in to comment.