mirror of https://github.com/goccy/go-json.git
Merge pull request #302 from goccy/feature/refactor-vm
Refactor vm code for encoder
This commit is contained in:
commit
8ac142ed32
File diff suppressed because it is too large
Load Diff
|
@ -126,6 +126,10 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
return append(b, ',')
|
return append(b, ',')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
|
return append(b, "null,"...)
|
||||||
|
}
|
||||||
|
|
||||||
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
last := len(b) - 1
|
last := len(b) - 1
|
||||||
b[last] = ':'
|
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, ',')
|
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 {
|
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
last := len(b) - 1
|
last := len(b) - 1
|
||||||
b[last] = ':'
|
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')
|
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 {
|
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
return append(b, ':', ' ')
|
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')
|
return append(b, ',', '\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
|
return append(b, "null,\n"...)
|
||||||
|
}
|
||||||
|
|
||||||
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
|
||||||
return append(b, ':', ' ')
|
return append(b, ':', ' ')
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue