func (gen *codeGen) resolveInPackage(t types.Type, p types.Package) (types.Type, types.Package) { d.Chk.True(t.IsUnresolved()) // For unresolved types that references types in the same package the ref is empty and we need to use the passed in package. if t.HasPackageRef() { p = gen.deps[t.PackageRef()] d.Chk.NotNil(p) } return p.Types()[t.Ordinal()], p }
func generateDepCode(packageName, outDir string, written map[string]bool, p types.Package, localPkgs refSet, vr types.ValueReader) depsMap { deps := depsMap{} for _, r := range p.Dependencies() { p := vr.ReadValue(r).(types.Package) pDeps := generateDepCode(packageName, outDir, written, p, localPkgs, vr) tag := code.ToTag(p.Ref()) parsed := pkg.Parsed{Package: p, Name: packageName} if !localPkgs[parsed.Ref()] { generateAndEmit(tag, filepath.Join(outDir, tag+"."+*outputLang), written, pDeps, parsed) localPkgs[parsed.Ref()] = true } for depRef, dep := range pDeps { deps[depRef] = dep } deps[r] = p } return deps }