forked from mirror/go-json
981 lines
36 KiB
Go
981 lines
36 KiB
Go
// Code generated by internal/cmd/generator. DO NOT EDIT!
|
|
package encoder
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
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
|
|
CodeMapEnd CodeType = 8
|
|
CodeRecursive CodeType = 9
|
|
CodeStructField CodeType = 10
|
|
CodeStructEnd CodeType = 11
|
|
)
|
|
|
|
var opTypeStrings = [416]string{
|
|
"End",
|
|
"Interface",
|
|
"Ptr",
|
|
"SliceElem",
|
|
"SliceEnd",
|
|
"ArrayElem",
|
|
"ArrayEnd",
|
|
"MapKey",
|
|
"MapValue",
|
|
"MapEnd",
|
|
"Recursive",
|
|
"RecursivePtr",
|
|
"RecursiveEnd",
|
|
"StructAnonymousEnd",
|
|
"Int",
|
|
"Uint",
|
|
"Float32",
|
|
"Float64",
|
|
"Bool",
|
|
"String",
|
|
"Bytes",
|
|
"Number",
|
|
"Array",
|
|
"Map",
|
|
"Slice",
|
|
"Struct",
|
|
"MarshalJSON",
|
|
"MarshalText",
|
|
"IntString",
|
|
"UintString",
|
|
"IntPtr",
|
|
"UintPtr",
|
|
"Float32Ptr",
|
|
"Float64Ptr",
|
|
"BoolPtr",
|
|
"StringPtr",
|
|
"BytesPtr",
|
|
"NumberPtr",
|
|
"ArrayPtr",
|
|
"MapPtr",
|
|
"SlicePtr",
|
|
"MarshalJSONPtr",
|
|
"MarshalTextPtr",
|
|
"InterfacePtr",
|
|
"StructHeadInt",
|
|
"StructHeadOmitEmptyInt",
|
|
"StructHeadStringTagInt",
|
|
"StructPtrHeadInt",
|
|
"StructPtrHeadOmitEmptyInt",
|
|
"StructPtrHeadStringTagInt",
|
|
"StructHeadUint",
|
|
"StructHeadOmitEmptyUint",
|
|
"StructHeadStringTagUint",
|
|
"StructPtrHeadUint",
|
|
"StructPtrHeadOmitEmptyUint",
|
|
"StructPtrHeadStringTagUint",
|
|
"StructHeadFloat32",
|
|
"StructHeadOmitEmptyFloat32",
|
|
"StructHeadStringTagFloat32",
|
|
"StructPtrHeadFloat32",
|
|
"StructPtrHeadOmitEmptyFloat32",
|
|
"StructPtrHeadStringTagFloat32",
|
|
"StructHeadFloat64",
|
|
"StructHeadOmitEmptyFloat64",
|
|
"StructHeadStringTagFloat64",
|
|
"StructPtrHeadFloat64",
|
|
"StructPtrHeadOmitEmptyFloat64",
|
|
"StructPtrHeadStringTagFloat64",
|
|
"StructHeadBool",
|
|
"StructHeadOmitEmptyBool",
|
|
"StructHeadStringTagBool",
|
|
"StructPtrHeadBool",
|
|
"StructPtrHeadOmitEmptyBool",
|
|
"StructPtrHeadStringTagBool",
|
|
"StructHeadString",
|
|
"StructHeadOmitEmptyString",
|
|
"StructHeadStringTagString",
|
|
"StructPtrHeadString",
|
|
"StructPtrHeadOmitEmptyString",
|
|
"StructPtrHeadStringTagString",
|
|
"StructHeadBytes",
|
|
"StructHeadOmitEmptyBytes",
|
|
"StructHeadStringTagBytes",
|
|
"StructPtrHeadBytes",
|
|
"StructPtrHeadOmitEmptyBytes",
|
|
"StructPtrHeadStringTagBytes",
|
|
"StructHeadNumber",
|
|
"StructHeadOmitEmptyNumber",
|
|
"StructHeadStringTagNumber",
|
|
"StructPtrHeadNumber",
|
|
"StructPtrHeadOmitEmptyNumber",
|
|
"StructPtrHeadStringTagNumber",
|
|
"StructHeadArray",
|
|
"StructHeadOmitEmptyArray",
|
|
"StructHeadStringTagArray",
|
|
"StructPtrHeadArray",
|
|
"StructPtrHeadOmitEmptyArray",
|
|
"StructPtrHeadStringTagArray",
|
|
"StructHeadMap",
|
|
"StructHeadOmitEmptyMap",
|
|
"StructHeadStringTagMap",
|
|
"StructPtrHeadMap",
|
|
"StructPtrHeadOmitEmptyMap",
|
|
"StructPtrHeadStringTagMap",
|
|
"StructHeadSlice",
|
|
"StructHeadOmitEmptySlice",
|
|
"StructHeadStringTagSlice",
|
|
"StructPtrHeadSlice",
|
|
"StructPtrHeadOmitEmptySlice",
|
|
"StructPtrHeadStringTagSlice",
|
|
"StructHeadStruct",
|
|
"StructHeadOmitEmptyStruct",
|
|
"StructHeadStringTagStruct",
|
|
"StructPtrHeadStruct",
|
|
"StructPtrHeadOmitEmptyStruct",
|
|
"StructPtrHeadStringTagStruct",
|
|
"StructHeadMarshalJSON",
|
|
"StructHeadOmitEmptyMarshalJSON",
|
|
"StructHeadStringTagMarshalJSON",
|
|
"StructPtrHeadMarshalJSON",
|
|
"StructPtrHeadOmitEmptyMarshalJSON",
|
|
"StructPtrHeadStringTagMarshalJSON",
|
|
"StructHeadMarshalText",
|
|
"StructHeadOmitEmptyMarshalText",
|
|
"StructHeadStringTagMarshalText",
|
|
"StructPtrHeadMarshalText",
|
|
"StructPtrHeadOmitEmptyMarshalText",
|
|
"StructPtrHeadStringTagMarshalText",
|
|
"StructHeadIntString",
|
|
"StructHeadOmitEmptyIntString",
|
|
"StructHeadStringTagIntString",
|
|
"StructPtrHeadIntString",
|
|
"StructPtrHeadOmitEmptyIntString",
|
|
"StructPtrHeadStringTagIntString",
|
|
"StructHeadUintString",
|
|
"StructHeadOmitEmptyUintString",
|
|
"StructHeadStringTagUintString",
|
|
"StructPtrHeadUintString",
|
|
"StructPtrHeadOmitEmptyUintString",
|
|
"StructPtrHeadStringTagUintString",
|
|
"StructHeadIntPtr",
|
|
"StructHeadOmitEmptyIntPtr",
|
|
"StructHeadStringTagIntPtr",
|
|
"StructPtrHeadIntPtr",
|
|
"StructPtrHeadOmitEmptyIntPtr",
|
|
"StructPtrHeadStringTagIntPtr",
|
|
"StructHeadUintPtr",
|
|
"StructHeadOmitEmptyUintPtr",
|
|
"StructHeadStringTagUintPtr",
|
|
"StructPtrHeadUintPtr",
|
|
"StructPtrHeadOmitEmptyUintPtr",
|
|
"StructPtrHeadStringTagUintPtr",
|
|
"StructHeadFloat32Ptr",
|
|
"StructHeadOmitEmptyFloat32Ptr",
|
|
"StructHeadStringTagFloat32Ptr",
|
|
"StructPtrHeadFloat32Ptr",
|
|
"StructPtrHeadOmitEmptyFloat32Ptr",
|
|
"StructPtrHeadStringTagFloat32Ptr",
|
|
"StructHeadFloat64Ptr",
|
|
"StructHeadOmitEmptyFloat64Ptr",
|
|
"StructHeadStringTagFloat64Ptr",
|
|
"StructPtrHeadFloat64Ptr",
|
|
"StructPtrHeadOmitEmptyFloat64Ptr",
|
|
"StructPtrHeadStringTagFloat64Ptr",
|
|
"StructHeadBoolPtr",
|
|
"StructHeadOmitEmptyBoolPtr",
|
|
"StructHeadStringTagBoolPtr",
|
|
"StructPtrHeadBoolPtr",
|
|
"StructPtrHeadOmitEmptyBoolPtr",
|
|
"StructPtrHeadStringTagBoolPtr",
|
|
"StructHeadStringPtr",
|
|
"StructHeadOmitEmptyStringPtr",
|
|
"StructHeadStringTagStringPtr",
|
|
"StructPtrHeadStringPtr",
|
|
"StructPtrHeadOmitEmptyStringPtr",
|
|
"StructPtrHeadStringTagStringPtr",
|
|
"StructHeadBytesPtr",
|
|
"StructHeadOmitEmptyBytesPtr",
|
|
"StructHeadStringTagBytesPtr",
|
|
"StructPtrHeadBytesPtr",
|
|
"StructPtrHeadOmitEmptyBytesPtr",
|
|
"StructPtrHeadStringTagBytesPtr",
|
|
"StructHeadNumberPtr",
|
|
"StructHeadOmitEmptyNumberPtr",
|
|
"StructHeadStringTagNumberPtr",
|
|
"StructPtrHeadNumberPtr",
|
|
"StructPtrHeadOmitEmptyNumberPtr",
|
|
"StructPtrHeadStringTagNumberPtr",
|
|
"StructHeadArrayPtr",
|
|
"StructHeadOmitEmptyArrayPtr",
|
|
"StructHeadStringTagArrayPtr",
|
|
"StructPtrHeadArrayPtr",
|
|
"StructPtrHeadOmitEmptyArrayPtr",
|
|
"StructPtrHeadStringTagArrayPtr",
|
|
"StructHeadMapPtr",
|
|
"StructHeadOmitEmptyMapPtr",
|
|
"StructHeadStringTagMapPtr",
|
|
"StructPtrHeadMapPtr",
|
|
"StructPtrHeadOmitEmptyMapPtr",
|
|
"StructPtrHeadStringTagMapPtr",
|
|
"StructHeadSlicePtr",
|
|
"StructHeadOmitEmptySlicePtr",
|
|
"StructHeadStringTagSlicePtr",
|
|
"StructPtrHeadSlicePtr",
|
|
"StructPtrHeadOmitEmptySlicePtr",
|
|
"StructPtrHeadStringTagSlicePtr",
|
|
"StructHeadMarshalJSONPtr",
|
|
"StructHeadOmitEmptyMarshalJSONPtr",
|
|
"StructHeadStringTagMarshalJSONPtr",
|
|
"StructPtrHeadMarshalJSONPtr",
|
|
"StructPtrHeadOmitEmptyMarshalJSONPtr",
|
|
"StructPtrHeadStringTagMarshalJSONPtr",
|
|
"StructHeadMarshalTextPtr",
|
|
"StructHeadOmitEmptyMarshalTextPtr",
|
|
"StructHeadStringTagMarshalTextPtr",
|
|
"StructPtrHeadMarshalTextPtr",
|
|
"StructPtrHeadOmitEmptyMarshalTextPtr",
|
|
"StructPtrHeadStringTagMarshalTextPtr",
|
|
"StructHeadInterfacePtr",
|
|
"StructHeadOmitEmptyInterfacePtr",
|
|
"StructHeadStringTagInterfacePtr",
|
|
"StructPtrHeadInterfacePtr",
|
|
"StructPtrHeadOmitEmptyInterfacePtr",
|
|
"StructPtrHeadStringTagInterfacePtr",
|
|
"StructHead",
|
|
"StructHeadOmitEmpty",
|
|
"StructHeadStringTag",
|
|
"StructPtrHead",
|
|
"StructPtrHeadOmitEmpty",
|
|
"StructPtrHeadStringTag",
|
|
"StructFieldInt",
|
|
"StructFieldOmitEmptyInt",
|
|
"StructFieldStringTagInt",
|
|
"StructEndInt",
|
|
"StructEndOmitEmptyInt",
|
|
"StructEndStringTagInt",
|
|
"StructFieldUint",
|
|
"StructFieldOmitEmptyUint",
|
|
"StructFieldStringTagUint",
|
|
"StructEndUint",
|
|
"StructEndOmitEmptyUint",
|
|
"StructEndStringTagUint",
|
|
"StructFieldFloat32",
|
|
"StructFieldOmitEmptyFloat32",
|
|
"StructFieldStringTagFloat32",
|
|
"StructEndFloat32",
|
|
"StructEndOmitEmptyFloat32",
|
|
"StructEndStringTagFloat32",
|
|
"StructFieldFloat64",
|
|
"StructFieldOmitEmptyFloat64",
|
|
"StructFieldStringTagFloat64",
|
|
"StructEndFloat64",
|
|
"StructEndOmitEmptyFloat64",
|
|
"StructEndStringTagFloat64",
|
|
"StructFieldBool",
|
|
"StructFieldOmitEmptyBool",
|
|
"StructFieldStringTagBool",
|
|
"StructEndBool",
|
|
"StructEndOmitEmptyBool",
|
|
"StructEndStringTagBool",
|
|
"StructFieldString",
|
|
"StructFieldOmitEmptyString",
|
|
"StructFieldStringTagString",
|
|
"StructEndString",
|
|
"StructEndOmitEmptyString",
|
|
"StructEndStringTagString",
|
|
"StructFieldBytes",
|
|
"StructFieldOmitEmptyBytes",
|
|
"StructFieldStringTagBytes",
|
|
"StructEndBytes",
|
|
"StructEndOmitEmptyBytes",
|
|
"StructEndStringTagBytes",
|
|
"StructFieldNumber",
|
|
"StructFieldOmitEmptyNumber",
|
|
"StructFieldStringTagNumber",
|
|
"StructEndNumber",
|
|
"StructEndOmitEmptyNumber",
|
|
"StructEndStringTagNumber",
|
|
"StructFieldArray",
|
|
"StructFieldOmitEmptyArray",
|
|
"StructFieldStringTagArray",
|
|
"StructEndArray",
|
|
"StructEndOmitEmptyArray",
|
|
"StructEndStringTagArray",
|
|
"StructFieldMap",
|
|
"StructFieldOmitEmptyMap",
|
|
"StructFieldStringTagMap",
|
|
"StructEndMap",
|
|
"StructEndOmitEmptyMap",
|
|
"StructEndStringTagMap",
|
|
"StructFieldSlice",
|
|
"StructFieldOmitEmptySlice",
|
|
"StructFieldStringTagSlice",
|
|
"StructEndSlice",
|
|
"StructEndOmitEmptySlice",
|
|
"StructEndStringTagSlice",
|
|
"StructFieldStruct",
|
|
"StructFieldOmitEmptyStruct",
|
|
"StructFieldStringTagStruct",
|
|
"StructEndStruct",
|
|
"StructEndOmitEmptyStruct",
|
|
"StructEndStringTagStruct",
|
|
"StructFieldMarshalJSON",
|
|
"StructFieldOmitEmptyMarshalJSON",
|
|
"StructFieldStringTagMarshalJSON",
|
|
"StructEndMarshalJSON",
|
|
"StructEndOmitEmptyMarshalJSON",
|
|
"StructEndStringTagMarshalJSON",
|
|
"StructFieldMarshalText",
|
|
"StructFieldOmitEmptyMarshalText",
|
|
"StructFieldStringTagMarshalText",
|
|
"StructEndMarshalText",
|
|
"StructEndOmitEmptyMarshalText",
|
|
"StructEndStringTagMarshalText",
|
|
"StructFieldIntString",
|
|
"StructFieldOmitEmptyIntString",
|
|
"StructFieldStringTagIntString",
|
|
"StructEndIntString",
|
|
"StructEndOmitEmptyIntString",
|
|
"StructEndStringTagIntString",
|
|
"StructFieldUintString",
|
|
"StructFieldOmitEmptyUintString",
|
|
"StructFieldStringTagUintString",
|
|
"StructEndUintString",
|
|
"StructEndOmitEmptyUintString",
|
|
"StructEndStringTagUintString",
|
|
"StructFieldIntPtr",
|
|
"StructFieldOmitEmptyIntPtr",
|
|
"StructFieldStringTagIntPtr",
|
|
"StructEndIntPtr",
|
|
"StructEndOmitEmptyIntPtr",
|
|
"StructEndStringTagIntPtr",
|
|
"StructFieldUintPtr",
|
|
"StructFieldOmitEmptyUintPtr",
|
|
"StructFieldStringTagUintPtr",
|
|
"StructEndUintPtr",
|
|
"StructEndOmitEmptyUintPtr",
|
|
"StructEndStringTagUintPtr",
|
|
"StructFieldFloat32Ptr",
|
|
"StructFieldOmitEmptyFloat32Ptr",
|
|
"StructFieldStringTagFloat32Ptr",
|
|
"StructEndFloat32Ptr",
|
|
"StructEndOmitEmptyFloat32Ptr",
|
|
"StructEndStringTagFloat32Ptr",
|
|
"StructFieldFloat64Ptr",
|
|
"StructFieldOmitEmptyFloat64Ptr",
|
|
"StructFieldStringTagFloat64Ptr",
|
|
"StructEndFloat64Ptr",
|
|
"StructEndOmitEmptyFloat64Ptr",
|
|
"StructEndStringTagFloat64Ptr",
|
|
"StructFieldBoolPtr",
|
|
"StructFieldOmitEmptyBoolPtr",
|
|
"StructFieldStringTagBoolPtr",
|
|
"StructEndBoolPtr",
|
|
"StructEndOmitEmptyBoolPtr",
|
|
"StructEndStringTagBoolPtr",
|
|
"StructFieldStringPtr",
|
|
"StructFieldOmitEmptyStringPtr",
|
|
"StructFieldStringTagStringPtr",
|
|
"StructEndStringPtr",
|
|
"StructEndOmitEmptyStringPtr",
|
|
"StructEndStringTagStringPtr",
|
|
"StructFieldBytesPtr",
|
|
"StructFieldOmitEmptyBytesPtr",
|
|
"StructFieldStringTagBytesPtr",
|
|
"StructEndBytesPtr",
|
|
"StructEndOmitEmptyBytesPtr",
|
|
"StructEndStringTagBytesPtr",
|
|
"StructFieldNumberPtr",
|
|
"StructFieldOmitEmptyNumberPtr",
|
|
"StructFieldStringTagNumberPtr",
|
|
"StructEndNumberPtr",
|
|
"StructEndOmitEmptyNumberPtr",
|
|
"StructEndStringTagNumberPtr",
|
|
"StructFieldArrayPtr",
|
|
"StructFieldOmitEmptyArrayPtr",
|
|
"StructFieldStringTagArrayPtr",
|
|
"StructEndArrayPtr",
|
|
"StructEndOmitEmptyArrayPtr",
|
|
"StructEndStringTagArrayPtr",
|
|
"StructFieldMapPtr",
|
|
"StructFieldOmitEmptyMapPtr",
|
|
"StructFieldStringTagMapPtr",
|
|
"StructEndMapPtr",
|
|
"StructEndOmitEmptyMapPtr",
|
|
"StructEndStringTagMapPtr",
|
|
"StructFieldSlicePtr",
|
|
"StructFieldOmitEmptySlicePtr",
|
|
"StructFieldStringTagSlicePtr",
|
|
"StructEndSlicePtr",
|
|
"StructEndOmitEmptySlicePtr",
|
|
"StructEndStringTagSlicePtr",
|
|
"StructFieldMarshalJSONPtr",
|
|
"StructFieldOmitEmptyMarshalJSONPtr",
|
|
"StructFieldStringTagMarshalJSONPtr",
|
|
"StructEndMarshalJSONPtr",
|
|
"StructEndOmitEmptyMarshalJSONPtr",
|
|
"StructEndStringTagMarshalJSONPtr",
|
|
"StructFieldMarshalTextPtr",
|
|
"StructFieldOmitEmptyMarshalTextPtr",
|
|
"StructFieldStringTagMarshalTextPtr",
|
|
"StructEndMarshalTextPtr",
|
|
"StructEndOmitEmptyMarshalTextPtr",
|
|
"StructEndStringTagMarshalTextPtr",
|
|
"StructFieldInterfacePtr",
|
|
"StructFieldOmitEmptyInterfacePtr",
|
|
"StructFieldStringTagInterfacePtr",
|
|
"StructEndInterfacePtr",
|
|
"StructEndOmitEmptyInterfacePtr",
|
|
"StructEndStringTagInterfacePtr",
|
|
"StructField",
|
|
"StructFieldOmitEmpty",
|
|
"StructFieldStringTag",
|
|
"StructEnd",
|
|
"StructEndOmitEmpty",
|
|
"StructEndStringTag",
|
|
}
|
|
|
|
type OpType int
|
|
|
|
const (
|
|
OpEnd OpType = 0
|
|
OpInterface OpType = 1
|
|
OpPtr OpType = 2
|
|
OpSliceElem OpType = 3
|
|
OpSliceEnd OpType = 4
|
|
OpArrayElem OpType = 5
|
|
OpArrayEnd OpType = 6
|
|
OpMapKey OpType = 7
|
|
OpMapValue OpType = 8
|
|
OpMapEnd OpType = 9
|
|
OpRecursive OpType = 10
|
|
OpRecursivePtr OpType = 11
|
|
OpRecursiveEnd OpType = 12
|
|
OpStructAnonymousEnd OpType = 13
|
|
OpInt OpType = 14
|
|
OpUint OpType = 15
|
|
OpFloat32 OpType = 16
|
|
OpFloat64 OpType = 17
|
|
OpBool OpType = 18
|
|
OpString OpType = 19
|
|
OpBytes OpType = 20
|
|
OpNumber OpType = 21
|
|
OpArray OpType = 22
|
|
OpMap OpType = 23
|
|
OpSlice OpType = 24
|
|
OpStruct OpType = 25
|
|
OpMarshalJSON OpType = 26
|
|
OpMarshalText OpType = 27
|
|
OpIntString OpType = 28
|
|
OpUintString OpType = 29
|
|
OpIntPtr OpType = 30
|
|
OpUintPtr OpType = 31
|
|
OpFloat32Ptr OpType = 32
|
|
OpFloat64Ptr OpType = 33
|
|
OpBoolPtr OpType = 34
|
|
OpStringPtr OpType = 35
|
|
OpBytesPtr OpType = 36
|
|
OpNumberPtr OpType = 37
|
|
OpArrayPtr OpType = 38
|
|
OpMapPtr OpType = 39
|
|
OpSlicePtr OpType = 40
|
|
OpMarshalJSONPtr OpType = 41
|
|
OpMarshalTextPtr OpType = 42
|
|
OpInterfacePtr OpType = 43
|
|
OpStructHeadInt OpType = 44
|
|
OpStructHeadOmitEmptyInt OpType = 45
|
|
OpStructHeadStringTagInt OpType = 46
|
|
OpStructPtrHeadInt OpType = 47
|
|
OpStructPtrHeadOmitEmptyInt OpType = 48
|
|
OpStructPtrHeadStringTagInt OpType = 49
|
|
OpStructHeadUint OpType = 50
|
|
OpStructHeadOmitEmptyUint OpType = 51
|
|
OpStructHeadStringTagUint OpType = 52
|
|
OpStructPtrHeadUint OpType = 53
|
|
OpStructPtrHeadOmitEmptyUint OpType = 54
|
|
OpStructPtrHeadStringTagUint OpType = 55
|
|
OpStructHeadFloat32 OpType = 56
|
|
OpStructHeadOmitEmptyFloat32 OpType = 57
|
|
OpStructHeadStringTagFloat32 OpType = 58
|
|
OpStructPtrHeadFloat32 OpType = 59
|
|
OpStructPtrHeadOmitEmptyFloat32 OpType = 60
|
|
OpStructPtrHeadStringTagFloat32 OpType = 61
|
|
OpStructHeadFloat64 OpType = 62
|
|
OpStructHeadOmitEmptyFloat64 OpType = 63
|
|
OpStructHeadStringTagFloat64 OpType = 64
|
|
OpStructPtrHeadFloat64 OpType = 65
|
|
OpStructPtrHeadOmitEmptyFloat64 OpType = 66
|
|
OpStructPtrHeadStringTagFloat64 OpType = 67
|
|
OpStructHeadBool OpType = 68
|
|
OpStructHeadOmitEmptyBool OpType = 69
|
|
OpStructHeadStringTagBool OpType = 70
|
|
OpStructPtrHeadBool OpType = 71
|
|
OpStructPtrHeadOmitEmptyBool OpType = 72
|
|
OpStructPtrHeadStringTagBool OpType = 73
|
|
OpStructHeadString OpType = 74
|
|
OpStructHeadOmitEmptyString OpType = 75
|
|
OpStructHeadStringTagString OpType = 76
|
|
OpStructPtrHeadString OpType = 77
|
|
OpStructPtrHeadOmitEmptyString OpType = 78
|
|
OpStructPtrHeadStringTagString OpType = 79
|
|
OpStructHeadBytes OpType = 80
|
|
OpStructHeadOmitEmptyBytes OpType = 81
|
|
OpStructHeadStringTagBytes OpType = 82
|
|
OpStructPtrHeadBytes OpType = 83
|
|
OpStructPtrHeadOmitEmptyBytes OpType = 84
|
|
OpStructPtrHeadStringTagBytes OpType = 85
|
|
OpStructHeadNumber OpType = 86
|
|
OpStructHeadOmitEmptyNumber OpType = 87
|
|
OpStructHeadStringTagNumber OpType = 88
|
|
OpStructPtrHeadNumber OpType = 89
|
|
OpStructPtrHeadOmitEmptyNumber OpType = 90
|
|
OpStructPtrHeadStringTagNumber OpType = 91
|
|
OpStructHeadArray OpType = 92
|
|
OpStructHeadOmitEmptyArray OpType = 93
|
|
OpStructHeadStringTagArray OpType = 94
|
|
OpStructPtrHeadArray OpType = 95
|
|
OpStructPtrHeadOmitEmptyArray OpType = 96
|
|
OpStructPtrHeadStringTagArray OpType = 97
|
|
OpStructHeadMap OpType = 98
|
|
OpStructHeadOmitEmptyMap OpType = 99
|
|
OpStructHeadStringTagMap OpType = 100
|
|
OpStructPtrHeadMap OpType = 101
|
|
OpStructPtrHeadOmitEmptyMap OpType = 102
|
|
OpStructPtrHeadStringTagMap OpType = 103
|
|
OpStructHeadSlice OpType = 104
|
|
OpStructHeadOmitEmptySlice OpType = 105
|
|
OpStructHeadStringTagSlice OpType = 106
|
|
OpStructPtrHeadSlice OpType = 107
|
|
OpStructPtrHeadOmitEmptySlice OpType = 108
|
|
OpStructPtrHeadStringTagSlice OpType = 109
|
|
OpStructHeadStruct OpType = 110
|
|
OpStructHeadOmitEmptyStruct OpType = 111
|
|
OpStructHeadStringTagStruct OpType = 112
|
|
OpStructPtrHeadStruct OpType = 113
|
|
OpStructPtrHeadOmitEmptyStruct OpType = 114
|
|
OpStructPtrHeadStringTagStruct OpType = 115
|
|
OpStructHeadMarshalJSON OpType = 116
|
|
OpStructHeadOmitEmptyMarshalJSON OpType = 117
|
|
OpStructHeadStringTagMarshalJSON OpType = 118
|
|
OpStructPtrHeadMarshalJSON OpType = 119
|
|
OpStructPtrHeadOmitEmptyMarshalJSON OpType = 120
|
|
OpStructPtrHeadStringTagMarshalJSON OpType = 121
|
|
OpStructHeadMarshalText OpType = 122
|
|
OpStructHeadOmitEmptyMarshalText OpType = 123
|
|
OpStructHeadStringTagMarshalText OpType = 124
|
|
OpStructPtrHeadMarshalText OpType = 125
|
|
OpStructPtrHeadOmitEmptyMarshalText OpType = 126
|
|
OpStructPtrHeadStringTagMarshalText OpType = 127
|
|
OpStructHeadIntString OpType = 128
|
|
OpStructHeadOmitEmptyIntString OpType = 129
|
|
OpStructHeadStringTagIntString OpType = 130
|
|
OpStructPtrHeadIntString OpType = 131
|
|
OpStructPtrHeadOmitEmptyIntString OpType = 132
|
|
OpStructPtrHeadStringTagIntString OpType = 133
|
|
OpStructHeadUintString OpType = 134
|
|
OpStructHeadOmitEmptyUintString OpType = 135
|
|
OpStructHeadStringTagUintString OpType = 136
|
|
OpStructPtrHeadUintString OpType = 137
|
|
OpStructPtrHeadOmitEmptyUintString OpType = 138
|
|
OpStructPtrHeadStringTagUintString OpType = 139
|
|
OpStructHeadIntPtr OpType = 140
|
|
OpStructHeadOmitEmptyIntPtr OpType = 141
|
|
OpStructHeadStringTagIntPtr OpType = 142
|
|
OpStructPtrHeadIntPtr OpType = 143
|
|
OpStructPtrHeadOmitEmptyIntPtr OpType = 144
|
|
OpStructPtrHeadStringTagIntPtr OpType = 145
|
|
OpStructHeadUintPtr OpType = 146
|
|
OpStructHeadOmitEmptyUintPtr OpType = 147
|
|
OpStructHeadStringTagUintPtr OpType = 148
|
|
OpStructPtrHeadUintPtr OpType = 149
|
|
OpStructPtrHeadOmitEmptyUintPtr OpType = 150
|
|
OpStructPtrHeadStringTagUintPtr OpType = 151
|
|
OpStructHeadFloat32Ptr OpType = 152
|
|
OpStructHeadOmitEmptyFloat32Ptr OpType = 153
|
|
OpStructHeadStringTagFloat32Ptr OpType = 154
|
|
OpStructPtrHeadFloat32Ptr OpType = 155
|
|
OpStructPtrHeadOmitEmptyFloat32Ptr OpType = 156
|
|
OpStructPtrHeadStringTagFloat32Ptr OpType = 157
|
|
OpStructHeadFloat64Ptr OpType = 158
|
|
OpStructHeadOmitEmptyFloat64Ptr OpType = 159
|
|
OpStructHeadStringTagFloat64Ptr OpType = 160
|
|
OpStructPtrHeadFloat64Ptr OpType = 161
|
|
OpStructPtrHeadOmitEmptyFloat64Ptr OpType = 162
|
|
OpStructPtrHeadStringTagFloat64Ptr OpType = 163
|
|
OpStructHeadBoolPtr OpType = 164
|
|
OpStructHeadOmitEmptyBoolPtr OpType = 165
|
|
OpStructHeadStringTagBoolPtr OpType = 166
|
|
OpStructPtrHeadBoolPtr OpType = 167
|
|
OpStructPtrHeadOmitEmptyBoolPtr OpType = 168
|
|
OpStructPtrHeadStringTagBoolPtr OpType = 169
|
|
OpStructHeadStringPtr OpType = 170
|
|
OpStructHeadOmitEmptyStringPtr OpType = 171
|
|
OpStructHeadStringTagStringPtr OpType = 172
|
|
OpStructPtrHeadStringPtr OpType = 173
|
|
OpStructPtrHeadOmitEmptyStringPtr OpType = 174
|
|
OpStructPtrHeadStringTagStringPtr OpType = 175
|
|
OpStructHeadBytesPtr OpType = 176
|
|
OpStructHeadOmitEmptyBytesPtr OpType = 177
|
|
OpStructHeadStringTagBytesPtr OpType = 178
|
|
OpStructPtrHeadBytesPtr OpType = 179
|
|
OpStructPtrHeadOmitEmptyBytesPtr OpType = 180
|
|
OpStructPtrHeadStringTagBytesPtr OpType = 181
|
|
OpStructHeadNumberPtr OpType = 182
|
|
OpStructHeadOmitEmptyNumberPtr OpType = 183
|
|
OpStructHeadStringTagNumberPtr OpType = 184
|
|
OpStructPtrHeadNumberPtr OpType = 185
|
|
OpStructPtrHeadOmitEmptyNumberPtr OpType = 186
|
|
OpStructPtrHeadStringTagNumberPtr OpType = 187
|
|
OpStructHeadArrayPtr OpType = 188
|
|
OpStructHeadOmitEmptyArrayPtr OpType = 189
|
|
OpStructHeadStringTagArrayPtr OpType = 190
|
|
OpStructPtrHeadArrayPtr OpType = 191
|
|
OpStructPtrHeadOmitEmptyArrayPtr OpType = 192
|
|
OpStructPtrHeadStringTagArrayPtr OpType = 193
|
|
OpStructHeadMapPtr OpType = 194
|
|
OpStructHeadOmitEmptyMapPtr OpType = 195
|
|
OpStructHeadStringTagMapPtr OpType = 196
|
|
OpStructPtrHeadMapPtr OpType = 197
|
|
OpStructPtrHeadOmitEmptyMapPtr OpType = 198
|
|
OpStructPtrHeadStringTagMapPtr OpType = 199
|
|
OpStructHeadSlicePtr OpType = 200
|
|
OpStructHeadOmitEmptySlicePtr OpType = 201
|
|
OpStructHeadStringTagSlicePtr OpType = 202
|
|
OpStructPtrHeadSlicePtr OpType = 203
|
|
OpStructPtrHeadOmitEmptySlicePtr OpType = 204
|
|
OpStructPtrHeadStringTagSlicePtr OpType = 205
|
|
OpStructHeadMarshalJSONPtr OpType = 206
|
|
OpStructHeadOmitEmptyMarshalJSONPtr OpType = 207
|
|
OpStructHeadStringTagMarshalJSONPtr OpType = 208
|
|
OpStructPtrHeadMarshalJSONPtr OpType = 209
|
|
OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 210
|
|
OpStructPtrHeadStringTagMarshalJSONPtr OpType = 211
|
|
OpStructHeadMarshalTextPtr OpType = 212
|
|
OpStructHeadOmitEmptyMarshalTextPtr OpType = 213
|
|
OpStructHeadStringTagMarshalTextPtr OpType = 214
|
|
OpStructPtrHeadMarshalTextPtr OpType = 215
|
|
OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 216
|
|
OpStructPtrHeadStringTagMarshalTextPtr OpType = 217
|
|
OpStructHeadInterfacePtr OpType = 218
|
|
OpStructHeadOmitEmptyInterfacePtr OpType = 219
|
|
OpStructHeadStringTagInterfacePtr OpType = 220
|
|
OpStructPtrHeadInterfacePtr OpType = 221
|
|
OpStructPtrHeadOmitEmptyInterfacePtr OpType = 222
|
|
OpStructPtrHeadStringTagInterfacePtr OpType = 223
|
|
OpStructHead OpType = 224
|
|
OpStructHeadOmitEmpty OpType = 225
|
|
OpStructHeadStringTag OpType = 226
|
|
OpStructPtrHead OpType = 227
|
|
OpStructPtrHeadOmitEmpty OpType = 228
|
|
OpStructPtrHeadStringTag OpType = 229
|
|
OpStructFieldInt OpType = 230
|
|
OpStructFieldOmitEmptyInt OpType = 231
|
|
OpStructFieldStringTagInt OpType = 232
|
|
OpStructEndInt OpType = 233
|
|
OpStructEndOmitEmptyInt OpType = 234
|
|
OpStructEndStringTagInt OpType = 235
|
|
OpStructFieldUint OpType = 236
|
|
OpStructFieldOmitEmptyUint OpType = 237
|
|
OpStructFieldStringTagUint OpType = 238
|
|
OpStructEndUint OpType = 239
|
|
OpStructEndOmitEmptyUint OpType = 240
|
|
OpStructEndStringTagUint OpType = 241
|
|
OpStructFieldFloat32 OpType = 242
|
|
OpStructFieldOmitEmptyFloat32 OpType = 243
|
|
OpStructFieldStringTagFloat32 OpType = 244
|
|
OpStructEndFloat32 OpType = 245
|
|
OpStructEndOmitEmptyFloat32 OpType = 246
|
|
OpStructEndStringTagFloat32 OpType = 247
|
|
OpStructFieldFloat64 OpType = 248
|
|
OpStructFieldOmitEmptyFloat64 OpType = 249
|
|
OpStructFieldStringTagFloat64 OpType = 250
|
|
OpStructEndFloat64 OpType = 251
|
|
OpStructEndOmitEmptyFloat64 OpType = 252
|
|
OpStructEndStringTagFloat64 OpType = 253
|
|
OpStructFieldBool OpType = 254
|
|
OpStructFieldOmitEmptyBool OpType = 255
|
|
OpStructFieldStringTagBool OpType = 256
|
|
OpStructEndBool OpType = 257
|
|
OpStructEndOmitEmptyBool OpType = 258
|
|
OpStructEndStringTagBool OpType = 259
|
|
OpStructFieldString OpType = 260
|
|
OpStructFieldOmitEmptyString OpType = 261
|
|
OpStructFieldStringTagString OpType = 262
|
|
OpStructEndString OpType = 263
|
|
OpStructEndOmitEmptyString OpType = 264
|
|
OpStructEndStringTagString OpType = 265
|
|
OpStructFieldBytes OpType = 266
|
|
OpStructFieldOmitEmptyBytes OpType = 267
|
|
OpStructFieldStringTagBytes OpType = 268
|
|
OpStructEndBytes OpType = 269
|
|
OpStructEndOmitEmptyBytes OpType = 270
|
|
OpStructEndStringTagBytes OpType = 271
|
|
OpStructFieldNumber OpType = 272
|
|
OpStructFieldOmitEmptyNumber OpType = 273
|
|
OpStructFieldStringTagNumber OpType = 274
|
|
OpStructEndNumber OpType = 275
|
|
OpStructEndOmitEmptyNumber OpType = 276
|
|
OpStructEndStringTagNumber OpType = 277
|
|
OpStructFieldArray OpType = 278
|
|
OpStructFieldOmitEmptyArray OpType = 279
|
|
OpStructFieldStringTagArray OpType = 280
|
|
OpStructEndArray OpType = 281
|
|
OpStructEndOmitEmptyArray OpType = 282
|
|
OpStructEndStringTagArray OpType = 283
|
|
OpStructFieldMap OpType = 284
|
|
OpStructFieldOmitEmptyMap OpType = 285
|
|
OpStructFieldStringTagMap OpType = 286
|
|
OpStructEndMap OpType = 287
|
|
OpStructEndOmitEmptyMap OpType = 288
|
|
OpStructEndStringTagMap OpType = 289
|
|
OpStructFieldSlice OpType = 290
|
|
OpStructFieldOmitEmptySlice OpType = 291
|
|
OpStructFieldStringTagSlice OpType = 292
|
|
OpStructEndSlice OpType = 293
|
|
OpStructEndOmitEmptySlice OpType = 294
|
|
OpStructEndStringTagSlice OpType = 295
|
|
OpStructFieldStruct OpType = 296
|
|
OpStructFieldOmitEmptyStruct OpType = 297
|
|
OpStructFieldStringTagStruct OpType = 298
|
|
OpStructEndStruct OpType = 299
|
|
OpStructEndOmitEmptyStruct OpType = 300
|
|
OpStructEndStringTagStruct OpType = 301
|
|
OpStructFieldMarshalJSON OpType = 302
|
|
OpStructFieldOmitEmptyMarshalJSON OpType = 303
|
|
OpStructFieldStringTagMarshalJSON OpType = 304
|
|
OpStructEndMarshalJSON OpType = 305
|
|
OpStructEndOmitEmptyMarshalJSON OpType = 306
|
|
OpStructEndStringTagMarshalJSON OpType = 307
|
|
OpStructFieldMarshalText OpType = 308
|
|
OpStructFieldOmitEmptyMarshalText OpType = 309
|
|
OpStructFieldStringTagMarshalText OpType = 310
|
|
OpStructEndMarshalText OpType = 311
|
|
OpStructEndOmitEmptyMarshalText OpType = 312
|
|
OpStructEndStringTagMarshalText OpType = 313
|
|
OpStructFieldIntString OpType = 314
|
|
OpStructFieldOmitEmptyIntString OpType = 315
|
|
OpStructFieldStringTagIntString OpType = 316
|
|
OpStructEndIntString OpType = 317
|
|
OpStructEndOmitEmptyIntString OpType = 318
|
|
OpStructEndStringTagIntString OpType = 319
|
|
OpStructFieldUintString OpType = 320
|
|
OpStructFieldOmitEmptyUintString OpType = 321
|
|
OpStructFieldStringTagUintString OpType = 322
|
|
OpStructEndUintString OpType = 323
|
|
OpStructEndOmitEmptyUintString OpType = 324
|
|
OpStructEndStringTagUintString OpType = 325
|
|
OpStructFieldIntPtr OpType = 326
|
|
OpStructFieldOmitEmptyIntPtr OpType = 327
|
|
OpStructFieldStringTagIntPtr OpType = 328
|
|
OpStructEndIntPtr OpType = 329
|
|
OpStructEndOmitEmptyIntPtr OpType = 330
|
|
OpStructEndStringTagIntPtr OpType = 331
|
|
OpStructFieldUintPtr OpType = 332
|
|
OpStructFieldOmitEmptyUintPtr OpType = 333
|
|
OpStructFieldStringTagUintPtr OpType = 334
|
|
OpStructEndUintPtr OpType = 335
|
|
OpStructEndOmitEmptyUintPtr OpType = 336
|
|
OpStructEndStringTagUintPtr OpType = 337
|
|
OpStructFieldFloat32Ptr OpType = 338
|
|
OpStructFieldOmitEmptyFloat32Ptr OpType = 339
|
|
OpStructFieldStringTagFloat32Ptr OpType = 340
|
|
OpStructEndFloat32Ptr OpType = 341
|
|
OpStructEndOmitEmptyFloat32Ptr OpType = 342
|
|
OpStructEndStringTagFloat32Ptr OpType = 343
|
|
OpStructFieldFloat64Ptr OpType = 344
|
|
OpStructFieldOmitEmptyFloat64Ptr OpType = 345
|
|
OpStructFieldStringTagFloat64Ptr OpType = 346
|
|
OpStructEndFloat64Ptr OpType = 347
|
|
OpStructEndOmitEmptyFloat64Ptr OpType = 348
|
|
OpStructEndStringTagFloat64Ptr OpType = 349
|
|
OpStructFieldBoolPtr OpType = 350
|
|
OpStructFieldOmitEmptyBoolPtr OpType = 351
|
|
OpStructFieldStringTagBoolPtr OpType = 352
|
|
OpStructEndBoolPtr OpType = 353
|
|
OpStructEndOmitEmptyBoolPtr OpType = 354
|
|
OpStructEndStringTagBoolPtr OpType = 355
|
|
OpStructFieldStringPtr OpType = 356
|
|
OpStructFieldOmitEmptyStringPtr OpType = 357
|
|
OpStructFieldStringTagStringPtr OpType = 358
|
|
OpStructEndStringPtr OpType = 359
|
|
OpStructEndOmitEmptyStringPtr OpType = 360
|
|
OpStructEndStringTagStringPtr OpType = 361
|
|
OpStructFieldBytesPtr OpType = 362
|
|
OpStructFieldOmitEmptyBytesPtr OpType = 363
|
|
OpStructFieldStringTagBytesPtr OpType = 364
|
|
OpStructEndBytesPtr OpType = 365
|
|
OpStructEndOmitEmptyBytesPtr OpType = 366
|
|
OpStructEndStringTagBytesPtr OpType = 367
|
|
OpStructFieldNumberPtr OpType = 368
|
|
OpStructFieldOmitEmptyNumberPtr OpType = 369
|
|
OpStructFieldStringTagNumberPtr OpType = 370
|
|
OpStructEndNumberPtr OpType = 371
|
|
OpStructEndOmitEmptyNumberPtr OpType = 372
|
|
OpStructEndStringTagNumberPtr OpType = 373
|
|
OpStructFieldArrayPtr OpType = 374
|
|
OpStructFieldOmitEmptyArrayPtr OpType = 375
|
|
OpStructFieldStringTagArrayPtr OpType = 376
|
|
OpStructEndArrayPtr OpType = 377
|
|
OpStructEndOmitEmptyArrayPtr OpType = 378
|
|
OpStructEndStringTagArrayPtr OpType = 379
|
|
OpStructFieldMapPtr OpType = 380
|
|
OpStructFieldOmitEmptyMapPtr OpType = 381
|
|
OpStructFieldStringTagMapPtr OpType = 382
|
|
OpStructEndMapPtr OpType = 383
|
|
OpStructEndOmitEmptyMapPtr OpType = 384
|
|
OpStructEndStringTagMapPtr OpType = 385
|
|
OpStructFieldSlicePtr OpType = 386
|
|
OpStructFieldOmitEmptySlicePtr OpType = 387
|
|
OpStructFieldStringTagSlicePtr OpType = 388
|
|
OpStructEndSlicePtr OpType = 389
|
|
OpStructEndOmitEmptySlicePtr OpType = 390
|
|
OpStructEndStringTagSlicePtr OpType = 391
|
|
OpStructFieldMarshalJSONPtr OpType = 392
|
|
OpStructFieldOmitEmptyMarshalJSONPtr OpType = 393
|
|
OpStructFieldStringTagMarshalJSONPtr OpType = 394
|
|
OpStructEndMarshalJSONPtr OpType = 395
|
|
OpStructEndOmitEmptyMarshalJSONPtr OpType = 396
|
|
OpStructEndStringTagMarshalJSONPtr OpType = 397
|
|
OpStructFieldMarshalTextPtr OpType = 398
|
|
OpStructFieldOmitEmptyMarshalTextPtr OpType = 399
|
|
OpStructFieldStringTagMarshalTextPtr OpType = 400
|
|
OpStructEndMarshalTextPtr OpType = 401
|
|
OpStructEndOmitEmptyMarshalTextPtr OpType = 402
|
|
OpStructEndStringTagMarshalTextPtr OpType = 403
|
|
OpStructFieldInterfacePtr OpType = 404
|
|
OpStructFieldOmitEmptyInterfacePtr OpType = 405
|
|
OpStructFieldStringTagInterfacePtr OpType = 406
|
|
OpStructEndInterfacePtr OpType = 407
|
|
OpStructEndOmitEmptyInterfacePtr OpType = 408
|
|
OpStructEndStringTagInterfacePtr OpType = 409
|
|
OpStructField OpType = 410
|
|
OpStructFieldOmitEmpty OpType = 411
|
|
OpStructFieldStringTag OpType = 412
|
|
OpStructEnd OpType = 413
|
|
OpStructEndOmitEmpty OpType = 414
|
|
OpStructEndStringTag OpType = 415
|
|
)
|
|
|
|
func (t OpType) String() string {
|
|
if int(t) >= 416 {
|
|
return ""
|
|
}
|
|
return opTypeStrings[int(t)]
|
|
}
|
|
|
|
func (t OpType) CodeType() CodeType {
|
|
if strings.Contains(t.String(), "Struct") {
|
|
if strings.Contains(t.String(), "End") {
|
|
return CodeStructEnd
|
|
}
|
|
return CodeStructField
|
|
}
|
|
switch t {
|
|
case OpArray, OpArrayPtr:
|
|
return CodeArrayHead
|
|
case OpArrayElem:
|
|
return CodeArrayElem
|
|
case OpSlice, OpSlicePtr:
|
|
return CodeSliceHead
|
|
case OpSliceElem:
|
|
return CodeSliceElem
|
|
case OpMap, OpMapPtr:
|
|
return CodeMapHead
|
|
case OpMapKey:
|
|
return CodeMapKey
|
|
case OpMapValue:
|
|
return CodeMapValue
|
|
case OpMapEnd:
|
|
return CodeMapEnd
|
|
}
|
|
|
|
return CodeOp
|
|
}
|
|
|
|
func (t OpType) HeadToPtrHead() OpType {
|
|
if strings.Index(t.String(), "PtrHead") > 0 {
|
|
return t
|
|
}
|
|
|
|
idx := strings.Index(t.String(), "Head")
|
|
if idx == -1 {
|
|
return t
|
|
}
|
|
suffix := "PtrHead" + t.String()[idx+len("Head"):]
|
|
|
|
const toPtrOffset = 3
|
|
if strings.Contains(OpType(int(t)+toPtrOffset).String(), suffix) {
|
|
return OpType(int(t) + toPtrOffset)
|
|
}
|
|
return t
|
|
}
|
|
|
|
func (t OpType) HeadToOmitEmptyHead() OpType {
|
|
const toOmitEmptyOffset = 1
|
|
if strings.Contains(OpType(int(t)+toOmitEmptyOffset).String(), "OmitEmpty") {
|
|
return OpType(int(t) + toOmitEmptyOffset)
|
|
}
|
|
|
|
return t
|
|
}
|
|
|
|
func (t OpType) HeadToStringTagHead() OpType {
|
|
const toStringTagOffset = 2
|
|
if strings.Contains(OpType(int(t)+toStringTagOffset).String(), "StringTag") {
|
|
return OpType(int(t) + toStringTagOffset)
|
|
}
|
|
return t
|
|
}
|
|
|
|
func (t OpType) PtrHeadToHead() OpType {
|
|
idx := strings.Index(t.String(), "Ptr")
|
|
if idx == -1 {
|
|
return t
|
|
}
|
|
suffix := t.String()[idx+len("Ptr"):]
|
|
|
|
const toPtrOffset = 3
|
|
if strings.Contains(OpType(int(t)-toPtrOffset).String(), suffix) {
|
|
return OpType(int(t) - toPtrOffset)
|
|
}
|
|
return t
|
|
}
|
|
|
|
func (t OpType) FieldToEnd() OpType {
|
|
idx := strings.Index(t.String(), "Field")
|
|
if idx == -1 {
|
|
return t
|
|
}
|
|
suffix := t.String()[idx+len("Field"):]
|
|
if suffix == "" || suffix == "OmitEmpty" || suffix == "StringTag" {
|
|
return t
|
|
}
|
|
const toEndOffset = 3
|
|
if strings.Contains(OpType(int(t)+toEndOffset).String(), "End"+suffix) {
|
|
return OpType(int(t) + toEndOffset)
|
|
}
|
|
return t
|
|
}
|
|
|
|
func (t OpType) FieldToOmitEmptyField() OpType {
|
|
const toOmitEmptyOffset = 1
|
|
if strings.Contains(OpType(int(t)+toOmitEmptyOffset).String(), "OmitEmpty") {
|
|
return OpType(int(t) + toOmitEmptyOffset)
|
|
}
|
|
return t
|
|
}
|
|
|
|
func (t OpType) FieldToStringTagField() OpType {
|
|
const toStringTagOffset = 2
|
|
if strings.Contains(OpType(int(t)+toStringTagOffset).String(), "StringTag") {
|
|
return OpType(int(t) + toStringTagOffset)
|
|
}
|
|
return t
|
|
}
|