FunctionDeclarationNode

class FunctionDeclarationNode(name: FunctionNameNode, pcLabel: LabelNode?, parameters: Arguments<ParameterNode>, body: BlockNode, sourceLocation: SourceLocation) : TopLevelDeclarationNode

A function declaration associating a name with code.

Parameters

name

A name identifying the function.

pcLabel

Value of the program control label at the beginning of body.

parameters

A list of formal parameters.

body

Code to run when the function is called.

Constructors

FunctionDeclarationNode
Link copied to clipboard
fun FunctionDeclarationNode(name: FunctionNameNode, pcLabel: LabelNode?, parameters: Arguments<ParameterNode>, body: BlockNode, sourceLocation: SourceLocation)

Functions

copy
Link copied to clipboard
open override fun copy(children: List<Node>): Node

Returns a shallow copy of this node where the child nodes are replaced by children.

getParameter
Link copied to clipboard
fun getParameter(name: ObjectVariable): ParameterNode?
getParameterAtIndex
Link copied to clipboard
fun getParameterAtIndex(i: Int): ParameterNode?
toDocument
Link copied to clipboard
override fun toDocument(): Document
toDocumentWithMetadata
Link copied to clipboard
fun toDocumentWithMetadata(metadata: Metadata): Document

Returns a pretty representation of this Node where each descendant is decorated using metadata.

toSurfaceNode
Link copied to clipboard
open override fun toSurfaceNode(metadata: Metadata): FunctionDeclarationNode

Returns a representation of this node in the surface syntax.

Properties

body
Link copied to clipboard
val body: BlockNode
children
Link copied to clipboard
open override val children: Iterable<Node>
name
Link copied to clipboard
val name: FunctionNameNode
parameters
Link copied to clipboard
val parameters: Arguments<ParameterNode>
pcLabel
Link copied to clipboard
val pcLabel: LabelNode?
sourceLocation
Link copied to clipboard
open override val sourceLocation: SourceLocation