MCPcopy Index your code
hub / github.com/goccy/go-json / ToAnonymousOpcode

Method ToAnonymousOpcode

internal/encoder/code.go:789–806  ·  view source on GitHub ↗
(ctx *compileContext, isFirstField, isEndField bool)

Source from the content-addressed store, hash-verified

787}
788
789func (c *StructFieldCode) ToAnonymousOpcode(ctx *compileContext, isFirstField, isEndField bool) Opcodes {
790 field := &Opcode{
791 Idx: opcodeOffset(ctx.ptrIndex),
792 Flags: c.flags() | AnonymousHeadFlags,
793 Key: c.structKey(ctx),
794 Offset: uint32(c.offset),
795 Type: c.typ,
796 DisplayIdx: ctx.opcodeIndex,
797 Indent: ctx.indent,
798 DisplayKey: c.key,
799 }
800 ctx.incIndex()
801 valueCodes := c.toValueOpcodes(ctx)
802 if isFirstField {
803 return c.headerOpcodes(ctx, field, valueCodes)
804 }
805 return c.fieldOpcodes(ctx, field, valueCodes)
806}
807
808func isEnableStructEndOptimization(value Code) bool {
809 switch value.Kind() {

Callers

nothing calls this directly

Calls 7

flagsMethod · 0.95
structKeyMethod · 0.95
toValueOpcodesMethod · 0.95
headerOpcodesMethod · 0.95
fieldOpcodesMethod · 0.95
opcodeOffsetFunction · 0.85
incIndexMethod · 0.80

Tested by

no test coverage detected