class Drizzle::AST::Function

Overview

Node representing a function definition. Functions are first-class in Drizzle, meaning that function names can be used as normal expressions.

The difference between what Drizzle does and what Monkey does is that in Monkey, the function literals themselves are expressions, whereas in Drizzle they are statements.

Defined in:

drizzle/ast/function.cr

Constructors

Instance Method Summary

Instance methods inherited from class Drizzle::AST::Node

literal : String literal, to_s : String to_s

Constructor Detail

def self.new(token : Token, name : Identifier, params : Array(TypedIdentifier), ret_type : Identifier?, body : BlockStatement) #

[View source]

Instance Method Detail

The block making up the body of the function


[View source]
def literal : String #

[View source]

The Identifier node representing the name of the function


[View source]
def params : Array(Drizzle::AST::TypedIdentifier) #

An array of TypedIdentifiers representing parameters to the function


[View source]
def ret_type : Drizzle::AST::Identifier? #

The return type of the function


[View source]
def to_s : String #

[View source]
def token : Drizzle::Token #

The token that led to the creation of the node


[View source]