MCPcopy Create free account
hub / github.com/decomp/decomp / declImports

Function declImports

cmd/go-post/fix.go:312–323  ·  view source on GitHub ↗

declImports reports whether gen contains an import of path.

(gen *ast.GenDecl, path string)

Source from the content-addressed store, hash-verified

310
311// declImports reports whether gen contains an import of path.
312func declImports(gen *ast.GenDecl, path string) bool {
313 if gen.Tok != token.IMPORT {
314 return false
315 }
316 for _, spec := range gen.Specs {
317 impspec := spec.(*ast.ImportSpec)
318 if importPath(impspec) == path {
319 return true
320 }
321 }
322 return false
323}
324
325// isPkgDot returns true if t is the expression "pkg.name"
326// where pkg is an imported identifier.

Callers 1

addImportFunction · 0.85

Calls 1

importPathFunction · 0.85

Tested by

no test coverage detected