@@ -13,7 +13,6 @@ import (
1313 "github.com/expr-lang/expr/conf"
1414 "github.com/expr-lang/expr/file"
1515 "github.com/expr-lang/expr/optimizer"
16- "github.com/expr-lang/expr/parser"
1716 "github.com/expr-lang/expr/patcher"
1817 "github.com/expr-lang/expr/vm"
1918)
@@ -25,7 +24,8 @@ type Option func(c *conf.Config)
2524// If struct is passed, all fields will be treated as variables,
2625// as well as all fields of embedded structs and struct itself.
2726// If map is passed, all items will be treated as variables.
28- // Methods defined on this type will be available as functions.
27+ // Methods defined on this type will be available as functions,
28+ // unless built with the expr_noreflectmethod build tag.
2929func Env (env any ) Option {
3030 return func (c * conf.Config ) {
3131 c .WithEnv (env )
@@ -264,27 +264,3 @@ func Compile(input string, ops ...Option) (*vm.Program, error) {
264264func Run (program * vm.Program , env any ) (any , error ) {
265265 return vm .Run (program , env )
266266}
267-
268- // Eval parses, compiles and runs given input.
269- func Eval (input string , env any ) (any , error ) {
270- if _ , ok := env .(Option ); ok {
271- return nil , fmt .Errorf ("misused expr.Eval: second argument (env) should be passed without expr.Env" )
272- }
273-
274- tree , err := parser .Parse (input )
275- if err != nil {
276- return nil , err
277- }
278-
279- program , err := compiler .Compile (tree , nil )
280- if err != nil {
281- return nil , err
282- }
283-
284- output , err := Run (program , env )
285- if err != nil {
286- return nil , err
287- }
288-
289- return output , nil
290- }
0 commit comments