bind expression (:=) instead of let
Some checks failed
Build / build (push) Successful in 10m26s
Test / build (push) Failing after 16m44s

This commit is contained in:
Chuck Smith
2024-03-21 17:43:03 -04:00
parent 66d5453ecc
commit 6282075e66
36 changed files with 425 additions and 583 deletions

View File

@@ -181,6 +181,11 @@ func (vm *VM) Run() error {
vm.globals[globalIndex] = ref
}
err := vm.push(Null)
if err != nil {
return err
}
case code.OpAssignGlobal:
globalIndex := code.ReadUint16(ins[ip+1:])
vm.currentFrame().ip += 2
@@ -284,7 +289,17 @@ func (vm *VM) Run() error {
frame := vm.currentFrame()
vm.stack[frame.basePointer+int(localIndex)] = vm.pop()
ref := vm.pop()
if immutable, ok := ref.(object.Immutable); ok {
vm.stack[frame.basePointer+int(localIndex)] = immutable.Clone()
} else {
vm.stack[frame.basePointer+int(localIndex)] = ref
}
err := vm.push(Null)
if err != nil {
return err
}
case code.OpGetLocal:
localIndex := code.ReadUint8(ins[ip+1:])