]>
Commit | Line | Data |
---|---|---|
15c0b25d AP |
1 | package hcl |
2 | ||
3 | import ( | |
4 | "github.com/zclconf/go-cty/cty" | |
5 | "github.com/zclconf/go-cty/cty/function" | |
6 | ) | |
7 | ||
8 | // An EvalContext provides the variables and functions that should be used | |
9 | // to evaluate an expression. | |
10 | type EvalContext struct { | |
11 | Variables map[string]cty.Value | |
12 | Functions map[string]function.Function | |
13 | parent *EvalContext | |
14 | } | |
15 | ||
16 | // NewChild returns a new EvalContext that is a child of the receiver. | |
17 | func (ctx *EvalContext) NewChild() *EvalContext { | |
18 | return &EvalContext{parent: ctx} | |
19 | } | |
20 | ||
21 | // Parent returns the parent of the receiver, or nil if the receiver has | |
22 | // no parent. | |
23 | func (ctx *EvalContext) Parent() *EvalContext { | |
24 | return ctx.parent | |
25 | } |