class

Syntax::If

Inherits Syntax::ASTNode < Reference < Object

An if expression.

'if' cond
  then
[
'else'
  else
]
'end'

An if elsif end is parsed as an If whose else is another If.

Constructors

new(cond : Syntax::ASTNode, a_then = nil, a_else = nil, ternary : Bool = false)
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

accept_children(visitor)
Source
clone_without_location
Source
cond
Source
cond=(cond : ASTNode)
Source
else
Source
else=(else : ASTNode)
Source
else_location

The location of the else keyword if present.

Source
else_location=(else_location : Location | Nil)

The location of the else keyword if present.

Source
hash(hasher)

See Object#hash(hasher)

ternary=(ternary : Bool)
Source
ternary?
Source
then
Source
then=(then : ASTNode)
Source