Class: Yadriggy::BeginEnd
- Includes:
- AstHelper
- Defined in:
- lib/yadriggy/ast.rb
Overview
begin-end.
Instance Attribute Summary collapse
-
#body ⇒ Exprs|ASTnode
readonly
The body.
-
#rescue ⇒ Rescue|nil
readonly
The rescue clause.
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ BeginEnd
constructor
A new instance of BeginEnd.
Methods included from AstHelper
#has_tag?, #to_node, #to_nodes
Methods inherited from ASTnode
#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value, #value_in_class
Constructor Details
#initialize(sexp) ⇒ BeginEnd
Returns a new instance of BeginEnd.
1559 1560 1561 1562 1563 1564 1565 |
# File 'lib/yadriggy/ast.rb', line 1559 def initialize(sexp) bodystmt = has_tag?(sexp[1], :bodystmt) @body = Exprs.make(bodystmt[1]) @rescue = Rescue.make(bodystmt[2], bodystmt[3], bodystmt[4]) add_child(@body) add_child(@rescue) end |
Instance Attribute Details
#body ⇒ Exprs|ASTnode (readonly)
Returns the body.
1553 1554 1555 |
# File 'lib/yadriggy/ast.rb', line 1553 def body @body end |
#rescue ⇒ Rescue|nil (readonly)
Returns the rescue clause.
1555 1556 1557 |
# File 'lib/yadriggy/ast.rb', line 1555 def rescue @rescue end |
Class Method Details
.tag ⇒ Object
1557 |
# File 'lib/yadriggy/ast.rb', line 1557 def self.tag() :begin end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
1570 1571 1572 |
# File 'lib/yadriggy/ast.rb', line 1570 def accept(evaluator) evaluator.begin_end(self) end |