MCPcopy
hub / github.com/hashicorp/hcl / Replace

Method Replace

hclwrite/ast_block.go:124–137  ·  view source on GitHub ↗
(newLabels []string)

Source from the content-addressed store, hash-verified

122}
123
124func (bl *blockLabels) Replace(newLabels []string) {
125 bl.children.Clear()
126 bl.items.Clear()
127
128 for _, label := range newLabels {
129 labelToks := TokensForValue(cty.StringVal(label))
130 // Force a new label to use the quoted form, which is the idiomatic
131 // form. The unquoted form is supported in HCL 2 only for compatibility
132 // with historical use in HCL 1.
133 labelObj := newQuoted(labelToks)
134 labelNode := bl.children.Append(labelObj)
135 bl.items.Add(labelNode)
136 }
137}
138
139func (bl *blockLabels) Current() []string {
140 labelNames := make([]string, 0, len(bl.items))

Callers 2

newBlockLabelsFunction · 0.95
SetLabelsMethod · 0.80

Calls 5

TokensForValueFunction · 0.85
newQuotedFunction · 0.85
AddMethod · 0.80
ClearMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected