diff options
author | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
---|---|---|
committer | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
commit | bae9f6d2fd5eb5bc80929bd393932b23f14d7c93 (patch) | |
tree | ca9ab12a7d78b1fc27a8f734729081357ce6d252 /vendor/github.com/hashicorp/hil/ast/conditional.go | |
parent | 254c495b6bebab3fb72a243c4bce858d79e6ee99 (diff) | |
download | terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.gz terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.zst terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.zip |
Initial transfer of provider code
Diffstat (limited to 'vendor/github.com/hashicorp/hil/ast/conditional.go')
-rw-r--r-- | vendor/github.com/hashicorp/hil/ast/conditional.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hil/ast/conditional.go b/vendor/github.com/hashicorp/hil/ast/conditional.go new file mode 100644 index 0000000..be48f89 --- /dev/null +++ b/vendor/github.com/hashicorp/hil/ast/conditional.go | |||
@@ -0,0 +1,36 @@ | |||
1 | package ast | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | ) | ||
6 | |||
7 | type Conditional struct { | ||
8 | CondExpr Node | ||
9 | TrueExpr Node | ||
10 | FalseExpr Node | ||
11 | Posx Pos | ||
12 | } | ||
13 | |||
14 | // Accept passes the given visitor to the child nodes in this order: | ||
15 | // CondExpr, TrueExpr, FalseExpr. It then finally passes itself to the visitor. | ||
16 | func (n *Conditional) Accept(v Visitor) Node { | ||
17 | n.CondExpr = n.CondExpr.Accept(v) | ||
18 | n.TrueExpr = n.TrueExpr.Accept(v) | ||
19 | n.FalseExpr = n.FalseExpr.Accept(v) | ||
20 | |||
21 | return v(n) | ||
22 | } | ||
23 | |||
24 | func (n *Conditional) Pos() Pos { | ||
25 | return n.Posx | ||
26 | } | ||
27 | |||
28 | func (n *Conditional) Type(Scope) (Type, error) { | ||
29 | // This is not actually a useful value; the type checker ignores | ||
30 | // this function when analyzing conditionals, just as with Arithmetic. | ||
31 | return TypeInt, nil | ||
32 | } | ||
33 | |||
34 | func (n *Conditional) GoString() string { | ||
35 | return fmt.Sprintf("*%#v", *n) | ||
36 | } | ||