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

Method BlocksAtPos

structure_at_pos.go:28–40  ·  structure_at_pos.go::File.BlocksAtPos

----------------------------------------------------------------------------- The methods in this file all have the general pattern of making a best-effort to find one or more constructs that contain a given source position. These all operate by delegating to an optional method of the same name and

(pos Pos)

Source from the content-addressed store, hash-verified

26//
27// The result is nil if no blocks at all contain the given position.
28func (f *File) BlocksAtPos(pos Pos) []*Block {
29 // The root body of the file must implement this interface in order
30 // to support BlocksAtPos.
31 type Interface interface {
32 BlocksAtPos(pos Pos) []*Block
33 }
34
35 impl, ok := f.Body.(Interface)
36 if !ok {
37 return nil
38 }
39 return impl.BlocksAtPos(pos)
40}
41
42// OutermostBlockAtPos attempts to find a top-level block in the receiving file
43// that contains the given position. This is a best-effort method that may not

Callers

nothing calls this directly

Calls 1

BlocksAtPosMethod · 0.65

Tested by

no test coverage detected