Simplified expression evaluation
This commit is contained in:
@ -1,26 +1,22 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"git.urbach.dev/cli/q/src/errors"
|
||||
"git.urbach.dev/cli/q/src/eval"
|
||||
"git.urbach.dev/cli/q/src/expression"
|
||||
)
|
||||
|
||||
// EvaluateCall evaluates a function call.
|
||||
func (f *Function) EvaluateCall(expr *expression.Expression) (eval.Value, error) {
|
||||
types, err := f.CompileCall(expr)
|
||||
func (f *Function) EvaluateCall(expr *expression.Expression) (eval.Register, error) {
|
||||
typ, err := f.CompileCall(expr)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return eval.Register{}, err
|
||||
}
|
||||
|
||||
if len(types) == 0 {
|
||||
return nil, errors.New(errors.UntypedExpression, f.File, expr.Token.Position)
|
||||
}
|
||||
value := eval.Register{Register: f.CPU.Output[0]}
|
||||
|
||||
value := eval.Register{
|
||||
Typ: types[0],
|
||||
Register: f.CPU.Output[0],
|
||||
if len(typ) > 0 {
|
||||
value.Typ = typ[0]
|
||||
}
|
||||
|
||||
return value, nil
|
||||
|
Reference in New Issue
Block a user