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

Method AsTraversal

json/structure.go:569–583  ·  view source on GitHub ↗

Implementation for hcl.AbsTraversalForExpr.

()

Source from the content-addressed store, hash-verified

567
568// Implementation for hcl.AbsTraversalForExpr.
569func (e *expression) AsTraversal() hcl.Traversal {
570 // In JSON-based syntax a traversal is given as a string containing
571 // traversal syntax as defined by hclsyntax.ParseTraversalAbs.
572
573 switch v := e.src.(type) {
574 case *stringVal:
575 traversal, diags := hclsyntax.ParseTraversalAbs([]byte(v.Value), v.SrcRange.Filename, v.SrcRange.Start)
576 if diags.HasErrors() {
577 return nil
578 }
579 return traversal
580 default:
581 return nil
582 }
583}
584
585// Implementation for hcl.ExprCall.
586func (e *expression) ExprCall() *hcl.StaticCall {

Callers 1

Calls 2

ParseTraversalAbsFunction · 0.92
HasErrorsMethod · 0.80

Tested by 1