class Cosmo::Function

Defined in:

cosmo/runtime/types/function.cr

Constructors

Instance Method Summary

Instance methods inherited from class Cosmo::Callable

arity : Range(UInt32, UInt32) arity, call(args : Array(ValueType)) : ValueType call, expand_args(args : Array(ValueType)) : Array(ValueType) expand_args, intrinsic? : Bool intrinsic?, to_s : String to_s

Constructor Detail

def self.new(interpreter : Cosmo::Interpreter, closure : Cosmo::Scope, definition : Cosmo::AST::Node, class_instance : Nil | Cosmo::ClassInstance = nil) #

[View source]

Instance Method Detail

def arity : Range(UInt32, UInt32) #
Description copied from class Cosmo::Callable

The amount of parameters this function will accept


[View source]
def call(args : Array(ValueType), return_type_override : String = return_typedef.lexeme, class_instance_override : ClassInstance | Nil = @class_instance) : ValueType #
Description copied from class Cosmo::Callable

Executes the function body, passing in args


[View source]

[View source]
def intrinsic? : Bool #
Description copied from class Cosmo::Callable

Whether or not this function is intrinsic


[View source]
def return_typedef #

[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]