Class: Atomy::Code::Send
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#proc_argument ⇒ Object
readonly
Returns the value of attribute proc_argument.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
Instance Method Summary collapse
- #bytecode(gen, mod) ⇒ Object
-
#initialize(receiver, message, arguments = [], splat_argument = nil, proc_argument = nil, block = nil) ⇒ Send
constructor
A new instance of Send.
- #push_proc_argument(gen, mod) ⇒ Object
Constructor Details
#initialize(receiver, message, arguments = [], splat_argument = nil, proc_argument = nil, block = nil) ⇒ Send
Returns a new instance of Send.
6 7 8 9 10 11 12 13 |
# File 'lib/atomy/code/send.rb', line 6 def initialize(receiver, , arguments = [], splat_argument = nil, proc_argument = nil, block = nil) @receiver = receiver @message = @arguments = arguments @splat_argument = splat_argument @proc_argument = proc_argument @block = block end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
4 5 6 |
# File 'lib/atomy/code/send.rb', line 4 def arguments @arguments end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/atomy/code/send.rb', line 4 def block @block end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/atomy/code/send.rb', line 4 def @message end |
#proc_argument ⇒ Object (readonly)
Returns the value of attribute proc_argument.
4 5 6 |
# File 'lib/atomy/code/send.rb', line 4 def proc_argument @proc_argument end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
4 5 6 |
# File 'lib/atomy/code/send.rb', line 4 def receiver @receiver end |
Instance Method Details
#bytecode(gen, mod) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/atomy/code/send.rb', line 15 def bytecode(gen, mod) flocal = gen.state.scope.search_local(:"#{@message}:function") if @receiver.nil? && flocal invoke_function(gen, mod, flocal) else invoke_method(gen, mod) end end |
#push_proc_argument(gen, mod) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/atomy/code/send.rb', line 97 def push_proc_argument(gen, mod) nil_proc_arg = gen.new_label mod.compile(gen, @proc_argument) gen.dup gen.goto_if_nil(nil_proc_arg) gen.push_cpath_top gen.find_const(:Proc) gen.swap gen.send(:__from_block__, 1) nil_proc_arg.set! end |