Class: SyntaxTree::YARV::PutSelf

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

Overview

### Summary

putself pushes the current value of self onto the stack.

### Usage

~~~ruby puts “Hello, world!” ~~~

Instance Method Summary collapse

Instance Method Details

#call(vm) ⇒ Object



4363
4364
4365
# File 'lib/syntax_tree/yarv/instructions.rb', line 4363

def call(vm)
  vm.push(vm.frame._self)
end

#canonicalObject



4359
4360
4361
# File 'lib/syntax_tree/yarv/instructions.rb', line 4359

def canonical
  self
end

#disasm(fmt) ⇒ Object



4339
4340
4341
# File 'lib/syntax_tree/yarv/instructions.rb', line 4339

def disasm(fmt)
  fmt.instruction("putself")
end

#lengthObject



4347
4348
4349
# File 'lib/syntax_tree/yarv/instructions.rb', line 4347

def length
  1
end

#popsObject



4351
4352
4353
# File 'lib/syntax_tree/yarv/instructions.rb', line 4351

def pops
  0
end

#pushesObject



4355
4356
4357
# File 'lib/syntax_tree/yarv/instructions.rb', line 4355

def pushes
  1
end

#to_a(_iseq) ⇒ Object



4343
4344
4345
# File 'lib/syntax_tree/yarv/instructions.rb', line 4343

def to_a(_iseq)
  [:putself]
end