diff --git a/cmd/generator/main.go b/cmd/generator/main.go new file mode 100644 index 0000000..1b8b8c3 --- /dev/null +++ b/cmd/generator/main.go @@ -0,0 +1,331 @@ +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "path/filepath" + "runtime" + "strings" + "text/template" +) + +type opType struct { + Op string + IndentOp string + Code string +} + +type headType struct { + Head string + PtrHead string + AnonymousHead string + AnonymousPtrHead string + OmitEmptyHead string + OmitEmptyPtrHead string + AnonymousOmitEmptyHead string + AnonymousOmitEmptyPtrHead string +} + +type fieldType struct { + Field string + OmitEmptyField string +} + +func _main() error { + tmpl, err := template.New("").Parse(`// Code generated by cmd/generator. DO NOT EDIT! +package json + +type codeType int + +const ( +{{- range $index, $type := .CodeTypes }} + code{{ $type }} codeType = {{ $index }} +{{- end }} +) + +type opType int + +const ( +{{- range $index, $type := .OpTypes }} + op{{ $type.Op }} opType = {{ $index }} +{{- end }} +) + +func (t opType) String() string { + switch t { +{{- range $type := .OpTypes }} + case op{{ $type.Op }}: + return "{{ $type.Op }}" +{{- end }} + } + return "" +} + +func (t opType) codeType() codeType { + switch t { +{{- range $type := .OpTypes }} + case op{{ $type.Op }}: + return code{{ $type.Code }} +{{- end }} + } + return codeOp +} + +func (t opType) toIndent() opType { + switch t { +{{- range $type := .OpTypes }} + case op{{ $type.Op }}: + return op{{ $type.IndentOp }} +{{- end }} + } + return t +} + +func (t opType) headToPtrHead() opType { + switch t { +{{- range $type := .HeadTypes }} + case op{{ $type.Head }}: + return op{{ $type.PtrHead }} + case op{{ $type.AnonymousHead }}: + return op{{ $type.AnonymousPtrHead }} + case op{{ $type.OmitEmptyHead }}: + return op{{ $type.OmitEmptyPtrHead }} + case op{{ $type.AnonymousOmitEmptyHead }}: + return op{{ $type.AnonymousOmitEmptyPtrHead }} +{{- end }} + } + return t +} + +func (t opType) headToAnonymousHead() opType { + switch t { +{{- range $type := .HeadTypes }} + case op{{ $type.Head }}: + return op{{ $type.AnonymousHead }} + case op{{ $type.PtrHead }}: + return op{{ $type.AnonymousPtrHead }} + case op{{ $type.OmitEmptyHead }}: + return op{{ $type.AnonymousOmitEmptyHead }} + case op{{ $type.OmitEmptyPtrHead }}: + return op{{ $type.AnonymousOmitEmptyPtrHead }} +{{- end }} + } + return t +} + +func (t opType) headToOmitEmptyHead() opType { + switch t { +{{- range $type := .HeadTypes }} + case op{{ $type.Head }}: + return op{{ $type.OmitEmptyHead }} + case op{{ $type.PtrHead }}: + return op{{ $type.OmitEmptyPtrHead }} +{{- end }} + } + return t +} + +func (t opType) ptrHeadToHead() opType { + switch t { +{{- range $type := .HeadTypes }} + case op{{ $type.PtrHead }}: + return op{{ $type.Head }} + case op{{ $type.AnonymousPtrHead }}: + return op{{ $type.AnonymousHead }} + case op{{ $type.OmitEmptyPtrHead }}: + return op{{ $type.OmitEmptyHead }} + case op{{ $type.AnonymousOmitEmptyPtrHead }}: + return op{{ $type.AnonymousOmitEmptyHead }} +{{- end }} + } + return t +} + +func (t opType) fieldToOmitEmptyField() opType { + switch t { +{{- range $type := .FieldTypes }} + case op{{ $type.Field }}: + return op{{ $type.OmitEmptyField }} +{{- end }} + } + return t +} + +`) + if err != nil { + return err + } + codeTypes := []string{ + "Op", + "ArrayHead", + "ArrayElem", + "SliceHead", + "SliceElem", + "MapHead", + "MapKey", + "MapValue", + "StructFieldRecursive", + "StructField", + } + primitiveTypes := []string{ + "int", "int8", "int16", "int32", "int64", + "uint", "uint8", "uint16", "uint32", "uint64", + "float32", "float64", "bool", "string", + } + primitiveTypesUpper := []string{} + for _, typ := range primitiveTypes { + primitiveTypesUpper = append(primitiveTypesUpper, strings.ToUpper(string(typ[0]))+typ[1:]) + } + opTypes := []opType{ + {"End", "EndIndent", "Op"}, + {"Interface", "InterfaceIndent", "Op"}, + {"Ptr", "PtrIndent", "Op"}, + {"MarshalJSON", "MarshalJSONIndent", "Op"}, + {"MarshalText", "MarshalTextIndent", "Op"}, + {"SliceHead", "SliceHeadIndent", "SliceHead"}, + {"RootSliceHead", "RootSliceHeadIndent", "SliceHead"}, + {"SliceElem", "SliceElemIndent", "SliceElem"}, + {"RootSliceElem", "RootSliceElemIndent", "SliceElem"}, + {"SliceEnd", "SliceEndIndent", "Op"}, + {"ArrayHead", "ArrayHeadIndent", "ArrayHead"}, + {"ArrayElem", "ArrayElemIndent", "ArrayElem"}, + {"ArrayEnd", "ArrayEndIndent", "Op"}, + {"MapHead", "MapHeadIndent", "MapHead"}, + {"MapHeadLoad", "MapHeadLoadIndent", "MapHead"}, + {"RootMapHead", "RootMapHeadIndent", "MapHead"}, + {"MapKey", "MapKeyIndent", "MapKey"}, + {"RootMapKey", "RootMapKeyIndent", "MapKey"}, + {"MapValue", "MapValueIndent", "MapValue"}, + {"MapEnd", "MapEndIndent", "Op"}, + {"StructFieldHead", "StructFieldHeadIndent", "StructField"}, + {"StructFieldHeadOmitEmpty", "StructFieldHeadOmitEmptyIndent", "StructField"}, + {"StructFieldAnonymousHead", "StructFieldAnonymousHeadIndent", "StructField"}, + {"StructFieldAnonymousHeadOmitEmpty", "StructFieldAnonymousHeadOmitEmptyIndent", "StructField"}, + {"StructFieldPtrAnonymousHeadOmitEmpty", "StructFieldPtrAnonymousHeadOmitEmptyIndent", "StructField"}, + {"StructFieldPtrHead", "StructFieldPtrHeadIndent", "StructField"}, + {"StructFieldPtrHeadOmitEmpty", "StructFieldPtrHeadOmitEmptyIndent", "StructField"}, + {"StructFieldPtrAnonymousHead", "StructFieldPtrAnonymousHeadIndent", "StructField"}, + {"StructField", "StructFieldIndent", "StructField"}, + {"StructFieldOmitEmpty", "StructFieldOmitEmptyIndent", "StructField"}, + {"StructFieldRecursive", "StructFieldRecursiveIndent", "StructFieldRecursive"}, + {"StructEnd", "StructEndIndent", "StructField"}, + {"StructAnonymousEnd", "StructAnonymousEndIndent", "StructField"}, + } + for _, typ := range primitiveTypesUpper { + opTypes = append(opTypes, opType{ + Op: typ, + IndentOp: fmt.Sprintf("%sIndent", typ), + Code: "Op", + }) + } + for _, prefix := range []string{ + "StructFieldHead", + "StructFieldHeadOmitEmpty", + "StructFieldAnonymousHead", + "StructFieldAnonymousHeadOmitEmpty", + "StructFieldPtrHead", + "StructFieldPtrHeadOmitEmpty", + "StructFieldPtrAnonymousHead", + "StructFieldPtrAnonymousHeadOmitEmpty", + "StructField", + "StructFieldOmitEmpty", + } { + for _, typ := range primitiveTypesUpper { + opTypes = append(opTypes, opType{ + Op: fmt.Sprintf("%s%s", prefix, typ), + IndentOp: fmt.Sprintf("%s%sIndent", prefix, typ), + Code: "StructField", + }) + } + } + for _, typ := range opTypes { + opTypes = append(opTypes, opType{ + Op: typ.IndentOp, + IndentOp: typ.IndentOp, + Code: typ.Code, + }) + } + base := headType{ + Head: "StructFieldHead", + PtrHead: "StructFieldPtrHead", + AnonymousHead: "StructFieldAnonymousHead", + AnonymousPtrHead: "StructFieldPtrAnonymousHead", + OmitEmptyHead: "StructFieldHeadOmitEmpty", + OmitEmptyPtrHead: "StructFieldPtrHeadOmitEmpty", + AnonymousOmitEmptyHead: "StructFieldAnonymousHeadOmitEmpty", + AnonymousOmitEmptyPtrHead: "StructFieldPtrAnonymousHeadOmitEmpty", + } + headTypes := []headType{base} + for _, prim := range primitiveTypesUpper { + headTypes = append(headTypes, headType{ + Head: fmt.Sprintf("%s%s", base.Head, prim), + PtrHead: fmt.Sprintf("%s%s", base.PtrHead, prim), + AnonymousHead: fmt.Sprintf("%s%s", base.AnonymousHead, prim), + AnonymousPtrHead: fmt.Sprintf("%s%s", base.AnonymousPtrHead, prim), + OmitEmptyHead: fmt.Sprintf("%s%s", base.OmitEmptyHead, prim), + OmitEmptyPtrHead: fmt.Sprintf("%s%s", base.OmitEmptyPtrHead, prim), + AnonymousOmitEmptyHead: fmt.Sprintf("%s%s", base.AnonymousOmitEmptyHead, prim), + AnonymousOmitEmptyPtrHead: fmt.Sprintf("%s%s", base.AnonymousOmitEmptyPtrHead, prim), + }) + } + for _, typ := range headTypes { + headTypes = append(headTypes, headType{ + Head: fmt.Sprintf("%sIndent", typ.Head), + PtrHead: fmt.Sprintf("%sIndent", typ.PtrHead), + AnonymousHead: fmt.Sprintf("%sIndent", typ.AnonymousHead), + AnonymousPtrHead: fmt.Sprintf("%sIndent", typ.AnonymousPtrHead), + OmitEmptyHead: fmt.Sprintf("%sIndent", typ.OmitEmptyHead), + OmitEmptyPtrHead: fmt.Sprintf("%sIndent", typ.OmitEmptyPtrHead), + AnonymousOmitEmptyHead: fmt.Sprintf("%sIndent", typ.AnonymousOmitEmptyHead), + AnonymousOmitEmptyPtrHead: fmt.Sprintf("%sIndent", typ.AnonymousOmitEmptyPtrHead), + }) + } + + baseField := fieldType{ + Field: "StructField", + OmitEmptyField: "StructFieldOmitEmpty", + } + fieldTypes := []fieldType{baseField} + for _, prim := range primitiveTypesUpper { + fieldTypes = append(fieldTypes, fieldType{ + Field: fmt.Sprintf("%s%s", baseField.Field, prim), + OmitEmptyField: fmt.Sprintf("%s%s", baseField.OmitEmptyField, prim), + }) + } + for _, typ := range fieldTypes { + fieldTypes = append(fieldTypes, fieldType{ + Field: fmt.Sprintf("%sIndent", typ.Field), + OmitEmptyField: fmt.Sprintf("%sIndent", typ.OmitEmptyField), + }) + } + + var b bytes.Buffer + if err := tmpl.Execute(&b, struct { + CodeTypes []string + OpTypes []opType + HeadTypes []headType + FieldTypes []fieldType + }{ + CodeTypes: codeTypes, + OpTypes: opTypes, + HeadTypes: headTypes, + FieldTypes: fieldTypes, + }); err != nil { + return err + } + path := filepath.Join(repoRoot(), "encode_optype.go") + return ioutil.WriteFile(path, b.Bytes(), 0644) +} + +func repoRoot() string { + _, file, _, _ := runtime.Caller(0) + relativePathFromRepoRoot := filepath.Join("cmd", "generator") + return strings.TrimSuffix(filepath.Dir(file), relativePathFromRepoRoot) +} + +func main() { + if err := _main(); err != nil { + panic(err) + } +} diff --git a/encode_compile.go b/encode_compile.go index ea61682..2817a66 100644 --- a/encode_compile.go +++ b/encode_compile.go @@ -77,132 +77,12 @@ func (e *Encoder) compile(typ *rtype, root, withIndent bool) (*opcode, error) { } func (e *Encoder) optimizeStructFieldPtrHead(typ *rtype, code *opcode) *opcode { - switch code.op { - case opStructFieldHead: - code.op = opStructFieldPtrHead - case opStructFieldHeadInt: - code.op = opStructFieldPtrHeadInt - case opStructFieldHeadInt8: - code.op = opStructFieldPtrHeadInt8 - case opStructFieldHeadInt16: - code.op = opStructFieldPtrHeadInt16 - case opStructFieldHeadInt32: - code.op = opStructFieldPtrHeadInt32 - case opStructFieldHeadInt64: - code.op = opStructFieldPtrHeadInt64 - case opStructFieldHeadUint: - code.op = opStructFieldPtrHeadUint - case opStructFieldHeadUint8: - code.op = opStructFieldPtrHeadUint8 - case opStructFieldHeadUint16: - code.op = opStructFieldPtrHeadUint16 - case opStructFieldHeadUint32: - code.op = opStructFieldPtrHeadUint32 - case opStructFieldHeadUint64: - code.op = opStructFieldPtrHeadUint64 - case opStructFieldHeadFloat32: - code.op = opStructFieldPtrHeadFloat32 - case opStructFieldHeadFloat64: - code.op = opStructFieldPtrHeadFloat64 - case opStructFieldHeadString: - code.op = opStructFieldPtrHeadString - case opStructFieldHeadBool: - code.op = opStructFieldPtrHeadBool - case opStructFieldHeadOmitEmpty: - code.op = opStructFieldPtrHeadOmitEmpty - case opStructFieldHeadIntOmitEmpty: - code.op = opStructFieldPtrHeadIntOmitEmpty - case opStructFieldHeadInt8OmitEmpty: - code.op = opStructFieldPtrHeadInt8OmitEmpty - case opStructFieldHeadInt16OmitEmpty: - code.op = opStructFieldPtrHeadInt16OmitEmpty - case opStructFieldHeadInt32OmitEmpty: - code.op = opStructFieldPtrHeadInt32OmitEmpty - case opStructFieldHeadInt64OmitEmpty: - code.op = opStructFieldPtrHeadInt64OmitEmpty - case opStructFieldHeadUintOmitEmpty: - code.op = opStructFieldPtrHeadUintOmitEmpty - case opStructFieldHeadUint8OmitEmpty: - code.op = opStructFieldPtrHeadUint8OmitEmpty - case opStructFieldHeadUint16OmitEmpty: - code.op = opStructFieldPtrHeadUint16OmitEmpty - case opStructFieldHeadUint32OmitEmpty: - code.op = opStructFieldPtrHeadUint32OmitEmpty - case opStructFieldHeadUint64OmitEmpty: - code.op = opStructFieldPtrHeadUint64OmitEmpty - case opStructFieldHeadFloat32OmitEmpty: - code.op = opStructFieldPtrHeadFloat32OmitEmpty - case opStructFieldHeadFloat64OmitEmpty: - code.op = opStructFieldPtrHeadFloat64OmitEmpty - case opStructFieldHeadStringOmitEmpty: - code.op = opStructFieldPtrHeadStringOmitEmpty - case opStructFieldHeadBoolOmitEmpty: - code.op = opStructFieldPtrHeadBoolOmitEmpty - - case opStructFieldHeadIndent: - code.op = opStructFieldPtrHeadIndent - case opStructFieldHeadIntIndent: - code.op = opStructFieldPtrHeadIntIndent - case opStructFieldHeadInt8Indent: - code.op = opStructFieldPtrHeadInt8Indent - case opStructFieldHeadInt16Indent: - code.op = opStructFieldPtrHeadInt16Indent - case opStructFieldHeadInt32Indent: - code.op = opStructFieldPtrHeadInt32Indent - case opStructFieldHeadInt64Indent: - code.op = opStructFieldPtrHeadInt64Indent - case opStructFieldHeadUintIndent: - code.op = opStructFieldPtrHeadUintIndent - case opStructFieldHeadUint8Indent: - code.op = opStructFieldPtrHeadUint8Indent - case opStructFieldHeadUint16Indent: - code.op = opStructFieldPtrHeadUint16Indent - case opStructFieldHeadUint32Indent: - code.op = opStructFieldPtrHeadUint32Indent - case opStructFieldHeadUint64Indent: - code.op = opStructFieldPtrHeadUint64Indent - case opStructFieldHeadFloat32Indent: - code.op = opStructFieldPtrHeadFloat32Indent - case opStructFieldHeadFloat64Indent: - code.op = opStructFieldPtrHeadFloat64Indent - case opStructFieldHeadStringIndent: - code.op = opStructFieldPtrHeadStringIndent - case opStructFieldHeadBoolIndent: - code.op = opStructFieldPtrHeadBoolIndent - case opStructFieldHeadOmitEmptyIndent: - code.op = opStructFieldPtrHeadOmitEmptyIndent - case opStructFieldHeadIntOmitEmptyIndent: - code.op = opStructFieldPtrHeadIntOmitEmptyIndent - case opStructFieldHeadInt8OmitEmptyIndent: - code.op = opStructFieldPtrHeadInt8OmitEmptyIndent - case opStructFieldHeadInt16OmitEmptyIndent: - code.op = opStructFieldPtrHeadInt16OmitEmptyIndent - case opStructFieldHeadInt32OmitEmptyIndent: - code.op = opStructFieldPtrHeadInt32OmitEmptyIndent - case opStructFieldHeadInt64OmitEmptyIndent: - code.op = opStructFieldPtrHeadInt64OmitEmptyIndent - case opStructFieldHeadUintOmitEmptyIndent: - code.op = opStructFieldPtrHeadUintOmitEmptyIndent - case opStructFieldHeadUint8OmitEmptyIndent: - code.op = opStructFieldPtrHeadUint8OmitEmptyIndent - case opStructFieldHeadUint16OmitEmptyIndent: - code.op = opStructFieldPtrHeadUint16OmitEmptyIndent - case opStructFieldHeadUint32OmitEmptyIndent: - code.op = opStructFieldPtrHeadUint32OmitEmptyIndent - case opStructFieldHeadUint64OmitEmptyIndent: - code.op = opStructFieldPtrHeadUint64OmitEmptyIndent - case opStructFieldHeadFloat32OmitEmptyIndent: - code.op = opStructFieldPtrHeadFloat32OmitEmptyIndent - case opStructFieldHeadFloat64OmitEmptyIndent: - code.op = opStructFieldPtrHeadFloat64OmitEmptyIndent - case opStructFieldHeadStringOmitEmptyIndent: - code.op = opStructFieldPtrHeadStringOmitEmptyIndent - case opStructFieldHeadBoolOmitEmptyIndent: - code.op = opStructFieldPtrHeadBoolOmitEmptyIndent - default: - return newOpCode(opPtr, typ, e.indent, code) + ptrHeadOp := code.op.headToPtrHead() + if code.op != ptrHeadOp { + code.op = ptrHeadOp + return code } - return code + return newOpCode(opPtr, typ, e.indent, code) } func (e *Encoder) compilePtr(typ *rtype, root, withIndent bool) (*opcode, error) { @@ -456,118 +336,7 @@ func (e *Encoder) isIgnoredStructField(field reflect.StructField) bool { return false } -func (e *Encoder) optimizeStructHeaderOmitEmptyIndent(op opType) opType { - switch op { - case opInt: - return opStructFieldHeadIntOmitEmptyIndent - case opInt8: - return opStructFieldHeadInt8OmitEmptyIndent - case opInt16: - return opStructFieldHeadInt16OmitEmptyIndent - case opInt32: - return opStructFieldHeadInt32OmitEmptyIndent - case opInt64: - return opStructFieldHeadInt64OmitEmptyIndent - case opUint: - return opStructFieldHeadUintOmitEmptyIndent - case opUint8: - return opStructFieldHeadUint8OmitEmptyIndent - case opUint16: - return opStructFieldHeadUint16OmitEmptyIndent - case opUint32: - return opStructFieldHeadUint32OmitEmptyIndent - case opUint64: - return opStructFieldHeadUint64OmitEmptyIndent - case opFloat32: - return opStructFieldHeadFloat32OmitEmptyIndent - case opFloat64: - return opStructFieldHeadFloat64OmitEmptyIndent - case opString: - return opStructFieldHeadStringOmitEmptyIndent - case opBool: - return opStructFieldHeadBoolOmitEmptyIndent - } - return opStructFieldHeadOmitEmptyIndent -} - -func (e *Encoder) optimizeStructHeaderIndent(op opType, isOmitEmpty bool) opType { - if isOmitEmpty { - return e.optimizeStructHeaderOmitEmptyIndent(op) - } - switch op { - case opInt: - return opStructFieldHeadIntIndent - case opInt8: - return opStructFieldHeadInt8Indent - case opInt16: - return opStructFieldHeadInt16Indent - case opInt32: - return opStructFieldHeadInt32Indent - case opInt64: - return opStructFieldHeadInt64Indent - case opUint: - return opStructFieldHeadUintIndent - case opUint8: - return opStructFieldHeadUint8Indent - case opUint16: - return opStructFieldHeadUint16Indent - case opUint32: - return opStructFieldHeadUint32Indent - case opUint64: - return opStructFieldHeadUint64Indent - case opFloat32: - return opStructFieldHeadFloat32Indent - case opFloat64: - return opStructFieldHeadFloat64Indent - case opString: - return opStructFieldHeadStringIndent - case opBool: - return opStructFieldHeadBoolIndent - } - return opStructFieldHeadIndent -} - -func (e *Encoder) optimizeStructHeaderOmitEmpty(op opType) opType { - switch op { - case opInt: - return opStructFieldHeadIntOmitEmpty - case opInt8: - return opStructFieldHeadInt8OmitEmpty - case opInt16: - return opStructFieldHeadInt16OmitEmpty - case opInt32: - return opStructFieldHeadInt32OmitEmpty - case opInt64: - return opStructFieldHeadInt64OmitEmpty - case opUint: - return opStructFieldHeadUintOmitEmpty - case opUint8: - return opStructFieldHeadUint8OmitEmpty - case opUint16: - return opStructFieldHeadUint16OmitEmpty - case opUint32: - return opStructFieldHeadUint32OmitEmpty - case opUint64: - return opStructFieldHeadUint64OmitEmpty - case opFloat32: - return opStructFieldHeadFloat32OmitEmpty - case opFloat64: - return opStructFieldHeadFloat64OmitEmpty - case opString: - return opStructFieldHeadStringOmitEmpty - case opBool: - return opStructFieldHeadBoolOmitEmpty - } - return opStructFieldHeadOmitEmpty -} - -func (e *Encoder) optimizeStructHeader(op opType, isOmitEmpty, withIndent bool) opType { - if withIndent { - return e.optimizeStructHeaderIndent(op, isOmitEmpty) - } - if isOmitEmpty { - return e.optimizeStructHeaderOmitEmpty(op) - } +func (e *Encoder) typeToHeaderType(op opType) opType { switch op { case opInt: return opStructFieldHeadInt @@ -601,118 +370,7 @@ func (e *Encoder) optimizeStructHeader(op opType, isOmitEmpty, withIndent bool) return opStructFieldHead } -func (e *Encoder) optimizeStructFieldOmitEmptyIndent(op opType) opType { - switch op { - case opInt: - return opStructFieldIntOmitEmptyIndent - case opInt8: - return opStructFieldInt8OmitEmptyIndent - case opInt16: - return opStructFieldInt16OmitEmptyIndent - case opInt32: - return opStructFieldInt32OmitEmptyIndent - case opInt64: - return opStructFieldInt64OmitEmptyIndent - case opUint: - return opStructFieldUintOmitEmptyIndent - case opUint8: - return opStructFieldUint8OmitEmptyIndent - case opUint16: - return opStructFieldUint16OmitEmptyIndent - case opUint32: - return opStructFieldUint32OmitEmptyIndent - case opUint64: - return opStructFieldUint64OmitEmptyIndent - case opFloat32: - return opStructFieldFloat32OmitEmptyIndent - case opFloat64: - return opStructFieldFloat64OmitEmptyIndent - case opString: - return opStructFieldStringOmitEmptyIndent - case opBool: - return opStructFieldBoolOmitEmptyIndent - } - return opStructFieldOmitEmptyIndent -} - -func (e *Encoder) optimizeStructFieldIndent(op opType, isOmitEmpty bool) opType { - if isOmitEmpty { - return e.optimizeStructFieldOmitEmptyIndent(op) - } - switch op { - case opInt: - return opStructFieldIntIndent - case opInt8: - return opStructFieldInt8Indent - case opInt16: - return opStructFieldInt16Indent - case opInt32: - return opStructFieldInt32Indent - case opInt64: - return opStructFieldInt64Indent - case opUint: - return opStructFieldUintIndent - case opUint8: - return opStructFieldUint8Indent - case opUint16: - return opStructFieldUint16Indent - case opUint32: - return opStructFieldUint32Indent - case opUint64: - return opStructFieldUint64Indent - case opFloat32: - return opStructFieldFloat32Indent - case opFloat64: - return opStructFieldFloat64Indent - case opString: - return opStructFieldStringIndent - case opBool: - return opStructFieldBoolIndent - } - return opStructFieldIndent -} - -func (e *Encoder) optimizeStructFieldOmitEmpty(op opType) opType { - switch op { - case opInt: - return opStructFieldIntOmitEmpty - case opInt8: - return opStructFieldInt8OmitEmpty - case opInt16: - return opStructFieldInt16OmitEmpty - case opInt32: - return opStructFieldInt32OmitEmpty - case opInt64: - return opStructFieldInt64OmitEmpty - case opUint: - return opStructFieldUintOmitEmpty - case opUint8: - return opStructFieldUint8OmitEmpty - case opUint16: - return opStructFieldUint16OmitEmpty - case opUint32: - return opStructFieldUint32OmitEmpty - case opUint64: - return opStructFieldUint64OmitEmpty - case opFloat32: - return opStructFieldFloat32OmitEmpty - case opFloat64: - return opStructFieldFloat64OmitEmpty - case opString: - return opStructFieldStringOmitEmpty - case opBool: - return opStructFieldBoolOmitEmpty - } - return opStructFieldOmitEmpty -} - -func (e *Encoder) optimizeStructField(op opType, isOmitEmpty, withIndent bool) opType { - if withIndent { - return e.optimizeStructFieldIndent(op, isOmitEmpty) - } - if isOmitEmpty { - return e.optimizeStructFieldOmitEmpty(op) - } +func (e *Encoder) typeToFieldType(op opType) opType { switch op { case opInt: return opStructFieldInt @@ -746,33 +404,102 @@ func (e *Encoder) optimizeStructField(op opType, isOmitEmpty, withIndent bool) o return opStructField } -func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, error) { +func (e *Encoder) optimizeStructHeader(op opType, isOmitEmpty, withIndent bool) opType { + headType := e.typeToHeaderType(op) + if isOmitEmpty { + headType = headType.headToOmitEmptyHead() + } + if withIndent { + return headType.toIndent() + } + return headType +} + +func (e *Encoder) optimizeStructField(op opType, isOmitEmpty, withIndent bool) opType { + fieldType := e.typeToFieldType(op) + if isOmitEmpty { + fieldType = fieldType.fieldToOmitEmptyField() + } + if withIndent { + return fieldType.toIndent() + } + return fieldType +} + +func (e *Encoder) recursiveCode(typ *rtype, code *compiledCode) *opcode { + return (*opcode)(unsafe.Pointer(&recursiveCode{ + opcodeHeader: &opcodeHeader{ + op: opStructFieldRecursive, + typ: typ, + indent: e.indent, + next: newEndOp(e.indent), + }, + jmp: code, + })) +} + +func (e *Encoder) compiledCode(typ *rtype, withIndent bool) *opcode { typeptr := uintptr(unsafe.Pointer(typ)) if withIndent { - if compiled, exists := e.structTypeToCompiledIndentCode[typeptr]; exists { - return (*opcode)(unsafe.Pointer(&recursiveCode{ - opcodeHeader: &opcodeHeader{ - op: opStructFieldRecursive, - typ: typ, - indent: e.indent, - next: newEndOp(e.indent), - }, - jmp: compiled, - })), nil + if compiledCode, exists := e.structTypeToCompiledIndentCode[typeptr]; exists { + return e.recursiveCode(typ, compiledCode) } } else { - if compiled, exists := e.structTypeToCompiledCode[typeptr]; exists { - return (*opcode)(unsafe.Pointer(&recursiveCode{ - opcodeHeader: &opcodeHeader{ - op: opStructFieldRecursive, - typ: typ, - indent: e.indent, - next: newEndOp(e.indent), - }, - jmp: compiled, - })), nil + if compiledCode, exists := e.structTypeToCompiledCode[typeptr]; exists { + return e.recursiveCode(typ, compiledCode) } } + return nil +} + +func (e *Encoder) keyNameAndOmitEmptyFromField(field reflect.StructField) (string, bool) { + keyName := field.Name + tag := e.getTag(field) + opts := strings.Split(tag, ",") + if len(opts) > 0 { + if opts[0] != "" { + keyName = opts[0] + } + } + isOmitEmpty := false + if len(opts) > 1 { + isOmitEmpty = opts[1] == "omitempty" + } + return keyName, isOmitEmpty +} + +func (e *Encoder) structHeader(fieldCode *structFieldCode, valueCode *opcode, isOmitEmpty, withIndent bool) *opcode { + fieldCode.indent-- + op := e.optimizeStructHeader(valueCode.op, isOmitEmpty, withIndent) + fieldCode.op = op + switch op { + case opStructFieldHead, + opStructFieldHeadOmitEmpty, + opStructFieldHeadIndent, + opStructFieldHeadOmitEmptyIndent: + return valueCode.beforeLastCode() + } + return (*opcode)(unsafe.Pointer(fieldCode)) +} + +func (e *Encoder) structField(fieldCode *structFieldCode, valueCode *opcode, isOmitEmpty, withIndent bool) *opcode { + code := (*opcode)(unsafe.Pointer(fieldCode)) + op := e.optimizeStructField(valueCode.op, isOmitEmpty, withIndent) + fieldCode.op = op + switch op { + case opStructField, + opStructFieldOmitEmpty, + opStructFieldIndent, + opStructFieldOmitEmptyIndent: + return valueCode.beforeLastCode() + } + return code +} +func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, error) { + if code := e.compiledCode(typ, withIndent); code != nil { + return code, nil + } + typeptr := uintptr(unsafe.Pointer(typ)) compiled := &compiledCode{} if withIndent { e.structTypeToCompiledIndentCode[typeptr] = compiled @@ -795,23 +522,25 @@ func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, err if e.isIgnoredStructField(field) { continue } - keyName := field.Name - tag := e.getTag(field) - opts := strings.Split(tag, ",") - if len(opts) > 0 { - if opts[0] != "" { - keyName = opts[0] - } - } - isOmitEmpty := false - if len(opts) > 1 { - isOmitEmpty = opts[1] == "omitempty" - } + keyName, isOmitEmpty := e.keyNameAndOmitEmptyFromField(field) fieldType := type2rtype(field.Type) valueCode, err := e.compile(fieldType, false, withIndent) if err != nil { return nil, err } + if field.Anonymous { + f := valueCode.toStructFieldCode() + for { + f.op = f.op.headToAnonymousHead() + if f.op == opStructEnd { + f.op = opStructAnonymousEnd + } + if f.nextField == nil { + break + } + f = f.nextField.toStructFieldCode() + } + } key := fmt.Sprintf(`"%s":`, keyName) fieldCode := &structFieldCode{ opcodeHeader: &opcodeHeader{ @@ -819,44 +548,33 @@ func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, err next: valueCode, indent: e.indent, }, - key: []byte(key), - offset: field.Offset, + anonymousKey: field.Anonymous, + key: []byte(key), + offset: field.Offset, } if fieldIdx == 0 { - fieldCode.indent-- + code = e.structHeader(fieldCode, valueCode, isOmitEmpty, withIndent) head = fieldCode - code = (*opcode)(unsafe.Pointer(fieldCode)) prevField = fieldCode - op := e.optimizeStructHeader(valueCode.op, isOmitEmpty, withIndent) - fieldCode.op = op - switch op { - case opStructFieldHead, - opStructFieldHeadOmitEmpty, - opStructFieldHeadIndent, - opStructFieldHeadOmitEmptyIndent: - code = valueCode.beforeLastCode() - } } else { - code.next = (*opcode)(unsafe.Pointer(fieldCode)) - prevField.nextField = (*opcode)(unsafe.Pointer(fieldCode)) + fcode := (*opcode)(unsafe.Pointer(fieldCode)) + code.next = fcode + code = e.structField(fieldCode, valueCode, isOmitEmpty, withIndent) + prevField.nextField = fcode prevField = fieldCode - code = (*opcode)(unsafe.Pointer(fieldCode)) - op := e.optimizeStructField(valueCode.op, isOmitEmpty, withIndent) - fieldCode.op = op - switch op { - case opStructField, - opStructFieldOmitEmpty, - opStructFieldIndent, - opStructFieldOmitEmptyIndent: - code = valueCode.beforeLastCode() - } } fieldIdx++ } e.indent-- - structEndCode := newOpCode(opStructEnd, nil, e.indent, nil) - + structEndCode := (*opcode)(unsafe.Pointer(&structFieldCode{ + opcodeHeader: &opcodeHeader{ + op: opStructEnd, + typ: nil, + indent: e.indent, + }, + })) + structEndCode.next = newEndOp(e.indent) if withIndent { structEndCode.op = opStructEndIndent } @@ -882,7 +600,6 @@ func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, err } head.end = structEndCode code.next = structEndCode - structEndCode.next = newEndOp(e.indent) ret := (*opcode)(unsafe.Pointer(head)) compiled.code = ret return ret, nil diff --git a/encode_opcode.go b/encode_opcode.go index f254706..f67065e 100644 --- a/encode_opcode.go +++ b/encode_opcode.go @@ -7,746 +7,6 @@ import ( "unsafe" ) -type opType int - -const ( - opEnd opType = iota - opInt - opInt8 - opInt16 - opInt32 - opInt64 - opUint - opUint8 - opUint16 - opUint32 - opUint64 - opFloat32 - opFloat64 - opString - opBool - opInterface - opPtr - opMarshalJSON - opMarshalText - - opSliceHead - opSliceElem - opSliceEnd - - opSliceHeadIndent - opRootSliceHeadIndent - opSliceElemIndent - opRootSliceElemIndent - opSliceEndIndent - - opArrayHead - opArrayElem - opArrayEnd - - opArrayHeadIndent - opArrayElemIndent - opArrayEndIndent - - opMapHead - opMapHeadLoad - opMapKey - opMapValue - - opMapHeadIndent - opRootMapHeadIndent - opMapHeadLoadIndent - opMapKeyIndent - opRootMapKeyIndent - opMapValueIndent - opMapEnd - opMapEndIndent - - // StructFieldHead - opStructFieldHead - opStructFieldHeadInt - opStructFieldHeadInt8 - opStructFieldHeadInt16 - opStructFieldHeadInt32 - opStructFieldHeadInt64 - opStructFieldHeadUint - opStructFieldHeadUint8 - opStructFieldHeadUint16 - opStructFieldHeadUint32 - opStructFieldHeadUint64 - opStructFieldHeadFloat32 - opStructFieldHeadFloat64 - opStructFieldHeadString - opStructFieldHeadBool - - opStructFieldHeadIndent - opStructFieldHeadIntIndent - opStructFieldHeadInt8Indent - opStructFieldHeadInt16Indent - opStructFieldHeadInt32Indent - opStructFieldHeadInt64Indent - opStructFieldHeadUintIndent - opStructFieldHeadUint8Indent - opStructFieldHeadUint16Indent - opStructFieldHeadUint32Indent - opStructFieldHeadUint64Indent - opStructFieldHeadFloat32Indent - opStructFieldHeadFloat64Indent - opStructFieldHeadStringIndent - opStructFieldHeadBoolIndent - - // StructFieldHead with omitempty - opStructFieldHeadOmitEmpty - opStructFieldHeadIntOmitEmpty - opStructFieldHeadInt8OmitEmpty - opStructFieldHeadInt16OmitEmpty - opStructFieldHeadInt32OmitEmpty - opStructFieldHeadInt64OmitEmpty - opStructFieldHeadUintOmitEmpty - opStructFieldHeadUint8OmitEmpty - opStructFieldHeadUint16OmitEmpty - opStructFieldHeadUint32OmitEmpty - opStructFieldHeadUint64OmitEmpty - opStructFieldHeadFloat32OmitEmpty - opStructFieldHeadFloat64OmitEmpty - opStructFieldHeadStringOmitEmpty - opStructFieldHeadBoolOmitEmpty - - opStructFieldHeadOmitEmptyIndent - opStructFieldHeadIntOmitEmptyIndent - opStructFieldHeadInt8OmitEmptyIndent - opStructFieldHeadInt16OmitEmptyIndent - opStructFieldHeadInt32OmitEmptyIndent - opStructFieldHeadInt64OmitEmptyIndent - opStructFieldHeadUintOmitEmptyIndent - opStructFieldHeadUint8OmitEmptyIndent - opStructFieldHeadUint16OmitEmptyIndent - opStructFieldHeadUint32OmitEmptyIndent - opStructFieldHeadUint64OmitEmptyIndent - opStructFieldHeadFloat32OmitEmptyIndent - opStructFieldHeadFloat64OmitEmptyIndent - opStructFieldHeadStringOmitEmptyIndent - opStructFieldHeadBoolOmitEmptyIndent - - // StructFieldHead for pointer structure - opStructFieldPtrHead - opStructFieldPtrHeadInt - opStructFieldPtrHeadInt8 - opStructFieldPtrHeadInt16 - opStructFieldPtrHeadInt32 - opStructFieldPtrHeadInt64 - opStructFieldPtrHeadUint - opStructFieldPtrHeadUint8 - opStructFieldPtrHeadUint16 - opStructFieldPtrHeadUint32 - opStructFieldPtrHeadUint64 - opStructFieldPtrHeadFloat32 - opStructFieldPtrHeadFloat64 - opStructFieldPtrHeadString - opStructFieldPtrHeadBool - - opStructFieldRecursive - - opStructFieldPtrHeadIndent - opStructFieldPtrHeadIntIndent - opStructFieldPtrHeadInt8Indent - opStructFieldPtrHeadInt16Indent - opStructFieldPtrHeadInt32Indent - opStructFieldPtrHeadInt64Indent - opStructFieldPtrHeadUintIndent - opStructFieldPtrHeadUint8Indent - opStructFieldPtrHeadUint16Indent - opStructFieldPtrHeadUint32Indent - opStructFieldPtrHeadUint64Indent - opStructFieldPtrHeadFloat32Indent - opStructFieldPtrHeadFloat64Indent - opStructFieldPtrHeadStringIndent - opStructFieldPtrHeadBoolIndent - - // StructFieldPtrHead with omitempty - opStructFieldPtrHeadOmitEmpty - opStructFieldPtrHeadIntOmitEmpty - opStructFieldPtrHeadInt8OmitEmpty - opStructFieldPtrHeadInt16OmitEmpty - opStructFieldPtrHeadInt32OmitEmpty - opStructFieldPtrHeadInt64OmitEmpty - opStructFieldPtrHeadUintOmitEmpty - opStructFieldPtrHeadUint8OmitEmpty - opStructFieldPtrHeadUint16OmitEmpty - opStructFieldPtrHeadUint32OmitEmpty - opStructFieldPtrHeadUint64OmitEmpty - opStructFieldPtrHeadFloat32OmitEmpty - opStructFieldPtrHeadFloat64OmitEmpty - opStructFieldPtrHeadStringOmitEmpty - opStructFieldPtrHeadBoolOmitEmpty - - opStructFieldPtrHeadOmitEmptyIndent - opStructFieldPtrHeadIntOmitEmptyIndent - opStructFieldPtrHeadInt8OmitEmptyIndent - opStructFieldPtrHeadInt16OmitEmptyIndent - opStructFieldPtrHeadInt32OmitEmptyIndent - opStructFieldPtrHeadInt64OmitEmptyIndent - opStructFieldPtrHeadUintOmitEmptyIndent - opStructFieldPtrHeadUint8OmitEmptyIndent - opStructFieldPtrHeadUint16OmitEmptyIndent - opStructFieldPtrHeadUint32OmitEmptyIndent - opStructFieldPtrHeadUint64OmitEmptyIndent - opStructFieldPtrHeadFloat32OmitEmptyIndent - opStructFieldPtrHeadFloat64OmitEmptyIndent - opStructFieldPtrHeadStringOmitEmptyIndent - opStructFieldPtrHeadBoolOmitEmptyIndent - - // StructField - opStructField - opStructFieldInt - opStructFieldInt8 - opStructFieldInt16 - opStructFieldInt32 - opStructFieldInt64 - opStructFieldUint - opStructFieldUint8 - opStructFieldUint16 - opStructFieldUint32 - opStructFieldUint64 - opStructFieldFloat32 - opStructFieldFloat64 - opStructFieldString - opStructFieldBool - - opStructFieldIndent - opStructFieldIntIndent - opStructFieldInt8Indent - opStructFieldInt16Indent - opStructFieldInt32Indent - opStructFieldInt64Indent - opStructFieldUintIndent - opStructFieldUint8Indent - opStructFieldUint16Indent - opStructFieldUint32Indent - opStructFieldUint64Indent - opStructFieldFloat32Indent - opStructFieldFloat64Indent - opStructFieldStringIndent - opStructFieldBoolIndent - - // StructField with omitempty - opStructFieldOmitEmpty - opStructFieldIntOmitEmpty - opStructFieldInt8OmitEmpty - opStructFieldInt16OmitEmpty - opStructFieldInt32OmitEmpty - opStructFieldInt64OmitEmpty - opStructFieldUintOmitEmpty - opStructFieldUint8OmitEmpty - opStructFieldUint16OmitEmpty - opStructFieldUint32OmitEmpty - opStructFieldUint64OmitEmpty - opStructFieldFloat32OmitEmpty - opStructFieldFloat64OmitEmpty - opStructFieldStringOmitEmpty - opStructFieldBoolOmitEmpty - - opStructFieldOmitEmptyIndent - opStructFieldIntOmitEmptyIndent - opStructFieldInt8OmitEmptyIndent - opStructFieldInt16OmitEmptyIndent - opStructFieldInt32OmitEmptyIndent - opStructFieldInt64OmitEmptyIndent - opStructFieldUintOmitEmptyIndent - opStructFieldUint8OmitEmptyIndent - opStructFieldUint16OmitEmptyIndent - opStructFieldUint32OmitEmptyIndent - opStructFieldUint64OmitEmptyIndent - opStructFieldFloat32OmitEmptyIndent - opStructFieldFloat64OmitEmptyIndent - opStructFieldStringOmitEmptyIndent - opStructFieldBoolOmitEmptyIndent - - opStructEnd - opStructEndIndent -) - -func (t opType) String() string { - switch t { - case opEnd: - return "END" - case opInt: - return "INT" - case opInt8: - return "INT8" - case opInt16: - return "INT16" - case opInt32: - return "INT32" - case opInt64: - return "INT64" - case opUint: - return "UINT" - case opUint8: - return "UINT8" - case opUint16: - return "UINT16" - case opUint32: - return "UINT32" - case opUint64: - return "UINT64" - case opFloat32: - return "FLOAT32" - case opFloat64: - return "FLOAT64" - case opString: - return "STRING" - case opBool: - return "BOOL" - case opInterface: - return "INTERFACE" - case opPtr: - return "PTR" - case opMarshalJSON: - return "MARSHAL_JSON" - case opMarshalText: - return "MARSHAL_TEXT" - - case opSliceHead: - return "SLICE_HEAD" - case opSliceElem: - return "SLICE_ELEM" - case opSliceEnd: - return "SLICE_END" - - case opSliceHeadIndent: - return "SLICE_HEAD_INDENT" - case opRootSliceHeadIndent: - return "ROOT_SLICE_HEAD_INDENT" - case opSliceElemIndent: - return "SLICE_ELEM_INDENT" - case opRootSliceElemIndent: - return "ROOT_SLICE_ELEM_INDENT" - case opSliceEndIndent: - return "SLICE_END_INDENT" - - case opArrayHead: - return "ARRAY_HEAD" - case opArrayElem: - return "ARRAY_ELEM" - case opArrayEnd: - return "ARRAY_END" - - case opArrayHeadIndent: - return "ARRAY_HEAD_INDENT" - case opArrayElemIndent: - return "ARRAY_ELEM_INDENT" - case opArrayEndIndent: - return "ARRAY_END_INDENT" - case opMapHead: - return "MAP_HEAD" - case opMapHeadLoad: - return "MAP_HEAD_LOAD" - case opMapKey: - return "MAP_KEY" - case opMapValue: - return "MAP_VALUE" - case opMapEnd: - return "MAP_END" - - case opMapHeadIndent: - return "MAP_HEAD_INDENT" - case opRootMapHeadIndent: - return "ROOT_MAP_HEAD_INDENT" - case opMapHeadLoadIndent: - return "MAP_HEAD_LOAD_INDENT" - case opMapKeyIndent: - return "MAP_KEY_INDENT" - case opRootMapKeyIndent: - return "ROOT_MAP_KEY_INDENT" - case opMapValueIndent: - return "MAP_VALUE_INDENT" - case opMapEndIndent: - return "MAP_END_INDENT" - - case opStructFieldRecursive: - return "STRUCT_FIELD_RECURSIVE" - case opStructFieldHead: - return "STRUCT_FIELD_HEAD" - case opStructFieldHeadInt: - return "STRUCT_FIELD_HEAD_INT" - case opStructFieldHeadInt8: - return "STRUCT_FIELD_HEAD_INT8" - case opStructFieldHeadInt16: - return "STRUCT_FIELD_HEAD_INT16" - case opStructFieldHeadInt32: - return "STRUCT_FIELD_HEAD_INT32" - case opStructFieldHeadInt64: - return "STRUCT_FIELD_HEAD_INT64" - case opStructFieldHeadUint: - return "STRUCT_FIELD_HEAD_UINT" - case opStructFieldHeadUint8: - return "STRUCT_FIELD_HEAD_UINT8" - case opStructFieldHeadUint16: - return "STRUCT_FIELD_HEAD_UINT16" - case opStructFieldHeadUint32: - return "STRUCT_FIELD_HEAD_UINT32" - case opStructFieldHeadUint64: - return "STRUCT_FIELD_HEAD_UINT64" - case opStructFieldHeadFloat32: - return "STRUCT_FIELD_HEAD_FLOAT32" - case opStructFieldHeadFloat64: - return "STRUCT_FIELD_HEAD_FLOAT64" - case opStructFieldHeadString: - return "STRUCT_FIELD_HEAD_STRING" - case opStructFieldHeadBool: - return "STRUCT_FIELD_HEAD_BOOL" - - case opStructFieldHeadIndent: - return "STRUCT_FIELD_HEAD_INDENT" - case opStructFieldHeadIntIndent: - return "STRUCT_FIELD_HEAD_INT_INDENT" - case opStructFieldHeadInt8Indent: - return "STRUCT_FIELD_HEAD_INT8_INDENT" - case opStructFieldHeadInt16Indent: - return "STRUCT_FIELD_HEAD_INT16_INDENT" - case opStructFieldHeadInt32Indent: - return "STRUCT_FIELD_HEAD_INT32_INDENT" - case opStructFieldHeadInt64Indent: - return "STRUCT_FIELD_HEAD_INT64_INDENT" - case opStructFieldHeadUintIndent: - return "STRUCT_FIELD_HEAD_UINT_INDENT" - case opStructFieldHeadUint8Indent: - return "STRUCT_FIELD_HEAD_UINT8_INDENT" - case opStructFieldHeadUint16Indent: - return "STRUCT_FIELD_HEAD_UINT16_INDENT" - case opStructFieldHeadUint32Indent: - return "STRUCT_FIELD_HEAD_UINT32_INDENT" - case opStructFieldHeadUint64Indent: - return "STRUCT_FIELD_HEAD_UINT64_INDENT" - case opStructFieldHeadFloat32Indent: - return "STRUCT_FIELD_HEAD_FLOAT32_INDENT" - case opStructFieldHeadFloat64Indent: - return "STRUCT_FIELD_HEAD_FLOAT64_INDENT" - case opStructFieldHeadStringIndent: - return "STRUCT_FIELD_HEAD_STRING_INDENT" - case opStructFieldHeadBoolIndent: - return "STRUCT_FIELD_HEAD_BOOL_INDENT" - - case opStructFieldHeadOmitEmpty: - return "STRUCT_FIELD_HEAD_OMIT_EMPTY" - case opStructFieldHeadIntOmitEmpty: - return "STRUCT_FIELD_HEAD_INT_OMIT_EMPTY" - case opStructFieldHeadInt8OmitEmpty: - return "STRUCT_FIELD_HEAD_INT8_OMIT_EMPTY" - case opStructFieldHeadInt16OmitEmpty: - return "STRUCT_FIELD_HEAD_INT16_OMIT_EMPTY" - case opStructFieldHeadInt32OmitEmpty: - return "STRUCT_FIELD_HEAD_INT32_OMIT_EMPTY" - case opStructFieldHeadInt64OmitEmpty: - return "STRUCT_FIELD_HEAD_INT64_OMIT_EMPTY" - case opStructFieldHeadUintOmitEmpty: - return "STRUCT_FIELD_HEAD_UINT_OMIT_EMPTY" - case opStructFieldHeadUint8OmitEmpty: - return "STRUCT_FIELD_HEAD_UINT8_OMIT_EMPTY" - case opStructFieldHeadUint16OmitEmpty: - return "STRUCT_FIELD_HEAD_UINT16_OMIT_EMPTY" - case opStructFieldHeadUint32OmitEmpty: - return "STRUCT_FIELD_HEAD_UINT32_OMIT_EMPTY" - case opStructFieldHeadUint64OmitEmpty: - return "STRUCT_FIELD_HEAD_UINT64_OMIT_EMPTY" - case opStructFieldHeadFloat32OmitEmpty: - return "STRUCT_FIELD_HEAD_FLOAT32_OMIT_EMPTY" - case opStructFieldHeadFloat64OmitEmpty: - return "STRUCT_FIELD_HEAD_FLOAT64_OMIT_EMPTY" - case opStructFieldHeadStringOmitEmpty: - return "STRUCT_FIELD_HEAD_STRING_OMIT_EMPTY" - case opStructFieldHeadBoolOmitEmpty: - return "STRUCT_FIELD_HEAD_BOOL_OMIT_EMPTY" - - case opStructFieldHeadOmitEmptyIndent: - return "STRUCT_FIELD_HEAD_OMIT_EMPTY_INDENT" - case opStructFieldHeadIntOmitEmptyIndent: - return "STRUCT_FIELD_HEAD_INT_OMIT_EMPTY_INDENT" - case opStructFieldHeadInt8OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_INT8_OMIT_EMPTY_INDENT" - case opStructFieldHeadInt16OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_INT16_OMIT_EMPTY_INDENT" - case opStructFieldHeadInt32OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_INT32_OMIT_EMPTY_INDENT" - case opStructFieldHeadInt64OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_INT64_OMIT_EMPTY_INDENT" - case opStructFieldHeadUintOmitEmptyIndent: - return "STRUCT_FIELD_HEAD_UINT_OMIT_EMPTY_INDENT" - case opStructFieldHeadUint8OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_UINT8_OMIT_EMPTY_INDENT" - case opStructFieldHeadUint16OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_UINT16_OMIT_EMPTY_INDENT" - case opStructFieldHeadUint32OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_UINT32_OMIT_EMPTY_INDENT" - case opStructFieldHeadUint64OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_UINT64_OMIT_EMPTY_INDENT" - case opStructFieldHeadFloat32OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_FLOAT32_OMIT_EMPTY_INDENT" - case opStructFieldHeadFloat64OmitEmptyIndent: - return "STRUCT_FIELD_HEAD_FLOAT64_OMIT_EMPTY_INDENT" - case opStructFieldHeadStringOmitEmptyIndent: - return "STRUCT_FIELD_HEAD_STRING_OMIT_EMPTY_INDENT" - case opStructFieldHeadBoolOmitEmptyIndent: - return "STRUCT_FIELD_HEAD_BOOL_OMIT_EMPTY_INDENT" - - case opStructFieldPtrHead: - return "STRUCT_FIELD_PTR_HEAD" - case opStructFieldPtrHeadInt: - return "STRUCT_FIELD_PTR_HEAD_INT" - case opStructFieldPtrHeadInt8: - return "STRUCT_FIELD_PTR_HEAD_INT8" - case opStructFieldPtrHeadInt16: - return "STRUCT_FIELD_PTR_HEAD_INT16" - case opStructFieldPtrHeadInt32: - return "STRUCT_FIELD_PTR_HEAD_INT32" - case opStructFieldPtrHeadInt64: - return "STRUCT_FIELD_PTR_HEAD_INT64" - case opStructFieldPtrHeadUint: - return "STRUCT_FIELD_PTR_HEAD_UINT" - case opStructFieldPtrHeadUint8: - return "STRUCT_FIELD_PTR_HEAD_UINT8" - case opStructFieldPtrHeadUint16: - return "STRUCT_FIELD_PTR_HEAD_UINT16" - case opStructFieldPtrHeadUint32: - return "STRUCT_FIELD_PTR_HEAD_UINT32" - case opStructFieldPtrHeadUint64: - return "STRUCT_FIELD_PTR_HEAD_UINT64" - case opStructFieldPtrHeadFloat32: - return "STRUCT_FIELD_PTR_HEAD_FLOAT32" - case opStructFieldPtrHeadFloat64: - return "STRUCT_FIELD_PTR_HEAD_FLOAT64" - case opStructFieldPtrHeadString: - return "STRUCT_FIELD_PTR_HEAD_STRING" - case opStructFieldPtrHeadBool: - return "STRUCT_FIELD_PTR_HEAD_BOOL" - - case opStructFieldPtrHeadIndent: - return "STRUCT_FIELD_PTR_HEAD_INDENT" - case opStructFieldPtrHeadIntIndent: - return "STRUCT_FIELD_PTR_HEAD_INT_INDENT" - case opStructFieldPtrHeadInt8Indent: - return "STRUCT_FIELD_PTR_HEAD_INT8_INDENT" - case opStructFieldPtrHeadInt16Indent: - return "STRUCT_FIELD_PTR_HEAD_INT16_INDENT" - case opStructFieldPtrHeadInt32Indent: - return "STRUCT_FIELD_PTR_HEAD_INT32_INDENT" - case opStructFieldPtrHeadInt64Indent: - return "STRUCT_FIELD_PTR_HEAD_INT64_INDENT" - case opStructFieldPtrHeadUintIndent: - return "STRUCT_FIELD_PTR_HEAD_UINT_INDENT" - case opStructFieldPtrHeadUint8Indent: - return "STRUCT_FIELD_PTR_HEAD_UINT8_INDENT" - case opStructFieldPtrHeadUint16Indent: - return "STRUCT_FIELD_PTR_HEAD_UINT16_INDENT" - case opStructFieldPtrHeadUint32Indent: - return "STRUCT_FIELD_PTR_HEAD_UINT32_INDENT" - case opStructFieldPtrHeadUint64Indent: - return "STRUCT_FIELD_PTR_HEAD_UINT64_INDENT" - case opStructFieldPtrHeadFloat32Indent: - return "STRUCT_FIELD_PTR_HEAD_FLOAT32_INDENT" - case opStructFieldPtrHeadFloat64Indent: - return "STRUCT_FIELD_PTR_HEAD_FLOAT64_INDENT" - case opStructFieldPtrHeadStringIndent: - return "STRUCT_FIELD_PTR_HEAD_STRING_INDENT" - case opStructFieldPtrHeadBoolIndent: - return "STRUCT_FIELD_PTR_HEAD_BOOL_INDENT" - - case opStructFieldPtrHeadOmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_OMIT_EMPTY" - case opStructFieldPtrHeadIntOmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_INT_OMIT_EMPTY" - case opStructFieldPtrHeadInt8OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_INT8_OMIT_EMPTY" - case opStructFieldPtrHeadInt16OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_INT16_OMIT_EMPTY" - case opStructFieldPtrHeadInt32OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_INT32_OMIT_EMPTY" - case opStructFieldPtrHeadInt64OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_INT64_OMIT_EMPTY" - case opStructFieldPtrHeadUintOmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_UINT_OMIT_EMPTY" - case opStructFieldPtrHeadUint8OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_UINT8_OMIT_EMPTY" - case opStructFieldPtrHeadUint16OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_UINT16_OMIT_EMPTY" - case opStructFieldPtrHeadUint32OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_UINT32_OMIT_EMPTY" - case opStructFieldPtrHeadUint64OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_UINT64_OMIT_EMPTY" - case opStructFieldPtrHeadFloat32OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_FLOAT32_OMIT_EMPTY" - case opStructFieldPtrHeadFloat64OmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_FLOAT64_OMIT_EMPTY" - case opStructFieldPtrHeadStringOmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_STRING_OMIT_EMPTY" - case opStructFieldPtrHeadBoolOmitEmpty: - return "STRUCT_FIELD_PTR_HEAD_BOOL_OMIT_EMPTY" - - case opStructFieldPtrHeadOmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadIntOmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_INT_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadInt8OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_INT8_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadInt16OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_INT16_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadInt32OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_INT32_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadInt64OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_INT64_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadUintOmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_UINT_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadUint8OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_UINT8_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadUint16OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_UINT16_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadUint32OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_UINT32_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadUint64OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_UINT64_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadFloat32OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_FLOAT32_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadFloat64OmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_FLOAT64_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadStringOmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_STRING_OMIT_EMPTY_INDENT" - case opStructFieldPtrHeadBoolOmitEmptyIndent: - return "STRUCT_FIELD_PTR_HEAD_BOOL_OMIT_EMPTY_INDENT" - - case opStructField: - return "STRUCT_FIELD" - case opStructFieldInt: - return "STRUCT_FIELD_INT" - case opStructFieldInt8: - return "STRUCT_FIELD_INT8" - case opStructFieldInt16: - return "STRUCT_FIELD_INT16" - case opStructFieldInt32: - return "STRUCT_FIELD_INT32" - case opStructFieldInt64: - return "STRUCT_FIELD_INT64" - case opStructFieldUint: - return "STRUCT_FIELD_UINT" - case opStructFieldUint8: - return "STRUCT_FIELD_UINT8" - case opStructFieldUint16: - return "STRUCT_FIELD_UINT16" - case opStructFieldUint32: - return "STRUCT_FIELD_UINT32" - case opStructFieldUint64: - return "STRUCT_FIELD_UINT64" - case opStructFieldFloat32: - return "STRUCT_FIELD_FLOAT32" - case opStructFieldFloat64: - return "STRUCT_FIELD_FLOAT64" - case opStructFieldString: - return "STRUCT_FIELD_STRING" - case opStructFieldBool: - return "STRUCT_FIELD_BOOL" - - case opStructFieldIndent: - return "STRUCT_FIELD_INDENT" - case opStructFieldIntIndent: - return "STRUCT_FIELD_INT_INDENT" - case opStructFieldInt8Indent: - return "STRUCT_FIELD_INT8_INDENT" - case opStructFieldInt16Indent: - return "STRUCT_FIELD_INT16_INDENT" - case opStructFieldInt32Indent: - return "STRUCT_FIELD_INT32_INDENT" - case opStructFieldInt64Indent: - return "STRUCT_FIELD_INT64_INDENT" - case opStructFieldUintIndent: - return "STRUCT_FIELD_UINT_INDENT" - case opStructFieldUint8Indent: - return "STRUCT_FIELD_UINT8_INDENT" - case opStructFieldUint16Indent: - return "STRUCT_FIELD_UINT16_INDENT" - case opStructFieldUint32Indent: - return "STRUCT_FIELD_UINT32_INDENT" - case opStructFieldUint64Indent: - return "STRUCT_FIELD_UINT64_INDENT" - case opStructFieldFloat32Indent: - return "STRUCT_FIELD_FLOAT32_INDENT" - case opStructFieldFloat64Indent: - return "STRUCT_FIELD_FLOAT64_INDENT" - case opStructFieldStringIndent: - return "STRUCT_FIELD_STRING_INDENT" - case opStructFieldBoolIndent: - return "STRUCT_FIELD_BOOL_INDENT" - - case opStructFieldOmitEmpty: - return "STRUCT_FIELD_OMIT_EMPTY" - case opStructFieldIntOmitEmpty: - return "STRUCT_FIELD_INT_OMIT_EMPTY" - case opStructFieldInt8OmitEmpty: - return "STRUCT_FIELD_INT8_OMIT_EMPTY" - case opStructFieldInt16OmitEmpty: - return "STRUCT_FIELD_INT16_OMIT_EMPTY" - case opStructFieldInt32OmitEmpty: - return "STRUCT_FIELD_INT32_OMIT_EMPTY" - case opStructFieldInt64OmitEmpty: - return "STRUCT_FIELD_INT64_OMIT_EMPTY" - case opStructFieldUintOmitEmpty: - return "STRUCT_FIELD_UINT_OMIT_EMPTY" - case opStructFieldUint8OmitEmpty: - return "STRUCT_FIELD_UINT8_OMIT_EMPTY" - case opStructFieldUint16OmitEmpty: - return "STRUCT_FIELD_UINT16_OMIT_EMPTY" - case opStructFieldUint32OmitEmpty: - return "STRUCT_FIELD_UINT32_OMIT_EMPTY" - case opStructFieldUint64OmitEmpty: - return "STRUCT_FIELD_UINT64_OMIT_EMPTY" - case opStructFieldFloat32OmitEmpty: - return "STRUCT_FIELD_FLOAT32_OMIT_EMPTY" - case opStructFieldFloat64OmitEmpty: - return "STRUCT_FIELD_FLOAT64_OMIT_EMPTY" - case opStructFieldStringOmitEmpty: - return "STRUCT_FIELD_STRING_OMIT_EMPTY" - case opStructFieldBoolOmitEmpty: - return "STRUCT_FIELD_BOOL_OMIT_EMPTY" - - case opStructFieldOmitEmptyIndent: - return "STRUCT_FIELD_OMIT_EMPTY_INDENT" - case opStructFieldIntOmitEmptyIndent: - return "STRUCT_FIELD_INT_OMIT_EMPTY_INDENT" - case opStructFieldInt8OmitEmptyIndent: - return "STRUCT_FIELD_INT8_OMIT_EMPTY_INDENT" - case opStructFieldInt16OmitEmptyIndent: - return "STRUCT_FIELD_INT16_OMIT_EMPTY_INDENT" - case opStructFieldInt32OmitEmptyIndent: - return "STRUCT_FIELD_INT32_OMIT_EMPTY_INDENT" - case opStructFieldInt64OmitEmptyIndent: - return "STRUCT_FIELD_INT64_OMIT_EMPTY_INDENT" - case opStructFieldUintOmitEmptyIndent: - return "STRUCT_FIELD_UINT_OMIT_EMPTY_INDENT" - case opStructFieldUint8OmitEmptyIndent: - return "STRUCT_FIELD_UINT8_OMIT_EMPTY_INDENT" - case opStructFieldUint16OmitEmptyIndent: - return "STRUCT_FIELD_UINT16_OMIT_EMPTY_INDENT" - case opStructFieldUint32OmitEmptyIndent: - return "STRUCT_FIELD_UINT32_OMIT_EMPTY_INDENT" - case opStructFieldUint64OmitEmptyIndent: - return "STRUCT_FIELD_UINT64_OMIT_EMPTY_INDENT" - case opStructFieldFloat32OmitEmptyIndent: - return "STRUCT_FIELD_FLOAT32_OMIT_EMPTY_INDENT" - case opStructFieldFloat64OmitEmptyIndent: - return "STRUCT_FIELD_FLOAT64_OMIT_EMPTY_INDENT" - case opStructFieldStringOmitEmptyIndent: - return "STRUCT_FIELD_STRING_OMIT_EMPTY_INDENT" - case opStructFieldBoolOmitEmptyIndent: - return "STRUCT_FIELD_BOOL_OMIT_EMPTY_INDENT" - - case opStructEnd: - return "STRUCT_END" - case opStructEndIndent: - return "STRUCT_END_INDENT" - - } - return "" -} - func copyOpcode(code *opcode) *opcode { codeMap := map[uintptr]*opcode{} return code.copy(codeMap) @@ -820,203 +80,24 @@ func (c *opcode) copy(codeMap map[uintptr]*opcode) *opcode { return code } var code *opcode - switch c.op { - case opArrayHead, opArrayHeadIndent: + switch c.op.codeType() { + case codeArrayHead: code = c.toArrayHeaderCode().copy(codeMap) - case opArrayElem, opArrayElemIndent: + case codeArrayElem: code = c.toArrayElemCode().copy(codeMap) - case opSliceHead, opSliceHeadIndent, opRootSliceHeadIndent: + case codeSliceHead: code = c.toSliceHeaderCode().copy(codeMap) - case opSliceElem, opSliceElemIndent, opRootSliceElemIndent: + case codeSliceElem: code = c.toSliceElemCode().copy(codeMap) - case opMapHead, opMapHeadLoad, opMapHeadIndent, opMapHeadLoadIndent, opRootMapHeadIndent: + case codeMapHead: code = c.toMapHeadCode().copy(codeMap) - case opMapKey, opMapKeyIndent, opRootMapKeyIndent: + case codeMapKey: code = c.toMapKeyCode().copy(codeMap) - case opMapValue, opMapValueIndent: + case codeMapValue: code = c.toMapValueCode().copy(codeMap) - case opStructFieldRecursive: + case codeStructFieldRecursive: code = c.toRecursiveCode().copy(codeMap) - case opStructFieldHead, - opStructFieldHeadInt, - opStructFieldHeadInt8, - opStructFieldHeadInt16, - opStructFieldHeadInt32, - opStructFieldHeadInt64, - opStructFieldHeadUint, - opStructFieldHeadUint8, - opStructFieldHeadUint16, - opStructFieldHeadUint32, - opStructFieldHeadUint64, - opStructFieldHeadFloat32, - opStructFieldHeadFloat64, - opStructFieldHeadString, - opStructFieldHeadBool, - opStructFieldHeadIndent, - opStructFieldHeadIntIndent, - opStructFieldHeadInt8Indent, - opStructFieldHeadInt16Indent, - opStructFieldHeadInt32Indent, - opStructFieldHeadInt64Indent, - opStructFieldHeadUintIndent, - opStructFieldHeadUint8Indent, - opStructFieldHeadUint16Indent, - opStructFieldHeadUint32Indent, - opStructFieldHeadUint64Indent, - opStructFieldHeadFloat32Indent, - opStructFieldHeadFloat64Indent, - opStructFieldHeadStringIndent, - opStructFieldHeadBoolIndent, - opStructFieldHeadOmitEmpty, - opStructFieldHeadIntOmitEmpty, - opStructFieldHeadInt8OmitEmpty, - opStructFieldHeadInt16OmitEmpty, - opStructFieldHeadInt32OmitEmpty, - opStructFieldHeadInt64OmitEmpty, - opStructFieldHeadUintOmitEmpty, - opStructFieldHeadUint8OmitEmpty, - opStructFieldHeadUint16OmitEmpty, - opStructFieldHeadUint32OmitEmpty, - opStructFieldHeadUint64OmitEmpty, - opStructFieldHeadFloat32OmitEmpty, - opStructFieldHeadFloat64OmitEmpty, - opStructFieldHeadStringOmitEmpty, - opStructFieldHeadBoolOmitEmpty, - opStructFieldHeadOmitEmptyIndent, - opStructFieldHeadIntOmitEmptyIndent, - opStructFieldHeadInt8OmitEmptyIndent, - opStructFieldHeadInt16OmitEmptyIndent, - opStructFieldHeadInt32OmitEmptyIndent, - opStructFieldHeadInt64OmitEmptyIndent, - opStructFieldHeadUintOmitEmptyIndent, - opStructFieldHeadUint8OmitEmptyIndent, - opStructFieldHeadUint16OmitEmptyIndent, - opStructFieldHeadUint32OmitEmptyIndent, - opStructFieldHeadUint64OmitEmptyIndent, - opStructFieldHeadFloat32OmitEmptyIndent, - opStructFieldHeadFloat64OmitEmptyIndent, - opStructFieldHeadStringOmitEmptyIndent, - opStructFieldHeadBoolOmitEmptyIndent, - opStructFieldPtrHead, - opStructFieldPtrHeadInt, - opStructFieldPtrHeadInt8, - opStructFieldPtrHeadInt16, - opStructFieldPtrHeadInt32, - opStructFieldPtrHeadInt64, - opStructFieldPtrHeadUint, - opStructFieldPtrHeadUint8, - opStructFieldPtrHeadUint16, - opStructFieldPtrHeadUint32, - opStructFieldPtrHeadUint64, - opStructFieldPtrHeadFloat32, - opStructFieldPtrHeadFloat64, - opStructFieldPtrHeadString, - opStructFieldPtrHeadBool, - opStructFieldPtrHeadIndent, - opStructFieldPtrHeadIntIndent, - opStructFieldPtrHeadInt8Indent, - opStructFieldPtrHeadInt16Indent, - opStructFieldPtrHeadInt32Indent, - opStructFieldPtrHeadInt64Indent, - opStructFieldPtrHeadUintIndent, - opStructFieldPtrHeadUint8Indent, - opStructFieldPtrHeadUint16Indent, - opStructFieldPtrHeadUint32Indent, - opStructFieldPtrHeadUint64Indent, - opStructFieldPtrHeadFloat32Indent, - opStructFieldPtrHeadFloat64Indent, - opStructFieldPtrHeadStringIndent, - opStructFieldPtrHeadBoolIndent, - opStructFieldPtrHeadOmitEmpty, - opStructFieldPtrHeadIntOmitEmpty, - opStructFieldPtrHeadInt8OmitEmpty, - opStructFieldPtrHeadInt16OmitEmpty, - opStructFieldPtrHeadInt32OmitEmpty, - opStructFieldPtrHeadInt64OmitEmpty, - opStructFieldPtrHeadUintOmitEmpty, - opStructFieldPtrHeadUint8OmitEmpty, - opStructFieldPtrHeadUint16OmitEmpty, - opStructFieldPtrHeadUint32OmitEmpty, - opStructFieldPtrHeadUint64OmitEmpty, - opStructFieldPtrHeadFloat32OmitEmpty, - opStructFieldPtrHeadFloat64OmitEmpty, - opStructFieldPtrHeadStringOmitEmpty, - opStructFieldPtrHeadBoolOmitEmpty, - opStructFieldPtrHeadOmitEmptyIndent, - opStructFieldPtrHeadIntOmitEmptyIndent, - opStructFieldPtrHeadInt8OmitEmptyIndent, - opStructFieldPtrHeadInt16OmitEmptyIndent, - opStructFieldPtrHeadInt32OmitEmptyIndent, - opStructFieldPtrHeadInt64OmitEmptyIndent, - opStructFieldPtrHeadUintOmitEmptyIndent, - opStructFieldPtrHeadUint8OmitEmptyIndent, - opStructFieldPtrHeadUint16OmitEmptyIndent, - opStructFieldPtrHeadUint32OmitEmptyIndent, - opStructFieldPtrHeadUint64OmitEmptyIndent, - opStructFieldPtrHeadFloat32OmitEmptyIndent, - opStructFieldPtrHeadFloat64OmitEmptyIndent, - opStructFieldPtrHeadStringOmitEmptyIndent, - opStructFieldPtrHeadBoolOmitEmptyIndent, - opStructField, - opStructFieldInt, - opStructFieldInt8, - opStructFieldInt16, - opStructFieldInt32, - opStructFieldInt64, - opStructFieldUint, - opStructFieldUint8, - opStructFieldUint16, - opStructFieldUint32, - opStructFieldUint64, - opStructFieldFloat32, - opStructFieldFloat64, - opStructFieldString, - opStructFieldBool, - opStructFieldIndent, - opStructFieldIntIndent, - opStructFieldInt8Indent, - opStructFieldInt16Indent, - opStructFieldInt32Indent, - opStructFieldInt64Indent, - opStructFieldUintIndent, - opStructFieldUint8Indent, - opStructFieldUint16Indent, - opStructFieldUint32Indent, - opStructFieldUint64Indent, - opStructFieldFloat32Indent, - opStructFieldFloat64Indent, - opStructFieldStringIndent, - opStructFieldBoolIndent, - opStructFieldOmitEmpty, - opStructFieldIntOmitEmpty, - opStructFieldInt8OmitEmpty, - opStructFieldInt16OmitEmpty, - opStructFieldInt32OmitEmpty, - opStructFieldInt64OmitEmpty, - opStructFieldUintOmitEmpty, - opStructFieldUint8OmitEmpty, - opStructFieldUint16OmitEmpty, - opStructFieldUint32OmitEmpty, - opStructFieldUint64OmitEmpty, - opStructFieldFloat32OmitEmpty, - opStructFieldFloat64OmitEmpty, - opStructFieldStringOmitEmpty, - opStructFieldBoolOmitEmpty, - opStructFieldOmitEmptyIndent, - opStructFieldIntOmitEmptyIndent, - opStructFieldInt8OmitEmptyIndent, - opStructFieldInt16OmitEmptyIndent, - opStructFieldInt32OmitEmptyIndent, - opStructFieldInt64OmitEmptyIndent, - opStructFieldUintOmitEmptyIndent, - opStructFieldUint8OmitEmptyIndent, - opStructFieldUint16OmitEmptyIndent, - opStructFieldUint32OmitEmptyIndent, - opStructFieldUint64OmitEmptyIndent, - opStructFieldFloat32OmitEmptyIndent, - opStructFieldFloat64OmitEmptyIndent, - opStructFieldStringOmitEmptyIndent, - opStructFieldBoolOmitEmptyIndent: + case codeStructField: code = c.toStructFieldCode().copy(codeMap) default: code = &opcode{} @@ -1223,10 +304,11 @@ func (c *arrayElemCode) copy(codeMap map[uintptr]*opcode) *opcode { type structFieldCode struct { *opcodeHeader - key []byte - offset uintptr - nextField *opcode - end *opcode + key []byte + offset uintptr + anonymousKey bool + nextField *opcode + end *opcode } func (c *structFieldCode) copy(codeMap map[uintptr]*opcode) *opcode { @@ -1238,8 +320,9 @@ func (c *structFieldCode) copy(codeMap map[uintptr]*opcode) *opcode { return code } field := &structFieldCode{ - key: c.key, - offset: c.offset, + key: c.key, + anonymousKey: c.anonymousKey, + offset: c.offset, } code := (*opcode)(unsafe.Pointer(field)) codeMap[addr] = code @@ -1423,127 +506,6 @@ func newRecursiveCode(recursive *recursiveCode) *opcode { head.end.next = newEndOp(0) code.ptr = recursive.ptr - switch code.op { - case opStructFieldPtrHead: - code.op = opStructFieldHead - case opStructFieldPtrHeadInt: - code.op = opStructFieldHeadInt - case opStructFieldPtrHeadInt8: - code.op = opStructFieldHeadInt8 - case opStructFieldPtrHeadInt16: - code.op = opStructFieldHeadInt16 - case opStructFieldPtrHeadInt32: - code.op = opStructFieldHeadInt32 - case opStructFieldPtrHeadInt64: - code.op = opStructFieldHeadInt64 - case opStructFieldPtrHeadUint: - code.op = opStructFieldHeadUint - case opStructFieldPtrHeadUint8: - code.op = opStructFieldHeadUint8 - case opStructFieldPtrHeadUint16: - code.op = opStructFieldHeadUint16 - case opStructFieldPtrHeadUint32: - code.op = opStructFieldHeadUint32 - case opStructFieldPtrHeadUint64: - code.op = opStructFieldHeadUint64 - case opStructFieldPtrHeadFloat32: - code.op = opStructFieldHeadFloat32 - case opStructFieldPtrHeadFloat64: - code.op = opStructFieldHeadFloat64 - case opStructFieldPtrHeadString: - code.op = opStructFieldHeadString - case opStructFieldPtrHeadBool: - code.op = opStructFieldHeadBool - case opStructFieldPtrHeadIndent: - code.op = opStructFieldHeadIndent - case opStructFieldPtrHeadIntIndent: - code.op = opStructFieldHeadIntIndent - case opStructFieldPtrHeadInt8Indent: - code.op = opStructFieldHeadInt8Indent - case opStructFieldPtrHeadInt16Indent: - code.op = opStructFieldHeadInt16Indent - case opStructFieldPtrHeadInt32Indent: - code.op = opStructFieldHeadInt32Indent - case opStructFieldPtrHeadInt64Indent: - code.op = opStructFieldHeadInt64Indent - case opStructFieldPtrHeadUintIndent: - code.op = opStructFieldHeadUintIndent - case opStructFieldPtrHeadUint8Indent: - code.op = opStructFieldHeadUint8Indent - case opStructFieldPtrHeadUint16Indent: - code.op = opStructFieldHeadUint16Indent - case opStructFieldPtrHeadUint32Indent: - code.op = opStructFieldHeadUint32Indent - case opStructFieldPtrHeadUint64Indent: - code.op = opStructFieldHeadUint64Indent - case opStructFieldPtrHeadFloat32Indent: - code.op = opStructFieldHeadFloat32Indent - case opStructFieldPtrHeadFloat64Indent: - code.op = opStructFieldHeadFloat64Indent - case opStructFieldPtrHeadStringIndent: - code.op = opStructFieldHeadStringIndent - case opStructFieldPtrHeadBoolIndent: - code.op = opStructFieldHeadBoolIndent - case opStructFieldPtrHeadOmitEmpty: - code.op = opStructFieldHeadOmitEmpty - case opStructFieldPtrHeadIntOmitEmpty: - code.op = opStructFieldHeadIntOmitEmpty - case opStructFieldPtrHeadInt8OmitEmpty: - code.op = opStructFieldHeadInt8OmitEmpty - case opStructFieldPtrHeadInt16OmitEmpty: - code.op = opStructFieldHeadInt16OmitEmpty - case opStructFieldPtrHeadInt32OmitEmpty: - code.op = opStructFieldHeadInt32OmitEmpty - case opStructFieldPtrHeadInt64OmitEmpty: - code.op = opStructFieldHeadInt64OmitEmpty - case opStructFieldPtrHeadUintOmitEmpty: - code.op = opStructFieldHeadUintOmitEmpty - case opStructFieldPtrHeadUint8OmitEmpty: - code.op = opStructFieldHeadUint8OmitEmpty - case opStructFieldPtrHeadUint16OmitEmpty: - code.op = opStructFieldHeadUint16OmitEmpty - case opStructFieldPtrHeadUint32OmitEmpty: - code.op = opStructFieldHeadUint32OmitEmpty - case opStructFieldPtrHeadUint64OmitEmpty: - code.op = opStructFieldHeadUint64OmitEmpty - case opStructFieldPtrHeadFloat32OmitEmpty: - code.op = opStructFieldHeadFloat32OmitEmpty - case opStructFieldPtrHeadFloat64OmitEmpty: - code.op = opStructFieldHeadFloat64OmitEmpty - case opStructFieldPtrHeadStringOmitEmpty: - code.op = opStructFieldHeadStringOmitEmpty - case opStructFieldPtrHeadBoolOmitEmpty: - code.op = opStructFieldHeadBoolOmitEmpty - case opStructFieldPtrHeadOmitEmptyIndent: - code.op = opStructFieldHeadOmitEmptyIndent - case opStructFieldPtrHeadIntOmitEmptyIndent: - code.op = opStructFieldHeadIntOmitEmptyIndent - case opStructFieldPtrHeadInt8OmitEmptyIndent: - code.op = opStructFieldHeadInt8OmitEmptyIndent - case opStructFieldPtrHeadInt16OmitEmptyIndent: - code.op = opStructFieldHeadInt16OmitEmptyIndent - case opStructFieldPtrHeadInt32OmitEmptyIndent: - code.op = opStructFieldHeadInt32OmitEmptyIndent - case opStructFieldPtrHeadInt64OmitEmptyIndent: - code.op = opStructFieldHeadInt64OmitEmptyIndent - case opStructFieldPtrHeadUintOmitEmptyIndent: - code.op = opStructFieldHeadUintOmitEmptyIndent - case opStructFieldPtrHeadUint8OmitEmptyIndent: - code.op = opStructFieldHeadUint8OmitEmptyIndent - case opStructFieldPtrHeadUint16OmitEmptyIndent: - code.op = opStructFieldHeadUint16OmitEmptyIndent - case opStructFieldPtrHeadUint32OmitEmptyIndent: - code.op = opStructFieldHeadUint32OmitEmptyIndent - case opStructFieldPtrHeadUint64OmitEmptyIndent: - code.op = opStructFieldHeadUint64OmitEmptyIndent - case opStructFieldPtrHeadFloat32OmitEmptyIndent: - code.op = opStructFieldHeadFloat32OmitEmptyIndent - case opStructFieldPtrHeadFloat64OmitEmptyIndent: - code.op = opStructFieldHeadFloat64OmitEmptyIndent - case opStructFieldPtrHeadStringOmitEmptyIndent: - code.op = opStructFieldHeadStringOmitEmptyIndent - case opStructFieldPtrHeadBoolOmitEmptyIndent: - code.op = opStructFieldHeadBoolOmitEmptyIndent - } + code.op = code.op.ptrHeadToHead() return code } diff --git a/encode_optype.go b/encode_optype.go new file mode 100644 index 0000000..6396b74 --- /dev/null +++ b/encode_optype.go @@ -0,0 +1,3589 @@ +// Code generated by cmd/generator. DO NOT EDIT! +package json + +type codeType int + +const ( + codeOp codeType = 0 + codeArrayHead codeType = 1 + codeArrayElem codeType = 2 + codeSliceHead codeType = 3 + codeSliceElem codeType = 4 + codeMapHead codeType = 5 + codeMapKey codeType = 6 + codeMapValue codeType = 7 + codeStructFieldRecursive codeType = 8 + codeStructField codeType = 9 +) + +type opType int + +const ( + opEnd opType = 0 + opInterface opType = 1 + opPtr opType = 2 + opMarshalJSON opType = 3 + opMarshalText opType = 4 + opSliceHead opType = 5 + opRootSliceHead opType = 6 + opSliceElem opType = 7 + opRootSliceElem opType = 8 + opSliceEnd opType = 9 + opArrayHead opType = 10 + opArrayElem opType = 11 + opArrayEnd opType = 12 + opMapHead opType = 13 + opMapHeadLoad opType = 14 + opRootMapHead opType = 15 + opMapKey opType = 16 + opRootMapKey opType = 17 + opMapValue opType = 18 + opMapEnd opType = 19 + opStructFieldHead opType = 20 + opStructFieldHeadOmitEmpty opType = 21 + opStructFieldAnonymousHead opType = 22 + opStructFieldAnonymousHeadOmitEmpty opType = 23 + opStructFieldPtrAnonymousHeadOmitEmpty opType = 24 + opStructFieldPtrHead opType = 25 + opStructFieldPtrHeadOmitEmpty opType = 26 + opStructFieldPtrAnonymousHead opType = 27 + opStructField opType = 28 + opStructFieldOmitEmpty opType = 29 + opStructFieldRecursive opType = 30 + opStructEnd opType = 31 + opStructAnonymousEnd opType = 32 + opInt opType = 33 + opInt8 opType = 34 + opInt16 opType = 35 + opInt32 opType = 36 + opInt64 opType = 37 + opUint opType = 38 + opUint8 opType = 39 + opUint16 opType = 40 + opUint32 opType = 41 + opUint64 opType = 42 + opFloat32 opType = 43 + opFloat64 opType = 44 + opBool opType = 45 + opString opType = 46 + opStructFieldHeadInt opType = 47 + opStructFieldHeadInt8 opType = 48 + opStructFieldHeadInt16 opType = 49 + opStructFieldHeadInt32 opType = 50 + opStructFieldHeadInt64 opType = 51 + opStructFieldHeadUint opType = 52 + opStructFieldHeadUint8 opType = 53 + opStructFieldHeadUint16 opType = 54 + opStructFieldHeadUint32 opType = 55 + opStructFieldHeadUint64 opType = 56 + opStructFieldHeadFloat32 opType = 57 + opStructFieldHeadFloat64 opType = 58 + opStructFieldHeadBool opType = 59 + opStructFieldHeadString opType = 60 + opStructFieldHeadOmitEmptyInt opType = 61 + opStructFieldHeadOmitEmptyInt8 opType = 62 + opStructFieldHeadOmitEmptyInt16 opType = 63 + opStructFieldHeadOmitEmptyInt32 opType = 64 + opStructFieldHeadOmitEmptyInt64 opType = 65 + opStructFieldHeadOmitEmptyUint opType = 66 + opStructFieldHeadOmitEmptyUint8 opType = 67 + opStructFieldHeadOmitEmptyUint16 opType = 68 + opStructFieldHeadOmitEmptyUint32 opType = 69 + opStructFieldHeadOmitEmptyUint64 opType = 70 + opStructFieldHeadOmitEmptyFloat32 opType = 71 + opStructFieldHeadOmitEmptyFloat64 opType = 72 + opStructFieldHeadOmitEmptyBool opType = 73 + opStructFieldHeadOmitEmptyString opType = 74 + opStructFieldAnonymousHeadInt opType = 75 + opStructFieldAnonymousHeadInt8 opType = 76 + opStructFieldAnonymousHeadInt16 opType = 77 + opStructFieldAnonymousHeadInt32 opType = 78 + opStructFieldAnonymousHeadInt64 opType = 79 + opStructFieldAnonymousHeadUint opType = 80 + opStructFieldAnonymousHeadUint8 opType = 81 + opStructFieldAnonymousHeadUint16 opType = 82 + opStructFieldAnonymousHeadUint32 opType = 83 + opStructFieldAnonymousHeadUint64 opType = 84 + opStructFieldAnonymousHeadFloat32 opType = 85 + opStructFieldAnonymousHeadFloat64 opType = 86 + opStructFieldAnonymousHeadBool opType = 87 + opStructFieldAnonymousHeadString opType = 88 + opStructFieldAnonymousHeadOmitEmptyInt opType = 89 + opStructFieldAnonymousHeadOmitEmptyInt8 opType = 90 + opStructFieldAnonymousHeadOmitEmptyInt16 opType = 91 + opStructFieldAnonymousHeadOmitEmptyInt32 opType = 92 + opStructFieldAnonymousHeadOmitEmptyInt64 opType = 93 + opStructFieldAnonymousHeadOmitEmptyUint opType = 94 + opStructFieldAnonymousHeadOmitEmptyUint8 opType = 95 + opStructFieldAnonymousHeadOmitEmptyUint16 opType = 96 + opStructFieldAnonymousHeadOmitEmptyUint32 opType = 97 + opStructFieldAnonymousHeadOmitEmptyUint64 opType = 98 + opStructFieldAnonymousHeadOmitEmptyFloat32 opType = 99 + opStructFieldAnonymousHeadOmitEmptyFloat64 opType = 100 + opStructFieldAnonymousHeadOmitEmptyBool opType = 101 + opStructFieldAnonymousHeadOmitEmptyString opType = 102 + opStructFieldPtrHeadInt opType = 103 + opStructFieldPtrHeadInt8 opType = 104 + opStructFieldPtrHeadInt16 opType = 105 + opStructFieldPtrHeadInt32 opType = 106 + opStructFieldPtrHeadInt64 opType = 107 + opStructFieldPtrHeadUint opType = 108 + opStructFieldPtrHeadUint8 opType = 109 + opStructFieldPtrHeadUint16 opType = 110 + opStructFieldPtrHeadUint32 opType = 111 + opStructFieldPtrHeadUint64 opType = 112 + opStructFieldPtrHeadFloat32 opType = 113 + opStructFieldPtrHeadFloat64 opType = 114 + opStructFieldPtrHeadBool opType = 115 + opStructFieldPtrHeadString opType = 116 + opStructFieldPtrHeadOmitEmptyInt opType = 117 + opStructFieldPtrHeadOmitEmptyInt8 opType = 118 + opStructFieldPtrHeadOmitEmptyInt16 opType = 119 + opStructFieldPtrHeadOmitEmptyInt32 opType = 120 + opStructFieldPtrHeadOmitEmptyInt64 opType = 121 + opStructFieldPtrHeadOmitEmptyUint opType = 122 + opStructFieldPtrHeadOmitEmptyUint8 opType = 123 + opStructFieldPtrHeadOmitEmptyUint16 opType = 124 + opStructFieldPtrHeadOmitEmptyUint32 opType = 125 + opStructFieldPtrHeadOmitEmptyUint64 opType = 126 + opStructFieldPtrHeadOmitEmptyFloat32 opType = 127 + opStructFieldPtrHeadOmitEmptyFloat64 opType = 128 + opStructFieldPtrHeadOmitEmptyBool opType = 129 + opStructFieldPtrHeadOmitEmptyString opType = 130 + opStructFieldPtrAnonymousHeadInt opType = 131 + opStructFieldPtrAnonymousHeadInt8 opType = 132 + opStructFieldPtrAnonymousHeadInt16 opType = 133 + opStructFieldPtrAnonymousHeadInt32 opType = 134 + opStructFieldPtrAnonymousHeadInt64 opType = 135 + opStructFieldPtrAnonymousHeadUint opType = 136 + opStructFieldPtrAnonymousHeadUint8 opType = 137 + opStructFieldPtrAnonymousHeadUint16 opType = 138 + opStructFieldPtrAnonymousHeadUint32 opType = 139 + opStructFieldPtrAnonymousHeadUint64 opType = 140 + opStructFieldPtrAnonymousHeadFloat32 opType = 141 + opStructFieldPtrAnonymousHeadFloat64 opType = 142 + opStructFieldPtrAnonymousHeadBool opType = 143 + opStructFieldPtrAnonymousHeadString opType = 144 + opStructFieldPtrAnonymousHeadOmitEmptyInt opType = 145 + opStructFieldPtrAnonymousHeadOmitEmptyInt8 opType = 146 + opStructFieldPtrAnonymousHeadOmitEmptyInt16 opType = 147 + opStructFieldPtrAnonymousHeadOmitEmptyInt32 opType = 148 + opStructFieldPtrAnonymousHeadOmitEmptyInt64 opType = 149 + opStructFieldPtrAnonymousHeadOmitEmptyUint opType = 150 + opStructFieldPtrAnonymousHeadOmitEmptyUint8 opType = 151 + opStructFieldPtrAnonymousHeadOmitEmptyUint16 opType = 152 + opStructFieldPtrAnonymousHeadOmitEmptyUint32 opType = 153 + opStructFieldPtrAnonymousHeadOmitEmptyUint64 opType = 154 + opStructFieldPtrAnonymousHeadOmitEmptyFloat32 opType = 155 + opStructFieldPtrAnonymousHeadOmitEmptyFloat64 opType = 156 + opStructFieldPtrAnonymousHeadOmitEmptyBool opType = 157 + opStructFieldPtrAnonymousHeadOmitEmptyString opType = 158 + opStructFieldInt opType = 159 + opStructFieldInt8 opType = 160 + opStructFieldInt16 opType = 161 + opStructFieldInt32 opType = 162 + opStructFieldInt64 opType = 163 + opStructFieldUint opType = 164 + opStructFieldUint8 opType = 165 + opStructFieldUint16 opType = 166 + opStructFieldUint32 opType = 167 + opStructFieldUint64 opType = 168 + opStructFieldFloat32 opType = 169 + opStructFieldFloat64 opType = 170 + opStructFieldBool opType = 171 + opStructFieldString opType = 172 + opStructFieldOmitEmptyInt opType = 173 + opStructFieldOmitEmptyInt8 opType = 174 + opStructFieldOmitEmptyInt16 opType = 175 + opStructFieldOmitEmptyInt32 opType = 176 + opStructFieldOmitEmptyInt64 opType = 177 + opStructFieldOmitEmptyUint opType = 178 + opStructFieldOmitEmptyUint8 opType = 179 + opStructFieldOmitEmptyUint16 opType = 180 + opStructFieldOmitEmptyUint32 opType = 181 + opStructFieldOmitEmptyUint64 opType = 182 + opStructFieldOmitEmptyFloat32 opType = 183 + opStructFieldOmitEmptyFloat64 opType = 184 + opStructFieldOmitEmptyBool opType = 185 + opStructFieldOmitEmptyString opType = 186 + opEndIndent opType = 187 + opInterfaceIndent opType = 188 + opPtrIndent opType = 189 + opMarshalJSONIndent opType = 190 + opMarshalTextIndent opType = 191 + opSliceHeadIndent opType = 192 + opRootSliceHeadIndent opType = 193 + opSliceElemIndent opType = 194 + opRootSliceElemIndent opType = 195 + opSliceEndIndent opType = 196 + opArrayHeadIndent opType = 197 + opArrayElemIndent opType = 198 + opArrayEndIndent opType = 199 + opMapHeadIndent opType = 200 + opMapHeadLoadIndent opType = 201 + opRootMapHeadIndent opType = 202 + opMapKeyIndent opType = 203 + opRootMapKeyIndent opType = 204 + opMapValueIndent opType = 205 + opMapEndIndent opType = 206 + opStructFieldHeadIndent opType = 207 + opStructFieldHeadOmitEmptyIndent opType = 208 + opStructFieldAnonymousHeadIndent opType = 209 + opStructFieldAnonymousHeadOmitEmptyIndent opType = 210 + opStructFieldPtrAnonymousHeadOmitEmptyIndent opType = 211 + opStructFieldPtrHeadIndent opType = 212 + opStructFieldPtrHeadOmitEmptyIndent opType = 213 + opStructFieldPtrAnonymousHeadIndent opType = 214 + opStructFieldIndent opType = 215 + opStructFieldOmitEmptyIndent opType = 216 + opStructFieldRecursiveIndent opType = 217 + opStructEndIndent opType = 218 + opStructAnonymousEndIndent opType = 219 + opIntIndent opType = 220 + opInt8Indent opType = 221 + opInt16Indent opType = 222 + opInt32Indent opType = 223 + opInt64Indent opType = 224 + opUintIndent opType = 225 + opUint8Indent opType = 226 + opUint16Indent opType = 227 + opUint32Indent opType = 228 + opUint64Indent opType = 229 + opFloat32Indent opType = 230 + opFloat64Indent opType = 231 + opBoolIndent opType = 232 + opStringIndent opType = 233 + opStructFieldHeadIntIndent opType = 234 + opStructFieldHeadInt8Indent opType = 235 + opStructFieldHeadInt16Indent opType = 236 + opStructFieldHeadInt32Indent opType = 237 + opStructFieldHeadInt64Indent opType = 238 + opStructFieldHeadUintIndent opType = 239 + opStructFieldHeadUint8Indent opType = 240 + opStructFieldHeadUint16Indent opType = 241 + opStructFieldHeadUint32Indent opType = 242 + opStructFieldHeadUint64Indent opType = 243 + opStructFieldHeadFloat32Indent opType = 244 + opStructFieldHeadFloat64Indent opType = 245 + opStructFieldHeadBoolIndent opType = 246 + opStructFieldHeadStringIndent opType = 247 + opStructFieldHeadOmitEmptyIntIndent opType = 248 + opStructFieldHeadOmitEmptyInt8Indent opType = 249 + opStructFieldHeadOmitEmptyInt16Indent opType = 250 + opStructFieldHeadOmitEmptyInt32Indent opType = 251 + opStructFieldHeadOmitEmptyInt64Indent opType = 252 + opStructFieldHeadOmitEmptyUintIndent opType = 253 + opStructFieldHeadOmitEmptyUint8Indent opType = 254 + opStructFieldHeadOmitEmptyUint16Indent opType = 255 + opStructFieldHeadOmitEmptyUint32Indent opType = 256 + opStructFieldHeadOmitEmptyUint64Indent opType = 257 + opStructFieldHeadOmitEmptyFloat32Indent opType = 258 + opStructFieldHeadOmitEmptyFloat64Indent opType = 259 + opStructFieldHeadOmitEmptyBoolIndent opType = 260 + opStructFieldHeadOmitEmptyStringIndent opType = 261 + opStructFieldAnonymousHeadIntIndent opType = 262 + opStructFieldAnonymousHeadInt8Indent opType = 263 + opStructFieldAnonymousHeadInt16Indent opType = 264 + opStructFieldAnonymousHeadInt32Indent opType = 265 + opStructFieldAnonymousHeadInt64Indent opType = 266 + opStructFieldAnonymousHeadUintIndent opType = 267 + opStructFieldAnonymousHeadUint8Indent opType = 268 + opStructFieldAnonymousHeadUint16Indent opType = 269 + opStructFieldAnonymousHeadUint32Indent opType = 270 + opStructFieldAnonymousHeadUint64Indent opType = 271 + opStructFieldAnonymousHeadFloat32Indent opType = 272 + opStructFieldAnonymousHeadFloat64Indent opType = 273 + opStructFieldAnonymousHeadBoolIndent opType = 274 + opStructFieldAnonymousHeadStringIndent opType = 275 + opStructFieldAnonymousHeadOmitEmptyIntIndent opType = 276 + opStructFieldAnonymousHeadOmitEmptyInt8Indent opType = 277 + opStructFieldAnonymousHeadOmitEmptyInt16Indent opType = 278 + opStructFieldAnonymousHeadOmitEmptyInt32Indent opType = 279 + opStructFieldAnonymousHeadOmitEmptyInt64Indent opType = 280 + opStructFieldAnonymousHeadOmitEmptyUintIndent opType = 281 + opStructFieldAnonymousHeadOmitEmptyUint8Indent opType = 282 + opStructFieldAnonymousHeadOmitEmptyUint16Indent opType = 283 + opStructFieldAnonymousHeadOmitEmptyUint32Indent opType = 284 + opStructFieldAnonymousHeadOmitEmptyUint64Indent opType = 285 + opStructFieldAnonymousHeadOmitEmptyFloat32Indent opType = 286 + opStructFieldAnonymousHeadOmitEmptyFloat64Indent opType = 287 + opStructFieldAnonymousHeadOmitEmptyBoolIndent opType = 288 + opStructFieldAnonymousHeadOmitEmptyStringIndent opType = 289 + opStructFieldPtrHeadIntIndent opType = 290 + opStructFieldPtrHeadInt8Indent opType = 291 + opStructFieldPtrHeadInt16Indent opType = 292 + opStructFieldPtrHeadInt32Indent opType = 293 + opStructFieldPtrHeadInt64Indent opType = 294 + opStructFieldPtrHeadUintIndent opType = 295 + opStructFieldPtrHeadUint8Indent opType = 296 + opStructFieldPtrHeadUint16Indent opType = 297 + opStructFieldPtrHeadUint32Indent opType = 298 + opStructFieldPtrHeadUint64Indent opType = 299 + opStructFieldPtrHeadFloat32Indent opType = 300 + opStructFieldPtrHeadFloat64Indent opType = 301 + opStructFieldPtrHeadBoolIndent opType = 302 + opStructFieldPtrHeadStringIndent opType = 303 + opStructFieldPtrHeadOmitEmptyIntIndent opType = 304 + opStructFieldPtrHeadOmitEmptyInt8Indent opType = 305 + opStructFieldPtrHeadOmitEmptyInt16Indent opType = 306 + opStructFieldPtrHeadOmitEmptyInt32Indent opType = 307 + opStructFieldPtrHeadOmitEmptyInt64Indent opType = 308 + opStructFieldPtrHeadOmitEmptyUintIndent opType = 309 + opStructFieldPtrHeadOmitEmptyUint8Indent opType = 310 + opStructFieldPtrHeadOmitEmptyUint16Indent opType = 311 + opStructFieldPtrHeadOmitEmptyUint32Indent opType = 312 + opStructFieldPtrHeadOmitEmptyUint64Indent opType = 313 + opStructFieldPtrHeadOmitEmptyFloat32Indent opType = 314 + opStructFieldPtrHeadOmitEmptyFloat64Indent opType = 315 + opStructFieldPtrHeadOmitEmptyBoolIndent opType = 316 + opStructFieldPtrHeadOmitEmptyStringIndent opType = 317 + opStructFieldPtrAnonymousHeadIntIndent opType = 318 + opStructFieldPtrAnonymousHeadInt8Indent opType = 319 + opStructFieldPtrAnonymousHeadInt16Indent opType = 320 + opStructFieldPtrAnonymousHeadInt32Indent opType = 321 + opStructFieldPtrAnonymousHeadInt64Indent opType = 322 + opStructFieldPtrAnonymousHeadUintIndent opType = 323 + opStructFieldPtrAnonymousHeadUint8Indent opType = 324 + opStructFieldPtrAnonymousHeadUint16Indent opType = 325 + opStructFieldPtrAnonymousHeadUint32Indent opType = 326 + opStructFieldPtrAnonymousHeadUint64Indent opType = 327 + opStructFieldPtrAnonymousHeadFloat32Indent opType = 328 + opStructFieldPtrAnonymousHeadFloat64Indent opType = 329 + opStructFieldPtrAnonymousHeadBoolIndent opType = 330 + opStructFieldPtrAnonymousHeadStringIndent opType = 331 + opStructFieldPtrAnonymousHeadOmitEmptyIntIndent opType = 332 + opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent opType = 333 + opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent opType = 334 + opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent opType = 335 + opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent opType = 336 + opStructFieldPtrAnonymousHeadOmitEmptyUintIndent opType = 337 + opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent opType = 338 + opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent opType = 339 + opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent opType = 340 + opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent opType = 341 + opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent opType = 342 + opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent opType = 343 + opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent opType = 344 + opStructFieldPtrAnonymousHeadOmitEmptyStringIndent opType = 345 + opStructFieldIntIndent opType = 346 + opStructFieldInt8Indent opType = 347 + opStructFieldInt16Indent opType = 348 + opStructFieldInt32Indent opType = 349 + opStructFieldInt64Indent opType = 350 + opStructFieldUintIndent opType = 351 + opStructFieldUint8Indent opType = 352 + opStructFieldUint16Indent opType = 353 + opStructFieldUint32Indent opType = 354 + opStructFieldUint64Indent opType = 355 + opStructFieldFloat32Indent opType = 356 + opStructFieldFloat64Indent opType = 357 + opStructFieldBoolIndent opType = 358 + opStructFieldStringIndent opType = 359 + opStructFieldOmitEmptyIntIndent opType = 360 + opStructFieldOmitEmptyInt8Indent opType = 361 + opStructFieldOmitEmptyInt16Indent opType = 362 + opStructFieldOmitEmptyInt32Indent opType = 363 + opStructFieldOmitEmptyInt64Indent opType = 364 + opStructFieldOmitEmptyUintIndent opType = 365 + opStructFieldOmitEmptyUint8Indent opType = 366 + opStructFieldOmitEmptyUint16Indent opType = 367 + opStructFieldOmitEmptyUint32Indent opType = 368 + opStructFieldOmitEmptyUint64Indent opType = 369 + opStructFieldOmitEmptyFloat32Indent opType = 370 + opStructFieldOmitEmptyFloat64Indent opType = 371 + opStructFieldOmitEmptyBoolIndent opType = 372 + opStructFieldOmitEmptyStringIndent opType = 373 +) + +func (t opType) String() string { + switch t { + case opEnd: + return "End" + case opInterface: + return "Interface" + case opPtr: + return "Ptr" + case opMarshalJSON: + return "MarshalJSON" + case opMarshalText: + return "MarshalText" + case opSliceHead: + return "SliceHead" + case opRootSliceHead: + return "RootSliceHead" + case opSliceElem: + return "SliceElem" + case opRootSliceElem: + return "RootSliceElem" + case opSliceEnd: + return "SliceEnd" + case opArrayHead: + return "ArrayHead" + case opArrayElem: + return "ArrayElem" + case opArrayEnd: + return "ArrayEnd" + case opMapHead: + return "MapHead" + case opMapHeadLoad: + return "MapHeadLoad" + case opRootMapHead: + return "RootMapHead" + case opMapKey: + return "MapKey" + case opRootMapKey: + return "RootMapKey" + case opMapValue: + return "MapValue" + case opMapEnd: + return "MapEnd" + case opStructFieldHead: + return "StructFieldHead" + case opStructFieldHeadOmitEmpty: + return "StructFieldHeadOmitEmpty" + case opStructFieldAnonymousHead: + return "StructFieldAnonymousHead" + case opStructFieldAnonymousHeadOmitEmpty: + return "StructFieldAnonymousHeadOmitEmpty" + case opStructFieldPtrAnonymousHeadOmitEmpty: + return "StructFieldPtrAnonymousHeadOmitEmpty" + case opStructFieldPtrHead: + return "StructFieldPtrHead" + case opStructFieldPtrHeadOmitEmpty: + return "StructFieldPtrHeadOmitEmpty" + case opStructFieldPtrAnonymousHead: + return "StructFieldPtrAnonymousHead" + case opStructField: + return "StructField" + case opStructFieldOmitEmpty: + return "StructFieldOmitEmpty" + case opStructFieldRecursive: + return "StructFieldRecursive" + case opStructEnd: + return "StructEnd" + case opStructAnonymousEnd: + return "StructAnonymousEnd" + case opInt: + return "Int" + case opInt8: + return "Int8" + case opInt16: + return "Int16" + case opInt32: + return "Int32" + case opInt64: + return "Int64" + case opUint: + return "Uint" + case opUint8: + return "Uint8" + case opUint16: + return "Uint16" + case opUint32: + return "Uint32" + case opUint64: + return "Uint64" + case opFloat32: + return "Float32" + case opFloat64: + return "Float64" + case opBool: + return "Bool" + case opString: + return "String" + case opStructFieldHeadInt: + return "StructFieldHeadInt" + case opStructFieldHeadInt8: + return "StructFieldHeadInt8" + case opStructFieldHeadInt16: + return "StructFieldHeadInt16" + case opStructFieldHeadInt32: + return "StructFieldHeadInt32" + case opStructFieldHeadInt64: + return "StructFieldHeadInt64" + case opStructFieldHeadUint: + return "StructFieldHeadUint" + case opStructFieldHeadUint8: + return "StructFieldHeadUint8" + case opStructFieldHeadUint16: + return "StructFieldHeadUint16" + case opStructFieldHeadUint32: + return "StructFieldHeadUint32" + case opStructFieldHeadUint64: + return "StructFieldHeadUint64" + case opStructFieldHeadFloat32: + return "StructFieldHeadFloat32" + case opStructFieldHeadFloat64: + return "StructFieldHeadFloat64" + case opStructFieldHeadBool: + return "StructFieldHeadBool" + case opStructFieldHeadString: + return "StructFieldHeadString" + case opStructFieldHeadOmitEmptyInt: + return "StructFieldHeadOmitEmptyInt" + case opStructFieldHeadOmitEmptyInt8: + return "StructFieldHeadOmitEmptyInt8" + case opStructFieldHeadOmitEmptyInt16: + return "StructFieldHeadOmitEmptyInt16" + case opStructFieldHeadOmitEmptyInt32: + return "StructFieldHeadOmitEmptyInt32" + case opStructFieldHeadOmitEmptyInt64: + return "StructFieldHeadOmitEmptyInt64" + case opStructFieldHeadOmitEmptyUint: + return "StructFieldHeadOmitEmptyUint" + case opStructFieldHeadOmitEmptyUint8: + return "StructFieldHeadOmitEmptyUint8" + case opStructFieldHeadOmitEmptyUint16: + return "StructFieldHeadOmitEmptyUint16" + case opStructFieldHeadOmitEmptyUint32: + return "StructFieldHeadOmitEmptyUint32" + case opStructFieldHeadOmitEmptyUint64: + return "StructFieldHeadOmitEmptyUint64" + case opStructFieldHeadOmitEmptyFloat32: + return "StructFieldHeadOmitEmptyFloat32" + case opStructFieldHeadOmitEmptyFloat64: + return "StructFieldHeadOmitEmptyFloat64" + case opStructFieldHeadOmitEmptyBool: + return "StructFieldHeadOmitEmptyBool" + case opStructFieldHeadOmitEmptyString: + return "StructFieldHeadOmitEmptyString" + case opStructFieldAnonymousHeadInt: + return "StructFieldAnonymousHeadInt" + case opStructFieldAnonymousHeadInt8: + return "StructFieldAnonymousHeadInt8" + case opStructFieldAnonymousHeadInt16: + return "StructFieldAnonymousHeadInt16" + case opStructFieldAnonymousHeadInt32: + return "StructFieldAnonymousHeadInt32" + case opStructFieldAnonymousHeadInt64: + return "StructFieldAnonymousHeadInt64" + case opStructFieldAnonymousHeadUint: + return "StructFieldAnonymousHeadUint" + case opStructFieldAnonymousHeadUint8: + return "StructFieldAnonymousHeadUint8" + case opStructFieldAnonymousHeadUint16: + return "StructFieldAnonymousHeadUint16" + case opStructFieldAnonymousHeadUint32: + return "StructFieldAnonymousHeadUint32" + case opStructFieldAnonymousHeadUint64: + return "StructFieldAnonymousHeadUint64" + case opStructFieldAnonymousHeadFloat32: + return "StructFieldAnonymousHeadFloat32" + case opStructFieldAnonymousHeadFloat64: + return "StructFieldAnonymousHeadFloat64" + case opStructFieldAnonymousHeadBool: + return "StructFieldAnonymousHeadBool" + case opStructFieldAnonymousHeadString: + return "StructFieldAnonymousHeadString" + case opStructFieldAnonymousHeadOmitEmptyInt: + return "StructFieldAnonymousHeadOmitEmptyInt" + case opStructFieldAnonymousHeadOmitEmptyInt8: + return "StructFieldAnonymousHeadOmitEmptyInt8" + case opStructFieldAnonymousHeadOmitEmptyInt16: + return "StructFieldAnonymousHeadOmitEmptyInt16" + case opStructFieldAnonymousHeadOmitEmptyInt32: + return "StructFieldAnonymousHeadOmitEmptyInt32" + case opStructFieldAnonymousHeadOmitEmptyInt64: + return "StructFieldAnonymousHeadOmitEmptyInt64" + case opStructFieldAnonymousHeadOmitEmptyUint: + return "StructFieldAnonymousHeadOmitEmptyUint" + case opStructFieldAnonymousHeadOmitEmptyUint8: + return "StructFieldAnonymousHeadOmitEmptyUint8" + case opStructFieldAnonymousHeadOmitEmptyUint16: + return "StructFieldAnonymousHeadOmitEmptyUint16" + case opStructFieldAnonymousHeadOmitEmptyUint32: + return "StructFieldAnonymousHeadOmitEmptyUint32" + case opStructFieldAnonymousHeadOmitEmptyUint64: + return "StructFieldAnonymousHeadOmitEmptyUint64" + case opStructFieldAnonymousHeadOmitEmptyFloat32: + return "StructFieldAnonymousHeadOmitEmptyFloat32" + case opStructFieldAnonymousHeadOmitEmptyFloat64: + return "StructFieldAnonymousHeadOmitEmptyFloat64" + case opStructFieldAnonymousHeadOmitEmptyBool: + return "StructFieldAnonymousHeadOmitEmptyBool" + case opStructFieldAnonymousHeadOmitEmptyString: + return "StructFieldAnonymousHeadOmitEmptyString" + case opStructFieldPtrHeadInt: + return "StructFieldPtrHeadInt" + case opStructFieldPtrHeadInt8: + return "StructFieldPtrHeadInt8" + case opStructFieldPtrHeadInt16: + return "StructFieldPtrHeadInt16" + case opStructFieldPtrHeadInt32: + return "StructFieldPtrHeadInt32" + case opStructFieldPtrHeadInt64: + return "StructFieldPtrHeadInt64" + case opStructFieldPtrHeadUint: + return "StructFieldPtrHeadUint" + case opStructFieldPtrHeadUint8: + return "StructFieldPtrHeadUint8" + case opStructFieldPtrHeadUint16: + return "StructFieldPtrHeadUint16" + case opStructFieldPtrHeadUint32: + return "StructFieldPtrHeadUint32" + case opStructFieldPtrHeadUint64: + return "StructFieldPtrHeadUint64" + case opStructFieldPtrHeadFloat32: + return "StructFieldPtrHeadFloat32" + case opStructFieldPtrHeadFloat64: + return "StructFieldPtrHeadFloat64" + case opStructFieldPtrHeadBool: + return "StructFieldPtrHeadBool" + case opStructFieldPtrHeadString: + return "StructFieldPtrHeadString" + case opStructFieldPtrHeadOmitEmptyInt: + return "StructFieldPtrHeadOmitEmptyInt" + case opStructFieldPtrHeadOmitEmptyInt8: + return "StructFieldPtrHeadOmitEmptyInt8" + case opStructFieldPtrHeadOmitEmptyInt16: + return "StructFieldPtrHeadOmitEmptyInt16" + case opStructFieldPtrHeadOmitEmptyInt32: + return "StructFieldPtrHeadOmitEmptyInt32" + case opStructFieldPtrHeadOmitEmptyInt64: + return "StructFieldPtrHeadOmitEmptyInt64" + case opStructFieldPtrHeadOmitEmptyUint: + return "StructFieldPtrHeadOmitEmptyUint" + case opStructFieldPtrHeadOmitEmptyUint8: + return "StructFieldPtrHeadOmitEmptyUint8" + case opStructFieldPtrHeadOmitEmptyUint16: + return "StructFieldPtrHeadOmitEmptyUint16" + case opStructFieldPtrHeadOmitEmptyUint32: + return "StructFieldPtrHeadOmitEmptyUint32" + case opStructFieldPtrHeadOmitEmptyUint64: + return "StructFieldPtrHeadOmitEmptyUint64" + case opStructFieldPtrHeadOmitEmptyFloat32: + return "StructFieldPtrHeadOmitEmptyFloat32" + case opStructFieldPtrHeadOmitEmptyFloat64: + return "StructFieldPtrHeadOmitEmptyFloat64" + case opStructFieldPtrHeadOmitEmptyBool: + return "StructFieldPtrHeadOmitEmptyBool" + case opStructFieldPtrHeadOmitEmptyString: + return "StructFieldPtrHeadOmitEmptyString" + case opStructFieldPtrAnonymousHeadInt: + return "StructFieldPtrAnonymousHeadInt" + case opStructFieldPtrAnonymousHeadInt8: + return "StructFieldPtrAnonymousHeadInt8" + case opStructFieldPtrAnonymousHeadInt16: + return "StructFieldPtrAnonymousHeadInt16" + case opStructFieldPtrAnonymousHeadInt32: + return "StructFieldPtrAnonymousHeadInt32" + case opStructFieldPtrAnonymousHeadInt64: + return "StructFieldPtrAnonymousHeadInt64" + case opStructFieldPtrAnonymousHeadUint: + return "StructFieldPtrAnonymousHeadUint" + case opStructFieldPtrAnonymousHeadUint8: + return "StructFieldPtrAnonymousHeadUint8" + case opStructFieldPtrAnonymousHeadUint16: + return "StructFieldPtrAnonymousHeadUint16" + case opStructFieldPtrAnonymousHeadUint32: + return "StructFieldPtrAnonymousHeadUint32" + case opStructFieldPtrAnonymousHeadUint64: + return "StructFieldPtrAnonymousHeadUint64" + case opStructFieldPtrAnonymousHeadFloat32: + return "StructFieldPtrAnonymousHeadFloat32" + case opStructFieldPtrAnonymousHeadFloat64: + return "StructFieldPtrAnonymousHeadFloat64" + case opStructFieldPtrAnonymousHeadBool: + return "StructFieldPtrAnonymousHeadBool" + case opStructFieldPtrAnonymousHeadString: + return "StructFieldPtrAnonymousHeadString" + case opStructFieldPtrAnonymousHeadOmitEmptyInt: + return "StructFieldPtrAnonymousHeadOmitEmptyInt" + case opStructFieldPtrAnonymousHeadOmitEmptyInt8: + return "StructFieldPtrAnonymousHeadOmitEmptyInt8" + case opStructFieldPtrAnonymousHeadOmitEmptyInt16: + return "StructFieldPtrAnonymousHeadOmitEmptyInt16" + case opStructFieldPtrAnonymousHeadOmitEmptyInt32: + return "StructFieldPtrAnonymousHeadOmitEmptyInt32" + case opStructFieldPtrAnonymousHeadOmitEmptyInt64: + return "StructFieldPtrAnonymousHeadOmitEmptyInt64" + case opStructFieldPtrAnonymousHeadOmitEmptyUint: + return "StructFieldPtrAnonymousHeadOmitEmptyUint" + case opStructFieldPtrAnonymousHeadOmitEmptyUint8: + return "StructFieldPtrAnonymousHeadOmitEmptyUint8" + case opStructFieldPtrAnonymousHeadOmitEmptyUint16: + return "StructFieldPtrAnonymousHeadOmitEmptyUint16" + case opStructFieldPtrAnonymousHeadOmitEmptyUint32: + return "StructFieldPtrAnonymousHeadOmitEmptyUint32" + case opStructFieldPtrAnonymousHeadOmitEmptyUint64: + return "StructFieldPtrAnonymousHeadOmitEmptyUint64" + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32: + return "StructFieldPtrAnonymousHeadOmitEmptyFloat32" + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64: + return "StructFieldPtrAnonymousHeadOmitEmptyFloat64" + case opStructFieldPtrAnonymousHeadOmitEmptyBool: + return "StructFieldPtrAnonymousHeadOmitEmptyBool" + case opStructFieldPtrAnonymousHeadOmitEmptyString: + return "StructFieldPtrAnonymousHeadOmitEmptyString" + case opStructFieldInt: + return "StructFieldInt" + case opStructFieldInt8: + return "StructFieldInt8" + case opStructFieldInt16: + return "StructFieldInt16" + case opStructFieldInt32: + return "StructFieldInt32" + case opStructFieldInt64: + return "StructFieldInt64" + case opStructFieldUint: + return "StructFieldUint" + case opStructFieldUint8: + return "StructFieldUint8" + case opStructFieldUint16: + return "StructFieldUint16" + case opStructFieldUint32: + return "StructFieldUint32" + case opStructFieldUint64: + return "StructFieldUint64" + case opStructFieldFloat32: + return "StructFieldFloat32" + case opStructFieldFloat64: + return "StructFieldFloat64" + case opStructFieldBool: + return "StructFieldBool" + case opStructFieldString: + return "StructFieldString" + case opStructFieldOmitEmptyInt: + return "StructFieldOmitEmptyInt" + case opStructFieldOmitEmptyInt8: + return "StructFieldOmitEmptyInt8" + case opStructFieldOmitEmptyInt16: + return "StructFieldOmitEmptyInt16" + case opStructFieldOmitEmptyInt32: + return "StructFieldOmitEmptyInt32" + case opStructFieldOmitEmptyInt64: + return "StructFieldOmitEmptyInt64" + case opStructFieldOmitEmptyUint: + return "StructFieldOmitEmptyUint" + case opStructFieldOmitEmptyUint8: + return "StructFieldOmitEmptyUint8" + case opStructFieldOmitEmptyUint16: + return "StructFieldOmitEmptyUint16" + case opStructFieldOmitEmptyUint32: + return "StructFieldOmitEmptyUint32" + case opStructFieldOmitEmptyUint64: + return "StructFieldOmitEmptyUint64" + case opStructFieldOmitEmptyFloat32: + return "StructFieldOmitEmptyFloat32" + case opStructFieldOmitEmptyFloat64: + return "StructFieldOmitEmptyFloat64" + case opStructFieldOmitEmptyBool: + return "StructFieldOmitEmptyBool" + case opStructFieldOmitEmptyString: + return "StructFieldOmitEmptyString" + case opEndIndent: + return "EndIndent" + case opInterfaceIndent: + return "InterfaceIndent" + case opPtrIndent: + return "PtrIndent" + case opMarshalJSONIndent: + return "MarshalJSONIndent" + case opMarshalTextIndent: + return "MarshalTextIndent" + case opSliceHeadIndent: + return "SliceHeadIndent" + case opRootSliceHeadIndent: + return "RootSliceHeadIndent" + case opSliceElemIndent: + return "SliceElemIndent" + case opRootSliceElemIndent: + return "RootSliceElemIndent" + case opSliceEndIndent: + return "SliceEndIndent" + case opArrayHeadIndent: + return "ArrayHeadIndent" + case opArrayElemIndent: + return "ArrayElemIndent" + case opArrayEndIndent: + return "ArrayEndIndent" + case opMapHeadIndent: + return "MapHeadIndent" + case opMapHeadLoadIndent: + return "MapHeadLoadIndent" + case opRootMapHeadIndent: + return "RootMapHeadIndent" + case opMapKeyIndent: + return "MapKeyIndent" + case opRootMapKeyIndent: + return "RootMapKeyIndent" + case opMapValueIndent: + return "MapValueIndent" + case opMapEndIndent: + return "MapEndIndent" + case opStructFieldHeadIndent: + return "StructFieldHeadIndent" + case opStructFieldHeadOmitEmptyIndent: + return "StructFieldHeadOmitEmptyIndent" + case opStructFieldAnonymousHeadIndent: + return "StructFieldAnonymousHeadIndent" + case opStructFieldAnonymousHeadOmitEmptyIndent: + return "StructFieldAnonymousHeadOmitEmptyIndent" + case opStructFieldPtrAnonymousHeadOmitEmptyIndent: + return "StructFieldPtrAnonymousHeadOmitEmptyIndent" + case opStructFieldPtrHeadIndent: + return "StructFieldPtrHeadIndent" + case opStructFieldPtrHeadOmitEmptyIndent: + return "StructFieldPtrHeadOmitEmptyIndent" + case opStructFieldPtrAnonymousHeadIndent: + return "StructFieldPtrAnonymousHeadIndent" + case opStructFieldIndent: + return "StructFieldIndent" + case opStructFieldOmitEmptyIndent: + return "StructFieldOmitEmptyIndent" + case opStructFieldRecursiveIndent: + return "StructFieldRecursiveIndent" + case opStructEndIndent: + return "StructEndIndent" + case opStructAnonymousEndIndent: + return "StructAnonymousEndIndent" + case opIntIndent: + return "IntIndent" + case opInt8Indent: + return "Int8Indent" + case opInt16Indent: + return "Int16Indent" + case opInt32Indent: + return "Int32Indent" + case opInt64Indent: + return "Int64Indent" + case opUintIndent: + return "UintIndent" + case opUint8Indent: + return "Uint8Indent" + case opUint16Indent: + return "Uint16Indent" + case opUint32Indent: + return "Uint32Indent" + case opUint64Indent: + return "Uint64Indent" + case opFloat32Indent: + return "Float32Indent" + case opFloat64Indent: + return "Float64Indent" + case opBoolIndent: + return "BoolIndent" + case opStringIndent: + return "StringIndent" + case opStructFieldHeadIntIndent: + return "StructFieldHeadIntIndent" + case opStructFieldHeadInt8Indent: + return "StructFieldHeadInt8Indent" + case opStructFieldHeadInt16Indent: + return "StructFieldHeadInt16Indent" + case opStructFieldHeadInt32Indent: + return "StructFieldHeadInt32Indent" + case opStructFieldHeadInt64Indent: + return "StructFieldHeadInt64Indent" + case opStructFieldHeadUintIndent: + return "StructFieldHeadUintIndent" + case opStructFieldHeadUint8Indent: + return "StructFieldHeadUint8Indent" + case opStructFieldHeadUint16Indent: + return "StructFieldHeadUint16Indent" + case opStructFieldHeadUint32Indent: + return "StructFieldHeadUint32Indent" + case opStructFieldHeadUint64Indent: + return "StructFieldHeadUint64Indent" + case opStructFieldHeadFloat32Indent: + return "StructFieldHeadFloat32Indent" + case opStructFieldHeadFloat64Indent: + return "StructFieldHeadFloat64Indent" + case opStructFieldHeadBoolIndent: + return "StructFieldHeadBoolIndent" + case opStructFieldHeadStringIndent: + return "StructFieldHeadStringIndent" + case opStructFieldHeadOmitEmptyIntIndent: + return "StructFieldHeadOmitEmptyIntIndent" + case opStructFieldHeadOmitEmptyInt8Indent: + return "StructFieldHeadOmitEmptyInt8Indent" + case opStructFieldHeadOmitEmptyInt16Indent: + return "StructFieldHeadOmitEmptyInt16Indent" + case opStructFieldHeadOmitEmptyInt32Indent: + return "StructFieldHeadOmitEmptyInt32Indent" + case opStructFieldHeadOmitEmptyInt64Indent: + return "StructFieldHeadOmitEmptyInt64Indent" + case opStructFieldHeadOmitEmptyUintIndent: + return "StructFieldHeadOmitEmptyUintIndent" + case opStructFieldHeadOmitEmptyUint8Indent: + return "StructFieldHeadOmitEmptyUint8Indent" + case opStructFieldHeadOmitEmptyUint16Indent: + return "StructFieldHeadOmitEmptyUint16Indent" + case opStructFieldHeadOmitEmptyUint32Indent: + return "StructFieldHeadOmitEmptyUint32Indent" + case opStructFieldHeadOmitEmptyUint64Indent: + return "StructFieldHeadOmitEmptyUint64Indent" + case opStructFieldHeadOmitEmptyFloat32Indent: + return "StructFieldHeadOmitEmptyFloat32Indent" + case opStructFieldHeadOmitEmptyFloat64Indent: + return "StructFieldHeadOmitEmptyFloat64Indent" + case opStructFieldHeadOmitEmptyBoolIndent: + return "StructFieldHeadOmitEmptyBoolIndent" + case opStructFieldHeadOmitEmptyStringIndent: + return "StructFieldHeadOmitEmptyStringIndent" + case opStructFieldAnonymousHeadIntIndent: + return "StructFieldAnonymousHeadIntIndent" + case opStructFieldAnonymousHeadInt8Indent: + return "StructFieldAnonymousHeadInt8Indent" + case opStructFieldAnonymousHeadInt16Indent: + return "StructFieldAnonymousHeadInt16Indent" + case opStructFieldAnonymousHeadInt32Indent: + return "StructFieldAnonymousHeadInt32Indent" + case opStructFieldAnonymousHeadInt64Indent: + return "StructFieldAnonymousHeadInt64Indent" + case opStructFieldAnonymousHeadUintIndent: + return "StructFieldAnonymousHeadUintIndent" + case opStructFieldAnonymousHeadUint8Indent: + return "StructFieldAnonymousHeadUint8Indent" + case opStructFieldAnonymousHeadUint16Indent: + return "StructFieldAnonymousHeadUint16Indent" + case opStructFieldAnonymousHeadUint32Indent: + return "StructFieldAnonymousHeadUint32Indent" + case opStructFieldAnonymousHeadUint64Indent: + return "StructFieldAnonymousHeadUint64Indent" + case opStructFieldAnonymousHeadFloat32Indent: + return "StructFieldAnonymousHeadFloat32Indent" + case opStructFieldAnonymousHeadFloat64Indent: + return "StructFieldAnonymousHeadFloat64Indent" + case opStructFieldAnonymousHeadBoolIndent: + return "StructFieldAnonymousHeadBoolIndent" + case opStructFieldAnonymousHeadStringIndent: + return "StructFieldAnonymousHeadStringIndent" + case opStructFieldAnonymousHeadOmitEmptyIntIndent: + return "StructFieldAnonymousHeadOmitEmptyIntIndent" + case opStructFieldAnonymousHeadOmitEmptyInt8Indent: + return "StructFieldAnonymousHeadOmitEmptyInt8Indent" + case opStructFieldAnonymousHeadOmitEmptyInt16Indent: + return "StructFieldAnonymousHeadOmitEmptyInt16Indent" + case opStructFieldAnonymousHeadOmitEmptyInt32Indent: + return "StructFieldAnonymousHeadOmitEmptyInt32Indent" + case opStructFieldAnonymousHeadOmitEmptyInt64Indent: + return "StructFieldAnonymousHeadOmitEmptyInt64Indent" + case opStructFieldAnonymousHeadOmitEmptyUintIndent: + return "StructFieldAnonymousHeadOmitEmptyUintIndent" + case opStructFieldAnonymousHeadOmitEmptyUint8Indent: + return "StructFieldAnonymousHeadOmitEmptyUint8Indent" + case opStructFieldAnonymousHeadOmitEmptyUint16Indent: + return "StructFieldAnonymousHeadOmitEmptyUint16Indent" + case opStructFieldAnonymousHeadOmitEmptyUint32Indent: + return "StructFieldAnonymousHeadOmitEmptyUint32Indent" + case opStructFieldAnonymousHeadOmitEmptyUint64Indent: + return "StructFieldAnonymousHeadOmitEmptyUint64Indent" + case opStructFieldAnonymousHeadOmitEmptyFloat32Indent: + return "StructFieldAnonymousHeadOmitEmptyFloat32Indent" + case opStructFieldAnonymousHeadOmitEmptyFloat64Indent: + return "StructFieldAnonymousHeadOmitEmptyFloat64Indent" + case opStructFieldAnonymousHeadOmitEmptyBoolIndent: + return "StructFieldAnonymousHeadOmitEmptyBoolIndent" + case opStructFieldAnonymousHeadOmitEmptyStringIndent: + return "StructFieldAnonymousHeadOmitEmptyStringIndent" + case opStructFieldPtrHeadIntIndent: + return "StructFieldPtrHeadIntIndent" + case opStructFieldPtrHeadInt8Indent: + return "StructFieldPtrHeadInt8Indent" + case opStructFieldPtrHeadInt16Indent: + return "StructFieldPtrHeadInt16Indent" + case opStructFieldPtrHeadInt32Indent: + return "StructFieldPtrHeadInt32Indent" + case opStructFieldPtrHeadInt64Indent: + return "StructFieldPtrHeadInt64Indent" + case opStructFieldPtrHeadUintIndent: + return "StructFieldPtrHeadUintIndent" + case opStructFieldPtrHeadUint8Indent: + return "StructFieldPtrHeadUint8Indent" + case opStructFieldPtrHeadUint16Indent: + return "StructFieldPtrHeadUint16Indent" + case opStructFieldPtrHeadUint32Indent: + return "StructFieldPtrHeadUint32Indent" + case opStructFieldPtrHeadUint64Indent: + return "StructFieldPtrHeadUint64Indent" + case opStructFieldPtrHeadFloat32Indent: + return "StructFieldPtrHeadFloat32Indent" + case opStructFieldPtrHeadFloat64Indent: + return "StructFieldPtrHeadFloat64Indent" + case opStructFieldPtrHeadBoolIndent: + return "StructFieldPtrHeadBoolIndent" + case opStructFieldPtrHeadStringIndent: + return "StructFieldPtrHeadStringIndent" + case opStructFieldPtrHeadOmitEmptyIntIndent: + return "StructFieldPtrHeadOmitEmptyIntIndent" + case opStructFieldPtrHeadOmitEmptyInt8Indent: + return "StructFieldPtrHeadOmitEmptyInt8Indent" + case opStructFieldPtrHeadOmitEmptyInt16Indent: + return "StructFieldPtrHeadOmitEmptyInt16Indent" + case opStructFieldPtrHeadOmitEmptyInt32Indent: + return "StructFieldPtrHeadOmitEmptyInt32Indent" + case opStructFieldPtrHeadOmitEmptyInt64Indent: + return "StructFieldPtrHeadOmitEmptyInt64Indent" + case opStructFieldPtrHeadOmitEmptyUintIndent: + return "StructFieldPtrHeadOmitEmptyUintIndent" + case opStructFieldPtrHeadOmitEmptyUint8Indent: + return "StructFieldPtrHeadOmitEmptyUint8Indent" + case opStructFieldPtrHeadOmitEmptyUint16Indent: + return "StructFieldPtrHeadOmitEmptyUint16Indent" + case opStructFieldPtrHeadOmitEmptyUint32Indent: + return "StructFieldPtrHeadOmitEmptyUint32Indent" + case opStructFieldPtrHeadOmitEmptyUint64Indent: + return "StructFieldPtrHeadOmitEmptyUint64Indent" + case opStructFieldPtrHeadOmitEmptyFloat32Indent: + return "StructFieldPtrHeadOmitEmptyFloat32Indent" + case opStructFieldPtrHeadOmitEmptyFloat64Indent: + return "StructFieldPtrHeadOmitEmptyFloat64Indent" + case opStructFieldPtrHeadOmitEmptyBoolIndent: + return "StructFieldPtrHeadOmitEmptyBoolIndent" + case opStructFieldPtrHeadOmitEmptyStringIndent: + return "StructFieldPtrHeadOmitEmptyStringIndent" + case opStructFieldPtrAnonymousHeadIntIndent: + return "StructFieldPtrAnonymousHeadIntIndent" + case opStructFieldPtrAnonymousHeadInt8Indent: + return "StructFieldPtrAnonymousHeadInt8Indent" + case opStructFieldPtrAnonymousHeadInt16Indent: + return "StructFieldPtrAnonymousHeadInt16Indent" + case opStructFieldPtrAnonymousHeadInt32Indent: + return "StructFieldPtrAnonymousHeadInt32Indent" + case opStructFieldPtrAnonymousHeadInt64Indent: + return "StructFieldPtrAnonymousHeadInt64Indent" + case opStructFieldPtrAnonymousHeadUintIndent: + return "StructFieldPtrAnonymousHeadUintIndent" + case opStructFieldPtrAnonymousHeadUint8Indent: + return "StructFieldPtrAnonymousHeadUint8Indent" + case opStructFieldPtrAnonymousHeadUint16Indent: + return "StructFieldPtrAnonymousHeadUint16Indent" + case opStructFieldPtrAnonymousHeadUint32Indent: + return "StructFieldPtrAnonymousHeadUint32Indent" + case opStructFieldPtrAnonymousHeadUint64Indent: + return "StructFieldPtrAnonymousHeadUint64Indent" + case opStructFieldPtrAnonymousHeadFloat32Indent: + return "StructFieldPtrAnonymousHeadFloat32Indent" + case opStructFieldPtrAnonymousHeadFloat64Indent: + return "StructFieldPtrAnonymousHeadFloat64Indent" + case opStructFieldPtrAnonymousHeadBoolIndent: + return "StructFieldPtrAnonymousHeadBoolIndent" + case opStructFieldPtrAnonymousHeadStringIndent: + return "StructFieldPtrAnonymousHeadStringIndent" + case opStructFieldPtrAnonymousHeadOmitEmptyIntIndent: + return "StructFieldPtrAnonymousHeadOmitEmptyIntIndent" + case opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyInt8Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyInt16Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyInt32Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyInt64Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyUintIndent: + return "StructFieldPtrAnonymousHeadOmitEmptyUintIndent" + case opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyUint8Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyUint16Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyUint32Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyUint64Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyFloat32Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent: + return "StructFieldPtrAnonymousHeadOmitEmptyFloat64Indent" + case opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent: + return "StructFieldPtrAnonymousHeadOmitEmptyBoolIndent" + case opStructFieldPtrAnonymousHeadOmitEmptyStringIndent: + return "StructFieldPtrAnonymousHeadOmitEmptyStringIndent" + case opStructFieldIntIndent: + return "StructFieldIntIndent" + case opStructFieldInt8Indent: + return "StructFieldInt8Indent" + case opStructFieldInt16Indent: + return "StructFieldInt16Indent" + case opStructFieldInt32Indent: + return "StructFieldInt32Indent" + case opStructFieldInt64Indent: + return "StructFieldInt64Indent" + case opStructFieldUintIndent: + return "StructFieldUintIndent" + case opStructFieldUint8Indent: + return "StructFieldUint8Indent" + case opStructFieldUint16Indent: + return "StructFieldUint16Indent" + case opStructFieldUint32Indent: + return "StructFieldUint32Indent" + case opStructFieldUint64Indent: + return "StructFieldUint64Indent" + case opStructFieldFloat32Indent: + return "StructFieldFloat32Indent" + case opStructFieldFloat64Indent: + return "StructFieldFloat64Indent" + case opStructFieldBoolIndent: + return "StructFieldBoolIndent" + case opStructFieldStringIndent: + return "StructFieldStringIndent" + case opStructFieldOmitEmptyIntIndent: + return "StructFieldOmitEmptyIntIndent" + case opStructFieldOmitEmptyInt8Indent: + return "StructFieldOmitEmptyInt8Indent" + case opStructFieldOmitEmptyInt16Indent: + return "StructFieldOmitEmptyInt16Indent" + case opStructFieldOmitEmptyInt32Indent: + return "StructFieldOmitEmptyInt32Indent" + case opStructFieldOmitEmptyInt64Indent: + return "StructFieldOmitEmptyInt64Indent" + case opStructFieldOmitEmptyUintIndent: + return "StructFieldOmitEmptyUintIndent" + case opStructFieldOmitEmptyUint8Indent: + return "StructFieldOmitEmptyUint8Indent" + case opStructFieldOmitEmptyUint16Indent: + return "StructFieldOmitEmptyUint16Indent" + case opStructFieldOmitEmptyUint32Indent: + return "StructFieldOmitEmptyUint32Indent" + case opStructFieldOmitEmptyUint64Indent: + return "StructFieldOmitEmptyUint64Indent" + case opStructFieldOmitEmptyFloat32Indent: + return "StructFieldOmitEmptyFloat32Indent" + case opStructFieldOmitEmptyFloat64Indent: + return "StructFieldOmitEmptyFloat64Indent" + case opStructFieldOmitEmptyBoolIndent: + return "StructFieldOmitEmptyBoolIndent" + case opStructFieldOmitEmptyStringIndent: + return "StructFieldOmitEmptyStringIndent" + } + return "" +} + +func (t opType) codeType() codeType { + switch t { + case opEnd: + return codeOp + case opInterface: + return codeOp + case opPtr: + return codeOp + case opMarshalJSON: + return codeOp + case opMarshalText: + return codeOp + case opSliceHead: + return codeSliceHead + case opRootSliceHead: + return codeSliceHead + case opSliceElem: + return codeSliceElem + case opRootSliceElem: + return codeSliceElem + case opSliceEnd: + return codeOp + case opArrayHead: + return codeArrayHead + case opArrayElem: + return codeArrayElem + case opArrayEnd: + return codeOp + case opMapHead: + return codeMapHead + case opMapHeadLoad: + return codeMapHead + case opRootMapHead: + return codeMapHead + case opMapKey: + return codeMapKey + case opRootMapKey: + return codeMapKey + case opMapValue: + return codeMapValue + case opMapEnd: + return codeOp + case opStructFieldHead: + return codeStructField + case opStructFieldHeadOmitEmpty: + return codeStructField + case opStructFieldAnonymousHead: + return codeStructField + case opStructFieldAnonymousHeadOmitEmpty: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmpty: + return codeStructField + case opStructFieldPtrHead: + return codeStructField + case opStructFieldPtrHeadOmitEmpty: + return codeStructField + case opStructFieldPtrAnonymousHead: + return codeStructField + case opStructField: + return codeStructField + case opStructFieldOmitEmpty: + return codeStructField + case opStructFieldRecursive: + return codeStructFieldRecursive + case opStructEnd: + return codeStructField + case opStructAnonymousEnd: + return codeStructField + case opInt: + return codeOp + case opInt8: + return codeOp + case opInt16: + return codeOp + case opInt32: + return codeOp + case opInt64: + return codeOp + case opUint: + return codeOp + case opUint8: + return codeOp + case opUint16: + return codeOp + case opUint32: + return codeOp + case opUint64: + return codeOp + case opFloat32: + return codeOp + case opFloat64: + return codeOp + case opBool: + return codeOp + case opString: + return codeOp + case opStructFieldHeadInt: + return codeStructField + case opStructFieldHeadInt8: + return codeStructField + case opStructFieldHeadInt16: + return codeStructField + case opStructFieldHeadInt32: + return codeStructField + case opStructFieldHeadInt64: + return codeStructField + case opStructFieldHeadUint: + return codeStructField + case opStructFieldHeadUint8: + return codeStructField + case opStructFieldHeadUint16: + return codeStructField + case opStructFieldHeadUint32: + return codeStructField + case opStructFieldHeadUint64: + return codeStructField + case opStructFieldHeadFloat32: + return codeStructField + case opStructFieldHeadFloat64: + return codeStructField + case opStructFieldHeadBool: + return codeStructField + case opStructFieldHeadString: + return codeStructField + case opStructFieldHeadOmitEmptyInt: + return codeStructField + case opStructFieldHeadOmitEmptyInt8: + return codeStructField + case opStructFieldHeadOmitEmptyInt16: + return codeStructField + case opStructFieldHeadOmitEmptyInt32: + return codeStructField + case opStructFieldHeadOmitEmptyInt64: + return codeStructField + case opStructFieldHeadOmitEmptyUint: + return codeStructField + case opStructFieldHeadOmitEmptyUint8: + return codeStructField + case opStructFieldHeadOmitEmptyUint16: + return codeStructField + case opStructFieldHeadOmitEmptyUint32: + return codeStructField + case opStructFieldHeadOmitEmptyUint64: + return codeStructField + case opStructFieldHeadOmitEmptyFloat32: + return codeStructField + case opStructFieldHeadOmitEmptyFloat64: + return codeStructField + case opStructFieldHeadOmitEmptyBool: + return codeStructField + case opStructFieldHeadOmitEmptyString: + return codeStructField + case opStructFieldAnonymousHeadInt: + return codeStructField + case opStructFieldAnonymousHeadInt8: + return codeStructField + case opStructFieldAnonymousHeadInt16: + return codeStructField + case opStructFieldAnonymousHeadInt32: + return codeStructField + case opStructFieldAnonymousHeadInt64: + return codeStructField + case opStructFieldAnonymousHeadUint: + return codeStructField + case opStructFieldAnonymousHeadUint8: + return codeStructField + case opStructFieldAnonymousHeadUint16: + return codeStructField + case opStructFieldAnonymousHeadUint32: + return codeStructField + case opStructFieldAnonymousHeadUint64: + return codeStructField + case opStructFieldAnonymousHeadFloat32: + return codeStructField + case opStructFieldAnonymousHeadFloat64: + return codeStructField + case opStructFieldAnonymousHeadBool: + return codeStructField + case opStructFieldAnonymousHeadString: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt8: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt16: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt32: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt64: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint8: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint16: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint32: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint64: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyFloat32: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyFloat64: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyBool: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyString: + return codeStructField + case opStructFieldPtrHeadInt: + return codeStructField + case opStructFieldPtrHeadInt8: + return codeStructField + case opStructFieldPtrHeadInt16: + return codeStructField + case opStructFieldPtrHeadInt32: + return codeStructField + case opStructFieldPtrHeadInt64: + return codeStructField + case opStructFieldPtrHeadUint: + return codeStructField + case opStructFieldPtrHeadUint8: + return codeStructField + case opStructFieldPtrHeadUint16: + return codeStructField + case opStructFieldPtrHeadUint32: + return codeStructField + case opStructFieldPtrHeadUint64: + return codeStructField + case opStructFieldPtrHeadFloat32: + return codeStructField + case opStructFieldPtrHeadFloat64: + return codeStructField + case opStructFieldPtrHeadBool: + return codeStructField + case opStructFieldPtrHeadString: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt8: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt16: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt32: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt64: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint8: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint16: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint32: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint64: + return codeStructField + case opStructFieldPtrHeadOmitEmptyFloat32: + return codeStructField + case opStructFieldPtrHeadOmitEmptyFloat64: + return codeStructField + case opStructFieldPtrHeadOmitEmptyBool: + return codeStructField + case opStructFieldPtrHeadOmitEmptyString: + return codeStructField + case opStructFieldPtrAnonymousHeadInt: + return codeStructField + case opStructFieldPtrAnonymousHeadInt8: + return codeStructField + case opStructFieldPtrAnonymousHeadInt16: + return codeStructField + case opStructFieldPtrAnonymousHeadInt32: + return codeStructField + case opStructFieldPtrAnonymousHeadInt64: + return codeStructField + case opStructFieldPtrAnonymousHeadUint: + return codeStructField + case opStructFieldPtrAnonymousHeadUint8: + return codeStructField + case opStructFieldPtrAnonymousHeadUint16: + return codeStructField + case opStructFieldPtrAnonymousHeadUint32: + return codeStructField + case opStructFieldPtrAnonymousHeadUint64: + return codeStructField + case opStructFieldPtrAnonymousHeadFloat32: + return codeStructField + case opStructFieldPtrAnonymousHeadFloat64: + return codeStructField + case opStructFieldPtrAnonymousHeadBool: + return codeStructField + case opStructFieldPtrAnonymousHeadString: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt8: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt16: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt32: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt64: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint8: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint16: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint32: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint64: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyBool: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyString: + return codeStructField + case opStructFieldInt: + return codeStructField + case opStructFieldInt8: + return codeStructField + case opStructFieldInt16: + return codeStructField + case opStructFieldInt32: + return codeStructField + case opStructFieldInt64: + return codeStructField + case opStructFieldUint: + return codeStructField + case opStructFieldUint8: + return codeStructField + case opStructFieldUint16: + return codeStructField + case opStructFieldUint32: + return codeStructField + case opStructFieldUint64: + return codeStructField + case opStructFieldFloat32: + return codeStructField + case opStructFieldFloat64: + return codeStructField + case opStructFieldBool: + return codeStructField + case opStructFieldString: + return codeStructField + case opStructFieldOmitEmptyInt: + return codeStructField + case opStructFieldOmitEmptyInt8: + return codeStructField + case opStructFieldOmitEmptyInt16: + return codeStructField + case opStructFieldOmitEmptyInt32: + return codeStructField + case opStructFieldOmitEmptyInt64: + return codeStructField + case opStructFieldOmitEmptyUint: + return codeStructField + case opStructFieldOmitEmptyUint8: + return codeStructField + case opStructFieldOmitEmptyUint16: + return codeStructField + case opStructFieldOmitEmptyUint32: + return codeStructField + case opStructFieldOmitEmptyUint64: + return codeStructField + case opStructFieldOmitEmptyFloat32: + return codeStructField + case opStructFieldOmitEmptyFloat64: + return codeStructField + case opStructFieldOmitEmptyBool: + return codeStructField + case opStructFieldOmitEmptyString: + return codeStructField + case opEndIndent: + return codeOp + case opInterfaceIndent: + return codeOp + case opPtrIndent: + return codeOp + case opMarshalJSONIndent: + return codeOp + case opMarshalTextIndent: + return codeOp + case opSliceHeadIndent: + return codeSliceHead + case opRootSliceHeadIndent: + return codeSliceHead + case opSliceElemIndent: + return codeSliceElem + case opRootSliceElemIndent: + return codeSliceElem + case opSliceEndIndent: + return codeOp + case opArrayHeadIndent: + return codeArrayHead + case opArrayElemIndent: + return codeArrayElem + case opArrayEndIndent: + return codeOp + case opMapHeadIndent: + return codeMapHead + case opMapHeadLoadIndent: + return codeMapHead + case opRootMapHeadIndent: + return codeMapHead + case opMapKeyIndent: + return codeMapKey + case opRootMapKeyIndent: + return codeMapKey + case opMapValueIndent: + return codeMapValue + case opMapEndIndent: + return codeOp + case opStructFieldHeadIndent: + return codeStructField + case opStructFieldHeadOmitEmptyIndent: + return codeStructField + case opStructFieldAnonymousHeadIndent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyIndent: + return codeStructField + case opStructFieldPtrHeadIndent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadIndent: + return codeStructField + case opStructFieldIndent: + return codeStructField + case opStructFieldOmitEmptyIndent: + return codeStructField + case opStructFieldRecursiveIndent: + return codeStructFieldRecursive + case opStructEndIndent: + return codeStructField + case opStructAnonymousEndIndent: + return codeStructField + case opIntIndent: + return codeOp + case opInt8Indent: + return codeOp + case opInt16Indent: + return codeOp + case opInt32Indent: + return codeOp + case opInt64Indent: + return codeOp + case opUintIndent: + return codeOp + case opUint8Indent: + return codeOp + case opUint16Indent: + return codeOp + case opUint32Indent: + return codeOp + case opUint64Indent: + return codeOp + case opFloat32Indent: + return codeOp + case opFloat64Indent: + return codeOp + case opBoolIndent: + return codeOp + case opStringIndent: + return codeOp + case opStructFieldHeadIntIndent: + return codeStructField + case opStructFieldHeadInt8Indent: + return codeStructField + case opStructFieldHeadInt16Indent: + return codeStructField + case opStructFieldHeadInt32Indent: + return codeStructField + case opStructFieldHeadInt64Indent: + return codeStructField + case opStructFieldHeadUintIndent: + return codeStructField + case opStructFieldHeadUint8Indent: + return codeStructField + case opStructFieldHeadUint16Indent: + return codeStructField + case opStructFieldHeadUint32Indent: + return codeStructField + case opStructFieldHeadUint64Indent: + return codeStructField + case opStructFieldHeadFloat32Indent: + return codeStructField + case opStructFieldHeadFloat64Indent: + return codeStructField + case opStructFieldHeadBoolIndent: + return codeStructField + case opStructFieldHeadStringIndent: + return codeStructField + case opStructFieldHeadOmitEmptyIntIndent: + return codeStructField + case opStructFieldHeadOmitEmptyInt8Indent: + return codeStructField + case opStructFieldHeadOmitEmptyInt16Indent: + return codeStructField + case opStructFieldHeadOmitEmptyInt32Indent: + return codeStructField + case opStructFieldHeadOmitEmptyInt64Indent: + return codeStructField + case opStructFieldHeadOmitEmptyUintIndent: + return codeStructField + case opStructFieldHeadOmitEmptyUint8Indent: + return codeStructField + case opStructFieldHeadOmitEmptyUint16Indent: + return codeStructField + case opStructFieldHeadOmitEmptyUint32Indent: + return codeStructField + case opStructFieldHeadOmitEmptyUint64Indent: + return codeStructField + case opStructFieldHeadOmitEmptyFloat32Indent: + return codeStructField + case opStructFieldHeadOmitEmptyFloat64Indent: + return codeStructField + case opStructFieldHeadOmitEmptyBoolIndent: + return codeStructField + case opStructFieldHeadOmitEmptyStringIndent: + return codeStructField + case opStructFieldAnonymousHeadIntIndent: + return codeStructField + case opStructFieldAnonymousHeadInt8Indent: + return codeStructField + case opStructFieldAnonymousHeadInt16Indent: + return codeStructField + case opStructFieldAnonymousHeadInt32Indent: + return codeStructField + case opStructFieldAnonymousHeadInt64Indent: + return codeStructField + case opStructFieldAnonymousHeadUintIndent: + return codeStructField + case opStructFieldAnonymousHeadUint8Indent: + return codeStructField + case opStructFieldAnonymousHeadUint16Indent: + return codeStructField + case opStructFieldAnonymousHeadUint32Indent: + return codeStructField + case opStructFieldAnonymousHeadUint64Indent: + return codeStructField + case opStructFieldAnonymousHeadFloat32Indent: + return codeStructField + case opStructFieldAnonymousHeadFloat64Indent: + return codeStructField + case opStructFieldAnonymousHeadBoolIndent: + return codeStructField + case opStructFieldAnonymousHeadStringIndent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyIntIndent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt8Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt16Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt32Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyInt64Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUintIndent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint8Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint16Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint32Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyUint64Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyFloat32Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyFloat64Indent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyBoolIndent: + return codeStructField + case opStructFieldAnonymousHeadOmitEmptyStringIndent: + return codeStructField + case opStructFieldPtrHeadIntIndent: + return codeStructField + case opStructFieldPtrHeadInt8Indent: + return codeStructField + case opStructFieldPtrHeadInt16Indent: + return codeStructField + case opStructFieldPtrHeadInt32Indent: + return codeStructField + case opStructFieldPtrHeadInt64Indent: + return codeStructField + case opStructFieldPtrHeadUintIndent: + return codeStructField + case opStructFieldPtrHeadUint8Indent: + return codeStructField + case opStructFieldPtrHeadUint16Indent: + return codeStructField + case opStructFieldPtrHeadUint32Indent: + return codeStructField + case opStructFieldPtrHeadUint64Indent: + return codeStructField + case opStructFieldPtrHeadFloat32Indent: + return codeStructField + case opStructFieldPtrHeadFloat64Indent: + return codeStructField + case opStructFieldPtrHeadBoolIndent: + return codeStructField + case opStructFieldPtrHeadStringIndent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyIntIndent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt8Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt16Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt32Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyInt64Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUintIndent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint8Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint16Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint32Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyUint64Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyFloat32Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyFloat64Indent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyBoolIndent: + return codeStructField + case opStructFieldPtrHeadOmitEmptyStringIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadIntIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadInt8Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadInt16Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadInt32Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadInt64Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadUintIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadUint8Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadUint16Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadUint32Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadUint64Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadFloat32Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadFloat64Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadBoolIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadStringIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyIntIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUintIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent: + return codeStructField + case opStructFieldPtrAnonymousHeadOmitEmptyStringIndent: + return codeStructField + case opStructFieldIntIndent: + return codeStructField + case opStructFieldInt8Indent: + return codeStructField + case opStructFieldInt16Indent: + return codeStructField + case opStructFieldInt32Indent: + return codeStructField + case opStructFieldInt64Indent: + return codeStructField + case opStructFieldUintIndent: + return codeStructField + case opStructFieldUint8Indent: + return codeStructField + case opStructFieldUint16Indent: + return codeStructField + case opStructFieldUint32Indent: + return codeStructField + case opStructFieldUint64Indent: + return codeStructField + case opStructFieldFloat32Indent: + return codeStructField + case opStructFieldFloat64Indent: + return codeStructField + case opStructFieldBoolIndent: + return codeStructField + case opStructFieldStringIndent: + return codeStructField + case opStructFieldOmitEmptyIntIndent: + return codeStructField + case opStructFieldOmitEmptyInt8Indent: + return codeStructField + case opStructFieldOmitEmptyInt16Indent: + return codeStructField + case opStructFieldOmitEmptyInt32Indent: + return codeStructField + case opStructFieldOmitEmptyInt64Indent: + return codeStructField + case opStructFieldOmitEmptyUintIndent: + return codeStructField + case opStructFieldOmitEmptyUint8Indent: + return codeStructField + case opStructFieldOmitEmptyUint16Indent: + return codeStructField + case opStructFieldOmitEmptyUint32Indent: + return codeStructField + case opStructFieldOmitEmptyUint64Indent: + return codeStructField + case opStructFieldOmitEmptyFloat32Indent: + return codeStructField + case opStructFieldOmitEmptyFloat64Indent: + return codeStructField + case opStructFieldOmitEmptyBoolIndent: + return codeStructField + case opStructFieldOmitEmptyStringIndent: + return codeStructField + } + return codeOp +} + +func (t opType) toIndent() opType { + switch t { + case opEnd: + return opEndIndent + case opInterface: + return opInterfaceIndent + case opPtr: + return opPtrIndent + case opMarshalJSON: + return opMarshalJSONIndent + case opMarshalText: + return opMarshalTextIndent + case opSliceHead: + return opSliceHeadIndent + case opRootSliceHead: + return opRootSliceHeadIndent + case opSliceElem: + return opSliceElemIndent + case opRootSliceElem: + return opRootSliceElemIndent + case opSliceEnd: + return opSliceEndIndent + case opArrayHead: + return opArrayHeadIndent + case opArrayElem: + return opArrayElemIndent + case opArrayEnd: + return opArrayEndIndent + case opMapHead: + return opMapHeadIndent + case opMapHeadLoad: + return opMapHeadLoadIndent + case opRootMapHead: + return opRootMapHeadIndent + case opMapKey: + return opMapKeyIndent + case opRootMapKey: + return opRootMapKeyIndent + case opMapValue: + return opMapValueIndent + case opMapEnd: + return opMapEndIndent + case opStructFieldHead: + return opStructFieldHeadIndent + case opStructFieldHeadOmitEmpty: + return opStructFieldHeadOmitEmptyIndent + case opStructFieldAnonymousHead: + return opStructFieldAnonymousHeadIndent + case opStructFieldAnonymousHeadOmitEmpty: + return opStructFieldAnonymousHeadOmitEmptyIndent + case opStructFieldPtrAnonymousHeadOmitEmpty: + return opStructFieldPtrAnonymousHeadOmitEmptyIndent + case opStructFieldPtrHead: + return opStructFieldPtrHeadIndent + case opStructFieldPtrHeadOmitEmpty: + return opStructFieldPtrHeadOmitEmptyIndent + case opStructFieldPtrAnonymousHead: + return opStructFieldPtrAnonymousHeadIndent + case opStructField: + return opStructFieldIndent + case opStructFieldOmitEmpty: + return opStructFieldOmitEmptyIndent + case opStructFieldRecursive: + return opStructFieldRecursiveIndent + case opStructEnd: + return opStructEndIndent + case opStructAnonymousEnd: + return opStructAnonymousEndIndent + case opInt: + return opIntIndent + case opInt8: + return opInt8Indent + case opInt16: + return opInt16Indent + case opInt32: + return opInt32Indent + case opInt64: + return opInt64Indent + case opUint: + return opUintIndent + case opUint8: + return opUint8Indent + case opUint16: + return opUint16Indent + case opUint32: + return opUint32Indent + case opUint64: + return opUint64Indent + case opFloat32: + return opFloat32Indent + case opFloat64: + return opFloat64Indent + case opBool: + return opBoolIndent + case opString: + return opStringIndent + case opStructFieldHeadInt: + return opStructFieldHeadIntIndent + case opStructFieldHeadInt8: + return opStructFieldHeadInt8Indent + case opStructFieldHeadInt16: + return opStructFieldHeadInt16Indent + case opStructFieldHeadInt32: + return opStructFieldHeadInt32Indent + case opStructFieldHeadInt64: + return opStructFieldHeadInt64Indent + case opStructFieldHeadUint: + return opStructFieldHeadUintIndent + case opStructFieldHeadUint8: + return opStructFieldHeadUint8Indent + case opStructFieldHeadUint16: + return opStructFieldHeadUint16Indent + case opStructFieldHeadUint32: + return opStructFieldHeadUint32Indent + case opStructFieldHeadUint64: + return opStructFieldHeadUint64Indent + case opStructFieldHeadFloat32: + return opStructFieldHeadFloat32Indent + case opStructFieldHeadFloat64: + return opStructFieldHeadFloat64Indent + case opStructFieldHeadBool: + return opStructFieldHeadBoolIndent + case opStructFieldHeadString: + return opStructFieldHeadStringIndent + case opStructFieldHeadOmitEmptyInt: + return opStructFieldHeadOmitEmptyIntIndent + case opStructFieldHeadOmitEmptyInt8: + return opStructFieldHeadOmitEmptyInt8Indent + case opStructFieldHeadOmitEmptyInt16: + return opStructFieldHeadOmitEmptyInt16Indent + case opStructFieldHeadOmitEmptyInt32: + return opStructFieldHeadOmitEmptyInt32Indent + case opStructFieldHeadOmitEmptyInt64: + return opStructFieldHeadOmitEmptyInt64Indent + case opStructFieldHeadOmitEmptyUint: + return opStructFieldHeadOmitEmptyUintIndent + case opStructFieldHeadOmitEmptyUint8: + return opStructFieldHeadOmitEmptyUint8Indent + case opStructFieldHeadOmitEmptyUint16: + return opStructFieldHeadOmitEmptyUint16Indent + case opStructFieldHeadOmitEmptyUint32: + return opStructFieldHeadOmitEmptyUint32Indent + case opStructFieldHeadOmitEmptyUint64: + return opStructFieldHeadOmitEmptyUint64Indent + case opStructFieldHeadOmitEmptyFloat32: + return opStructFieldHeadOmitEmptyFloat32Indent + case opStructFieldHeadOmitEmptyFloat64: + return opStructFieldHeadOmitEmptyFloat64Indent + case opStructFieldHeadOmitEmptyBool: + return opStructFieldHeadOmitEmptyBoolIndent + case opStructFieldHeadOmitEmptyString: + return opStructFieldHeadOmitEmptyStringIndent + case opStructFieldAnonymousHeadInt: + return opStructFieldAnonymousHeadIntIndent + case opStructFieldAnonymousHeadInt8: + return opStructFieldAnonymousHeadInt8Indent + case opStructFieldAnonymousHeadInt16: + return opStructFieldAnonymousHeadInt16Indent + case opStructFieldAnonymousHeadInt32: + return opStructFieldAnonymousHeadInt32Indent + case opStructFieldAnonymousHeadInt64: + return opStructFieldAnonymousHeadInt64Indent + case opStructFieldAnonymousHeadUint: + return opStructFieldAnonymousHeadUintIndent + case opStructFieldAnonymousHeadUint8: + return opStructFieldAnonymousHeadUint8Indent + case opStructFieldAnonymousHeadUint16: + return opStructFieldAnonymousHeadUint16Indent + case opStructFieldAnonymousHeadUint32: + return opStructFieldAnonymousHeadUint32Indent + case opStructFieldAnonymousHeadUint64: + return opStructFieldAnonymousHeadUint64Indent + case opStructFieldAnonymousHeadFloat32: + return opStructFieldAnonymousHeadFloat32Indent + case opStructFieldAnonymousHeadFloat64: + return opStructFieldAnonymousHeadFloat64Indent + case opStructFieldAnonymousHeadBool: + return opStructFieldAnonymousHeadBoolIndent + case opStructFieldAnonymousHeadString: + return opStructFieldAnonymousHeadStringIndent + case opStructFieldAnonymousHeadOmitEmptyInt: + return opStructFieldAnonymousHeadOmitEmptyIntIndent + case opStructFieldAnonymousHeadOmitEmptyInt8: + return opStructFieldAnonymousHeadOmitEmptyInt8Indent + case opStructFieldAnonymousHeadOmitEmptyInt16: + return opStructFieldAnonymousHeadOmitEmptyInt16Indent + case opStructFieldAnonymousHeadOmitEmptyInt32: + return opStructFieldAnonymousHeadOmitEmptyInt32Indent + case opStructFieldAnonymousHeadOmitEmptyInt64: + return opStructFieldAnonymousHeadOmitEmptyInt64Indent + case opStructFieldAnonymousHeadOmitEmptyUint: + return opStructFieldAnonymousHeadOmitEmptyUintIndent + case opStructFieldAnonymousHeadOmitEmptyUint8: + return opStructFieldAnonymousHeadOmitEmptyUint8Indent + case opStructFieldAnonymousHeadOmitEmptyUint16: + return opStructFieldAnonymousHeadOmitEmptyUint16Indent + case opStructFieldAnonymousHeadOmitEmptyUint32: + return opStructFieldAnonymousHeadOmitEmptyUint32Indent + case opStructFieldAnonymousHeadOmitEmptyUint64: + return opStructFieldAnonymousHeadOmitEmptyUint64Indent + case opStructFieldAnonymousHeadOmitEmptyFloat32: + return opStructFieldAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldAnonymousHeadOmitEmptyFloat64: + return opStructFieldAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldAnonymousHeadOmitEmptyBool: + return opStructFieldAnonymousHeadOmitEmptyBoolIndent + case opStructFieldAnonymousHeadOmitEmptyString: + return opStructFieldAnonymousHeadOmitEmptyStringIndent + case opStructFieldPtrHeadInt: + return opStructFieldPtrHeadIntIndent + case opStructFieldPtrHeadInt8: + return opStructFieldPtrHeadInt8Indent + case opStructFieldPtrHeadInt16: + return opStructFieldPtrHeadInt16Indent + case opStructFieldPtrHeadInt32: + return opStructFieldPtrHeadInt32Indent + case opStructFieldPtrHeadInt64: + return opStructFieldPtrHeadInt64Indent + case opStructFieldPtrHeadUint: + return opStructFieldPtrHeadUintIndent + case opStructFieldPtrHeadUint8: + return opStructFieldPtrHeadUint8Indent + case opStructFieldPtrHeadUint16: + return opStructFieldPtrHeadUint16Indent + case opStructFieldPtrHeadUint32: + return opStructFieldPtrHeadUint32Indent + case opStructFieldPtrHeadUint64: + return opStructFieldPtrHeadUint64Indent + case opStructFieldPtrHeadFloat32: + return opStructFieldPtrHeadFloat32Indent + case opStructFieldPtrHeadFloat64: + return opStructFieldPtrHeadFloat64Indent + case opStructFieldPtrHeadBool: + return opStructFieldPtrHeadBoolIndent + case opStructFieldPtrHeadString: + return opStructFieldPtrHeadStringIndent + case opStructFieldPtrHeadOmitEmptyInt: + return opStructFieldPtrHeadOmitEmptyIntIndent + case opStructFieldPtrHeadOmitEmptyInt8: + return opStructFieldPtrHeadOmitEmptyInt8Indent + case opStructFieldPtrHeadOmitEmptyInt16: + return opStructFieldPtrHeadOmitEmptyInt16Indent + case opStructFieldPtrHeadOmitEmptyInt32: + return opStructFieldPtrHeadOmitEmptyInt32Indent + case opStructFieldPtrHeadOmitEmptyInt64: + return opStructFieldPtrHeadOmitEmptyInt64Indent + case opStructFieldPtrHeadOmitEmptyUint: + return opStructFieldPtrHeadOmitEmptyUintIndent + case opStructFieldPtrHeadOmitEmptyUint8: + return opStructFieldPtrHeadOmitEmptyUint8Indent + case opStructFieldPtrHeadOmitEmptyUint16: + return opStructFieldPtrHeadOmitEmptyUint16Indent + case opStructFieldPtrHeadOmitEmptyUint32: + return opStructFieldPtrHeadOmitEmptyUint32Indent + case opStructFieldPtrHeadOmitEmptyUint64: + return opStructFieldPtrHeadOmitEmptyUint64Indent + case opStructFieldPtrHeadOmitEmptyFloat32: + return opStructFieldPtrHeadOmitEmptyFloat32Indent + case opStructFieldPtrHeadOmitEmptyFloat64: + return opStructFieldPtrHeadOmitEmptyFloat64Indent + case opStructFieldPtrHeadOmitEmptyBool: + return opStructFieldPtrHeadOmitEmptyBoolIndent + case opStructFieldPtrHeadOmitEmptyString: + return opStructFieldPtrHeadOmitEmptyStringIndent + case opStructFieldPtrAnonymousHeadInt: + return opStructFieldPtrAnonymousHeadIntIndent + case opStructFieldPtrAnonymousHeadInt8: + return opStructFieldPtrAnonymousHeadInt8Indent + case opStructFieldPtrAnonymousHeadInt16: + return opStructFieldPtrAnonymousHeadInt16Indent + case opStructFieldPtrAnonymousHeadInt32: + return opStructFieldPtrAnonymousHeadInt32Indent + case opStructFieldPtrAnonymousHeadInt64: + return opStructFieldPtrAnonymousHeadInt64Indent + case opStructFieldPtrAnonymousHeadUint: + return opStructFieldPtrAnonymousHeadUintIndent + case opStructFieldPtrAnonymousHeadUint8: + return opStructFieldPtrAnonymousHeadUint8Indent + case opStructFieldPtrAnonymousHeadUint16: + return opStructFieldPtrAnonymousHeadUint16Indent + case opStructFieldPtrAnonymousHeadUint32: + return opStructFieldPtrAnonymousHeadUint32Indent + case opStructFieldPtrAnonymousHeadUint64: + return opStructFieldPtrAnonymousHeadUint64Indent + case opStructFieldPtrAnonymousHeadFloat32: + return opStructFieldPtrAnonymousHeadFloat32Indent + case opStructFieldPtrAnonymousHeadFloat64: + return opStructFieldPtrAnonymousHeadFloat64Indent + case opStructFieldPtrAnonymousHeadBool: + return opStructFieldPtrAnonymousHeadBoolIndent + case opStructFieldPtrAnonymousHeadString: + return opStructFieldPtrAnonymousHeadStringIndent + case opStructFieldPtrAnonymousHeadOmitEmptyInt: + return opStructFieldPtrAnonymousHeadOmitEmptyIntIndent + case opStructFieldPtrAnonymousHeadOmitEmptyInt8: + return opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt16: + return opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt32: + return opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt64: + return opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint: + return opStructFieldPtrAnonymousHeadOmitEmptyUintIndent + case opStructFieldPtrAnonymousHeadOmitEmptyUint8: + return opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint16: + return opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint32: + return opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint64: + return opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyBool: + return opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent + case opStructFieldPtrAnonymousHeadOmitEmptyString: + return opStructFieldPtrAnonymousHeadOmitEmptyStringIndent + case opStructFieldInt: + return opStructFieldIntIndent + case opStructFieldInt8: + return opStructFieldInt8Indent + case opStructFieldInt16: + return opStructFieldInt16Indent + case opStructFieldInt32: + return opStructFieldInt32Indent + case opStructFieldInt64: + return opStructFieldInt64Indent + case opStructFieldUint: + return opStructFieldUintIndent + case opStructFieldUint8: + return opStructFieldUint8Indent + case opStructFieldUint16: + return opStructFieldUint16Indent + case opStructFieldUint32: + return opStructFieldUint32Indent + case opStructFieldUint64: + return opStructFieldUint64Indent + case opStructFieldFloat32: + return opStructFieldFloat32Indent + case opStructFieldFloat64: + return opStructFieldFloat64Indent + case opStructFieldBool: + return opStructFieldBoolIndent + case opStructFieldString: + return opStructFieldStringIndent + case opStructFieldOmitEmptyInt: + return opStructFieldOmitEmptyIntIndent + case opStructFieldOmitEmptyInt8: + return opStructFieldOmitEmptyInt8Indent + case opStructFieldOmitEmptyInt16: + return opStructFieldOmitEmptyInt16Indent + case opStructFieldOmitEmptyInt32: + return opStructFieldOmitEmptyInt32Indent + case opStructFieldOmitEmptyInt64: + return opStructFieldOmitEmptyInt64Indent + case opStructFieldOmitEmptyUint: + return opStructFieldOmitEmptyUintIndent + case opStructFieldOmitEmptyUint8: + return opStructFieldOmitEmptyUint8Indent + case opStructFieldOmitEmptyUint16: + return opStructFieldOmitEmptyUint16Indent + case opStructFieldOmitEmptyUint32: + return opStructFieldOmitEmptyUint32Indent + case opStructFieldOmitEmptyUint64: + return opStructFieldOmitEmptyUint64Indent + case opStructFieldOmitEmptyFloat32: + return opStructFieldOmitEmptyFloat32Indent + case opStructFieldOmitEmptyFloat64: + return opStructFieldOmitEmptyFloat64Indent + case opStructFieldOmitEmptyBool: + return opStructFieldOmitEmptyBoolIndent + case opStructFieldOmitEmptyString: + return opStructFieldOmitEmptyStringIndent + case opEndIndent: + return opEndIndent + case opInterfaceIndent: + return opInterfaceIndent + case opPtrIndent: + return opPtrIndent + case opMarshalJSONIndent: + return opMarshalJSONIndent + case opMarshalTextIndent: + return opMarshalTextIndent + case opSliceHeadIndent: + return opSliceHeadIndent + case opRootSliceHeadIndent: + return opRootSliceHeadIndent + case opSliceElemIndent: + return opSliceElemIndent + case opRootSliceElemIndent: + return opRootSliceElemIndent + case opSliceEndIndent: + return opSliceEndIndent + case opArrayHeadIndent: + return opArrayHeadIndent + case opArrayElemIndent: + return opArrayElemIndent + case opArrayEndIndent: + return opArrayEndIndent + case opMapHeadIndent: + return opMapHeadIndent + case opMapHeadLoadIndent: + return opMapHeadLoadIndent + case opRootMapHeadIndent: + return opRootMapHeadIndent + case opMapKeyIndent: + return opMapKeyIndent + case opRootMapKeyIndent: + return opRootMapKeyIndent + case opMapValueIndent: + return opMapValueIndent + case opMapEndIndent: + return opMapEndIndent + case opStructFieldHeadIndent: + return opStructFieldHeadIndent + case opStructFieldHeadOmitEmptyIndent: + return opStructFieldHeadOmitEmptyIndent + case opStructFieldAnonymousHeadIndent: + return opStructFieldAnonymousHeadIndent + case opStructFieldAnonymousHeadOmitEmptyIndent: + return opStructFieldAnonymousHeadOmitEmptyIndent + case opStructFieldPtrAnonymousHeadOmitEmptyIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyIndent + case opStructFieldPtrHeadIndent: + return opStructFieldPtrHeadIndent + case opStructFieldPtrHeadOmitEmptyIndent: + return opStructFieldPtrHeadOmitEmptyIndent + case opStructFieldPtrAnonymousHeadIndent: + return opStructFieldPtrAnonymousHeadIndent + case opStructFieldIndent: + return opStructFieldIndent + case opStructFieldOmitEmptyIndent: + return opStructFieldOmitEmptyIndent + case opStructFieldRecursiveIndent: + return opStructFieldRecursiveIndent + case opStructEndIndent: + return opStructEndIndent + case opStructAnonymousEndIndent: + return opStructAnonymousEndIndent + case opIntIndent: + return opIntIndent + case opInt8Indent: + return opInt8Indent + case opInt16Indent: + return opInt16Indent + case opInt32Indent: + return opInt32Indent + case opInt64Indent: + return opInt64Indent + case opUintIndent: + return opUintIndent + case opUint8Indent: + return opUint8Indent + case opUint16Indent: + return opUint16Indent + case opUint32Indent: + return opUint32Indent + case opUint64Indent: + return opUint64Indent + case opFloat32Indent: + return opFloat32Indent + case opFloat64Indent: + return opFloat64Indent + case opBoolIndent: + return opBoolIndent + case opStringIndent: + return opStringIndent + case opStructFieldHeadIntIndent: + return opStructFieldHeadIntIndent + case opStructFieldHeadInt8Indent: + return opStructFieldHeadInt8Indent + case opStructFieldHeadInt16Indent: + return opStructFieldHeadInt16Indent + case opStructFieldHeadInt32Indent: + return opStructFieldHeadInt32Indent + case opStructFieldHeadInt64Indent: + return opStructFieldHeadInt64Indent + case opStructFieldHeadUintIndent: + return opStructFieldHeadUintIndent + case opStructFieldHeadUint8Indent: + return opStructFieldHeadUint8Indent + case opStructFieldHeadUint16Indent: + return opStructFieldHeadUint16Indent + case opStructFieldHeadUint32Indent: + return opStructFieldHeadUint32Indent + case opStructFieldHeadUint64Indent: + return opStructFieldHeadUint64Indent + case opStructFieldHeadFloat32Indent: + return opStructFieldHeadFloat32Indent + case opStructFieldHeadFloat64Indent: + return opStructFieldHeadFloat64Indent + case opStructFieldHeadBoolIndent: + return opStructFieldHeadBoolIndent + case opStructFieldHeadStringIndent: + return opStructFieldHeadStringIndent + case opStructFieldHeadOmitEmptyIntIndent: + return opStructFieldHeadOmitEmptyIntIndent + case opStructFieldHeadOmitEmptyInt8Indent: + return opStructFieldHeadOmitEmptyInt8Indent + case opStructFieldHeadOmitEmptyInt16Indent: + return opStructFieldHeadOmitEmptyInt16Indent + case opStructFieldHeadOmitEmptyInt32Indent: + return opStructFieldHeadOmitEmptyInt32Indent + case opStructFieldHeadOmitEmptyInt64Indent: + return opStructFieldHeadOmitEmptyInt64Indent + case opStructFieldHeadOmitEmptyUintIndent: + return opStructFieldHeadOmitEmptyUintIndent + case opStructFieldHeadOmitEmptyUint8Indent: + return opStructFieldHeadOmitEmptyUint8Indent + case opStructFieldHeadOmitEmptyUint16Indent: + return opStructFieldHeadOmitEmptyUint16Indent + case opStructFieldHeadOmitEmptyUint32Indent: + return opStructFieldHeadOmitEmptyUint32Indent + case opStructFieldHeadOmitEmptyUint64Indent: + return opStructFieldHeadOmitEmptyUint64Indent + case opStructFieldHeadOmitEmptyFloat32Indent: + return opStructFieldHeadOmitEmptyFloat32Indent + case opStructFieldHeadOmitEmptyFloat64Indent: + return opStructFieldHeadOmitEmptyFloat64Indent + case opStructFieldHeadOmitEmptyBoolIndent: + return opStructFieldHeadOmitEmptyBoolIndent + case opStructFieldHeadOmitEmptyStringIndent: + return opStructFieldHeadOmitEmptyStringIndent + case opStructFieldAnonymousHeadIntIndent: + return opStructFieldAnonymousHeadIntIndent + case opStructFieldAnonymousHeadInt8Indent: + return opStructFieldAnonymousHeadInt8Indent + case opStructFieldAnonymousHeadInt16Indent: + return opStructFieldAnonymousHeadInt16Indent + case opStructFieldAnonymousHeadInt32Indent: + return opStructFieldAnonymousHeadInt32Indent + case opStructFieldAnonymousHeadInt64Indent: + return opStructFieldAnonymousHeadInt64Indent + case opStructFieldAnonymousHeadUintIndent: + return opStructFieldAnonymousHeadUintIndent + case opStructFieldAnonymousHeadUint8Indent: + return opStructFieldAnonymousHeadUint8Indent + case opStructFieldAnonymousHeadUint16Indent: + return opStructFieldAnonymousHeadUint16Indent + case opStructFieldAnonymousHeadUint32Indent: + return opStructFieldAnonymousHeadUint32Indent + case opStructFieldAnonymousHeadUint64Indent: + return opStructFieldAnonymousHeadUint64Indent + case opStructFieldAnonymousHeadFloat32Indent: + return opStructFieldAnonymousHeadFloat32Indent + case opStructFieldAnonymousHeadFloat64Indent: + return opStructFieldAnonymousHeadFloat64Indent + case opStructFieldAnonymousHeadBoolIndent: + return opStructFieldAnonymousHeadBoolIndent + case opStructFieldAnonymousHeadStringIndent: + return opStructFieldAnonymousHeadStringIndent + case opStructFieldAnonymousHeadOmitEmptyIntIndent: + return opStructFieldAnonymousHeadOmitEmptyIntIndent + case opStructFieldAnonymousHeadOmitEmptyInt8Indent: + return opStructFieldAnonymousHeadOmitEmptyInt8Indent + case opStructFieldAnonymousHeadOmitEmptyInt16Indent: + return opStructFieldAnonymousHeadOmitEmptyInt16Indent + case opStructFieldAnonymousHeadOmitEmptyInt32Indent: + return opStructFieldAnonymousHeadOmitEmptyInt32Indent + case opStructFieldAnonymousHeadOmitEmptyInt64Indent: + return opStructFieldAnonymousHeadOmitEmptyInt64Indent + case opStructFieldAnonymousHeadOmitEmptyUintIndent: + return opStructFieldAnonymousHeadOmitEmptyUintIndent + case opStructFieldAnonymousHeadOmitEmptyUint8Indent: + return opStructFieldAnonymousHeadOmitEmptyUint8Indent + case opStructFieldAnonymousHeadOmitEmptyUint16Indent: + return opStructFieldAnonymousHeadOmitEmptyUint16Indent + case opStructFieldAnonymousHeadOmitEmptyUint32Indent: + return opStructFieldAnonymousHeadOmitEmptyUint32Indent + case opStructFieldAnonymousHeadOmitEmptyUint64Indent: + return opStructFieldAnonymousHeadOmitEmptyUint64Indent + case opStructFieldAnonymousHeadOmitEmptyFloat32Indent: + return opStructFieldAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldAnonymousHeadOmitEmptyFloat64Indent: + return opStructFieldAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldAnonymousHeadOmitEmptyBoolIndent: + return opStructFieldAnonymousHeadOmitEmptyBoolIndent + case opStructFieldAnonymousHeadOmitEmptyStringIndent: + return opStructFieldAnonymousHeadOmitEmptyStringIndent + case opStructFieldPtrHeadIntIndent: + return opStructFieldPtrHeadIntIndent + case opStructFieldPtrHeadInt8Indent: + return opStructFieldPtrHeadInt8Indent + case opStructFieldPtrHeadInt16Indent: + return opStructFieldPtrHeadInt16Indent + case opStructFieldPtrHeadInt32Indent: + return opStructFieldPtrHeadInt32Indent + case opStructFieldPtrHeadInt64Indent: + return opStructFieldPtrHeadInt64Indent + case opStructFieldPtrHeadUintIndent: + return opStructFieldPtrHeadUintIndent + case opStructFieldPtrHeadUint8Indent: + return opStructFieldPtrHeadUint8Indent + case opStructFieldPtrHeadUint16Indent: + return opStructFieldPtrHeadUint16Indent + case opStructFieldPtrHeadUint32Indent: + return opStructFieldPtrHeadUint32Indent + case opStructFieldPtrHeadUint64Indent: + return opStructFieldPtrHeadUint64Indent + case opStructFieldPtrHeadFloat32Indent: + return opStructFieldPtrHeadFloat32Indent + case opStructFieldPtrHeadFloat64Indent: + return opStructFieldPtrHeadFloat64Indent + case opStructFieldPtrHeadBoolIndent: + return opStructFieldPtrHeadBoolIndent + case opStructFieldPtrHeadStringIndent: + return opStructFieldPtrHeadStringIndent + case opStructFieldPtrHeadOmitEmptyIntIndent: + return opStructFieldPtrHeadOmitEmptyIntIndent + case opStructFieldPtrHeadOmitEmptyInt8Indent: + return opStructFieldPtrHeadOmitEmptyInt8Indent + case opStructFieldPtrHeadOmitEmptyInt16Indent: + return opStructFieldPtrHeadOmitEmptyInt16Indent + case opStructFieldPtrHeadOmitEmptyInt32Indent: + return opStructFieldPtrHeadOmitEmptyInt32Indent + case opStructFieldPtrHeadOmitEmptyInt64Indent: + return opStructFieldPtrHeadOmitEmptyInt64Indent + case opStructFieldPtrHeadOmitEmptyUintIndent: + return opStructFieldPtrHeadOmitEmptyUintIndent + case opStructFieldPtrHeadOmitEmptyUint8Indent: + return opStructFieldPtrHeadOmitEmptyUint8Indent + case opStructFieldPtrHeadOmitEmptyUint16Indent: + return opStructFieldPtrHeadOmitEmptyUint16Indent + case opStructFieldPtrHeadOmitEmptyUint32Indent: + return opStructFieldPtrHeadOmitEmptyUint32Indent + case opStructFieldPtrHeadOmitEmptyUint64Indent: + return opStructFieldPtrHeadOmitEmptyUint64Indent + case opStructFieldPtrHeadOmitEmptyFloat32Indent: + return opStructFieldPtrHeadOmitEmptyFloat32Indent + case opStructFieldPtrHeadOmitEmptyFloat64Indent: + return opStructFieldPtrHeadOmitEmptyFloat64Indent + case opStructFieldPtrHeadOmitEmptyBoolIndent: + return opStructFieldPtrHeadOmitEmptyBoolIndent + case opStructFieldPtrHeadOmitEmptyStringIndent: + return opStructFieldPtrHeadOmitEmptyStringIndent + case opStructFieldPtrAnonymousHeadIntIndent: + return opStructFieldPtrAnonymousHeadIntIndent + case opStructFieldPtrAnonymousHeadInt8Indent: + return opStructFieldPtrAnonymousHeadInt8Indent + case opStructFieldPtrAnonymousHeadInt16Indent: + return opStructFieldPtrAnonymousHeadInt16Indent + case opStructFieldPtrAnonymousHeadInt32Indent: + return opStructFieldPtrAnonymousHeadInt32Indent + case opStructFieldPtrAnonymousHeadInt64Indent: + return opStructFieldPtrAnonymousHeadInt64Indent + case opStructFieldPtrAnonymousHeadUintIndent: + return opStructFieldPtrAnonymousHeadUintIndent + case opStructFieldPtrAnonymousHeadUint8Indent: + return opStructFieldPtrAnonymousHeadUint8Indent + case opStructFieldPtrAnonymousHeadUint16Indent: + return opStructFieldPtrAnonymousHeadUint16Indent + case opStructFieldPtrAnonymousHeadUint32Indent: + return opStructFieldPtrAnonymousHeadUint32Indent + case opStructFieldPtrAnonymousHeadUint64Indent: + return opStructFieldPtrAnonymousHeadUint64Indent + case opStructFieldPtrAnonymousHeadFloat32Indent: + return opStructFieldPtrAnonymousHeadFloat32Indent + case opStructFieldPtrAnonymousHeadFloat64Indent: + return opStructFieldPtrAnonymousHeadFloat64Indent + case opStructFieldPtrAnonymousHeadBoolIndent: + return opStructFieldPtrAnonymousHeadBoolIndent + case opStructFieldPtrAnonymousHeadStringIndent: + return opStructFieldPtrAnonymousHeadStringIndent + case opStructFieldPtrAnonymousHeadOmitEmptyIntIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyIntIndent + case opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUintIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyUintIndent + case opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent + case opStructFieldPtrAnonymousHeadOmitEmptyStringIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyStringIndent + case opStructFieldIntIndent: + return opStructFieldIntIndent + case opStructFieldInt8Indent: + return opStructFieldInt8Indent + case opStructFieldInt16Indent: + return opStructFieldInt16Indent + case opStructFieldInt32Indent: + return opStructFieldInt32Indent + case opStructFieldInt64Indent: + return opStructFieldInt64Indent + case opStructFieldUintIndent: + return opStructFieldUintIndent + case opStructFieldUint8Indent: + return opStructFieldUint8Indent + case opStructFieldUint16Indent: + return opStructFieldUint16Indent + case opStructFieldUint32Indent: + return opStructFieldUint32Indent + case opStructFieldUint64Indent: + return opStructFieldUint64Indent + case opStructFieldFloat32Indent: + return opStructFieldFloat32Indent + case opStructFieldFloat64Indent: + return opStructFieldFloat64Indent + case opStructFieldBoolIndent: + return opStructFieldBoolIndent + case opStructFieldStringIndent: + return opStructFieldStringIndent + case opStructFieldOmitEmptyIntIndent: + return opStructFieldOmitEmptyIntIndent + case opStructFieldOmitEmptyInt8Indent: + return opStructFieldOmitEmptyInt8Indent + case opStructFieldOmitEmptyInt16Indent: + return opStructFieldOmitEmptyInt16Indent + case opStructFieldOmitEmptyInt32Indent: + return opStructFieldOmitEmptyInt32Indent + case opStructFieldOmitEmptyInt64Indent: + return opStructFieldOmitEmptyInt64Indent + case opStructFieldOmitEmptyUintIndent: + return opStructFieldOmitEmptyUintIndent + case opStructFieldOmitEmptyUint8Indent: + return opStructFieldOmitEmptyUint8Indent + case opStructFieldOmitEmptyUint16Indent: + return opStructFieldOmitEmptyUint16Indent + case opStructFieldOmitEmptyUint32Indent: + return opStructFieldOmitEmptyUint32Indent + case opStructFieldOmitEmptyUint64Indent: + return opStructFieldOmitEmptyUint64Indent + case opStructFieldOmitEmptyFloat32Indent: + return opStructFieldOmitEmptyFloat32Indent + case opStructFieldOmitEmptyFloat64Indent: + return opStructFieldOmitEmptyFloat64Indent + case opStructFieldOmitEmptyBoolIndent: + return opStructFieldOmitEmptyBoolIndent + case opStructFieldOmitEmptyStringIndent: + return opStructFieldOmitEmptyStringIndent + } + return t +} + +func (t opType) headToPtrHead() opType { + switch t { + case opStructFieldHead: + return opStructFieldPtrHead + case opStructFieldAnonymousHead: + return opStructFieldPtrAnonymousHead + case opStructFieldHeadOmitEmpty: + return opStructFieldPtrHeadOmitEmpty + case opStructFieldAnonymousHeadOmitEmpty: + return opStructFieldPtrAnonymousHeadOmitEmpty + case opStructFieldHeadInt: + return opStructFieldPtrHeadInt + case opStructFieldAnonymousHeadInt: + return opStructFieldPtrAnonymousHeadInt + case opStructFieldHeadOmitEmptyInt: + return opStructFieldPtrHeadOmitEmptyInt + case opStructFieldAnonymousHeadOmitEmptyInt: + return opStructFieldPtrAnonymousHeadOmitEmptyInt + case opStructFieldHeadInt8: + return opStructFieldPtrHeadInt8 + case opStructFieldAnonymousHeadInt8: + return opStructFieldPtrAnonymousHeadInt8 + case opStructFieldHeadOmitEmptyInt8: + return opStructFieldPtrHeadOmitEmptyInt8 + case opStructFieldAnonymousHeadOmitEmptyInt8: + return opStructFieldPtrAnonymousHeadOmitEmptyInt8 + case opStructFieldHeadInt16: + return opStructFieldPtrHeadInt16 + case opStructFieldAnonymousHeadInt16: + return opStructFieldPtrAnonymousHeadInt16 + case opStructFieldHeadOmitEmptyInt16: + return opStructFieldPtrHeadOmitEmptyInt16 + case opStructFieldAnonymousHeadOmitEmptyInt16: + return opStructFieldPtrAnonymousHeadOmitEmptyInt16 + case opStructFieldHeadInt32: + return opStructFieldPtrHeadInt32 + case opStructFieldAnonymousHeadInt32: + return opStructFieldPtrAnonymousHeadInt32 + case opStructFieldHeadOmitEmptyInt32: + return opStructFieldPtrHeadOmitEmptyInt32 + case opStructFieldAnonymousHeadOmitEmptyInt32: + return opStructFieldPtrAnonymousHeadOmitEmptyInt32 + case opStructFieldHeadInt64: + return opStructFieldPtrHeadInt64 + case opStructFieldAnonymousHeadInt64: + return opStructFieldPtrAnonymousHeadInt64 + case opStructFieldHeadOmitEmptyInt64: + return opStructFieldPtrHeadOmitEmptyInt64 + case opStructFieldAnonymousHeadOmitEmptyInt64: + return opStructFieldPtrAnonymousHeadOmitEmptyInt64 + case opStructFieldHeadUint: + return opStructFieldPtrHeadUint + case opStructFieldAnonymousHeadUint: + return opStructFieldPtrAnonymousHeadUint + case opStructFieldHeadOmitEmptyUint: + return opStructFieldPtrHeadOmitEmptyUint + case opStructFieldAnonymousHeadOmitEmptyUint: + return opStructFieldPtrAnonymousHeadOmitEmptyUint + case opStructFieldHeadUint8: + return opStructFieldPtrHeadUint8 + case opStructFieldAnonymousHeadUint8: + return opStructFieldPtrAnonymousHeadUint8 + case opStructFieldHeadOmitEmptyUint8: + return opStructFieldPtrHeadOmitEmptyUint8 + case opStructFieldAnonymousHeadOmitEmptyUint8: + return opStructFieldPtrAnonymousHeadOmitEmptyUint8 + case opStructFieldHeadUint16: + return opStructFieldPtrHeadUint16 + case opStructFieldAnonymousHeadUint16: + return opStructFieldPtrAnonymousHeadUint16 + case opStructFieldHeadOmitEmptyUint16: + return opStructFieldPtrHeadOmitEmptyUint16 + case opStructFieldAnonymousHeadOmitEmptyUint16: + return opStructFieldPtrAnonymousHeadOmitEmptyUint16 + case opStructFieldHeadUint32: + return opStructFieldPtrHeadUint32 + case opStructFieldAnonymousHeadUint32: + return opStructFieldPtrAnonymousHeadUint32 + case opStructFieldHeadOmitEmptyUint32: + return opStructFieldPtrHeadOmitEmptyUint32 + case opStructFieldAnonymousHeadOmitEmptyUint32: + return opStructFieldPtrAnonymousHeadOmitEmptyUint32 + case opStructFieldHeadUint64: + return opStructFieldPtrHeadUint64 + case opStructFieldAnonymousHeadUint64: + return opStructFieldPtrAnonymousHeadUint64 + case opStructFieldHeadOmitEmptyUint64: + return opStructFieldPtrHeadOmitEmptyUint64 + case opStructFieldAnonymousHeadOmitEmptyUint64: + return opStructFieldPtrAnonymousHeadOmitEmptyUint64 + case opStructFieldHeadFloat32: + return opStructFieldPtrHeadFloat32 + case opStructFieldAnonymousHeadFloat32: + return opStructFieldPtrAnonymousHeadFloat32 + case opStructFieldHeadOmitEmptyFloat32: + return opStructFieldPtrHeadOmitEmptyFloat32 + case opStructFieldAnonymousHeadOmitEmptyFloat32: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat32 + case opStructFieldHeadFloat64: + return opStructFieldPtrHeadFloat64 + case opStructFieldAnonymousHeadFloat64: + return opStructFieldPtrAnonymousHeadFloat64 + case opStructFieldHeadOmitEmptyFloat64: + return opStructFieldPtrHeadOmitEmptyFloat64 + case opStructFieldAnonymousHeadOmitEmptyFloat64: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat64 + case opStructFieldHeadBool: + return opStructFieldPtrHeadBool + case opStructFieldAnonymousHeadBool: + return opStructFieldPtrAnonymousHeadBool + case opStructFieldHeadOmitEmptyBool: + return opStructFieldPtrHeadOmitEmptyBool + case opStructFieldAnonymousHeadOmitEmptyBool: + return opStructFieldPtrAnonymousHeadOmitEmptyBool + case opStructFieldHeadString: + return opStructFieldPtrHeadString + case opStructFieldAnonymousHeadString: + return opStructFieldPtrAnonymousHeadString + case opStructFieldHeadOmitEmptyString: + return opStructFieldPtrHeadOmitEmptyString + case opStructFieldAnonymousHeadOmitEmptyString: + return opStructFieldPtrAnonymousHeadOmitEmptyString + case opStructFieldHeadIndent: + return opStructFieldPtrHeadIndent + case opStructFieldAnonymousHeadIndent: + return opStructFieldPtrAnonymousHeadIndent + case opStructFieldHeadOmitEmptyIndent: + return opStructFieldPtrHeadOmitEmptyIndent + case opStructFieldAnonymousHeadOmitEmptyIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyIndent + case opStructFieldHeadIntIndent: + return opStructFieldPtrHeadIntIndent + case opStructFieldAnonymousHeadIntIndent: + return opStructFieldPtrAnonymousHeadIntIndent + case opStructFieldHeadOmitEmptyIntIndent: + return opStructFieldPtrHeadOmitEmptyIntIndent + case opStructFieldAnonymousHeadOmitEmptyIntIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyIntIndent + case opStructFieldHeadInt8Indent: + return opStructFieldPtrHeadInt8Indent + case opStructFieldAnonymousHeadInt8Indent: + return opStructFieldPtrAnonymousHeadInt8Indent + case opStructFieldHeadOmitEmptyInt8Indent: + return opStructFieldPtrHeadOmitEmptyInt8Indent + case opStructFieldAnonymousHeadOmitEmptyInt8Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent + case opStructFieldHeadInt16Indent: + return opStructFieldPtrHeadInt16Indent + case opStructFieldAnonymousHeadInt16Indent: + return opStructFieldPtrAnonymousHeadInt16Indent + case opStructFieldHeadOmitEmptyInt16Indent: + return opStructFieldPtrHeadOmitEmptyInt16Indent + case opStructFieldAnonymousHeadOmitEmptyInt16Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent + case opStructFieldHeadInt32Indent: + return opStructFieldPtrHeadInt32Indent + case opStructFieldAnonymousHeadInt32Indent: + return opStructFieldPtrAnonymousHeadInt32Indent + case opStructFieldHeadOmitEmptyInt32Indent: + return opStructFieldPtrHeadOmitEmptyInt32Indent + case opStructFieldAnonymousHeadOmitEmptyInt32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent + case opStructFieldHeadInt64Indent: + return opStructFieldPtrHeadInt64Indent + case opStructFieldAnonymousHeadInt64Indent: + return opStructFieldPtrAnonymousHeadInt64Indent + case opStructFieldHeadOmitEmptyInt64Indent: + return opStructFieldPtrHeadOmitEmptyInt64Indent + case opStructFieldAnonymousHeadOmitEmptyInt64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent + case opStructFieldHeadUintIndent: + return opStructFieldPtrHeadUintIndent + case opStructFieldAnonymousHeadUintIndent: + return opStructFieldPtrAnonymousHeadUintIndent + case opStructFieldHeadOmitEmptyUintIndent: + return opStructFieldPtrHeadOmitEmptyUintIndent + case opStructFieldAnonymousHeadOmitEmptyUintIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyUintIndent + case opStructFieldHeadUint8Indent: + return opStructFieldPtrHeadUint8Indent + case opStructFieldAnonymousHeadUint8Indent: + return opStructFieldPtrAnonymousHeadUint8Indent + case opStructFieldHeadOmitEmptyUint8Indent: + return opStructFieldPtrHeadOmitEmptyUint8Indent + case opStructFieldAnonymousHeadOmitEmptyUint8Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent + case opStructFieldHeadUint16Indent: + return opStructFieldPtrHeadUint16Indent + case opStructFieldAnonymousHeadUint16Indent: + return opStructFieldPtrAnonymousHeadUint16Indent + case opStructFieldHeadOmitEmptyUint16Indent: + return opStructFieldPtrHeadOmitEmptyUint16Indent + case opStructFieldAnonymousHeadOmitEmptyUint16Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent + case opStructFieldHeadUint32Indent: + return opStructFieldPtrHeadUint32Indent + case opStructFieldAnonymousHeadUint32Indent: + return opStructFieldPtrAnonymousHeadUint32Indent + case opStructFieldHeadOmitEmptyUint32Indent: + return opStructFieldPtrHeadOmitEmptyUint32Indent + case opStructFieldAnonymousHeadOmitEmptyUint32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent + case opStructFieldHeadUint64Indent: + return opStructFieldPtrHeadUint64Indent + case opStructFieldAnonymousHeadUint64Indent: + return opStructFieldPtrAnonymousHeadUint64Indent + case opStructFieldHeadOmitEmptyUint64Indent: + return opStructFieldPtrHeadOmitEmptyUint64Indent + case opStructFieldAnonymousHeadOmitEmptyUint64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent + case opStructFieldHeadFloat32Indent: + return opStructFieldPtrHeadFloat32Indent + case opStructFieldAnonymousHeadFloat32Indent: + return opStructFieldPtrAnonymousHeadFloat32Indent + case opStructFieldHeadOmitEmptyFloat32Indent: + return opStructFieldPtrHeadOmitEmptyFloat32Indent + case opStructFieldAnonymousHeadOmitEmptyFloat32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldHeadFloat64Indent: + return opStructFieldPtrHeadFloat64Indent + case opStructFieldAnonymousHeadFloat64Indent: + return opStructFieldPtrAnonymousHeadFloat64Indent + case opStructFieldHeadOmitEmptyFloat64Indent: + return opStructFieldPtrHeadOmitEmptyFloat64Indent + case opStructFieldAnonymousHeadOmitEmptyFloat64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldHeadBoolIndent: + return opStructFieldPtrHeadBoolIndent + case opStructFieldAnonymousHeadBoolIndent: + return opStructFieldPtrAnonymousHeadBoolIndent + case opStructFieldHeadOmitEmptyBoolIndent: + return opStructFieldPtrHeadOmitEmptyBoolIndent + case opStructFieldAnonymousHeadOmitEmptyBoolIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent + case opStructFieldHeadStringIndent: + return opStructFieldPtrHeadStringIndent + case opStructFieldAnonymousHeadStringIndent: + return opStructFieldPtrAnonymousHeadStringIndent + case opStructFieldHeadOmitEmptyStringIndent: + return opStructFieldPtrHeadOmitEmptyStringIndent + case opStructFieldAnonymousHeadOmitEmptyStringIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyStringIndent + } + return t +} + +func (t opType) headToAnonymousHead() opType { + switch t { + case opStructFieldHead: + return opStructFieldAnonymousHead + case opStructFieldPtrHead: + return opStructFieldPtrAnonymousHead + case opStructFieldHeadOmitEmpty: + return opStructFieldAnonymousHeadOmitEmpty + case opStructFieldPtrHeadOmitEmpty: + return opStructFieldPtrAnonymousHeadOmitEmpty + case opStructFieldHeadInt: + return opStructFieldAnonymousHeadInt + case opStructFieldPtrHeadInt: + return opStructFieldPtrAnonymousHeadInt + case opStructFieldHeadOmitEmptyInt: + return opStructFieldAnonymousHeadOmitEmptyInt + case opStructFieldPtrHeadOmitEmptyInt: + return opStructFieldPtrAnonymousHeadOmitEmptyInt + case opStructFieldHeadInt8: + return opStructFieldAnonymousHeadInt8 + case opStructFieldPtrHeadInt8: + return opStructFieldPtrAnonymousHeadInt8 + case opStructFieldHeadOmitEmptyInt8: + return opStructFieldAnonymousHeadOmitEmptyInt8 + case opStructFieldPtrHeadOmitEmptyInt8: + return opStructFieldPtrAnonymousHeadOmitEmptyInt8 + case opStructFieldHeadInt16: + return opStructFieldAnonymousHeadInt16 + case opStructFieldPtrHeadInt16: + return opStructFieldPtrAnonymousHeadInt16 + case opStructFieldHeadOmitEmptyInt16: + return opStructFieldAnonymousHeadOmitEmptyInt16 + case opStructFieldPtrHeadOmitEmptyInt16: + return opStructFieldPtrAnonymousHeadOmitEmptyInt16 + case opStructFieldHeadInt32: + return opStructFieldAnonymousHeadInt32 + case opStructFieldPtrHeadInt32: + return opStructFieldPtrAnonymousHeadInt32 + case opStructFieldHeadOmitEmptyInt32: + return opStructFieldAnonymousHeadOmitEmptyInt32 + case opStructFieldPtrHeadOmitEmptyInt32: + return opStructFieldPtrAnonymousHeadOmitEmptyInt32 + case opStructFieldHeadInt64: + return opStructFieldAnonymousHeadInt64 + case opStructFieldPtrHeadInt64: + return opStructFieldPtrAnonymousHeadInt64 + case opStructFieldHeadOmitEmptyInt64: + return opStructFieldAnonymousHeadOmitEmptyInt64 + case opStructFieldPtrHeadOmitEmptyInt64: + return opStructFieldPtrAnonymousHeadOmitEmptyInt64 + case opStructFieldHeadUint: + return opStructFieldAnonymousHeadUint + case opStructFieldPtrHeadUint: + return opStructFieldPtrAnonymousHeadUint + case opStructFieldHeadOmitEmptyUint: + return opStructFieldAnonymousHeadOmitEmptyUint + case opStructFieldPtrHeadOmitEmptyUint: + return opStructFieldPtrAnonymousHeadOmitEmptyUint + case opStructFieldHeadUint8: + return opStructFieldAnonymousHeadUint8 + case opStructFieldPtrHeadUint8: + return opStructFieldPtrAnonymousHeadUint8 + case opStructFieldHeadOmitEmptyUint8: + return opStructFieldAnonymousHeadOmitEmptyUint8 + case opStructFieldPtrHeadOmitEmptyUint8: + return opStructFieldPtrAnonymousHeadOmitEmptyUint8 + case opStructFieldHeadUint16: + return opStructFieldAnonymousHeadUint16 + case opStructFieldPtrHeadUint16: + return opStructFieldPtrAnonymousHeadUint16 + case opStructFieldHeadOmitEmptyUint16: + return opStructFieldAnonymousHeadOmitEmptyUint16 + case opStructFieldPtrHeadOmitEmptyUint16: + return opStructFieldPtrAnonymousHeadOmitEmptyUint16 + case opStructFieldHeadUint32: + return opStructFieldAnonymousHeadUint32 + case opStructFieldPtrHeadUint32: + return opStructFieldPtrAnonymousHeadUint32 + case opStructFieldHeadOmitEmptyUint32: + return opStructFieldAnonymousHeadOmitEmptyUint32 + case opStructFieldPtrHeadOmitEmptyUint32: + return opStructFieldPtrAnonymousHeadOmitEmptyUint32 + case opStructFieldHeadUint64: + return opStructFieldAnonymousHeadUint64 + case opStructFieldPtrHeadUint64: + return opStructFieldPtrAnonymousHeadUint64 + case opStructFieldHeadOmitEmptyUint64: + return opStructFieldAnonymousHeadOmitEmptyUint64 + case opStructFieldPtrHeadOmitEmptyUint64: + return opStructFieldPtrAnonymousHeadOmitEmptyUint64 + case opStructFieldHeadFloat32: + return opStructFieldAnonymousHeadFloat32 + case opStructFieldPtrHeadFloat32: + return opStructFieldPtrAnonymousHeadFloat32 + case opStructFieldHeadOmitEmptyFloat32: + return opStructFieldAnonymousHeadOmitEmptyFloat32 + case opStructFieldPtrHeadOmitEmptyFloat32: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat32 + case opStructFieldHeadFloat64: + return opStructFieldAnonymousHeadFloat64 + case opStructFieldPtrHeadFloat64: + return opStructFieldPtrAnonymousHeadFloat64 + case opStructFieldHeadOmitEmptyFloat64: + return opStructFieldAnonymousHeadOmitEmptyFloat64 + case opStructFieldPtrHeadOmitEmptyFloat64: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat64 + case opStructFieldHeadBool: + return opStructFieldAnonymousHeadBool + case opStructFieldPtrHeadBool: + return opStructFieldPtrAnonymousHeadBool + case opStructFieldHeadOmitEmptyBool: + return opStructFieldAnonymousHeadOmitEmptyBool + case opStructFieldPtrHeadOmitEmptyBool: + return opStructFieldPtrAnonymousHeadOmitEmptyBool + case opStructFieldHeadString: + return opStructFieldAnonymousHeadString + case opStructFieldPtrHeadString: + return opStructFieldPtrAnonymousHeadString + case opStructFieldHeadOmitEmptyString: + return opStructFieldAnonymousHeadOmitEmptyString + case opStructFieldPtrHeadOmitEmptyString: + return opStructFieldPtrAnonymousHeadOmitEmptyString + case opStructFieldHeadIndent: + return opStructFieldAnonymousHeadIndent + case opStructFieldPtrHeadIndent: + return opStructFieldPtrAnonymousHeadIndent + case opStructFieldHeadOmitEmptyIndent: + return opStructFieldAnonymousHeadOmitEmptyIndent + case opStructFieldPtrHeadOmitEmptyIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyIndent + case opStructFieldHeadIntIndent: + return opStructFieldAnonymousHeadIntIndent + case opStructFieldPtrHeadIntIndent: + return opStructFieldPtrAnonymousHeadIntIndent + case opStructFieldHeadOmitEmptyIntIndent: + return opStructFieldAnonymousHeadOmitEmptyIntIndent + case opStructFieldPtrHeadOmitEmptyIntIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyIntIndent + case opStructFieldHeadInt8Indent: + return opStructFieldAnonymousHeadInt8Indent + case opStructFieldPtrHeadInt8Indent: + return opStructFieldPtrAnonymousHeadInt8Indent + case opStructFieldHeadOmitEmptyInt8Indent: + return opStructFieldAnonymousHeadOmitEmptyInt8Indent + case opStructFieldPtrHeadOmitEmptyInt8Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent + case opStructFieldHeadInt16Indent: + return opStructFieldAnonymousHeadInt16Indent + case opStructFieldPtrHeadInt16Indent: + return opStructFieldPtrAnonymousHeadInt16Indent + case opStructFieldHeadOmitEmptyInt16Indent: + return opStructFieldAnonymousHeadOmitEmptyInt16Indent + case opStructFieldPtrHeadOmitEmptyInt16Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent + case opStructFieldHeadInt32Indent: + return opStructFieldAnonymousHeadInt32Indent + case opStructFieldPtrHeadInt32Indent: + return opStructFieldPtrAnonymousHeadInt32Indent + case opStructFieldHeadOmitEmptyInt32Indent: + return opStructFieldAnonymousHeadOmitEmptyInt32Indent + case opStructFieldPtrHeadOmitEmptyInt32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent + case opStructFieldHeadInt64Indent: + return opStructFieldAnonymousHeadInt64Indent + case opStructFieldPtrHeadInt64Indent: + return opStructFieldPtrAnonymousHeadInt64Indent + case opStructFieldHeadOmitEmptyInt64Indent: + return opStructFieldAnonymousHeadOmitEmptyInt64Indent + case opStructFieldPtrHeadOmitEmptyInt64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent + case opStructFieldHeadUintIndent: + return opStructFieldAnonymousHeadUintIndent + case opStructFieldPtrHeadUintIndent: + return opStructFieldPtrAnonymousHeadUintIndent + case opStructFieldHeadOmitEmptyUintIndent: + return opStructFieldAnonymousHeadOmitEmptyUintIndent + case opStructFieldPtrHeadOmitEmptyUintIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyUintIndent + case opStructFieldHeadUint8Indent: + return opStructFieldAnonymousHeadUint8Indent + case opStructFieldPtrHeadUint8Indent: + return opStructFieldPtrAnonymousHeadUint8Indent + case opStructFieldHeadOmitEmptyUint8Indent: + return opStructFieldAnonymousHeadOmitEmptyUint8Indent + case opStructFieldPtrHeadOmitEmptyUint8Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent + case opStructFieldHeadUint16Indent: + return opStructFieldAnonymousHeadUint16Indent + case opStructFieldPtrHeadUint16Indent: + return opStructFieldPtrAnonymousHeadUint16Indent + case opStructFieldHeadOmitEmptyUint16Indent: + return opStructFieldAnonymousHeadOmitEmptyUint16Indent + case opStructFieldPtrHeadOmitEmptyUint16Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent + case opStructFieldHeadUint32Indent: + return opStructFieldAnonymousHeadUint32Indent + case opStructFieldPtrHeadUint32Indent: + return opStructFieldPtrAnonymousHeadUint32Indent + case opStructFieldHeadOmitEmptyUint32Indent: + return opStructFieldAnonymousHeadOmitEmptyUint32Indent + case opStructFieldPtrHeadOmitEmptyUint32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent + case opStructFieldHeadUint64Indent: + return opStructFieldAnonymousHeadUint64Indent + case opStructFieldPtrHeadUint64Indent: + return opStructFieldPtrAnonymousHeadUint64Indent + case opStructFieldHeadOmitEmptyUint64Indent: + return opStructFieldAnonymousHeadOmitEmptyUint64Indent + case opStructFieldPtrHeadOmitEmptyUint64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent + case opStructFieldHeadFloat32Indent: + return opStructFieldAnonymousHeadFloat32Indent + case opStructFieldPtrHeadFloat32Indent: + return opStructFieldPtrAnonymousHeadFloat32Indent + case opStructFieldHeadOmitEmptyFloat32Indent: + return opStructFieldAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldPtrHeadOmitEmptyFloat32Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldHeadFloat64Indent: + return opStructFieldAnonymousHeadFloat64Indent + case opStructFieldPtrHeadFloat64Indent: + return opStructFieldPtrAnonymousHeadFloat64Indent + case opStructFieldHeadOmitEmptyFloat64Indent: + return opStructFieldAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldPtrHeadOmitEmptyFloat64Indent: + return opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldHeadBoolIndent: + return opStructFieldAnonymousHeadBoolIndent + case opStructFieldPtrHeadBoolIndent: + return opStructFieldPtrAnonymousHeadBoolIndent + case opStructFieldHeadOmitEmptyBoolIndent: + return opStructFieldAnonymousHeadOmitEmptyBoolIndent + case opStructFieldPtrHeadOmitEmptyBoolIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent + case opStructFieldHeadStringIndent: + return opStructFieldAnonymousHeadStringIndent + case opStructFieldPtrHeadStringIndent: + return opStructFieldPtrAnonymousHeadStringIndent + case opStructFieldHeadOmitEmptyStringIndent: + return opStructFieldAnonymousHeadOmitEmptyStringIndent + case opStructFieldPtrHeadOmitEmptyStringIndent: + return opStructFieldPtrAnonymousHeadOmitEmptyStringIndent + } + return t +} + +func (t opType) headToOmitEmptyHead() opType { + switch t { + case opStructFieldHead: + return opStructFieldHeadOmitEmpty + case opStructFieldPtrHead: + return opStructFieldPtrHeadOmitEmpty + case opStructFieldHeadInt: + return opStructFieldHeadOmitEmptyInt + case opStructFieldPtrHeadInt: + return opStructFieldPtrHeadOmitEmptyInt + case opStructFieldHeadInt8: + return opStructFieldHeadOmitEmptyInt8 + case opStructFieldPtrHeadInt8: + return opStructFieldPtrHeadOmitEmptyInt8 + case opStructFieldHeadInt16: + return opStructFieldHeadOmitEmptyInt16 + case opStructFieldPtrHeadInt16: + return opStructFieldPtrHeadOmitEmptyInt16 + case opStructFieldHeadInt32: + return opStructFieldHeadOmitEmptyInt32 + case opStructFieldPtrHeadInt32: + return opStructFieldPtrHeadOmitEmptyInt32 + case opStructFieldHeadInt64: + return opStructFieldHeadOmitEmptyInt64 + case opStructFieldPtrHeadInt64: + return opStructFieldPtrHeadOmitEmptyInt64 + case opStructFieldHeadUint: + return opStructFieldHeadOmitEmptyUint + case opStructFieldPtrHeadUint: + return opStructFieldPtrHeadOmitEmptyUint + case opStructFieldHeadUint8: + return opStructFieldHeadOmitEmptyUint8 + case opStructFieldPtrHeadUint8: + return opStructFieldPtrHeadOmitEmptyUint8 + case opStructFieldHeadUint16: + return opStructFieldHeadOmitEmptyUint16 + case opStructFieldPtrHeadUint16: + return opStructFieldPtrHeadOmitEmptyUint16 + case opStructFieldHeadUint32: + return opStructFieldHeadOmitEmptyUint32 + case opStructFieldPtrHeadUint32: + return opStructFieldPtrHeadOmitEmptyUint32 + case opStructFieldHeadUint64: + return opStructFieldHeadOmitEmptyUint64 + case opStructFieldPtrHeadUint64: + return opStructFieldPtrHeadOmitEmptyUint64 + case opStructFieldHeadFloat32: + return opStructFieldHeadOmitEmptyFloat32 + case opStructFieldPtrHeadFloat32: + return opStructFieldPtrHeadOmitEmptyFloat32 + case opStructFieldHeadFloat64: + return opStructFieldHeadOmitEmptyFloat64 + case opStructFieldPtrHeadFloat64: + return opStructFieldPtrHeadOmitEmptyFloat64 + case opStructFieldHeadBool: + return opStructFieldHeadOmitEmptyBool + case opStructFieldPtrHeadBool: + return opStructFieldPtrHeadOmitEmptyBool + case opStructFieldHeadString: + return opStructFieldHeadOmitEmptyString + case opStructFieldPtrHeadString: + return opStructFieldPtrHeadOmitEmptyString + case opStructFieldHeadIndent: + return opStructFieldHeadOmitEmptyIndent + case opStructFieldPtrHeadIndent: + return opStructFieldPtrHeadOmitEmptyIndent + case opStructFieldHeadIntIndent: + return opStructFieldHeadOmitEmptyIntIndent + case opStructFieldPtrHeadIntIndent: + return opStructFieldPtrHeadOmitEmptyIntIndent + case opStructFieldHeadInt8Indent: + return opStructFieldHeadOmitEmptyInt8Indent + case opStructFieldPtrHeadInt8Indent: + return opStructFieldPtrHeadOmitEmptyInt8Indent + case opStructFieldHeadInt16Indent: + return opStructFieldHeadOmitEmptyInt16Indent + case opStructFieldPtrHeadInt16Indent: + return opStructFieldPtrHeadOmitEmptyInt16Indent + case opStructFieldHeadInt32Indent: + return opStructFieldHeadOmitEmptyInt32Indent + case opStructFieldPtrHeadInt32Indent: + return opStructFieldPtrHeadOmitEmptyInt32Indent + case opStructFieldHeadInt64Indent: + return opStructFieldHeadOmitEmptyInt64Indent + case opStructFieldPtrHeadInt64Indent: + return opStructFieldPtrHeadOmitEmptyInt64Indent + case opStructFieldHeadUintIndent: + return opStructFieldHeadOmitEmptyUintIndent + case opStructFieldPtrHeadUintIndent: + return opStructFieldPtrHeadOmitEmptyUintIndent + case opStructFieldHeadUint8Indent: + return opStructFieldHeadOmitEmptyUint8Indent + case opStructFieldPtrHeadUint8Indent: + return opStructFieldPtrHeadOmitEmptyUint8Indent + case opStructFieldHeadUint16Indent: + return opStructFieldHeadOmitEmptyUint16Indent + case opStructFieldPtrHeadUint16Indent: + return opStructFieldPtrHeadOmitEmptyUint16Indent + case opStructFieldHeadUint32Indent: + return opStructFieldHeadOmitEmptyUint32Indent + case opStructFieldPtrHeadUint32Indent: + return opStructFieldPtrHeadOmitEmptyUint32Indent + case opStructFieldHeadUint64Indent: + return opStructFieldHeadOmitEmptyUint64Indent + case opStructFieldPtrHeadUint64Indent: + return opStructFieldPtrHeadOmitEmptyUint64Indent + case opStructFieldHeadFloat32Indent: + return opStructFieldHeadOmitEmptyFloat32Indent + case opStructFieldPtrHeadFloat32Indent: + return opStructFieldPtrHeadOmitEmptyFloat32Indent + case opStructFieldHeadFloat64Indent: + return opStructFieldHeadOmitEmptyFloat64Indent + case opStructFieldPtrHeadFloat64Indent: + return opStructFieldPtrHeadOmitEmptyFloat64Indent + case opStructFieldHeadBoolIndent: + return opStructFieldHeadOmitEmptyBoolIndent + case opStructFieldPtrHeadBoolIndent: + return opStructFieldPtrHeadOmitEmptyBoolIndent + case opStructFieldHeadStringIndent: + return opStructFieldHeadOmitEmptyStringIndent + case opStructFieldPtrHeadStringIndent: + return opStructFieldPtrHeadOmitEmptyStringIndent + } + return t +} + +func (t opType) ptrHeadToHead() opType { + switch t { + case opStructFieldPtrHead: + return opStructFieldHead + case opStructFieldPtrAnonymousHead: + return opStructFieldAnonymousHead + case opStructFieldPtrHeadOmitEmpty: + return opStructFieldHeadOmitEmpty + case opStructFieldPtrAnonymousHeadOmitEmpty: + return opStructFieldAnonymousHeadOmitEmpty + case opStructFieldPtrHeadInt: + return opStructFieldHeadInt + case opStructFieldPtrAnonymousHeadInt: + return opStructFieldAnonymousHeadInt + case opStructFieldPtrHeadOmitEmptyInt: + return opStructFieldHeadOmitEmptyInt + case opStructFieldPtrAnonymousHeadOmitEmptyInt: + return opStructFieldAnonymousHeadOmitEmptyInt + case opStructFieldPtrHeadInt8: + return opStructFieldHeadInt8 + case opStructFieldPtrAnonymousHeadInt8: + return opStructFieldAnonymousHeadInt8 + case opStructFieldPtrHeadOmitEmptyInt8: + return opStructFieldHeadOmitEmptyInt8 + case opStructFieldPtrAnonymousHeadOmitEmptyInt8: + return opStructFieldAnonymousHeadOmitEmptyInt8 + case opStructFieldPtrHeadInt16: + return opStructFieldHeadInt16 + case opStructFieldPtrAnonymousHeadInt16: + return opStructFieldAnonymousHeadInt16 + case opStructFieldPtrHeadOmitEmptyInt16: + return opStructFieldHeadOmitEmptyInt16 + case opStructFieldPtrAnonymousHeadOmitEmptyInt16: + return opStructFieldAnonymousHeadOmitEmptyInt16 + case opStructFieldPtrHeadInt32: + return opStructFieldHeadInt32 + case opStructFieldPtrAnonymousHeadInt32: + return opStructFieldAnonymousHeadInt32 + case opStructFieldPtrHeadOmitEmptyInt32: + return opStructFieldHeadOmitEmptyInt32 + case opStructFieldPtrAnonymousHeadOmitEmptyInt32: + return opStructFieldAnonymousHeadOmitEmptyInt32 + case opStructFieldPtrHeadInt64: + return opStructFieldHeadInt64 + case opStructFieldPtrAnonymousHeadInt64: + return opStructFieldAnonymousHeadInt64 + case opStructFieldPtrHeadOmitEmptyInt64: + return opStructFieldHeadOmitEmptyInt64 + case opStructFieldPtrAnonymousHeadOmitEmptyInt64: + return opStructFieldAnonymousHeadOmitEmptyInt64 + case opStructFieldPtrHeadUint: + return opStructFieldHeadUint + case opStructFieldPtrAnonymousHeadUint: + return opStructFieldAnonymousHeadUint + case opStructFieldPtrHeadOmitEmptyUint: + return opStructFieldHeadOmitEmptyUint + case opStructFieldPtrAnonymousHeadOmitEmptyUint: + return opStructFieldAnonymousHeadOmitEmptyUint + case opStructFieldPtrHeadUint8: + return opStructFieldHeadUint8 + case opStructFieldPtrAnonymousHeadUint8: + return opStructFieldAnonymousHeadUint8 + case opStructFieldPtrHeadOmitEmptyUint8: + return opStructFieldHeadOmitEmptyUint8 + case opStructFieldPtrAnonymousHeadOmitEmptyUint8: + return opStructFieldAnonymousHeadOmitEmptyUint8 + case opStructFieldPtrHeadUint16: + return opStructFieldHeadUint16 + case opStructFieldPtrAnonymousHeadUint16: + return opStructFieldAnonymousHeadUint16 + case opStructFieldPtrHeadOmitEmptyUint16: + return opStructFieldHeadOmitEmptyUint16 + case opStructFieldPtrAnonymousHeadOmitEmptyUint16: + return opStructFieldAnonymousHeadOmitEmptyUint16 + case opStructFieldPtrHeadUint32: + return opStructFieldHeadUint32 + case opStructFieldPtrAnonymousHeadUint32: + return opStructFieldAnonymousHeadUint32 + case opStructFieldPtrHeadOmitEmptyUint32: + return opStructFieldHeadOmitEmptyUint32 + case opStructFieldPtrAnonymousHeadOmitEmptyUint32: + return opStructFieldAnonymousHeadOmitEmptyUint32 + case opStructFieldPtrHeadUint64: + return opStructFieldHeadUint64 + case opStructFieldPtrAnonymousHeadUint64: + return opStructFieldAnonymousHeadUint64 + case opStructFieldPtrHeadOmitEmptyUint64: + return opStructFieldHeadOmitEmptyUint64 + case opStructFieldPtrAnonymousHeadOmitEmptyUint64: + return opStructFieldAnonymousHeadOmitEmptyUint64 + case opStructFieldPtrHeadFloat32: + return opStructFieldHeadFloat32 + case opStructFieldPtrAnonymousHeadFloat32: + return opStructFieldAnonymousHeadFloat32 + case opStructFieldPtrHeadOmitEmptyFloat32: + return opStructFieldHeadOmitEmptyFloat32 + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32: + return opStructFieldAnonymousHeadOmitEmptyFloat32 + case opStructFieldPtrHeadFloat64: + return opStructFieldHeadFloat64 + case opStructFieldPtrAnonymousHeadFloat64: + return opStructFieldAnonymousHeadFloat64 + case opStructFieldPtrHeadOmitEmptyFloat64: + return opStructFieldHeadOmitEmptyFloat64 + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64: + return opStructFieldAnonymousHeadOmitEmptyFloat64 + case opStructFieldPtrHeadBool: + return opStructFieldHeadBool + case opStructFieldPtrAnonymousHeadBool: + return opStructFieldAnonymousHeadBool + case opStructFieldPtrHeadOmitEmptyBool: + return opStructFieldHeadOmitEmptyBool + case opStructFieldPtrAnonymousHeadOmitEmptyBool: + return opStructFieldAnonymousHeadOmitEmptyBool + case opStructFieldPtrHeadString: + return opStructFieldHeadString + case opStructFieldPtrAnonymousHeadString: + return opStructFieldAnonymousHeadString + case opStructFieldPtrHeadOmitEmptyString: + return opStructFieldHeadOmitEmptyString + case opStructFieldPtrAnonymousHeadOmitEmptyString: + return opStructFieldAnonymousHeadOmitEmptyString + case opStructFieldPtrHeadIndent: + return opStructFieldHeadIndent + case opStructFieldPtrAnonymousHeadIndent: + return opStructFieldAnonymousHeadIndent + case opStructFieldPtrHeadOmitEmptyIndent: + return opStructFieldHeadOmitEmptyIndent + case opStructFieldPtrAnonymousHeadOmitEmptyIndent: + return opStructFieldAnonymousHeadOmitEmptyIndent + case opStructFieldPtrHeadIntIndent: + return opStructFieldHeadIntIndent + case opStructFieldPtrAnonymousHeadIntIndent: + return opStructFieldAnonymousHeadIntIndent + case opStructFieldPtrHeadOmitEmptyIntIndent: + return opStructFieldHeadOmitEmptyIntIndent + case opStructFieldPtrAnonymousHeadOmitEmptyIntIndent: + return opStructFieldAnonymousHeadOmitEmptyIntIndent + case opStructFieldPtrHeadInt8Indent: + return opStructFieldHeadInt8Indent + case opStructFieldPtrAnonymousHeadInt8Indent: + return opStructFieldAnonymousHeadInt8Indent + case opStructFieldPtrHeadOmitEmptyInt8Indent: + return opStructFieldHeadOmitEmptyInt8Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt8Indent: + return opStructFieldAnonymousHeadOmitEmptyInt8Indent + case opStructFieldPtrHeadInt16Indent: + return opStructFieldHeadInt16Indent + case opStructFieldPtrAnonymousHeadInt16Indent: + return opStructFieldAnonymousHeadInt16Indent + case opStructFieldPtrHeadOmitEmptyInt16Indent: + return opStructFieldHeadOmitEmptyInt16Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt16Indent: + return opStructFieldAnonymousHeadOmitEmptyInt16Indent + case opStructFieldPtrHeadInt32Indent: + return opStructFieldHeadInt32Indent + case opStructFieldPtrAnonymousHeadInt32Indent: + return opStructFieldAnonymousHeadInt32Indent + case opStructFieldPtrHeadOmitEmptyInt32Indent: + return opStructFieldHeadOmitEmptyInt32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt32Indent: + return opStructFieldAnonymousHeadOmitEmptyInt32Indent + case opStructFieldPtrHeadInt64Indent: + return opStructFieldHeadInt64Indent + case opStructFieldPtrAnonymousHeadInt64Indent: + return opStructFieldAnonymousHeadInt64Indent + case opStructFieldPtrHeadOmitEmptyInt64Indent: + return opStructFieldHeadOmitEmptyInt64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyInt64Indent: + return opStructFieldAnonymousHeadOmitEmptyInt64Indent + case opStructFieldPtrHeadUintIndent: + return opStructFieldHeadUintIndent + case opStructFieldPtrAnonymousHeadUintIndent: + return opStructFieldAnonymousHeadUintIndent + case opStructFieldPtrHeadOmitEmptyUintIndent: + return opStructFieldHeadOmitEmptyUintIndent + case opStructFieldPtrAnonymousHeadOmitEmptyUintIndent: + return opStructFieldAnonymousHeadOmitEmptyUintIndent + case opStructFieldPtrHeadUint8Indent: + return opStructFieldHeadUint8Indent + case opStructFieldPtrAnonymousHeadUint8Indent: + return opStructFieldAnonymousHeadUint8Indent + case opStructFieldPtrHeadOmitEmptyUint8Indent: + return opStructFieldHeadOmitEmptyUint8Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint8Indent: + return opStructFieldAnonymousHeadOmitEmptyUint8Indent + case opStructFieldPtrHeadUint16Indent: + return opStructFieldHeadUint16Indent + case opStructFieldPtrAnonymousHeadUint16Indent: + return opStructFieldAnonymousHeadUint16Indent + case opStructFieldPtrHeadOmitEmptyUint16Indent: + return opStructFieldHeadOmitEmptyUint16Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint16Indent: + return opStructFieldAnonymousHeadOmitEmptyUint16Indent + case opStructFieldPtrHeadUint32Indent: + return opStructFieldHeadUint32Indent + case opStructFieldPtrAnonymousHeadUint32Indent: + return opStructFieldAnonymousHeadUint32Indent + case opStructFieldPtrHeadOmitEmptyUint32Indent: + return opStructFieldHeadOmitEmptyUint32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint32Indent: + return opStructFieldAnonymousHeadOmitEmptyUint32Indent + case opStructFieldPtrHeadUint64Indent: + return opStructFieldHeadUint64Indent + case opStructFieldPtrAnonymousHeadUint64Indent: + return opStructFieldAnonymousHeadUint64Indent + case opStructFieldPtrHeadOmitEmptyUint64Indent: + return opStructFieldHeadOmitEmptyUint64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyUint64Indent: + return opStructFieldAnonymousHeadOmitEmptyUint64Indent + case opStructFieldPtrHeadFloat32Indent: + return opStructFieldHeadFloat32Indent + case opStructFieldPtrAnonymousHeadFloat32Indent: + return opStructFieldAnonymousHeadFloat32Indent + case opStructFieldPtrHeadOmitEmptyFloat32Indent: + return opStructFieldHeadOmitEmptyFloat32Indent + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32Indent: + return opStructFieldAnonymousHeadOmitEmptyFloat32Indent + case opStructFieldPtrHeadFloat64Indent: + return opStructFieldHeadFloat64Indent + case opStructFieldPtrAnonymousHeadFloat64Indent: + return opStructFieldAnonymousHeadFloat64Indent + case opStructFieldPtrHeadOmitEmptyFloat64Indent: + return opStructFieldHeadOmitEmptyFloat64Indent + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64Indent: + return opStructFieldAnonymousHeadOmitEmptyFloat64Indent + case opStructFieldPtrHeadBoolIndent: + return opStructFieldHeadBoolIndent + case opStructFieldPtrAnonymousHeadBoolIndent: + return opStructFieldAnonymousHeadBoolIndent + case opStructFieldPtrHeadOmitEmptyBoolIndent: + return opStructFieldHeadOmitEmptyBoolIndent + case opStructFieldPtrAnonymousHeadOmitEmptyBoolIndent: + return opStructFieldAnonymousHeadOmitEmptyBoolIndent + case opStructFieldPtrHeadStringIndent: + return opStructFieldHeadStringIndent + case opStructFieldPtrAnonymousHeadStringIndent: + return opStructFieldAnonymousHeadStringIndent + case opStructFieldPtrHeadOmitEmptyStringIndent: + return opStructFieldHeadOmitEmptyStringIndent + case opStructFieldPtrAnonymousHeadOmitEmptyStringIndent: + return opStructFieldAnonymousHeadOmitEmptyStringIndent + } + return t +} + +func (t opType) fieldToOmitEmptyField() opType { + switch t { + case opStructField: + return opStructFieldOmitEmpty + case opStructFieldInt: + return opStructFieldOmitEmptyInt + case opStructFieldInt8: + return opStructFieldOmitEmptyInt8 + case opStructFieldInt16: + return opStructFieldOmitEmptyInt16 + case opStructFieldInt32: + return opStructFieldOmitEmptyInt32 + case opStructFieldInt64: + return opStructFieldOmitEmptyInt64 + case opStructFieldUint: + return opStructFieldOmitEmptyUint + case opStructFieldUint8: + return opStructFieldOmitEmptyUint8 + case opStructFieldUint16: + return opStructFieldOmitEmptyUint16 + case opStructFieldUint32: + return opStructFieldOmitEmptyUint32 + case opStructFieldUint64: + return opStructFieldOmitEmptyUint64 + case opStructFieldFloat32: + return opStructFieldOmitEmptyFloat32 + case opStructFieldFloat64: + return opStructFieldOmitEmptyFloat64 + case opStructFieldBool: + return opStructFieldOmitEmptyBool + case opStructFieldString: + return opStructFieldOmitEmptyString + case opStructFieldIndent: + return opStructFieldOmitEmptyIndent + case opStructFieldIntIndent: + return opStructFieldOmitEmptyIntIndent + case opStructFieldInt8Indent: + return opStructFieldOmitEmptyInt8Indent + case opStructFieldInt16Indent: + return opStructFieldOmitEmptyInt16Indent + case opStructFieldInt32Indent: + return opStructFieldOmitEmptyInt32Indent + case opStructFieldInt64Indent: + return opStructFieldOmitEmptyInt64Indent + case opStructFieldUintIndent: + return opStructFieldOmitEmptyUintIndent + case opStructFieldUint8Indent: + return opStructFieldOmitEmptyUint8Indent + case opStructFieldUint16Indent: + return opStructFieldOmitEmptyUint16Indent + case opStructFieldUint32Indent: + return opStructFieldOmitEmptyUint32Indent + case opStructFieldUint64Indent: + return opStructFieldOmitEmptyUint64Indent + case opStructFieldFloat32Indent: + return opStructFieldOmitEmptyFloat32Indent + case opStructFieldFloat64Indent: + return opStructFieldOmitEmptyFloat64Indent + case opStructFieldBoolIndent: + return opStructFieldOmitEmptyBoolIndent + case opStructFieldStringIndent: + return opStructFieldOmitEmptyStringIndent + } + return t +} + diff --git a/encode_test.go b/encode_test.go index 831bc0d..94d9604 100644 --- a/encode_test.go +++ b/encode_test.go @@ -132,6 +132,56 @@ func Test_Marshal(t *testing.T) { assertErr(t, err) assertEq(t, "recursive", `{"a":{"b":{"t":{"d":"hello"}},"c":{"t":{"d":"world"}}}}`, string(bytes)) }) + t.Run("embedded", func(t *testing.T) { + type T struct { + A string `json:"a"` + } + type U struct { + *T + B string `json:"b"` + } + type T2 struct { + A string `json:"a,omitempty"` + } + type U2 struct { + *T2 + B string `json:"b,omitempty"` + } + t.Run("exists field", func(t *testing.T) { + bytes, err := json.Marshal(&U{ + T: &T{ + A: "aaa", + }, + B: "bbb", + }) + assertErr(t, err) + assertEq(t, "embedded", `{"a":"aaa","b":"bbb"}`, string(bytes)) + t.Run("omitempty", func(t *testing.T) { + bytes, err := json.Marshal(&U2{ + T2: &T2{ + A: "aaa", + }, + B: "bbb", + }) + assertErr(t, err) + assertEq(t, "embedded", `{"a":"aaa","b":"bbb"}`, string(bytes)) + }) + }) + t.Run("none field", func(t *testing.T) { + bytes, err := json.Marshal(&U{ + B: "bbb", + }) + assertErr(t, err) + assertEq(t, "embedded", `{"b":"bbb"}`, string(bytes)) + t.Run("omitempty", func(t *testing.T) { + bytes, err := json.Marshal(&U2{ + B: "bbb", + }) + assertErr(t, err) + assertEq(t, "embedded", `{"b":"bbb"}`, string(bytes)) + }) + }) + }) t.Run("omitempty", func(t *testing.T) { type T struct { A int `json:",omitempty"` diff --git a/encode_vm.go b/encode_vm.go index 2dee165..8ed7cec 100644 --- a/encode_vm.go +++ b/encode_vm.go @@ -487,10 +487,12 @@ func (e *Encoder) run(code *opcode) error { code = field.end.next } else { e.encodeByte('{') - e.encodeBytes(field.key) + if !field.anonymousKey { + e.encodeBytes(field.key) + } code = field.next - code.ptr = field.ptr + field.offset - field.nextField.ptr = field.ptr + code.ptr = ptr + field.nextField.ptr = ptr } case opStructFieldPtrHeadInt: code.ptr = e.ptrToPtr(code.ptr) @@ -504,8 +506,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeInt(e.ptrToInt(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt(e.ptrToInt(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadInt: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadInt: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeInt(e.ptrToInt(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt8: @@ -520,8 +536,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeInt8(e.ptrToInt8(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt8(e.ptrToInt8(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadInt8: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadInt8: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeInt8(e.ptrToInt8(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt16: @@ -536,8 +566,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeInt16(e.ptrToInt16(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt16(e.ptrToInt16(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadInt16: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadInt16: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeInt16(e.ptrToInt16(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt32: @@ -552,8 +596,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeInt32(e.ptrToInt32(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt32(e.ptrToInt32(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadInt32: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadInt32: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeInt32(e.ptrToInt32(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt64: @@ -568,8 +626,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeInt64(e.ptrToInt64(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt64(e.ptrToInt64(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadInt64: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadInt64: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeInt64(e.ptrToInt64(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint: @@ -584,8 +656,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeUint(e.ptrToUint(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint(e.ptrToUint(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadUint: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadUint: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeUint(e.ptrToUint(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint8: @@ -600,8 +686,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeUint8(e.ptrToUint8(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint8(e.ptrToUint8(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadUint8: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadUint8: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeUint8(e.ptrToUint8(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint16: @@ -616,8 +716,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeUint16(e.ptrToUint16(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint16(e.ptrToUint16(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadUint16: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadUint16: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeUint16(e.ptrToUint16(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint32: @@ -632,8 +746,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeUint32(e.ptrToUint32(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint32(e.ptrToUint32(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadUint32: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadUint32: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeUint32(e.ptrToUint32(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint64: @@ -648,8 +776,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeUint64(e.ptrToUint64(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint64(e.ptrToUint64(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadUint64: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadUint64: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeUint64(e.ptrToUint64(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadFloat32: @@ -664,8 +806,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeFloat32(e.ptrToFloat32(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeFloat32(e.ptrToFloat32(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadFloat32: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadFloat32: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeFloat32(e.ptrToFloat32(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadFloat64: @@ -678,7 +834,7 @@ func (e *Encoder) run(code *opcode) error { e.encodeNull() code = field.end } else { - v := e.ptrToFloat64(field.ptr + field.offset) + v := e.ptrToFloat64(ptr) if math.IsInf(v, 0) || math.IsNaN(v) { return &UnsupportedValueError{ Value: reflect.ValueOf(v), @@ -688,7 +844,28 @@ func (e *Encoder) run(code *opcode) error { e.encodeByte('{') e.encodeBytes(field.key) e.encodeFloat64(v) - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadFloat64: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadFloat64: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + v := e.ptrToFloat64(ptr) + if math.IsInf(v, 0) || math.IsNaN(v) { + return &UnsupportedValueError{ + Value: reflect.ValueOf(v), + Str: strconv.FormatFloat(v, 'g', -1, 64), + } + } + e.encodeBytes(field.key) + e.encodeFloat64(v) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadString: @@ -703,8 +880,22 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeString(e.ptrToString(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeString(e.ptrToString(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadString: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadString: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeString(e.ptrToString(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadBool: @@ -719,11 +910,24 @@ func (e *Encoder) run(code *opcode) error { } else { e.encodeByte('{') e.encodeBytes(field.key) - e.encodeBool(e.ptrToBool(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeBool(e.ptrToBool(ptr)) + field.nextField.ptr = ptr + code = field.next + } + case opStructFieldPtrAnonymousHeadBool: + code.ptr = e.ptrToPtr(code.ptr) + fallthrough + case opStructFieldAnonymousHeadBool: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end + } else { + e.encodeBytes(field.key) + e.encodeBool(e.ptrToBool(ptr)) + field.nextField.ptr = ptr code = field.next } - case opStructFieldPtrHeadIndent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) @@ -743,8 +947,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeBytes(field.key) e.encodeByte(' ') code = field.next - code.ptr = field.ptr + field.offset - field.nextField.ptr = field.ptr + code.ptr = ptr + field.nextField.ptr = ptr } case opStructFieldPtrHeadIntIndent: code.ptr = e.ptrToPtr(code.ptr) @@ -761,8 +965,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeInt(e.ptrToInt(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt(e.ptrToInt(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt8Indent: @@ -781,8 +985,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeInt8(e.ptrToInt8(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt8(e.ptrToInt8(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt16Indent: @@ -800,8 +1004,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeInt16(e.ptrToInt16(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt16(e.ptrToInt16(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt32Indent: @@ -820,8 +1024,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeInt32(e.ptrToInt32(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt32(e.ptrToInt32(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadInt64Indent: @@ -840,8 +1044,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeInt64(e.ptrToInt64(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeInt64(e.ptrToInt64(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUintIndent: @@ -860,8 +1064,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeUint(e.ptrToUint(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint(e.ptrToUint(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint8Indent: @@ -880,8 +1084,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeUint8(e.ptrToUint8(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint8(e.ptrToUint8(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint16Indent: @@ -900,8 +1104,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeUint16(e.ptrToUint16(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint16(e.ptrToUint16(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint32Indent: @@ -920,8 +1124,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeUint32(e.ptrToUint32(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint32(e.ptrToUint32(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadUint64Indent: @@ -940,8 +1144,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeUint64(e.ptrToUint64(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeUint64(e.ptrToUint64(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadFloat32Indent: @@ -960,8 +1164,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeFloat32(e.ptrToFloat32(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeFloat32(e.ptrToFloat32(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadFloat64Indent: @@ -975,7 +1179,7 @@ func (e *Encoder) run(code *opcode) error { e.encodeNull() code = field.end } else { - v := e.ptrToFloat64(field.ptr + field.offset) + v := e.ptrToFloat64(ptr) if math.IsInf(v, 0) || math.IsNaN(v) { return &UnsupportedValueError{ Value: reflect.ValueOf(v), @@ -988,7 +1192,7 @@ func (e *Encoder) run(code *opcode) error { e.encodeBytes(field.key) e.encodeByte(' ') e.encodeFloat64(v) - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadStringIndent: @@ -1007,8 +1211,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeString(e.ptrToString(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeString(e.ptrToString(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadBoolIndent: @@ -1027,8 +1231,8 @@ func (e *Encoder) run(code *opcode) error { e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeByte(' ') - e.encodeBool(e.ptrToBool(field.ptr + field.offset)) - field.nextField.ptr = field.ptr + e.encodeBool(e.ptrToBool(ptr)) + field.nextField.ptr = ptr code = field.next } case opStructFieldPtrHeadOmitEmpty: @@ -1043,307 +1247,534 @@ func (e *Encoder) run(code *opcode) error { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') p := ptr + field.offset if p == 0 || *(*uintptr)(unsafe.Pointer(p)) == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) code = field.next code.ptr = p } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadIntOmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmpty: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadIntOmitEmpty: + case opStructFieldAnonymousHeadOmitEmpty: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + p := ptr + field.offset + if p == 0 || *(*uintptr)(unsafe.Pointer(p)) == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + code = field.next + code.ptr = p + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyInt: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyInt: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToInt(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeInt(v) code = field.next } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt8OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyInt: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt8OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyInt: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToInt(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeInt(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyInt8: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyInt8: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToInt8(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeInt8(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadInt16OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyInt8: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt16OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyInt8: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToInt8(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeInt8(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyInt16: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyInt16: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToInt16(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeInt16(v) code = field.next } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt32OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyInt16: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt32OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyInt16: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToInt16(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeInt16(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyInt32: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyInt32: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToInt32(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeInt32(v) code = field.next } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt64OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyInt32: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt64OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyInt32: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToInt32(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeInt32(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyInt64: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyInt64: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToInt64(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeInt64(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadUintOmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyInt64: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUintOmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyInt64: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToInt64(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeInt64(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyUint: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyUint: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToUint(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeUint(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadUint8OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyUint: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint8OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyUint: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToUint(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeUint(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyUint8: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyUint8: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToUint8(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeUint8(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadUint16OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyUint8: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint16OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyUint8: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToUint8(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeUint8(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyUint16: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyUint16: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToUint16(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeUint16(v) code = field.next } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadUint32OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyUint16: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint32OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyUint16: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToUint16(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeUint16(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyUint32: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyUint32: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToUint32(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeUint32(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadUint64OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyUint32: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint64OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyUint32: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToUint32(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeUint32(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyUint64: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyUint64: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToUint64(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeUint64(v) code = field.next } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadFloat32OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyUint64: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadFloat32OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyUint64: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToUint64(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeUint64(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyFloat32: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyFloat32: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToFloat32(ptr + field.offset) if v == 0 { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeFloat32(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadFloat64OmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyFloat32: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadFloat64OmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyFloat32: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToFloat32(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeFloat32(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyFloat64: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyFloat64: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToFloat64(ptr + field.offset) if v == 0 { @@ -1355,64 +1786,127 @@ func (e *Encoder) run(code *opcode) error { Str: strconv.FormatFloat(v, 'g', -1, 64), } } - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeFloat64(v) code = field.next } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadStringOmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyFloat64: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadStringOmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyFloat64: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToFloat64(ptr + field.offset) + if v == 0 { + code = field.nextField + } else { + if math.IsInf(v, 0) || math.IsNaN(v) { + return &UnsupportedValueError{ + Value: reflect.ValueOf(v), + Str: strconv.FormatFloat(v, 'g', -1, 64), + } + } + e.encodeBytes(field.key) + e.encodeFloat64(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyString: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyString: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToString(ptr + field.offset) if v == "" { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeString(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr } - case opStructFieldPtrHeadBoolOmitEmpty: + case opStructFieldPtrAnonymousHeadOmitEmptyString: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadBoolOmitEmpty: + case opStructFieldAnonymousHeadOmitEmptyString: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToString(ptr + field.offset) + if v == "" { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeString(v) + code = field.next + } + field.nextField.ptr = ptr + } + case opStructFieldPtrHeadOmitEmptyBool: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldHeadOmitEmptyBool: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { e.encodeNull() code = field.end.next } else { - e.encodeIndent(code.indent) e.encodeByte('{') v := e.ptrToBool(ptr + field.offset) if !v { code = field.nextField } else { - e.encodeIndent(code.indent + 1) e.encodeBytes(field.key) e.encodeBool(v) code = field.next } - field.nextField.ptr = field.ptr + field.nextField.ptr = ptr + } + case opStructFieldPtrAnonymousHeadOmitEmptyBool: + if code.ptr != 0 { + code.ptr = e.ptrToPtr(code.ptr) + } + fallthrough + case opStructFieldAnonymousHeadOmitEmptyBool: + field := code.toStructFieldCode() + ptr := field.ptr + if ptr == 0 { + code = field.end.next + } else { + v := e.ptrToBool(ptr + field.offset) + if !v { + code = field.nextField + } else { + e.encodeBytes(field.key) + e.encodeBool(v) + code = field.next + } + field.nextField.ptr = ptr } - case opStructFieldPtrHeadOmitEmptyIndent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) @@ -1440,12 +1934,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadIntOmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyIntIndent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadIntOmitEmptyIndent: + case opStructFieldHeadOmitEmptyIntIndent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1467,12 +1961,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt8OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyInt8Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt8OmitEmptyIndent: + case opStructFieldHeadOmitEmptyInt8Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1494,12 +1988,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt16OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyInt16Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt16OmitEmptyIndent: + case opStructFieldHeadOmitEmptyInt16Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1521,12 +2015,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt32OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyInt32Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt32OmitEmptyIndent: + case opStructFieldHeadOmitEmptyInt32Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1548,12 +2042,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadInt64OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyInt64Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadInt64OmitEmptyIndent: + case opStructFieldHeadOmitEmptyInt64Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1575,12 +2069,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadUintOmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyUintIndent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUintOmitEmptyIndent: + case opStructFieldHeadOmitEmptyUintIndent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1602,12 +2096,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadUint8OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyUint8Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint8OmitEmptyIndent: + case opStructFieldHeadOmitEmptyUint8Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1629,12 +2123,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadUint16OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyUint16Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint16OmitEmptyIndent: + case opStructFieldHeadOmitEmptyUint16Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1656,12 +2150,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadUint32OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyUint32Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint32OmitEmptyIndent: + case opStructFieldHeadOmitEmptyUint32Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1683,12 +2177,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadUint64OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyUint64Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadUint64OmitEmptyIndent: + case opStructFieldHeadOmitEmptyUint64Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1710,12 +2204,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadFloat32OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyFloat32Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadFloat32OmitEmptyIndent: + case opStructFieldHeadOmitEmptyFloat32Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1737,12 +2231,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadFloat64OmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyFloat64Indent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadFloat64OmitEmptyIndent: + case opStructFieldHeadOmitEmptyFloat64Indent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1770,12 +2264,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadStringOmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyStringIndent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadStringOmitEmptyIndent: + case opStructFieldHeadOmitEmptyStringIndent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -1797,12 +2291,12 @@ func (e *Encoder) run(code *opcode) error { } field.nextField.ptr = field.ptr } - case opStructFieldPtrHeadBoolOmitEmptyIndent: + case opStructFieldPtrHeadOmitEmptyBoolIndent: if code.ptr != 0 { code.ptr = e.ptrToPtr(code.ptr) } fallthrough - case opStructFieldHeadBoolOmitEmptyIndent: + case opStructFieldHeadOmitEmptyBoolIndent: field := code.toStructFieldCode() ptr := field.ptr if ptr == 0 { @@ -2153,7 +2647,7 @@ func (e *Encoder) run(code *opcode) error { code.ptr = p } c.nextField.ptr = c.ptr - case opStructFieldIntOmitEmpty: + case opStructFieldOmitEmptyInt: c := code.toStructFieldCode() v := e.ptrToInt(c.ptr + c.offset) if v != 0 { @@ -2165,7 +2659,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt8OmitEmpty: + case opStructFieldOmitEmptyInt8: c := code.toStructFieldCode() v := e.ptrToInt8(c.ptr + c.offset) if v != 0 { @@ -2177,7 +2671,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt16OmitEmpty: + case opStructFieldOmitEmptyInt16: c := code.toStructFieldCode() v := e.ptrToInt16(c.ptr + c.offset) if v != 0 { @@ -2189,7 +2683,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt32OmitEmpty: + case opStructFieldOmitEmptyInt32: c := code.toStructFieldCode() v := e.ptrToInt32(c.ptr + c.offset) if v != 0 { @@ -2201,7 +2695,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt64OmitEmpty: + case opStructFieldOmitEmptyInt64: c := code.toStructFieldCode() v := e.ptrToInt64(c.ptr + c.offset) if v != 0 { @@ -2213,7 +2707,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUintOmitEmpty: + case opStructFieldOmitEmptyUint: c := code.toStructFieldCode() v := e.ptrToUint(c.ptr + c.offset) if v != 0 { @@ -2225,7 +2719,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint8OmitEmpty: + case opStructFieldOmitEmptyUint8: c := code.toStructFieldCode() v := e.ptrToUint8(c.ptr + c.offset) if v != 0 { @@ -2237,7 +2731,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint16OmitEmpty: + case opStructFieldOmitEmptyUint16: c := code.toStructFieldCode() v := e.ptrToUint16(c.ptr + c.offset) if v != 0 { @@ -2249,7 +2743,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint32OmitEmpty: + case opStructFieldOmitEmptyUint32: c := code.toStructFieldCode() v := e.ptrToUint32(c.ptr + c.offset) if v != 0 { @@ -2261,7 +2755,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint64OmitEmpty: + case opStructFieldOmitEmptyUint64: c := code.toStructFieldCode() v := e.ptrToUint64(c.ptr + c.offset) if v != 0 { @@ -2273,7 +2767,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldFloat32OmitEmpty: + case opStructFieldOmitEmptyFloat32: c := code.toStructFieldCode() v := e.ptrToFloat32(c.ptr + c.offset) if v != 0 { @@ -2285,7 +2779,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldFloat64OmitEmpty: + case opStructFieldOmitEmptyFloat64: c := code.toStructFieldCode() v := e.ptrToFloat64(c.ptr + c.offset) if v != 0 { @@ -2303,7 +2797,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldStringOmitEmpty: + case opStructFieldOmitEmptyString: c := code.toStructFieldCode() v := e.ptrToString(c.ptr + c.offset) if v != "" { @@ -2315,7 +2809,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldBoolOmitEmpty: + case opStructFieldOmitEmptyBool: c := code.toStructFieldCode() v := e.ptrToBool(c.ptr + c.offset) if v { @@ -2344,7 +2838,7 @@ func (e *Encoder) run(code *opcode) error { code.ptr = p } c.nextField.ptr = c.ptr - case opStructFieldIntOmitEmptyIndent: + case opStructFieldOmitEmptyIntIndent: c := code.toStructFieldCode() v := e.ptrToInt(c.ptr + c.offset) if v != 0 { @@ -2358,7 +2852,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt8OmitEmptyIndent: + case opStructFieldOmitEmptyInt8Indent: c := code.toStructFieldCode() v := e.ptrToInt8(c.ptr + c.offset) if v != 0 { @@ -2372,7 +2866,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt16OmitEmptyIndent: + case opStructFieldOmitEmptyInt16Indent: c := code.toStructFieldCode() v := e.ptrToInt16(c.ptr + c.offset) if v != 0 { @@ -2386,7 +2880,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt32OmitEmptyIndent: + case opStructFieldOmitEmptyInt32Indent: c := code.toStructFieldCode() v := e.ptrToInt32(c.ptr + c.offset) if v != 0 { @@ -2400,7 +2894,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldInt64OmitEmptyIndent: + case opStructFieldOmitEmptyInt64Indent: c := code.toStructFieldCode() v := e.ptrToInt64(c.ptr + c.offset) if v != 0 { @@ -2414,7 +2908,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUintOmitEmptyIndent: + case opStructFieldOmitEmptyUintIndent: c := code.toStructFieldCode() v := e.ptrToUint(c.ptr + c.offset) if v != 0 { @@ -2428,7 +2922,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint8OmitEmptyIndent: + case opStructFieldOmitEmptyUint8Indent: c := code.toStructFieldCode() v := e.ptrToUint8(c.ptr + c.offset) if v != 0 { @@ -2442,7 +2936,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint16OmitEmptyIndent: + case opStructFieldOmitEmptyUint16Indent: c := code.toStructFieldCode() v := e.ptrToUint16(c.ptr + c.offset) if v != 0 { @@ -2456,7 +2950,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint32OmitEmptyIndent: + case opStructFieldOmitEmptyUint32Indent: c := code.toStructFieldCode() v := e.ptrToUint32(c.ptr + c.offset) if v != 0 { @@ -2470,7 +2964,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldUint64OmitEmptyIndent: + case opStructFieldOmitEmptyUint64Indent: c := code.toStructFieldCode() v := e.ptrToUint64(c.ptr + c.offset) if v != 0 { @@ -2484,7 +2978,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldFloat32OmitEmptyIndent: + case opStructFieldOmitEmptyFloat32Indent: c := code.toStructFieldCode() v := e.ptrToFloat32(c.ptr + c.offset) if v != 0 { @@ -2498,7 +2992,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldFloat64OmitEmptyIndent: + case opStructFieldOmitEmptyFloat64Indent: c := code.toStructFieldCode() v := e.ptrToFloat64(c.ptr + c.offset) if v != 0 { @@ -2518,7 +3012,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldStringOmitEmptyIndent: + case opStructFieldOmitEmptyStringIndent: c := code.toStructFieldCode() v := e.ptrToString(c.ptr + c.offset) if v != "" { @@ -2532,7 +3026,7 @@ func (e *Encoder) run(code *opcode) error { } code = code.next code.ptr = c.ptr - case opStructFieldBoolOmitEmptyIndent: + case opStructFieldOmitEmptyBoolIndent: c := code.toStructFieldCode() v := e.ptrToBool(c.ptr + c.offset) if v { @@ -2549,6 +3043,8 @@ func (e *Encoder) run(code *opcode) error { case opStructEnd: e.encodeByte('}') code = code.next + case opStructAnonymousEnd: + code = code.next case opStructEndIndent: e.encodeByte('\n') e.encodeIndent(code.indent)