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

Method OutermostExprAtPos

hclsyntax/structure_at_pos.go:112–121  ·  view source on GitHub ↗

OutermostExprAtPos implements the method of the same name for an *hcl.File that is backed by a *Body.

(pos hcl.Pos)

Source from the content-addressed store, hash-verified

110// OutermostExprAtPos implements the method of the same name for an *hcl.File
111// that is backed by a *Body.
112func (b *Body) OutermostExprAtPos(pos hcl.Pos) hcl.Expression {
113 attr := b.attributeAtPos(pos)
114 if attr == nil {
115 return nil
116 }
117 if !attr.Expr.Range().ContainsPos(pos) {
118 return nil
119 }
120 return attr.Expr
121}

Callers

nothing calls this directly

Implementers 8

Bodyhclsyntax/structure.go
unknownBodyext/dynblock/unknown_body.go
expandBodyext/dynblock/expand_body.go
deepWrapperext/transform/transform.go
diagBodyext/transform/error.go
bodyjson/structure.go
mockBodyhcltest/mock.go

Calls 3

attributeAtPosMethod · 0.95
ContainsPosMethod · 0.80
RangeMethod · 0.65

Tested by

no test coverage detected