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

Function

Mattt edited this page Aug 2, 2020 · 8 revisions

Function

A function declaration.

public struct Function:​ Declaration, Hashable, Codable

Inheritance

Codable, CustomStringConvertible, Declaration, ExpressibleBySyntax, Hashable

Initializers

init(_:​)

Creates an instance initialized with the given syntax node.

public init(_ node:​ FunctionDeclSyntax)

Properties

attributes

The declaration attributes.

let attributes:[Attribute]

modifiers

The declaration modifiers.

let modifiers:[Modifier]

keyword

The declaration keyword ("func").

let keyword:​ String

identifier

The function identifier.

let identifier:​ String

signature

The function signature.

let signature:​ Signature

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) {}

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 {}

isOperator

Whether the function is an operator.

var isOperator:​ Bool

description

var description:​ String
Clone this wiki locally