FunctionDecl
public struct FunctionDecl : CapturingDecl, ExposableDecl, GenericDecl
A function declaration.
-
Declaration
Swift
public static let constructDescription: String -
Declaration
Swift
public static let isCallable: Bool -
Declaration
Swift
public let site: SourceRange -
The site of the
funintroducer.Declaration
Swift
public let introducerSite: SourceRange -
The attributes of the declaration.
Declaration
Swift
public let attributes: [SourceRepresentable<Attribute>] -
The access modifier of the declaration, if any.
Declaration
Swift
public let accessModifier: SourceRepresentable<AccessModifier> -
The member modifier of the declaration.
Declaration
Swift
public let memberModifier: SourceRepresentable<MemberModifier>? -
The access effect of the function’s receiver.
Declaration
Swift
public let receiverEffect: SourceRepresentable<AccessEffect>? -
The operator notation of the function.
Declaration
Swift
public let notation: SourceRepresentable<OperatorNotation>? -
The identifier of the function, if any.
Declaration
Swift
public let identifier: SourceRepresentable<Identifier>? -
The generic clause of the declaration, if any.
Declaration
Swift
public let genericClause: SourceRepresentable<GenericClause>? -
The explicit capture declarations of the function.
Declaration
Swift
public let explicitCaptures: [BindingDecl.ID] -
The parameters of the function.
All parameters must have a type annotation unless
isInExprContextistrue.Declaration
Swift
public let parameters: [ParameterDecl.ID] -
The declaration of the implicit receiver parameter, if any.
Declaration
Swift
public let receiver: ParameterDecl.ID? -
The return type annotation of the function, if any.
Declaration
Swift
public let output: AnyExprID? -
The body of the declaration, if any.
Declaration
Swift
public let body: FunctionBody? -
Indicates whether the declaration appears in an expression context.
Declaration
Swift
public let isInExprContext: Bool -
Properties about the API described by the function.
Declaration
Swift
public let api: APIFlags -
init(introducerSite:attributes: accessModifier: memberModifier: receiverEffect: notation: identifier: genericClause: explicitCaptures: parameters: receiver: output: body: isInExprContext: site: ) Creates an instance with the given properties.
Declaration
Swift
public init( introducerSite: SourceRange, attributes: [SourceRepresentable<Attribute>] = [], accessModifier: SourceRepresentable<AccessModifier>, memberModifier: SourceRepresentable<MemberModifier>? = nil, receiverEffect: SourceRepresentable<AccessEffect>? = nil, notation: SourceRepresentable<OperatorNotation>? = nil, identifier: SourceRepresentable<Identifier>? = nil, genericClause: SourceRepresentable<GenericClause>? = nil, explicitCaptures: [BindingDecl.ID] = [], parameters: [ParameterDecl.ID] = [], receiver: ParameterDecl.ID? = nil, output: AnyExprID? = nil, body: FunctionBody? = nil, isInExprContext: Bool = false, site: SourceRange ) -
trueiffselfis a definition of the entity that it declares.Declaration
Swift
public var isDefinition: Bool { get } -
trueiffselfdenotes a static member function.Declaration
Swift
public var isStatic: Bool { get } -
trueiffselfdenotes aninoutmember function.Declaration
Swift
public var isInout: Bool { get } -
trueiffselfdenotes asinkmember function.Declaration
Swift
public var isSink: Bool { get } -
trueiffselfdenotes a deinitializer.Declaration
Swift
public var isDeinit: Bool { get } -
trueiffselfis a foreign function interface.Declaration
Swift
public var isForeignInterface: Bool { get } -
selfiffselfdeclares a function whose implementation is defined externally.Declaration
Swift
public var isExternal: Bool { get } -
The part of the declaration that may have implicit captures.
Declaration
Swift
public var sourcesOfImplicitCaptures: [AnyNodeID] { get } -
Declaration
Swift
public func validateForm(in ast: AST, reportingDiagnosticsTo log: inout DiagnosticSet) -
A set of properties about the API described by a function declaration.
See moreDeclaration
Swift
public struct APIFlags : OptionSet, Codable, RawRepresentable, Sendable
View on GitHub