Program generates an evaluable instance of the Ast within the environment (Env).
(ast *Ast, opts ...ProgramOption)
| 721 | |
| 722 | // Program generates an evaluable instance of the Ast within the environment (Env). |
| 723 | func (e *Env) Program(ast *Ast, opts ...ProgramOption) (Program, error) { |
| 724 | // Surface any error recorded while the Ast was loaded (e.g. an over-deep AST rejected by |
| 725 | // ParsedExprToAst / CheckedExprToAst) rather than recursing into the planner on it. This is a |
| 726 | // cheap field read; the depth traversal itself runs once at conversion time, not here. |
| 727 | if ast != nil && ast.loadErr != nil { |
| 728 | return nil, ast.loadErr |
| 729 | } |
| 730 | return e.PlanProgram(ast.NativeRep(), opts...) |
| 731 | } |
| 732 | |
| 733 | // PlanProgram generates an evaluable instance of the AST in the go-native representation within |
| 734 | // the environment (Env). |