ExprSyntaxProtocol
Protocol to which all ExprSyntax
nodes conform.
protocol ExprSyntaxProtocol : SyntaxProtocol
Browse conforming typesExtension point to add common methods to all ExprSyntax
nodes.
Protocol to which all ExprSyntax
nodes conform.
protocol ExprSyntaxProtocol : SyntaxProtocol
Extension point to add common methods to all ExprSyntax
nodes.
import SwiftSyntax
A library for working with Swift code.
struct ExprSyntax
protocol SyntaxProtocol : CustomDebugStringConvertible, CustomReflectable, CustomStringConvertible, Sendable, TextOutputStreamable
Provide common functionality for specialized syntax nodes. Extend this protocol to provide common functionality for all syntax nodes.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Sendable
A 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 TextOutputStreamable
A source of text-streaming operations.
struct MissingExprSyntax
In case the source code is missing an expression, this node stands in place of the missing expression.
struct ArrayExprSyntax
An array literal.
struct ArrowExprSyntax
The arrow when a type is used at a position that syntactically expectes an expression.
struct AsExprSyntax
The cast of an expressison to a different type.
struct AssignmentExprSyntax
struct AwaitExprSyntax
struct BinaryOperatorExprSyntax
An operator like +
or -
.
struct BooleanLiteralExprSyntax
struct BorrowExprSyntax
struct ClosureExprSyntax
struct ConsumeExprSyntax
struct CopyExprSyntax
struct DeclReferenceExprSyntax
struct DictionaryExprSyntax
A dictionary literal
struct DiscardAssignmentExprSyntax
A _
that discards a value inside an assignment.
struct EditorPlaceholderExprSyntax
struct FloatLiteralExprSyntax
struct ForceUnwrapExprSyntax
struct FunctionCallExprSyntax
struct GenericSpecializationExprSyntax
struct IfExprSyntax
struct InOutExprSyntax
An expression prefixed with &
to pass an argument to an inout
parameter.
struct InfixOperatorExprSyntax
An infix operator call like 1 + 2
.
struct IntegerLiteralExprSyntax
struct IsExprSyntax
Checks if an expression is of a given type.
struct KeyPathExprSyntax
A key path.
struct MacroExpansionExprSyntax
The expansion of a freestanding macro in a position that expects an expression.
struct MemberAccessExprSyntax
An expression that access a member like a function or a property.
struct NilLiteralExprSyntax
struct OptionalChainingExprSyntax
struct PackElementExprSyntax
A pack element expression spelled with each
.
struct PackExpansionExprSyntax
A pack expansion expression spelled with repeat
.
struct PatternExprSyntax
struct PostfixIfConfigExprSyntax
struct PostfixOperatorExprSyntax
struct PrefixOperatorExprSyntax
A prefix operator applied to a value.
struct RegexLiteralExprSyntax
struct SequenceExprSyntax
A flat list of expressions before operator folding using the SwiftOperators
library.
struct SimpleStringLiteralExprSyntax
A simple string that can’t contain string interpolation and cannot have raw string delimiters.
struct StringLiteralExprSyntax
A string literal.
struct SubscriptCallExprSyntax
struct SuperExprSyntax
struct SwitchExprSyntax
A switch
expression.
struct TernaryExprSyntax
The ternary operator with operator precedences resolved.
struct TryExprSyntax
An expression prefixed with try
.
struct TupleExprSyntax
struct TypeExprSyntax
struct UnresolvedAsExprSyntax
The as
keyword without any operands.
struct UnresolvedIsExprSyntax
The is
keyword without any operands.
struct UnresolvedTernaryExprSyntax
The middle section of a ternary operator between ?
and :
.
func `as`<S>(_ syntaxType: S.Type) -> S? where S : ExprSyntaxProtocol
Attempts to cast the current syntax node to a given specialized syntax type.
func cast<S>(_ syntaxType: S.Type) -> S where S : ExprSyntaxProtocol
Force-casts the current syntax node to a given specialized syntax type.
func `is`<S>(_ syntaxType: S.Type) -> Bool where S : ExprSyntaxProtocol
Checks if the current syntax node can be cast to a given specialized syntax type.
func `as`(_ syntaxType: ExprSyntax.Type) -> ExprSyntax?
Attempts to upcast the current syntax node to its base node type (ExprSyntax
).
func `as`<S>(_ syntaxType: S.Type) -> S? where S : SyntaxProtocol
Attempts to cast the current syntax node to a given node type from the a base node protocol hierarchy other than ExprSyntaxProtocol
.
func cast(_ syntaxType: ExprSyntax.Type) -> ExprSyntax
Force-upcast the current syntax node to its base node type (ExprSyntax
).
func cast<S>(_ syntaxType: S.Type) -> S where S : SyntaxProtocol
Force-casts the current syntax node to a given node type from a base node protocol hierarchy other than ExprSyntaxProtocol
.
func `is`(_ syntaxType: ExprSyntax.Type) -> Bool
Checks if the current syntax node can be upcast to its base node type (ExprSyntax
).
func `is`<S>(_ syntaxType: S.Type) -> Bool where S : SyntaxProtocol
Checks if the current syntax node can be cast to a given node type from a base node protocol hierarchy other than ExprSyntaxProtocol
.
protocol _LeafExprSyntaxNodeProtocol : ExprSyntaxProtocol
Protocol that syntax nodes conform to if they don’t have any semantic subtypes. These are syntax nodes that are not considered base nodes for other syntax types.