Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Function

mattt edited this page Mar 28, 2020 · 8 revisions

Function

A function declaration.

public struct Function: Declaration, Hashable, Codable

Inheritance

Codable, Hashable, Declaration

Nested Types

Function.Signature

Initializers

init(_:)

Creates an instance initialized with the given syntax node.

public init(_ node: FunctionSignatureSyntax)

init(_:)

Creates an instance initialized with the given syntax node.

public init(_ node: FunctionDeclSyntax)

init(_:)

Creates an instance initialized with the given syntax node.

public init(_ node: FunctionParameterSyntax)

Properties

genericParameters

The generic parameters for the declaration.

let genericParameters: [GenericParameter]

For example, the following declaration of function f has a single generic parameter whose identifier is "T" and type is "Equatable":

func f<T: Equatable>(value: T) {}

isOperator

Whether the function is an operator.

var isOperator: Bool

keyword

The declaration keyword ("func").

let keyword: String

description

var description: String

description

var description: String

description

var description: String

attributes

The declaration attributes.

let attributes: [Attribute]

identifier

The function identifier.

let identifier: String

genericRequirements

The generic parameter requirements for the declaration.

let genericRequirements: [GenericRequirement]

For example, the following declaration of function f has a single requirement that its generic parameter identified as "T" conforms to the type identified as "Hahable":

func f<T>(value: T) where T: Hashable {}

modifiers

The declaration modifiers.

let modifiers: [Modifier]

signature

The function signature.

let signature: Signature
Clone this wiki locally