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

Method addConstant

gen/size.go:51–71  ·  view source on GitHub ↗

this lets us chain together addition operations where possible

(sz string)

Source from the content-addressed store, hash-verified

49// this lets us chain together addition
50// operations where possible
51func (s *sizeGen) addConstant(sz string) {
52 if !s.p.ok() {
53 return
54 }
55
56 switch s.state {
57 case assign:
58 s.p.print("\ns = " + sz)
59 s.state = expr
60 return
61 case add:
62 s.p.print("\ns += " + sz)
63 s.state = expr
64 return
65 case expr:
66 s.p.print(" + " + sz)
67 return
68 }
69
70 panic("unknown size state")
71}
72
73func (s *sizeGen) Execute(p Elem, ctx Context) error {
74 s.ctx = &ctx

Callers 5

gStructMethod · 0.95
gSliceMethod · 0.95
gArrayMethod · 0.95
gMapMethod · 0.95
gBaseMethod · 0.95

Calls 2

okMethod · 0.80
printMethod · 0.80

Tested by

no test coverage detected