MCPcopy
hub / github.com/uber-go/nilaway / GetDeclaringPath

Function GetDeclaringPath

assertion/function/assertiontree/util.go:44–54  ·  view source on GitHub ↗

GetDeclaringPath finds the path of nested AST nodes beginning with the passed interval `[start, end]`

(pass *analysishelper.EnhancedPass, start, end token.Pos)

Source from the content-addressed store, hash-verified

42
43// GetDeclaringPath finds the path of nested AST nodes beginning with the passed interval `[start, end]`
44func GetDeclaringPath(pass *analysishelper.EnhancedPass, start, end token.Pos) ([]ast.Node, bool) {
45 astFile := lookupAstFromFile(pass, pass.Fset.File(start))
46 if astFile == nil {
47 astFile = lookupAstFromFilename(pass, pass.Fset.Position(start).Filename)
48 }
49 if astFile != nil {
50 path, _ := astutil.PathEnclosingInterval(astFile, start, end)
51 return path, true
52 }
53 return nil, false
54}
55
56// each of the following deepNilabilityOf... functions serves to inspect an object for possible sites
57// that could grant it a deep nilability annotation. Every case defaults to just introspecting the

Callers 1

GetDeclaringIdentMethod · 0.85

Calls 3

lookupAstFromFileFunction · 0.85
lookupAstFromFilenameFunction · 0.85
PositionMethod · 0.65

Tested by

no test coverage detected