Files
tablizer/vendor/github.com/glycerine/zygomys/zygo/address.go
2024-05-14 12:10:58 +02:00

22 lines
420 B
Go

package zygo
type Address struct {
function *SexpFunction
position int
}
func (a Address) IsStackElem() {}
func (stack *Stack) PushAddr(function *SexpFunction, pc int) {
stack.Push(Address{function, pc})
}
func (stack *Stack) PopAddr() (*SexpFunction, int, error) {
elem, err := stack.Pop()
if err != nil {
return MissingFunction, 0, err
}
addr := elem.(Address)
return addr.function, addr.position, nil
}