MCPcopy
hub / github.com/google/mangle / PackageID

Method PackageID

ast/decl.go:217–232  ·  view source on GitHub ↗

PackageID returns the package part (dirname).

()

Source from the content-addressed store, hash-verified

215
216// PackageID returns the package part (dirname).
217func (d Decl) PackageID() string {
218 p := d.DeclaredAtom.Predicate
219 if p.Symbol == "Package" {
220 for _, a := range d.Descr {
221 if a.Predicate.Symbol == DescrName {
222 c := a.Args[0].(Constant)
223 s, _ := c.StringValue()
224 return s
225 }
226 }
227 }
228 if lastDot := strings.LastIndex(p.Symbol, "."); lastDot != -1 {
229 return p.Symbol[:lastDot]
230 }
231 return ""
232}
233
234// Visible returns whether the predicate should be visible to other packages.
235func (d Decl) Visible() bool {

Callers 3

TestDeclPackageDeclFunction · 0.95
checkVisibilityMethod · 0.80
TestDeclPackageFunction · 0.80

Calls 1

StringValueMethod · 0.80

Tested by 2

TestDeclPackageDeclFunction · 0.76
TestDeclPackageFunction · 0.64