Files
monkey/vm/frame.go
Chuck Smith 0b1ed43ae5
Some checks failed
Build / build (push) Successful in 2m1s
Test / build (push) Failing after 11m48s
Demo changes
2024-03-18 20:00:14 -04:00

28 lines
457 B
Go

package vm
import (
"monkey/code"
"monkey/object"
)
type Frame struct {
cl *object.Closure
ip int
basePointer int
}
func NewFrame(cl *object.Closure, basePointer int) *Frame {
return &Frame{
cl: cl,
ip: -1,
basePointer: basePointer}
}
func (f *Frame) Instructions() code.Instructions {
return f.cl.Fn.Instructions
}
func (f *Frame) NextOp() code.Opcode {
return code.Opcode(f.Instructions()[f.ip+1])
}