AddDeclVar declares a variable in the environment but doesn't register an expr with it. This allows planning to succeed, but with no value for the variable at runtime.
(name string, typeHint *envlib.TypeDesc)
| 639 | // AddDeclVar declares a variable in the environment but doesn't register an expr with it. |
| 640 | // This allows planning to succeed, but with no value for the variable at runtime. |
| 641 | func (e *Evaluator) AddDeclVar(name string, typeHint *envlib.TypeDesc) error { |
| 642 | ctx := e.ctx.copy() |
| 643 | ctx.addLetVar(name, "", typeHint) |
| 644 | err := updateContextPlans(ctx, e.env) |
| 645 | if err != nil { |
| 646 | return err |
| 647 | } |
| 648 | e.ctx = *ctx |
| 649 | return nil |
| 650 | } |
| 651 | |
| 652 | // AddDeclFn declares a function in the environment but doesn't register an expr with it. |
| 653 | // This allows planning to succeed, but with no value for the function at runtime. |