Class: Rubinius::ToolSet.current::TS::AST::ReceiverCase
- Defined in:
- lib/rubinius/ast/control_flow.rb
Instance Attribute Summary collapse
-
#receiver ⇒ Object
Returns the value of attribute receiver.
Attributes inherited from Case
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, receiver, whens, else_body) ⇒ ReceiverCase
constructor
A new instance of ReceiverCase.
- #receiver_sexp ⇒ Object
Methods inherited from Case
Methods inherited from Node
#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #to_sexp, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, receiver, whens, else_body) ⇒ ReceiverCase
Returns a new instance of ReceiverCase.
51 52 53 54 55 56 |
# File 'lib/rubinius/ast/control_flow.rb', line 51 def initialize(line, receiver, whens, else_body) @line = line @receiver = receiver @whens = whens @else = else_body || NilLiteral.new(line) end |
Instance Attribute Details
#receiver ⇒ Object
Returns the value of attribute receiver.
49 50 51 |
# File 'lib/rubinius/ast/control_flow.rb', line 49 def receiver @receiver end |
Instance Method Details
#bytecode(g) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rubinius/ast/control_flow.rb', line 58 def bytecode(g) pos(g) done = g.new_label @receiver.bytecode(g) @whens.each do |w| w.receiver_bytecode(g, done) end g.pop @else.bytecode(g) # See command in if about why using line 0 g.set_line 0 done.set! end |
#receiver_sexp ⇒ Object
78 79 80 |
# File 'lib/rubinius/ast/control_flow.rb', line 78 def receiver_sexp @receiver.to_sexp end |