| 1234567891011121314151617181920212223242526272829 |
- // Author: simon
- // Author: ynwdlxm@163.com
- // Date: 2022/11/15 10:57
- // Desc:
- package vm
- import (
- "github/runnignwater/monkey/code"
- "github/runnignwater/monkey/object"
- )
- type Frame struct {
- fn *object.CompileFunction // points to the compiled function
- ip int // the instruction pointer in this frame
- basePointer int
- }
- func NewFrame(fn *object.CompileFunction, basePointer int) *Frame {
- return &Frame{
- fn: fn,
- ip: -1,
- basePointer: basePointer,
- }
- }
- func (f *Frame) Instructions() code.Instructions {
- return f.fn.Instructions
- }
|