MCPcopy
hub / github.com/tinylib/msgp / gArray

Method gArray

gen/size.go:170–189  ·  view source on GitHub ↗
(a *Array)

Source from the content-addressed store, hash-verified

168}
169
170func (s *sizeGen) gArray(a *Array) {
171 if !s.p.ok() {
172 return
173 }
174
175 s.addConstant(builtinSize(arrayHeader))
176
177 // if the array's children are a fixed
178 // size, we can compile an expression
179 // that always represents the array's wire size
180 if str, ok := fixedsizeExpr(a); ok {
181 s.addConstant(str)
182 return
183 }
184
185 setTypeParams(a.Els, a.typeParams)
186 s.state = add
187 s.p.rangeBlock(s.ctx, a.Index, a.Varname(), s, a.Els)
188 s.state = add
189}
190
191func (s *sizeGen) gMap(m *Map) {
192 s.addConstant(builtinSize(mapHeader))

Callers

nothing calls this directly

Calls 7

addConstantMethod · 0.95
builtinSizeFunction · 0.85
fixedsizeExprFunction · 0.85
setTypeParamsFunction · 0.85
okMethod · 0.80
rangeBlockMethod · 0.80
VarnameMethod · 0.65

Tested by

no test coverage detected