Improved server example

This commit is contained in:
2025-02-08 17:34:11 +01:00
parent 526385280a
commit d0d096bcd2
5 changed files with 37 additions and 10 deletions

View File

@ -2,6 +2,7 @@ package core
import (
"git.akyoto.dev/cli/q/src/asm"
"git.akyoto.dev/cli/q/src/errors"
"git.akyoto.dev/cli/q/src/expression"
"git.akyoto.dev/cli/q/src/types"
)
@ -11,6 +12,11 @@ func (f *Function) CompileDelete(root *expression.Expression) error {
parameters := root.Children[1:]
variableName := parameters[0].Token.Text(f.File.Bytes)
variable := f.VariableByName(variableName)
if variable == nil {
return errors.New(&errors.UnknownIdentifier{Name: variableName}, f.File, parameters[0].Token.Position)
}
defer f.UseVariable(variable)
f.SaveRegister(f.CPU.Input[0])
f.SaveRegister(f.CPU.Input[1])