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

Method FirstEmbed

bind/types.go:128–143  ·  view source on GitHub ↗

FirstEmbed returns the first field if it is embedded, supporting convention of placing embedded "parent" types first

()

Source from the content-addressed store, hash-verified

126// FirstEmbed returns the first field if it is embedded,
127// supporting convention of placing embedded "parent" types first
128func (s *Struct) FirstEmbed() *symbol {
129 st := s.Struct()
130 numFields := st.NumFields()
131 if numFields == 0 {
132 return nil
133 }
134 f := s.Struct().Field(0)
135 if !f.Embedded() {
136 return nil
137 }
138 ftyp := current.symtype(f.Type())
139 if ftyp == nil {
140 return nil
141 }
142 return ftyp
143}
144
145///////////////////////////////////////////////////////////////////////////////////
146// Interface

Callers 2

sortStructEmbedsMethod · 0.80
genStructMethod · 0.80

Calls 2

StructMethod · 0.95
symtypeMethod · 0.80

Tested by

no test coverage detected