Class: SyntaxTree::YARV::Intern

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

Overview

### Summary

intern converts the top element of the stack to a symbol and pushes the symbol onto the stack.

### Usage

~~~ruby :“#”foo“” ~~~

Instance Method Summary collapse

Methods inherited from Instruction

#branch_targets, #canonical, #falls_through?, #leaves?, #length, #side_effects?

Instance Method Details

#==(other) ⇒ Object



1997
1998
1999
# File 'lib/syntax_tree/yarv/instructions.rb', line 1997

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

#call(vm) ⇒ Object



2009
2010
2011
# File 'lib/syntax_tree/yarv/instructions.rb', line 2009

def call(vm)
  vm.push(vm.pop.to_sym)
end

#deconstruct_keys(_keys) ⇒ Object



1993
1994
1995
# File 'lib/syntax_tree/yarv/instructions.rb', line 1993

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



1985
1986
1987
# File 'lib/syntax_tree/yarv/instructions.rb', line 1985

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

#popsObject



2001
2002
2003
# File 'lib/syntax_tree/yarv/instructions.rb', line 2001

def pops
  1
end

#pushesObject



2005
2006
2007
# File 'lib/syntax_tree/yarv/instructions.rb', line 2005

def pushes
  1
end

#to_a(_iseq) ⇒ Object



1989
1990
1991
# File 'lib/syntax_tree/yarv/instructions.rb', line 1989

def to_a(_iseq)
  [:intern]
end