class SyntaxTree::YARV::VM::Stack

This represents the global VM stack. It effectively is an array, but wraps mutating functions with instrumentation.

Attributes

events[R]
values[R]

Public Class Methods

new(events) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 167
def initialize(events)
  @events = events
  @values = []
end

Public Instance Methods

[](...) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 196
def [](...)
  values.[](...)
end
[]=(...) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 200
def []=(...)
  values.[]=(...).tap { events.publish_stack_change(self) }
end
concat(...) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 172
def concat(...)
  values.concat(...).tap { events.publish_stack_change(self) }
end
last() click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 176
def last
  values.last
end
length() click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 180
def length
  values.length
end
pop(...) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 188
def pop(...)
  values.pop(...).tap { events.publish_stack_change(self) }
end
push(...) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 184
def push(...)
  values.push(...).tap { events.publish_stack_change(self) }
end
slice!(...) click to toggle source
# File lib/syntax_tree/yarv/vm.rb, line 192
def slice!(...)
  values.slice!(...).tap { events.publish_stack_change(self) }
end