MCPcopy Create free account
hub / github.com/google/gapid / field

Function field

core/codegen/value.go:110–124  ·  view source on GitHub ↗
(s *Struct, f IndexOrName)

Source from the content-addressed store, hash-verified

108}
109
110func field(s *Struct, f IndexOrName) (Field, int) {
111 var i int
112 switch f := f.(type) {
113 case int:
114 i = f
115 case string:
116 var ok bool
117 if i, ok = s.fieldIndices[f]; !ok {
118 fail("%v does not contain a field with name '%v':\n%+v", s.TypeName(), f, s)
119 }
120 default:
121 fail("Attempted to index field of struct '%v' with %T. Must be int or string", s.TypeName(), f)
122 }
123 return s.fields[i], i
124}
125
126func (b *Builder) pathName(rootName string, path []ValueIndexOrName) string {
127 name := rootName

Callers 3

pathMethod · 0.70
InsertMethod · 0.70
ExtractMethod · 0.70

Calls 2

failFunction · 0.70
TypeNameMethod · 0.65

Tested by

no test coverage detected