Everything is a closure
This commit is contained in:
11
vm/frame.go
11
vm/frame.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user