Function

data class Function(val title: String, val parameters: MutableList<Property>, var statements: Block?, val returnTypeName: String) : Type, IsParent

Used to define the function type

Example:

int Max(int a, int b)
{
if (a >= b)
return a;
else
return b;
}

Constructors

Link copied to clipboard
constructor(title: String, parameters: MutableList<Property>, statements: Block?, returnTypeName: String)

Properties

Link copied to clipboard

represents a list of the function's parameters

Link copied to clipboard
open override var parent: IsParent?
Link copied to clipboard

is the name of the Type of value returned by the function

Link copied to clipboard
open override val scope: SymbolTable?

is the scope to which the node belongs

Link copied to clipboard

is the block of statements within the function

Link copied to clipboard
open override val title: String

represents the name of the function

Functions

Link copied to clipboard
open override fun replaceChild(initial: AstObject, replacement: AstObject)

Is replacing a certain child of the class with another object of the same type If the two parameters don't have the same type, no block will be replaced. If the type of initial doesn't match any of the current node children, no child will be replaced

Link copied to clipboard
open override fun setParentForChildren()

Sets the object as a parent for its children