Everything is a closure
Some checks failed
Build / build (push) Failing after 1m56s
Test / build (push) Failing after 2m33s

This commit is contained in:
Chuck Smith
2024-03-13 17:08:17 -04:00
parent e373e9f68a
commit 78b560e457
7 changed files with 132 additions and 81 deletions

View File

@@ -6,15 +6,18 @@ import (
)
type Frame struct {
fn *object.CompiledFunction
cl *object.Closure
ip int
basePointer int
}
func NewFrame(fn *object.CompiledFunction, basePointer int) *Frame {
return &Frame{fn: fn, ip: -1, basePointer: basePointer}
func NewFrame(cl *object.Closure, basePointer int) *Frame {
return &Frame{
cl: cl,
ip: -1,
basePointer: basePointer}
}
func (f *Frame) Instructions() code.Instructions {
return f.fn.Instructions
return f.cl.Fn.Instructions
}