mirror of https://github.com/goccy/go-json.git
Refactor encoder's vm
This commit is contained in:
parent
fa6c96f02c
commit
f6b4e43f6a
File diff suppressed because it is too large
Load Diff
|
@ -126,6 +126,10 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
|||
return append(b, ',')
|
||||
}
|
||||
|
||||
func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||
return append(b, "null,"...)
|
||||
}
|
||||
|
||||
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||
last := len(b) - 1
|
||||
b[last] = ':'
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -178,6 +178,13 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
|||
return append(b, ',')
|
||||
}
|
||||
|
||||
func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte {
|
||||
format := ctx.Option.ColorScheme.Null
|
||||
b = append(b, format.Header...)
|
||||
b = append(b, "null"...)
|
||||
return append(append(b, format.Footer...), ',')
|
||||
}
|
||||
|
||||
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||
last := len(b) - 1
|
||||
b[last] = ':'
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -181,6 +181,13 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
|||
return append(b, ',', '\n')
|
||||
}
|
||||
|
||||
func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte {
|
||||
format := ctx.Option.ColorScheme.Null
|
||||
b = append(b, format.Header...)
|
||||
b = append(b, "null"...)
|
||||
return append(append(b, format.Footer...), ',', '\n')
|
||||
}
|
||||
|
||||
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||
return append(b, ':', ' ')
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -128,6 +128,10 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
|||
return append(b, ',', '\n')
|
||||
}
|
||||
|
||||
func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||
return append(b, "null,\n"...)
|
||||
}
|
||||
|
||||
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||
return append(b, ':', ' ')
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue