MCPcopy Index your code
hub / github.com/go-python/gopy / sortStructEmbeds

Method sortStructEmbeds

bind/package.go:623–648  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

621}
622
623func (p *Package) sortStructEmbeds() {
624 for {
625 nswap := 0
626 for _, s := range p.structs {
627 emb := s.FirstEmbed()
628 if emb == nil {
629 continue
630 }
631 emss, ok := p.objs[emb.goname]
632 if !ok {
633 continue
634 }
635 if ems, isstru := emss.(*Struct); isstru {
636 if ems.idx > s.idx {
637 nswap++
638 p.structs[s.idx], p.structs[ems.idx] = p.structs[ems.idx], p.structs[s.idx]
639 s.idx, ems.idx = ems.idx, s.idx
640 }
641 }
642 }
643 if nswap == 0 {
644 break
645 }
646 // fmt.Printf("%s nswap: %v\n", p.pkg.Path(), nswap)
647 }
648}

Callers 1

genAllMethod · 0.80

Calls 1

FirstEmbedMethod · 0.80

Tested by

no test coverage detected