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

Function lookupAstFromFile

assertion/function/assertiontree/util.go:449–456  ·  view source on GitHub ↗

lookupAstFromFile attempts to find the file ast for a given file (token.File) nilable(result 0)

(pass *analysishelper.EnhancedPass, file *token.File)

Source from the content-addressed store, hash-verified

447// lookupAstFromFile attempts to find the file ast for a given file (token.File)
448// nilable(result 0)
449func lookupAstFromFile(pass *analysishelper.EnhancedPass, file *token.File) *ast.File {
450 for _, astFile := range pass.Files {
451 if file != nil && int(astFile.Pos()) >= file.Base() && int(astFile.Pos()) <= file.Base()+file.Size() {
452 return astFile
453 }
454 }
455 return nil
456}
457
458// lookupAstFromFilename attempts to find the file ast for a given file (token.File)
459// nilable(result 0)

Callers 1

GetDeclaringPathFunction · 0.85

Calls 2

SizeMethod · 0.65
PosMethod · 0.45

Tested by

no test coverage detected