class Drizzle::AST::IfStatement
Overview
Node representing an if statement.
if (
Defined in:
drizzle/ast/if_statement.crConstructors
Instance Method Summary
-
#alt_consequences : Array(Drizzle::AST::IfStatement)
An optional array of alternative conditions and consequences to run in case the first condition fails
-
#alternative : Drizzle::AST::BlockStatement?
An optional alternative block to be run if all prior conditions have failed
-
#condition : Drizzle::AST::Expression
The initial condition to be tested
-
#consequence : Drizzle::AST::BlockStatement
The set of statements to be run if the initial condition has proven to be true
- #literal : String
- #to_s : String
-
#token : Drizzle::Token
The token that led to the creation of the statement node
Instance methods inherited from class Drizzle::AST::Node
literal : String
literal,
to_s : String
to_s
Constructor Detail
def self.new(token : Token, condition : Expression, consequence : BlockStatement, alt_consequences : Array(IfStatement) = [] of IfStatement, alternative : BlockStatement? = nil)
#
Instance Method Detail
def alt_consequences : Array(Drizzle::AST::IfStatement)
#
An optional array of alternative conditions and consequences to run in case the first condition fails
def alternative : Drizzle::AST::BlockStatement?
#
An optional alternative block to be run if all prior conditions have failed
def consequence : Drizzle::AST::BlockStatement
#
The set of statements to be run if the initial condition has proven to be true