Reduced memory usage
This commit is contained in:
@ -3,6 +3,7 @@ package core
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/build/ast"
|
||||
"git.akyoto.dev/cli/q/src/build/errors"
|
||||
"git.akyoto.dev/cli/q/src/build/scope"
|
||||
"git.akyoto.dev/cli/q/src/build/token"
|
||||
)
|
||||
|
||||
@ -20,5 +21,15 @@ func (f *Function) CompileDefinition(node *ast.Define) error {
|
||||
return errors.New(&errors.UnusedVariable{Name: name}, f.File, node.Name.Position)
|
||||
}
|
||||
|
||||
return f.storeVariableInRegister(name, node.Value, uses)
|
||||
register := f.CurrentScope().MustFindFree(f.cpu.General)
|
||||
f.CurrentScope().Reserve(register)
|
||||
err := f.ExpressionToRegister(node.Value, register)
|
||||
|
||||
f.AddVariable(&scope.Variable{
|
||||
Name: name,
|
||||
Register: register,
|
||||
Alive: uses,
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user