Class: SyntaxTree::YARV::Intern

Inherits:
Object
  • Object
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

Instance Method Details

#call(vm) ⇒ Object



1948
1949
1950
# File 'lib/syntax_tree/yarv/instructions.rb', line 1948

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

#canonicalObject



1944
1945
1946
# File 'lib/syntax_tree/yarv/instructions.rb', line 1944

def canonical
  self
end

#disasm(fmt) ⇒ Object



1924
1925
1926
# File 'lib/syntax_tree/yarv/instructions.rb', line 1924

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

#lengthObject



1932
1933
1934
# File 'lib/syntax_tree/yarv/instructions.rb', line 1932

def length
  1
end

#popsObject



1936
1937
1938
# File 'lib/syntax_tree/yarv/instructions.rb', line 1936

def pops
  1
end

#pushesObject



1940
1941
1942
# File 'lib/syntax_tree/yarv/instructions.rb', line 1940

def pushes
  1
end

#to_a(_iseq) ⇒ Object



1928
1929
1930
# File 'lib/syntax_tree/yarv/instructions.rb', line 1928

def to_a(_iseq)
  [:intern]
end