Program generates an evaluable instance of the Ast within the environment (Env).
(ast *Ast, opts ...ProgramOption)
| 786 | |
| 787 | // Program generates an evaluable instance of the Ast within the environment (Env). |
| 788 | func (e *Env) Program(ast *Ast, opts ...ProgramOption) (Program, error) { |
| 789 | // Surface any error recorded while the Ast was loaded (e.g. an over-deep AST rejected by |
| 790 | // ParsedExprToAst / CheckedExprToAst) rather than recursing into the planner on it. This is a |
| 791 | // cheap field read; the depth traversal itself runs once at conversion time, not here. |
| 792 | if ast != nil && ast.loadErr != nil { |
| 793 | return nil, ast.loadErr |
| 794 | } |
| 795 | return e.PlanProgram(ast.NativeRep(), opts...) |
| 796 | } |
| 797 | |
| 798 | // PlanProgram generates an evaluable instance of the AST in the go-native representation within |
| 799 | // the environment (Env). |