Class: Rubinius::AST::Break

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

Direct Known Subclasses

Next, Redo, Retry

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, expr) ⇒ Break

Returns a new instance of Break.



220
221
222
223
# File 'lib/compiler/ast/control_flow.rb', line 220

def initialize(line, expr)
  @line = line
  @value = expr || NilLiteral.new(line)
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



218
219
220
# File 'lib/compiler/ast/control_flow.rb', line 218

def value
  @value
end

Instance Method Details

#jump_error(g, name) ⇒ Object



225
226
227
228
229
# File 'lib/compiler/ast/control_flow.rb', line 225

def jump_error(g, name)
  g.push_rubinius
  g.push_literal name
  g.send :jump_error, 1
end

#sexp_nameObject



231
232
233
# File 'lib/compiler/ast/control_flow.rb', line 231

def sexp_name
  :break
end

#to_sexpObject



235
236
237
238
239
# File 'lib/compiler/ast/control_flow.rb', line 235

def to_sexp
  sexp = [sexp_name]
  sexp << @value.to_sexp if @value
  sexp
end