Class: Rubinius::AST::Rescue

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

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, body, rescue_body, else_body) ⇒ Rescue

Returns a new instance of Rescue.



39
40
41
42
43
44
# File 'lib/compiler/ast/exceptions.rb', line 39

def initialize(line, body, rescue_body, else_body)
  @line = line
  @body = body
  @rescue = rescue_body
  @else = else_body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



37
38
39
# File 'lib/compiler/ast/exceptions.rb', line 37

def body
  @body
end

#elseObject

Returns the value of attribute else.



37
38
39
# File 'lib/compiler/ast/exceptions.rb', line 37

def else
  @else
end

#rescueObject

Returns the value of attribute rescue.



37
38
39
# File 'lib/compiler/ast/exceptions.rb', line 37

def rescue
  @rescue
end

Instance Method Details

#to_sexpObject



46
47
48
49
50
# File 'lib/compiler/ast/exceptions.rb', line 46

def to_sexp
  sexp = [:rescue, @body.to_sexp, @rescue.to_sexp]
  sexp << @else.to_sexp if @else
  sexp
end