class SyntaxTree::YARV::Once


~~~
END { puts “END” }
~~~ruby
### Usage
of running the instruction sequence onto the stack.
uses a cache to ensure that it is only executed once. It pushes the result
that is it only ever executed once for the lifetime of the program. It
`once` is an instruction that wraps an instruction sequence and ensures
### Summary

def ==(other)

def ==(other)
  other.is_a?(Once) && other.iseq == iseq && other.cache == cache
end

def call(vm)

def call(vm)
  return if @executed
  vm.push(vm.run_block_frame(iseq, vm.frame))
  @executed = true
end

def deconstruct_keys(_keys)

def deconstruct_keys(_keys)
  { iseq: iseq, cache: cache }
end

def disasm(fmt)

def disasm(fmt)
  fmt.enqueue(iseq)
  fmt.instruction("once", [iseq.name, fmt.inline_storage(cache)])
end

def initialize(iseq, cache)

def initialize(iseq, cache)
  @iseq = iseq
  @cache = cache
end

def length

def length
  3
end

def pushes

def pushes
  1
end

def to_a(_iseq)

def to_a(_iseq)
  [:once, iseq.to_a, cache]
end