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/variable_access.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/variable_access.go')
-rw-r--r-- | vendor/github.com/hashicorp/hil/ast/variable_access.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hil/ast/variable_access.go b/vendor/github.com/hashicorp/hil/ast/variable_access.go new file mode 100644 index 0000000..4c1362d --- /dev/null +++ b/vendor/github.com/hashicorp/hil/ast/variable_access.go | |||
@@ -0,0 +1,36 @@ | |||
1 | package ast | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | ) | ||
6 | |||
7 | // VariableAccess represents a variable access. | ||
8 | type VariableAccess struct { | ||
9 | Name string | ||
10 | Posx Pos | ||
11 | } | ||
12 | |||
13 | func (n *VariableAccess) Accept(v Visitor) Node { | ||
14 | return v(n) | ||
15 | } | ||
16 | |||
17 | func (n *VariableAccess) Pos() Pos { | ||
18 | return n.Posx | ||
19 | } | ||
20 | |||
21 | func (n *VariableAccess) GoString() string { | ||
22 | return fmt.Sprintf("*%#v", *n) | ||
23 | } | ||
24 | |||
25 | func (n *VariableAccess) String() string { | ||
26 | return fmt.Sprintf("Variable(%s)", n.Name) | ||
27 | } | ||
28 | |||
29 | func (n *VariableAccess) Type(s Scope) (Type, error) { | ||
30 | v, ok := s.LookupVar(n.Name) | ||
31 | if !ok { | ||
32 | return TypeInvalid, fmt.Errorf("unknown variable: %s", n.Name) | ||
33 | } | ||
34 | |||
35 | return v.Type, nil | ||
36 | } | ||