Removed unused struct fields

This commit is contained in:
Eduard Urbach 2024-07-17 12:38:57 +02:00
parent 8ec0e02dbe
commit f4e4e49fce
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
3 changed files with 3 additions and 6 deletions

View File

@ -41,7 +41,7 @@ func (f *Function) CompileDefinition(node *ast.Define) error {
func (f *Function) AddVariable(variable *Variable) { func (f *Function) AddVariable(variable *Variable) {
if config.Comments { if config.Comments {
f.Comment("%s = %s (%s, %d uses)", variable.Name, variable.Value, variable.Register, variable.Alive) f.Comment("%s = %s (%d uses)", variable.Name, variable.Register, variable.Alive)
} }
scope := f.Scope() scope := f.Scope()

View File

@ -9,9 +9,9 @@ import (
// Scope represents an independent code block. // Scope represents an independent code block.
type Scope struct { type Scope struct {
cpu.State
variables map[string]*Variable variables map[string]*Variable
inLoop bool inLoop bool
cpu.State
} }
// Scope returns the current scope. // Scope returns the current scope.
@ -37,7 +37,6 @@ func (f *Function) pushScope(body ast.AST) *Scope {
} }
scope.variables[k] = &Variable{ scope.variables[k] = &Variable{
Value: v.Value,
Name: v.Name, Name: v.Name,
Register: v.Register, Register: v.Register,
Alive: count, Alive: count,

View File

@ -2,16 +2,14 @@ package core
import ( import (
"git.akyoto.dev/cli/q/src/build/cpu" "git.akyoto.dev/cli/q/src/build/cpu"
"git.akyoto.dev/cli/q/src/build/expression"
) )
// Variable represents a named register. // Variable represents a named register.
type Variable struct { type Variable struct {
Value *expression.Expression Scope *Scope
Name string Name string
Register cpu.Register Register cpu.Register
Alive int Alive int
Scope *Scope
} }
// Variable returns the variable with the given name or `nil` if it doesn't exist. // Variable returns the variable with the given name or `nil` if it doesn't exist.