Removed eval() function from ast interface and implementation. Check on preset control variables is now done in initDefaultVars()
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
type Expr interface {
|
||||
Eval(ctx ExprContext) (result any, err error)
|
||||
eval(ctx ExprContext, preset bool) (result any, err error)
|
||||
String() string
|
||||
}
|
||||
|
||||
@@ -106,16 +105,10 @@ func (self *ast) Finish() {
|
||||
}
|
||||
|
||||
func (self *ast) Eval(ctx ExprContext) (result any, err error) {
|
||||
return self.eval(ctx, true)
|
||||
}
|
||||
|
||||
func (self *ast) eval(ctx ExprContext, preset bool) (result any, err error) {
|
||||
self.Finish()
|
||||
|
||||
if self.root != nil {
|
||||
if preset {
|
||||
initDefaultVars(ctx)
|
||||
}
|
||||
initDefaultVars(ctx)
|
||||
if self.forest != nil {
|
||||
for _, root := range self.forest {
|
||||
if result, err = root.compute(ctx); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user