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.crConstructors
Instance Method Summary
-
#body : Drizzle::AST::BlockStatement
The block making up the body of the function
- #literal : String
-
#name : Drizzle::AST::Identifier
The Identifier node representing the name of the function
-
#params : Array(Drizzle::AST::TypedIdentifier)
An array of TypedIdentifiers representing parameters to the function
-
#ret_type : Drizzle::AST::Identifier?
The return type of the function
- #to_s : String
-
#token : Drizzle::Token
The token that led to the creation of the node
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)
#
Instance Method Detail
def params : Array(Drizzle::AST::TypedIdentifier)
#
An array of TypedIdentifiers representing parameters to the function