Skip to content

Commit 6f07866

Browse files
committed
improve comments
1 parent a576321 commit 6f07866

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

internal/stacks/stackruntime/internal/stackeval/walk_dynamic.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,18 @@ func walkDynamicObjectsInStack[Output any](
6868
walk.AsyncTask(ctx, func(ctx context.Context) {
6969
insts, unknown := call.Instances(ctx, phase)
7070

71-
// If unknown, then process the unknown instance and skip the rest.
7271
if unknown {
72+
73+
// If unknown, then we should check for any stacks that exist
74+
// in the state and "claim" them. Basically, this means this
75+
// value was known and created some stack instances previously
76+
// then became unknown in the current operation and we want to
77+
7378
knownInstances := stack.KnownEmbeddedStacks(call.addr.Item, phase)
7479
if len(knownInstances) == 0 {
7580
// with no known instances, we'll just process the constant
76-
// unknown instance
81+
// unknown instance. This represents the idea that stacks
82+
// could be created once the value becomes unknown.
7783
inst := call.UnknownInstance(ctx, phase)
7884
visit(ctx, walk, inst)
7985

@@ -82,8 +88,9 @@ func walkDynamicObjectsInStack[Output any](
8288
return
8389
}
8490

85-
// otherwise we have instances, so we'll process those with
86-
// dedicated instances
91+
// otherwise we have known instances in the state, so we'll
92+
// create some dynamic instances for them so the user doesn't
93+
// worry they have just disappeared.
8794

8895
for inst := range knownInstances {
8996
if inst.Key == addrs.WildcardKey {

0 commit comments

Comments
 (0)