Deletions in the config package

This commit is contained in:
Pam Selle 2020-03-02 15:35:35 -05:00
parent c4441661b0
commit dd6fb16971
4 changed files with 1 additions and 79 deletions

View File

@ -29,10 +29,6 @@ func (r varRange) SourceRange() tfdiags.SourceRange {
return r.rng return r.rng
} }
func makeVarRange(rng tfdiags.SourceRange) varRange {
return varRange{rng}
}
// CountVariable is a variable for referencing information about // CountVariable is a variable for referencing information about
// the count. // the count.
type CountVariable struct { type CountVariable struct {

View File

@ -1,54 +0,0 @@
package config
import (
"fmt"
"github.com/hashicorp/hil/ast"
)
// stringSliceToVariableValue converts a string slice into the value
// required to be returned from interpolation functions which return
// TypeList.
func stringSliceToVariableValue(values []string) []ast.Variable {
output := make([]ast.Variable, len(values))
for index, value := range values {
output[index] = ast.Variable{
Type: ast.TypeString,
Value: value,
}
}
return output
}
// listVariableSliceToVariableValue converts a list of lists into the value
// required to be returned from interpolation functions which return TypeList.
func listVariableSliceToVariableValue(values [][]ast.Variable) []ast.Variable {
output := make([]ast.Variable, len(values))
for index, value := range values {
output[index] = ast.Variable{
Type: ast.TypeList,
Value: value,
}
}
return output
}
func listVariableValueToStringSlice(values []ast.Variable) ([]string, error) {
output := make([]string, len(values))
for index, value := range values {
if value.Type != ast.TypeString {
return []string{}, fmt.Errorf("list has non-string element (%T)", value.Type.String())
}
output[index] = value.Value.(string)
}
return output, nil
}
// Funcs used to return a mapping of built-in functions for configuration.
//
// However, these function implementations are no longer used. To find the
// current function implementations, refer to ../lang/functions.go instead.
func Funcs() map[string]ast.Function {
return nil
}

View File

@ -1,11 +0,0 @@
package config
import (
"github.com/hashicorp/hil/ast"
)
type noopNode struct{}
func (n *noopNode) Accept(ast.Visitor) ast.Node { return n }
func (n *noopNode) Pos() ast.Pos { return ast.Pos{} }
func (n *noopNode) Type(ast.Scope) (ast.Type, error) { return ast.TypeString, nil }

View File

@ -401,19 +401,10 @@ type gobRawConfig struct {
} }
// langEvalConfig returns the evaluation configuration we use to execute. // langEvalConfig returns the evaluation configuration we use to execute.
//
// The interpolation functions are no longer available here, because this
// codepath is no longer used. Instead, see ../lang/functions.go .
func langEvalConfig(vs map[string]ast.Variable) *hil.EvalConfig { func langEvalConfig(vs map[string]ast.Variable) *hil.EvalConfig {
funcMap := make(map[string]ast.Function)
for k, v := range Funcs() {
funcMap[k] = v
}
return &hil.EvalConfig{ return &hil.EvalConfig{
GlobalScope: &ast.BasicScope{ GlobalScope: &ast.BasicScope{
VarMap: vs, VarMap: vs,
FuncMap: funcMap,
}, },
} }
} }