mirror of https://github.com/goccy/go-json.git
Reduce code size of encode_optype.go
This commit is contained in:
parent
5209a753d2
commit
3989252ca9
|
@ -99,6 +99,12 @@ const (
|
|||
{{- end }}
|
||||
)
|
||||
|
||||
var opTypeStrings = [{{ .OpLen }}]string{
|
||||
{{- range $type := .OpTypes }}
|
||||
"{{ $type.Op }}",
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
type opType int
|
||||
|
||||
const (
|
||||
|
@ -108,13 +114,10 @@ const (
|
|||
)
|
||||
|
||||
func (t opType) String() string {
|
||||
switch t {
|
||||
{{- range $type := .OpTypes }}
|
||||
case op{{ $type.Op }}:
|
||||
return "{{ $type.Op }}"
|
||||
{{- end }}
|
||||
if int(t) >= {{ .OpLen }} {
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
return opTypeStrings[int(t)]
|
||||
}
|
||||
|
||||
func (t opType) codeType() codeType {
|
||||
|
|
8321
encode_optype.go
8321
encode_optype.go
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue