MCPcopy Create free account
hub / github.com/brimdata/super / buildEnum

Function buildEnum

sup/builder.go:263–275  ·  view source on GitHub ↗
(b *scode.Builder, enum *Enum)

Source from the content-addressed store, hash-verified

261}
262
263func buildEnum(b *scode.Builder, enum *Enum) error {
264 under, ok := super.TypeUnder(enum.Type).(*super.TypeEnum)
265 if !ok {
266 // This shouldn't happen.
267 return errors.New("enum value is not of type enum")
268 }
269 selector := under.Lookup(enum.Name)
270 if selector < 0 {
271 return fmt.Errorf("symbol %q not a member of %s", enum.Name, String(enum.Type))
272 }
273 b.Append(super.EncodeUint(uint64(selector)))
274 return nil
275}
276
277func buildTypeValue(b *scode.Builder, tv *TypeValue) error {
278 b.Append(super.EncodeTypeValue(tv.Value))

Callers 1

buildValueFunction · 0.85

Calls 6

TypeUnderFunction · 0.92
EncodeUintFunction · 0.92
NewMethod · 0.80
StringFunction · 0.70
LookupMethod · 0.65
AppendMethod · 0.45

Tested by

no test coverage detected