Skip to content

Commit

Permalink
decoder: Implement reference targets for Set
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Jan 30, 2023
1 parent b6dc7c6 commit 4f3db92
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions decoder/expr_set_ref_targets.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package decoder

import (
"context"

"github.com/hashicorp/hcl-lang/lang"
"github.com/hashicorp/hcl-lang/reference"
"github.com/hashicorp/hcl/v2/hclsyntax"
)

func (set Set) ReferenceTargets(ctx context.Context, addr lang.Address, addrCtx AddressContext) reference.Targets {
eType, ok := set.expr.(*hclsyntax.TupleConsExpr)
if !ok {
return reference.Targets{}
}

if len(eType.Exprs) == 0 || set.cons.Elem == nil {
return reference.Targets{}
}

targets := make(reference.Targets, 0)

// TODO: collect parent target for the whole set

return targets
}

0 comments on commit 4f3db92

Please sign in to comment.