class Cosmo::Function
- Cosmo::Function
- Cosmo::Callable
- Reference
- Object
Defined in:
cosmo/runtime/types/function.crConstructors
Instance Method Summary
-
#arity : Range(UInt32, UInt32)
The amount of parameters this function will accept
-
#call(args : Array(ValueType), return_type_override : String = return_typedef.lexeme, class_instance_override : ClassInstance | Nil = @class_instance) : ValueType
Executes the function body, passing in
args
- #definition : Statement::FunctionDef | Expression::Lambda
-
#intrinsic? : Bool
Whether or not this function is intrinsic
- #return_typedef
-
#to_s : String
Returns a nicely readable and concise string representation of this object, typically intended for users.
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)
#
Instance Method Detail
def arity : Range(UInt32, UInt32)
#
Description copied from class Cosmo::Callable
The amount of parameters this function will accept
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
def intrinsic? : Bool
#
Description copied from class Cosmo::Callable
Whether or not this function is intrinsic
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
.