Skip to content
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
17 changes: 13 additions & 4 deletions CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "platformVersion",
deprecatedName: "availabilityVersionRestriction",
kind: .node(kind: .platformVersion)
kind: .node(kind: .platformVersion),
documentation: "The platform/version pair, e.g. `iOS 10.1`"
),
Child(
name: "trailingComma",
Expand Down Expand Up @@ -292,15 +293,19 @@ public let ATTRIBUTE_NODES: [Node] = [
children: [
Child(
name: "witnessMethodLabel",
kind: .token(choices: [.keyword(.witness_method)])
kind: .token(choices: [.keyword(.witness_method)]),
documentation: #"The `witnessMethod` label."#
),
Child(
name: "colon",
kind: .token(choices: [.token(.colon)])
kind: .token(choices: [.token(.colon)]),
documentation: #"The colon separating the `witnessMethod` label and the original protocol name."#

),
Child(
name: "protocolName",
kind: .token(choices: [.token(.identifier)])
kind: .token(choices: [.token(.identifier)]),
documentation: "The original protocol name."
),
]
),
Expand Down Expand Up @@ -454,6 +459,7 @@ public let ATTRIBUTE_NODES: [Node] = [
name: "kindSpecifier",
deprecatedName: "diffKind",
kind: .token(choices: [.keyword(._forward), .keyword(.reverse), .keyword(._linear)]),
documentation: "The differentiability kind, if it exists.",
isOptional: true
),
Child(
Expand All @@ -467,6 +473,7 @@ public let ATTRIBUTE_NODES: [Node] = [
name: "arguments",
deprecatedName: "diffParams",
kind: .node(kind: .differentiabilityWithRespectToArgument),
documentation: "The differentiability arguments, if any exists.",
isOptional: true
),
Child(
Expand Down Expand Up @@ -675,11 +682,13 @@ public let ATTRIBUTE_NODES: [Node] = [
name: "name",
kind: .node(kind: .token),
nameForDiagnostics: "name",
documentation: "The identifier name for a nullary selection, if it exists.",
isOptional: true
),
Child(
name: "colon",
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating the label and the value or a colon representing an unlabeled argument",
isOptional: true
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4524,6 +4524,9 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S

/// - Parameters:
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
/// - witnessMethodLabel: The `witnessMethod` label.
/// - colon: The colon separating the `witnessMethod` label and the original protocol name.
/// - protocolName: The original protocol name.
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
public init(
leadingTrivia: Trivia? = nil,
Expand Down Expand Up @@ -4578,6 +4581,8 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S
}
}

/// The `witnessMethod` label.
///
/// ### Tokens
///
/// For syntax trees generated by the parser, this is guaranteed to be `witness_method`.
Expand All @@ -4599,6 +4604,8 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S
}
}

/// The colon separating the `witnessMethod` label and the original protocol name.
///
/// ### Tokens
///
/// For syntax trees generated by the parser, this is guaranteed to be `:`.
Expand All @@ -4620,6 +4627,8 @@ public struct ConventionWitnessMethodAttributeArgumentsSyntax: SyntaxProtocol, S
}
}

/// The original protocol name.
///
/// ### Tokens
///
/// For syntax trees generated by the parser, this is guaranteed to be `<identifier>`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2817,7 +2817,9 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash

/// - Parameters:
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
/// - kindSpecifier: The differentiability kind, if it exists.
/// - kindSpecifierComma: The comma following the differentiability kind, if it exists.
/// - arguments: The differentiability arguments, if any exists.
/// - argumentsComma: The comma following the differentiability arguments clause, if it exists.
/// - genericWhereClause: A `where` clause that places additional constraints on generic parameters like `where T: Differentiable`.
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
Expand Down Expand Up @@ -2886,6 +2888,8 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash
}
}

/// The differentiability kind, if it exists.
///
/// ### Tokens
///
/// For syntax trees generated by the parser, this is guaranteed to be one of the following kinds:
Expand Down Expand Up @@ -2933,6 +2937,7 @@ public struct DifferentiableAttributeArgumentsSyntax: SyntaxProtocol, SyntaxHash
}
}

/// The differentiability arguments, if any exists.
public var arguments: DifferentiabilityWithRespectToArgumentSyntax? {
get {
return Syntax(self).child(at: 5)?.cast(DifferentiabilityWithRespectToArgumentSyntax.self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable, _LeafSynt

/// - Parameters:
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
/// - name: The identifier name for a nullary selection, if it exists.
/// - colon: The colon separating the label and the value or a colon representing an unlabeled argument
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
public init(
leadingTrivia: Trivia? = nil,
Expand Down Expand Up @@ -84,6 +86,7 @@ public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable, _LeafSynt
}
}

/// The identifier name for a nullary selection, if it exists.
public var name: TokenSyntax? {
get {
return Syntax(self).child(at: 1)?.cast(TokenSyntax.self)
Expand All @@ -102,6 +105,8 @@ public struct ObjCSelectorPieceSyntax: SyntaxProtocol, SyntaxHashable, _LeafSynt
}
}

/// The colon separating the label and the value or a colon representing an unlabeled argument
///
/// ### Tokens
///
/// For syntax trees generated by the parser, this is guaranteed to be `:`.
Expand Down Expand Up @@ -2101,6 +2106,7 @@ public struct PlatformVersionItemSyntax: SyntaxProtocol, SyntaxHashable, _LeafSy

/// - Parameters:
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
/// - platformVersion: The platform/version pair, e.g. `iOS 10.1`
/// - trailingComma: A trailing comma if the argument is followed by another argument
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
public init(
Expand Down Expand Up @@ -2150,6 +2156,7 @@ public struct PlatformVersionItemSyntax: SyntaxProtocol, SyntaxHashable, _LeafSy
}
}

/// The platform/version pair, e.g. `iOS 10.1`
public var platformVersion: PlatformVersionSyntax {
get {
return Syntax(self).child(at: 1)!.cast(PlatformVersionSyntax.self)
Expand Down