2021-11-19 20:38:56 -10:00
|
|
|
package vm
|
|
|
|
|
|
|
|
|
|
type Function struct {
|
|
|
|
|
Instructions []*Instruction
|
|
|
|
|
}
|
2021-11-22 22:19:38 -08:00
|
|
|
|
|
|
|
|
func (fnc *Function) Copy() *Function {
|
|
|
|
|
ret := &Function{}
|
|
|
|
|
|
|
|
|
|
for _, instr := range fnc.Instructions {
|
|
|
|
|
ret.Instructions = append(ret.Instructions, instr.Copy())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret
|
|
|
|
|
}
|