class Kaze::Function

Overview

A callable function. It may also be anonymous.

Defined in:

function.cr

Constructors

Instance Method Summary

Instance methods inherited from class Kaze::Callable

arity : Int32 arity, call(interpreter : Interpreter, arguments : Array(VG)) : VG call, to_s : String to_s

Constructor Detail

def self.new(declaration : Stmt::Function, closure : Environment, is_initializer : Bool) #

[View source]

Instance Method Detail

def arity : Int32 #

The number of arguments the function takes.


[View source]
def bind(instance : Instance) : Function #

Bind self to a class instance. Returns a function with self in its scope.


[View source]
def call(interpreter : Interpreter, arguments : Array(VG)) : VG #

Executes the function.


[View source]
def to_s : String #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]