mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-04-27 18:00:48 -04:00
configgraph: ContributingResourceInstances uses ValueMarksOfTypeDeep
Recent changes in cty have included some new functions for working with marks more efficiently. This particular function allows us to iterate over the deep marks on a value without creating a new unmarked copy of the value and without building an intermediate map of marks. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
@@ -58,13 +58,10 @@ func ContributingResourceInstances(v cty.Value) iter.Seq[*ResourceInstance] {
|
||||
// multiple references to the same resource instance as long as the
|
||||
// pointers are unique, but the doc comment above reserves the right
|
||||
// to change our approach here in future, if needed.)
|
||||
_, marks := v.UnmarkDeep()
|
||||
return func(yield func(*ResourceInstance) bool) {
|
||||
for mark := range marks {
|
||||
if mark, ok := mark.(ResourceInstanceMark); ok {
|
||||
if !yield(mark.instance) {
|
||||
break
|
||||
}
|
||||
for mark := range cty.ValueMarksOfTypeDeep[ResourceInstanceMark](v) {
|
||||
if !yield(mark.instance) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user