Simplified Evaluate function

This commit is contained in:
2025-02-27 15:30:44 +01:00
parent 9f78733d5d
commit efb3089211
15 changed files with 98 additions and 96 deletions

View File

@ -1,28 +1,7 @@
package scope
import (
"git.urbach.dev/cli/q/src/cpu"
"git.urbach.dev/cli/q/src/types"
)
// Variable represents a named register.
// Variable is a named value.
type Variable struct {
Type types.Type
Name string
Alive uint8
Register cpu.Register
}
// IsAlive returns true if the variable is still alive.
func (v *Variable) IsAlive() bool {
return v.Alive > 0
}
// Use reduces the lifetime counter by one.
func (v *Variable) Use() {
if v.Alive == 0 {
panic("incorrect number of variable use calls")
}
v.Alive--
Value
Name string
}