ClosureCaptureListSyntax
SyntaxCollections.swift:274struct ClosureCaptureListSyntaxstruct ClosureCaptureListSyntaximport SwiftSyntaxA library for working with Swift code.
struct ClosureCaptureSyntaxstruct ClosureCaptureClauseSyntaxvar items: ClosureCaptureListSyntax { get set }struct SyntaxChildrenCollection that contains the present child Syntax nodes of the given node.
struct SyntaxChildrenIndexAn index in a syntax children collection.
struct AccessorDeclListSyntaxstruct ArrayElementListSyntaxstruct ArrayElementSyntaxAn element inside an array literal.
struct AttributeListSyntaxA list of attributes that can be attached to a declaration.
struct AttributeSyntaxAn @ attribute.
struct AvailabilityArgumentListSyntaxstruct AvailabilityArgumentSyntaxA single argument to an @available argument like *, iOS 10.1, or message: "This has been deprecated".
struct CatchClauseListSyntaxstruct CatchClauseSyntaxstruct CatchItemListSyntaxstruct CatchItemSyntaxstruct ClosureParameterListSyntaxstruct ClosureParameterSyntaxstruct ClosureShorthandParameterListSyntaxA list of closure parameters that are not parenthesized and don’t have type annotations.
struct ClosureShorthandParameterSyntaxstruct CodeBlockItemListSyntaxstruct CodeBlockItemSyntaxA CodeBlockItem is any Syntax node that appears on its own line inside a CodeBlock.
struct CompositionTypeElementListSyntaxstruct CompositionTypeElementSyntaxstruct ConditionElementListSyntaxstruct ConditionElementSyntaxstruct DeclModifierListSyntaxstruct DeclModifierSyntaxstruct DeclNameArgumentListSyntaxstruct DeclNameArgumentSyntaxstruct DesignatedTypeListSyntaxstruct DesignatedTypeSyntaxstruct DictionaryElementListSyntaxstruct DictionaryElementSyntaxAn element inside a dictionary literal.
struct DifferentiabilityArgumentListSyntaxstruct DifferentiabilityArgumentSyntaxA differentiability argument: either the “self” identifier, a function parameter name, or a function parameter index.
struct DocumentationAttributeArgumentListSyntaxThe arguments of the ‘@_documentation’ attribute
struct DocumentationAttributeArgumentSyntaxstruct EffectsAttributeArgumentListSyntaxThe arguments of the ‘@_effects’ attribute. These will be parsed during the SIL stage.
struct EnumCaseElementListSyntaxA collection of 0 or more EnumCaseElementSyntaxs.
struct EnumCaseElementSyntaxAn element of an enum case, containing the name of the case and, optionally, either associated values or an assignment to a raw value.
struct EnumCaseParameterListSyntaxstruct EnumCaseParameterSyntaxstruct ExprListSyntaxA list of expressions connected by operators. This list is contained by a SequenceExprSyntax.
struct FunctionParameterListSyntaxA list of function parameters that are type annotated and a label. The function parameters are represented by FunctionParameterListSyntax.
struct FunctionParameterSyntaxA function parameter
struct GenericArgumentListSyntaxstruct GenericArgumentSyntaxstruct GenericParameterListSyntaxstruct GenericParameterSyntaxstruct GenericRequirementListSyntaxstruct GenericRequirementSyntaxstruct IfConfigClauseListSyntaxstruct IfConfigClauseSyntaxstruct ImportPathComponentListSyntaxstruct ImportPathComponentSyntaxstruct InheritedTypeListSyntaxstruct InheritedTypeSyntaxstruct KeyPathComponentListSyntaxThe components of a key path
struct KeyPathComponentSyntaxA single key path component
struct LabeledExprListSyntaxstruct LabeledExprSyntaxAn expression that is prefixed by a label.
struct MemberBlockItemListSyntaxstruct MemberBlockItemSyntaxA member declaration of a type consisting of a declaration and an optional semicolon;
struct MultipleTrailingClosureElementListSyntaxstruct MultipleTrailingClosureElementSyntaxstruct ObjCSelectorPieceListSyntaxstruct ObjCSelectorPieceSyntaxA piece of an Objective-C selector. Either consisting of just an identifier for a nullary selector, an identifier and a colon for a labeled argument or just a colon for an unlabeled argument
struct PatternBindingListSyntaxstruct PatternBindingSyntaxDefines variables inside a variable declaration.
struct PlatformVersionItemListSyntaxstruct PlatformVersionItemSyntaxA single platform/version pair in an attribute, e.g. iOS 10.1.
struct PrecedenceGroupAttributeListSyntaxstruct PrecedenceGroupRelationSyntaxSpecify the new precedence group’s relation to existing precedence groups.
struct PrecedenceGroupAssignmentSyntaxSpecifies the precedence of an operator when used in an operation that includes optional chaining.
struct PrecedenceGroupAssociativitySyntaxSpecifies how a sequence of operators with the same precedence level are grouped together in the absence of grouping parentheses.
struct PrecedenceGroupNameListSyntaxstruct PrecedenceGroupNameSyntaxstruct PrimaryAssociatedTypeListSyntaxstruct PrimaryAssociatedTypeSyntaxstruct SimpleStringLiteralSegmentListSyntaxString literal segments that only can contain non string interpolated or extended escaped strings
struct StringSegmentSyntaxA literal segment inside a string segment.
struct SpecializeAttributeArgumentListSyntaxA collection of arguments for the @_specialize attribute
struct LabeledSpecializeArgumentSyntaxA labeled argument for the @_specialize attribute like exported: true
struct SpecializeAvailabilityArgumentSyntaxThe availability argument for the _specialize attribute
struct SpecializeTargetFunctionArgumentSyntaxA labeled argument for the @_specialize attribute with a function decl value like target: myFunc(_:)
struct GenericWhereClauseSyntaxA where clause that places additional constraints on generic parameters like where Element: Hashable.
struct StringLiteralSegmentListSyntaxstruct ExpressionSegmentSyntaxAn interpolated expression inside a string literal.
struct SwitchCaseItemListSyntaxstruct SwitchCaseItemSyntaxstruct SwitchCaseListSyntaxstruct SwitchCaseSyntaxstruct TuplePatternElementListSyntaxA list of TuplePatternElementSyntax.
struct TuplePatternElementSyntaxAn element that represents a single tuple value in TuplePatternElementListSyntax.
struct TupleTypeElementListSyntaxstruct TupleTypeElementSyntaxstruct TypeSpecifierListSyntaxstruct SimpleTypeSpecifierSyntaxA specifier that can be attached to a type to eg. mark a parameter as inout or consuming
struct UnexpectedNodesSyntaxA collection of syntax nodes that occurred in the source code but could not be used to form a valid syntax tree.
struct VersionComponentListSyntaxstruct VersionComponentSyntaxAn element to represent a single component in a version, like .1.
struct YieldedExpressionListSyntaxstruct YieldedExpressionSyntaxprotocol BidirectionalCollection<Element> : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollectionA collection that supports backward as well as forward traversal.
protocol Collection<Element> : SequenceA sequence whose elements can be traversed multiple times, nondestructively, and accessed by an indexed subscript.
protocol CustomDebugStringConvertibleA type with a customized textual representation suitable for debugging purposes.
protocol CustomReflectableA type that explicitly supplies its own mirror.
protocol CustomStringConvertibleA type with a customized textual representation.
protocol EquatableA type that can be compared for value equality.
protocol ExpressibleByArrayLiteralA type that can be initialized using an array literal.
protocol Hashable : EquatableA type that can be hashed into a Hasher to produce an integer hash value.
protocol SendableA thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.
protocol Sequence<Element>A type that provides sequential, iterated access to its elements.
protocol SyntaxCollection : BidirectionalCollection, ExpressibleByArrayLiteral, SyntaxProtocol where Self.Element : SyntaxProtocol, Self.Index == SyntaxChildrenIndexprotocol SyntaxHashable : HashableProtocol that provides a common Hashable implementation for all syntax nodes
protocol SyntaxProtocol : CustomDebugStringConvertible, CustomReflectable, CustomStringConvertible, Sendable, TextOutputStreamableProvide common functionality for specialized syntax nodes. Extend this protocol to provide common functionality for all syntax nodes.
protocol TextOutputStreamableA source of text-streaming operations.
init?(_ node: some SyntaxProtocol) static let syntaxKind: SyntaxKindlet _syntaxNode: Syntaxtypealias Element = ClosureCaptureSyntaxinit<Children>(_ children: Children) where Children : Sequence, Self.Element == Children.Element init?<S>(_ node: S?) where S : SyntaxProtocol Initializes a new instance of the conforming type from a given specialized syntax node.
init(arrayLiteral elements: Self.Element...) static var structure: SyntaxNodeStructure { get }var count: Int { get }The number of elements, present or missing, in this collection.
var customMirror: Mirror { get }var debugDescription: String { get }A simple description of this node (ie. its type).
var description: String { get }A source-accurate description of this node.
var detached: Self { get }Return this subtree with this node as the root, ie. detach this node from its parent.
var endIndex: SyntaxChildrenIndex { get }var endPosition: AbsolutePosition { get }The end position of this node, including its trivia.
var endPositionBeforeTrailingTrivia: AbsolutePosition { get }The end position of this node’s content, before any trailing trivia.
var first: Self.Element? { get }The first element of the collection.
var hasError: Bool { get }Whether the tree contained by this layout has any
var hasMaximumNestingLevelOverflow: Bool { get }var hasParent: Bool { get }Whether or not this node has a parent.
var hasSequenceExpr: Bool { get }Whether this tree contains a missing token or unexpected node.
var hasWarning: Bool { get }Whether the tree contained by this layout has any tokens with a TokenDiagnostic of severity warning.
var id: SyntaxIdentifier { get }Returns a value representing the unique identity of the node.
var indices: DefaultIndices<Self> { get }The indices that are valid for subscripting the collection, in ascending order.
var isEmpty: Bool { get }A Boolean value indicating whether the collection is empty.
var keyPathInParent: AnyKeyPath? { get }var kind: SyntaxKind { get }The kind of the syntax node, e.g. if it is a functionDecl.
var last: Self.Element? { get }The last element of the collection.
var lazy: LazySequence<Self> { get }A sequence containing the same elements as this sequence, but on which some operations, such as map and filter, are implemented lazily.
var leadingTrivia: Trivia { get set }The leading trivia of this syntax node.
var leadingTriviaLength: SourceLength { get }The length this node’s leading trivia takes up spelled out in source.
var parent: Syntax? { get }The parent of this syntax node, or nil if this node is the root.
var position: AbsolutePosition { get }The absolute position of the starting point of this node. If the first token is with leading trivia, the position points to the start of the leading trivia.
var positionAfterSkippingLeadingTrivia: AbsolutePosition { get }The absolute position of the starting point of this node, skipping any leading trivia attached to the first token syntax.
var range: Range<AbsolutePosition> { get }The range of this node including leading and trailing trivia.
var raw: RawSyntax { get }var root: Syntax { get }The root of the tree in which this node resides.
var startIndex: SyntaxChildrenIndex { get }var syntaxNodeType: any SyntaxProtocol.Type { get }The dynamic metatype of the concrete node.
var syntaxTextBytes: [UInt8] { get }Retrieve the syntax text as an array of bytes that models the input source even in the presence of invalid UTF-8.
var totalLength: SourceLength { get }The length of this node including all of its trivia.
var trailingTrivia: Trivia { get set }The trailing trivia of this syntax node.
var trailingTriviaLength: SourceLength { get }The length this node’s trailing trivia takes up spelled out in source.
var trimmed: Self { get }A copy of this node without the leading trivia of the first token in the node and the trailing trivia of the last token in the node.
var trimmedDescription: String { get }The description of this node with leading whitespace of the first token and trailing whitespace of the last token removed.
var trimmedLength: SourceLength { get }The length this node takes up spelled out in the source, excluding its leading or trailing trivia.
var trimmedRange: Range<AbsolutePosition> { get }The range of this node excluding leading and trailing trivia.
var underestimatedCount: Int { get }A value less than or equal to the number of elements in the collection.
subscript(position: SyntaxChildrenIndex) -> Self.Element { get set } static func != (lhs: Self, rhs: Self) -> Bool Returns a Boolean value indicating whether two values are not equal.
static func + (lhs: some Sequence<Self.Element>, rhs: Self) -> Self Creates a new collection by concatenating the elements of a sequence and a collection.
static func + (lhs: some RangeReplaceableCollection<Self.Element>, rhs: Self) -> Self Creates a new collection by concatenating the elements of a sequence and a collection.
static func + (lhs: Self, rhs: some Sequence<Self.Element>) -> Self Creates a new collection by concatenating the elements of a collection and a sequence.
static func + (lhs: Self, rhs: some RangeReplaceableCollection<Self.Element>) -> Self Creates a new collection by concatenating the elements of a collection and a sequence.
static func += (lhs: inout Self, rhs: some Sequence<Self.Element>) Appends the elements of a sequence to a range-replaceable collection.
static func == (lhs: Self, rhs: Self) -> Bool func allSatisfy(_ predicate: (Self.Element) throws -> Bool) rethrows -> Bool Returns a Boolean value indicating whether every element of a sequence satisfies a given predicate.
func ancestorOrSelf<T>(mapping map: (Syntax) -> T?) -> T? Returns this node or the first ancestor that satisfies condition.
mutating func append(_ newElement: Self.Element) Adds an element to the end of the collection.
mutating func append(contentsOf newElements: some Sequence<Self.Element>) Adds the elements of a sequence to the end of this collection.
func `as`<S>(_ syntaxType: S.Type) -> S? where S : SyntaxProtocol Attempts to cast the current syntax node to a given specialized syntax type.
func asProtocol(_: (any MissingNodeSyntax).Type) -> (any MissingNodeSyntax)? Return the non-type erased version of this syntax node if it conforms to MissingNodeSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any ParenthesizedSyntax).Type) -> (any ParenthesizedSyntax)? Return the non-type erased version of this syntax node if it conforms to ParenthesizedSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithCodeBlockSyntax).Type) -> (any WithCodeBlockSyntax)? Return the non-type erased version of this syntax node if it conforms to WithCodeBlockSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithModifiersSyntax).Type) -> (any WithModifiersSyntax)? Return the non-type erased version of this syntax node if it conforms to WithModifiersSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithAttributesSyntax).Type) -> (any WithAttributesSyntax)? Return the non-type erased version of this syntax node if it conforms to WithAttributesSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithStatementsSyntax).Type) -> (any WithStatementsSyntax)? Return the non-type erased version of this syntax node if it conforms to WithStatementsSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any EffectSpecifiersSyntax).Type) -> (any EffectSpecifiersSyntax)? Return the non-type erased version of this syntax node if it conforms to EffectSpecifiersSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithTrailingCommaSyntax).Type) -> (any WithTrailingCommaSyntax)? Return the non-type erased version of this syntax node if it conforms to WithTrailingCommaSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithGenericParametersSyntax).Type) -> (any WithGenericParametersSyntax)? Return the non-type erased version of this syntax node if it conforms to WithGenericParametersSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any WithOptionalCodeBlockSyntax).Type) -> (any WithOptionalCodeBlockSyntax)? Return the non-type erased version of this syntax node if it conforms to WithOptionalCodeBlockSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any FreestandingMacroExpansionSyntax).Type) -> (any FreestandingMacroExpansionSyntax)? Return the non-type erased version of this syntax node if it conforms to FreestandingMacroExpansionSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any BracedSyntax).Type) -> (any BracedSyntax)? Return the non-type erased version of this syntax node if it conforms to BracedSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any DeclGroupSyntax).Type) -> (any DeclGroupSyntax)? Return the non-type erased version of this syntax node if it conforms to DeclGroupSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func asProtocol(_: (any NamedDeclSyntax).Type) -> (any NamedDeclSyntax)? Return the non-type erased version of this syntax node if it conforms to NamedDeclSyntax. Otherwise return nil. Note that this will incur an existential conversion.
func cast<S>(_ syntaxType: S.Type) -> S where S : SyntaxProtocol Force-casts the current syntax node to a given specialized syntax type.
func children(viewMode: SyntaxTreeViewMode) -> SyntaxChildren A sequence over the children of this node.
func compactMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] Returns an array containing the non-nil results of calling the given transformation with each element of this sequence.
func contains(_ element: Self.Element) -> Bool Returns a Boolean value indicating whether the sequence contains the given element.
func contains(where predicate: (Self.Element) throws -> Bool) rethrows -> Bool Returns a Boolean value indicating whether the sequence contains an element that satisfies the given predicate.
func count<E>(where predicate: (Self.Element) throws(E) -> Bool) throws(E) -> Int where E : Error Returns the number of elements in the sequence that satisfy the given predicate.
func debugDescription(includeTrivia: Bool = false, converter: SourceLocationConverter? = nil, mark: (any SyntaxProtocol)? = nil, indentString: String = "") -> String Returns a summarized dump of this node.
func difference<C>(from other: C) -> CollectionDifference<Self.Element> where C : BidirectionalCollection, Self.Element == C.Element Returns the difference needed to produce this collection’s ordered elements from the given collection.
func difference<C>(from other: C, by areEquivalent: (C.Element, Self.Element) -> Bool) -> CollectionDifference<Self.Element> where C : BidirectionalCollection, Self.Element == C.Element Returns the difference needed to produce this collection’s ordered elements from the given collection, using the given predicate as an equivalence test.
func distance(from start: SyntaxChildrenIndex, to end: SyntaxChildrenIndex) -> Int func drop(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence Returns a subsequence by skipping elements while predicate returns true and returning the remaining elements.
func dropFirst(_ k: Int = 1) -> Self.SubSequence Returns a subsequence containing all but the given number of initial elements.
func dropLast(_ k: Int) -> Self.SubSequence Returns a subsequence containing all but the specified number of final elements.
func elementsEqual<OtherSequence>(_ other: OtherSequence) -> Bool where OtherSequence : Sequence, Self.Element == OtherSequence.Element Returns a Boolean value indicating whether this sequence and another sequence contain the same elements in the same order.
func elementsEqual<OtherSequence>(_ other: OtherSequence, by areEquivalent: (Self.Element, OtherSequence.Element) throws -> Bool) rethrows -> Bool where OtherSequence : Sequence Returns a Boolean value indicating whether this sequence and another sequence contain equivalent elements in the same order, using the given predicate as the equivalence test.
func endLocation(converter: SourceLocationConverter, afterTrailingTrivia: Bool = false) -> SourceLocation The ending location, in the provided file, of this Syntax node.
func enumerated() -> EnumeratedSequence<Self> Returns a sequence of pairs (n, x), where n represents a consecutive integer starting at zero and x represents an element of the sequence.
func filter(_ isIncluded: (Self.Element) throws -> Bool) rethrows -> Self Returns a new SyntaxCollection that just contains the elements satisfying the given predicate.
func first(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Element? Returns the first element of the sequence that satisfies the given predicate.
func firstIndex(of element: Self.Element) -> Self.Index? Returns the first index where the specified value appears in the collection.
func firstIndex(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Index? Returns the first index in which an element of the collection satisfies the given predicate.
func firstRange<C>(of other: C) -> Range<Self.Index>? where C : Collection, Self.Element == C.Element Finds and returns the range of the first occurrence of a given collection within this collection.
func firstToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax? Returns the first token node that is part of this syntax node.
func flatMap<SegmentOfResult>(_ transform: (Self.Element) throws -> SegmentOfResult) rethrows -> [SegmentOfResult.Element] where SegmentOfResult : Sequence Returns an array containing the concatenated results of calling the given transformation with each element of this sequence.
func forEach(_ body: (Self.Element) throws -> Void) rethrows Calls the given closure on each element in the sequence in the same order as a for-in loop.
func formIndex(_ i: inout Self.Index, offsetBy distance: Int) Offsets the given index by the specified distance.
func formIndex(_ i: inout Self.Index, offsetBy distance: Int, limitedBy limit: Self.Index) -> Bool Offsets the given index by the specified distance, or so that it equals the given limiting index.
func formIndex(after i: inout Self.Index) Replaces the given index with its successor.
func formIndex(before i: inout Self.Index) func hash(into hasher: inout Hasher) func index(_ i: Self.Index, offsetBy distance: Int) -> Self.Index func index(_ i: Self.Index, offsetBy distance: Int, limitedBy limit: Self.Index) -> Self.Index? func index(after index: SyntaxChildrenIndex) -> SyntaxChildrenIndex func index(at offset: Int) -> SyntaxChildrenIndex Returns the index of the n-th element in this collection.
func index(before index: SyntaxChildrenIndex) -> SyntaxChildrenIndex func index(of node: Self.Element) -> SyntaxChildrenIndex? Return the index of node within this collection.
func indices(of element: Self.Element) -> RangeSet<Self.Index> Returns the indices of all the elements that are equal to the given element.
func indices(where predicate: (Self.Element) throws -> Bool) rethrows -> RangeSet<Self.Index> Returns the indices of all the elements that match the given predicate.
mutating func insert(_ newElement: Self.Element, at i: Self.Index) Inserts a new element into the collection at the specified position.
mutating func insert(contentsOf newElements: some Collection<Self.Element>, at i: Self.Index) Inserts the elements of a sequence into the collection at the specified position.
func `is`<S>(_ syntaxType: S.Type) -> Bool where S : SyntaxProtocol Checks if the current syntax node can be cast to a given specialized syntax type.
func isProtocol(_: (any MissingNodeSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to MissingNodeSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any ParenthesizedSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to ParenthesizedSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithCodeBlockSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithCodeBlockSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithModifiersSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithModifiersSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithAttributesSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithAttributesSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithStatementsSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithStatementsSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any EffectSpecifiersSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to EffectSpecifiersSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithTrailingCommaSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithTrailingCommaSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithGenericParametersSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithGenericParametersSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any WithOptionalCodeBlockSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to WithOptionalCodeBlockSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any FreestandingMacroExpansionSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to FreestandingMacroExpansionSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any BracedSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to BracedSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any DeclGroupSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to DeclGroupSyntax. Note that this will incur an existential conversion.
func isProtocol(_: (any NamedDeclSyntax).Type) -> Bool Check whether the non-type erased version of this syntax node conforms to NamedDeclSyntax. Note that this will incur an existential conversion.
func last(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Element? Returns the last element of the sequence that satisfies the given predicate.
func lastIndex(of element: Self.Element) -> Self.Index? Returns the last index where the specified value appears in the collection.
func lastIndex(where predicate: (Self.Element) throws -> Bool) rethrows -> Self.Index? Returns the index of the last element in the collection that matches the given predicate.
func lastToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax? Returns the last token node that is part of this syntax node.
func lexicographicallyPrecedes<OtherSequence>(_ other: OtherSequence, by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> Bool where OtherSequence : Sequence, Self.Element == OtherSequence.Element Returns a Boolean value indicating whether the sequence precedes another sequence in a lexicographical (dictionary) ordering, using the given predicate to compare elements.
func makeIterator() -> SyntaxCollectionIterator<Self.Element> func map<T, E>(_ transform: (Self.Element) throws(E) -> T) throws(E) -> [T] where E : Error Returns an array containing the results of mapping the given closure over the sequence’s elements.
func map<T, E>(_ transform: (Self.Element) throws(E) -> T) throws(E) -> [T] where E : Error Returns an array containing the results of mapping the given closure over the sequence’s elements.
@warn_unqualified_access func max(by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> Self.Element? Returns the maximum element in the sequence, using the given predicate as the comparison between elements.
@warn_unqualified_access func min(by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> Self.Element? Returns the minimum element in the sequence, using the given predicate as the comparison between elements.
func nextToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax? Recursively walks through the tree to find the next token semantically after this node.
func node(at syntaxIdentifier: SyntaxIdentifier) -> Syntax? If the node with the given syntaxIdentifier is a (recursive) child of this node, return the node with that identifier.
func prefix(_ maxLength: Int) -> Self.SubSequence Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.
func prefix(through position: Self.Index) -> Self.SubSequence Returns a subsequence from the start of the collection through the specified position.
func prefix(upTo end: Self.Index) -> Self.SubSequence Returns a subsequence from the start of the collection up to, but not including, the specified position.
func prefix(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence Returns a subsequence containing the initial elements until predicate returns false and skipping the remaining elements.
func previousToken(viewMode: SyntaxTreeViewMode) -> TokenSyntax? Recursively walks through the tree to find the token semantically before this node.
func randomElement() -> Self.Element? Returns a random element of the collection.
func randomElement<T>(using generator: inout T) -> Self.Element? where T : RandomNumberGenerator Returns a random element of the collection, using the given generator as a source for randomness.
func ranges<C>(of other: C) -> [Range<Self.Index>] where C : Collection, Self.Element == C.Element Finds and returns the ranges of the all occurrences of a given sequence within the collection.
func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, Self.Element) throws -> Result) rethrows -> Result Returns the result of combining the elements of the sequence using the given closure.
func reduce<Result>(into initialResult: Result, _ updateAccumulatingResult: (inout Result, Self.Element) throws -> ()) rethrows -> Result Returns the result of combining the elements of the sequence using the given closure.
@discardableResult mutating func remove(at position: Self.Index) -> Self.Element Removes and returns the element at the specified position.
mutating func removeSubrange(_ bounds: Range<Self.Index>) Removes the elements in the specified subrange from the collection.
func removingSubranges(_ subranges: RangeSet<Self.Index>) -> DiscontiguousSlice<Self> Returns a collection of the elements in this collection that are not represented by the given range set.
mutating func replaceSubrange(_ subrange: Range<Self.Index>, with newElements: some Collection<Self.Element>) Replace the nodes in subrange by newElements.
func reversed() -> ReversedCollection<Self> Returns a view presenting the elements of the collection in reverse order.
func shuffled() -> [Self.Element] Returns the elements of the sequence, shuffled.
func shuffled<T>(using generator: inout T) -> [Self.Element] where T : RandomNumberGenerator Returns the elements of the sequence, shuffled using the given generator as a source for randomness.
func sorted(by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool) rethrows -> [Self.Element] Returns the elements of the sequence, sorted using the given predicate as the comparison between elements.
func sourceRange(converter: SourceLocationConverter, afterLeadingTrivia: Bool = true, afterTrailingTrivia: Bool = false) -> SourceRange The source range, in the provided file, of this Syntax node.
func split(maxSplits: Int = Int.max, omittingEmptySubsequences: Bool = true, whereSeparator isSeparator: (Self.Element) throws -> Bool) rethrows -> [Self.SubSequence] Returns the longest possible subsequences of the collection, in order, that don’t contain elements satisfying the given predicate.
func split(separator: Self.Element, maxSplits: Int = Int.max, omittingEmptySubsequences: Bool = true) -> [Self.SubSequence] Returns the longest possible subsequences of the collection, in order, around elements equal to the given element.
func startLocation(converter: SourceLocationConverter, afterLeadingTrivia: Bool = true) -> SourceLocation The starting location, in the provided file, of this Syntax node.
func starts<PossiblePrefix>(with possiblePrefix: PossiblePrefix) -> Bool where PossiblePrefix : Sequence, Self.Element == PossiblePrefix.Element Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in another sequence.
func starts<PossiblePrefix>(with possiblePrefix: PossiblePrefix, by areEquivalent: (Self.Element, PossiblePrefix.Element) throws -> Bool) rethrows -> Bool where PossiblePrefix : Sequence Returns a Boolean value indicating whether the initial elements of the sequence are equivalent to the elements in another sequence, using the given predicate as the equivalence test.
func suffix(_ maxLength: Int) -> Self.SubSequence Returns a subsequence, up to the given maximum length, containing the final elements of the collection.
func suffix(from start: Self.Index) -> Self.SubSequence Returns a subsequence from the specified position to the end of the collection.
func token(at position: AbsolutePosition) -> TokenSyntax? Find the syntax token at the given absolute position within this syntax node or any of its children.
func tokens(viewMode: SyntaxTreeViewMode) -> TokenSequence Sequence of tokens that are part of this Syntax node.
func trimmed(matching filter: (TriviaPiece) -> Bool) -> Self A copy of this node with pieces that match matching trimmed from the leading trivia of the first token and trailing trivia of the last token.
func trimmedDescription(matching filter: (TriviaPiece) -> Bool) -> String The description of this node with pieces that match matching removed from the leading trivia of the first token and trailing trivia of the last token.
func trimmingPrefix<Prefix>(_ prefix: Prefix) -> Self.SubSequence where Prefix : Sequence, Self.Element == Prefix.Element Returns a new collection of the same type by removing prefix from the start of the collection.
func trimmingPrefix(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence func with<T>(_ keyPath: WritableKeyPath<Self, T>, _ value: T) -> Self Returns a new syntax node that has the child at keyPath replaced by value.
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeBufferPointer<Self.Element>) throws -> R) rethrows -> R? func write<Target>(to stream: inout Target) where Target : TextOutputStream Prints the raw value of this node to the provided stream.
init(_ collection: Self) Initialize the collection from a collection of the same type.
var byteRange: ByteSourceRange { get }var byteSize: Int { get }The textual byte length of this node including leading and trailing trivia.
var byteSizeAfterTrimmingTrivia: Int { get }The textual byte length of this node excluding leading and trailing trivia.
var contentLength: SourceLength { get }var firstToken: TokenSyntax? { get }var index: SyntaxChildrenIndex { get }The index of this node in a SyntaxChildren collection.
var isImplicit: Bool { get }When isImplicit is true, the syntax node doesn’t include any underlying tokens, e.g. an empty CodeBlockItemList.
var lastToken: TokenSyntax? { get }var nextToken: TokenSyntax? { get }var previousToken: TokenSyntax? { get }var totalByteRange: ByteSourceRange { get }The byte source range of this node including leading and trailing trivia.
var trimmedByteRange: ByteSourceRange { get }The byte source range of this node excluding leading and trailing trivia.
func appending(_ syntax: Self.Element) -> Self Creates a new collection by appending the provided syntax element to the children.
func `as`(_ syntaxType: Syntax.Type) -> Syntax? Attempts to upcast the current syntax node to Syntax node.
func `as`(_ syntaxType: Self.Type) -> Self? Casts the current syntax node to its own type.
func cast(_ syntaxType: Syntax.Type) -> Syntax Force-cast the current syntax node to Syntax node..
func cast(_ syntaxType: Self.Type) -> Self Force-casts the current syntax node to its own type.
func detach() -> Self func flatMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] func inserting(_ syntax: Self.Element, at index: Int) -> Self Creates a new collection by inserting the provided syntax element at the provided index in the children.
func `is`(_ syntaxType: Syntax.Type) -> Bool Checks if the current syntax node can be upcast to Syntax node.
func `is`(_ syntaxType: Self.Type) -> Bool Checks if the current syntax node can be cast to its own type.
func prepending(_ syntax: Self.Element) -> Self Creates a new collection by prepending the provided syntax element to the children.
func removing(childAt index: Int) -> Self Creates a new collection by removing the syntax element at the provided index.
func removingFirst() -> Self Creates a new collection by removing the first element.
func removingLast() -> Self Creates a new collection by removing the last element.
func replacing(childAt index: Int, with syntax: Self.Element) -> Self Creates a new collection by replacing the syntax element at the provided index.
import SwiftSyntaxBuilderSwiftSyntaxBuilder is a tool for generating Swift code in a convenient way using result builders.
init(@ClosureCaptureListBuilder itemsBuilder: () throws -> ClosureCaptureListSyntax) rethrows