Class: SyntaxTree::YARV::PutObject

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/yarv/instructions.rb

Overview

### Summary

putobject pushes a known value onto the stack.

### Usage

~~~ruby 5 ~~~

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ PutObject

Returns a new instance of PutObject.



4211
4212
4213
# File 'lib/syntax_tree/yarv/instructions.rb', line 4211

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



4209
4210
4211
# File 'lib/syntax_tree/yarv/instructions.rb', line 4209

def object
  @object
end

Instance Method Details

#call(vm) ⇒ Object



4239
4240
4241
# File 'lib/syntax_tree/yarv/instructions.rb', line 4239

def call(vm)
  vm.push(object)
end

#canonicalObject



4235
4236
4237
# File 'lib/syntax_tree/yarv/instructions.rb', line 4235

def canonical
  self
end

#disasm(fmt) ⇒ Object



4215
4216
4217
# File 'lib/syntax_tree/yarv/instructions.rb', line 4215

def disasm(fmt)
  fmt.instruction("putobject", [fmt.object(object)])
end

#lengthObject



4223
4224
4225
# File 'lib/syntax_tree/yarv/instructions.rb', line 4223

def length
  2
end

#popsObject



4227
4228
4229
# File 'lib/syntax_tree/yarv/instructions.rb', line 4227

def pops
  0
end

#pushesObject



4231
4232
4233
# File 'lib/syntax_tree/yarv/instructions.rb', line 4231

def pushes
  1
end

#to_a(_iseq) ⇒ Object



4219
4220
4221
# File 'lib/syntax_tree/yarv/instructions.rb', line 4219

def to_a(_iseq)
  [:putobject, object]
end