Class: SyntaxTree::YARV::OptSendWithoutBlock
Overview
### Summary
‘opt_send_without_block` is a specialization of the send instruction that occurs when a method is being called without a block. It pops the receiver and the arguments off the stack and pushes on the result.
### Usage
~~~ruby puts “Hello, world!” ~~~
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
Returns a new instance of OptSendWithoutBlock.
4227
4228
4229
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4227
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
4225
4226
4227
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4225
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
4243
4244
4245
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4243
def ==(other)
other.is_a?(OptSendWithoutBlock) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
4263
4264
4265
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4263
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
4259
4260
4261
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4259
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
4239
4240
4241
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4239
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
4231
4232
4233
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4231
def disasm(fmt)
fmt.instruction("opt_send_without_block", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
4247
4248
4249
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4247
def length
2
end
|
#pops ⇒ Object
4251
4252
4253
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4251
def pops
1 + calldata.argc
end
|
#pushes ⇒ Object
4255
4256
4257
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4255
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
4235
4236
4237
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4235
def to_a(_iseq)
[:opt_send_without_block, calldata.to_h]
end
|