Class: Rubinius::AST::While

Inherits:
Node
  • Object
show all
Defined in:
lib/compiler/ast/control_flow.rb

Direct Known Subclasses

Until

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

#initialize(line, condition, body, check_first) ⇒ While

Returns a new instance of While.



154
155
156
157
158
159
# File 'lib/compiler/ast/control_flow.rb', line 154

def initialize(line, condition, body, check_first)
  @line = line
  @condition = condition
  @body = body || NilLiteral.new(line)
  @check_first = check_first
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



152
153
154
# File 'lib/compiler/ast/control_flow.rb', line 152

def body
  @body
end

#check_firstObject

Returns the value of attribute check_first.



152
153
154
# File 'lib/compiler/ast/control_flow.rb', line 152

def check_first
  @check_first
end

#conditionObject

Returns the value of attribute condition.



152
153
154
# File 'lib/compiler/ast/control_flow.rb', line 152

def condition
  @condition
end

Instance Method Details

#sexp_nameObject



161
162
163
# File 'lib/compiler/ast/control_flow.rb', line 161

def sexp_name
  :while
end

#to_sexpObject



165
166
167
# File 'lib/compiler/ast/control_flow.rb', line 165

def to_sexp
  [sexp_name, @condition.to_sexp, @body.to_sexp, @check_first]
end