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

#==(other) ⇒ Object



4994
4995
4996
# File 'lib/syntax_tree/yarv/instructions.rb', line 4994

def ==(other)
  other.is_a?(PutSelf)
end

#call(vm) ⇒ Object



5014
5015
5016
# File 'lib/syntax_tree/yarv/instructions.rb', line 5014

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

#canonicalObject



5010
5011
5012
# File 'lib/syntax_tree/yarv/instructions.rb', line 5010

def canonical
  self
end

#deconstruct_keys(_keys) ⇒ Object



4990
4991
4992
# File 'lib/syntax_tree/yarv/instructions.rb', line 4990

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



4982
4983
4984
# File 'lib/syntax_tree/yarv/instructions.rb', line 4982

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

#lengthObject



4998
4999
5000
# File 'lib/syntax_tree/yarv/instructions.rb', line 4998

def length
  1
end

#popsObject



5002
5003
5004
# File 'lib/syntax_tree/yarv/instructions.rb', line 5002

def pops
  0
end

#pushesObject



5006
5007
5008
# File 'lib/syntax_tree/yarv/instructions.rb', line 5006

def pushes
  1
end

#to_a(_iseq) ⇒ Object



4986
4987
4988
# File 'lib/syntax_tree/yarv/instructions.rb', line 4986

def to_a(_iseq)
  [:putself]
end