Implemented boolean literals

This commit is contained in:
2025-02-26 14:33:41 +01:00
parent 91f34bc88f
commit 5f46a6f14e
11 changed files with 69 additions and 13 deletions

View File

@ -1,6 +1,7 @@
package core
import (
"git.urbach.dev/cli/q/src/ast"
"git.urbach.dev/cli/q/src/cpu"
"git.urbach.dev/cli/q/src/errors"
"git.urbach.dev/cli/q/src/expression"
@ -24,6 +25,16 @@ func (f *Function) Evaluate(expr *expression.Expression) (types.Type, cpu.Regist
}
}
if ast.IsFunctionCall(expr) {
types, err := f.CompileCall(expr)
if err != nil {
return nil, 0, false, err
}
return types[0], f.CPU.Output[0], false, nil
}
tmp := f.NewRegister()
typ, err := f.ExpressionToRegister(expr, tmp)
return typ, tmp, true, err