Added missing register deallocation

This commit is contained in:
2025-01-26 14:31:38 +01:00
parent e62eaba6e6
commit fb40059113
3 changed files with 14 additions and 5 deletions

View File

@ -42,13 +42,17 @@ func (f *Function) CompileAssignArray(node *ast.Assign) error {
memory.Offset = byte(offset)
} else {
_, indexRegister, err := f.Evaluate(index)
_, indexRegister, isTemporary, err := f.Evaluate(index)
if err != nil {
return err
}
memory.OffsetRegister = indexRegister
if isTemporary {
defer f.FreeRegister(indexRegister)
}
}
_, err := f.ExpressionToMemory(right, memory)