Class: SyntaxTree::YARV::Intern
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::Intern
- 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
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
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 |
#canonical ⇒ Object
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 |
#length ⇒ Object
1932 1933 1934 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1932 def length 1 end |
#pops ⇒ Object
1936 1937 1938 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 1936 def pops 1 end |
#pushes ⇒ Object
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 |