forked from mirror/go-json
Add type infromation to the debug information
This commit is contained in:
parent
44bc17ce8c
commit
5093e5bd78
internal/encoder
|
@ -65,6 +65,7 @@ func compileToGetCodeSetSlowPath(typeptr uintptr) (*OpcodeSet, error) {
|
||||||
code = copyOpcode(code)
|
code = copyOpcode(code)
|
||||||
codeLength := code.TotalLength()
|
codeLength := code.TotalLength()
|
||||||
codeSet := &OpcodeSet{
|
codeSet := &OpcodeSet{
|
||||||
|
Type: copiedType,
|
||||||
Code: code,
|
Code: code,
|
||||||
CodeLength: codeLength,
|
CodeLength: codeLength,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) {
|
||||||
code = copyOpcode(code)
|
code = copyOpcode(code)
|
||||||
codeLength := code.TotalLength()
|
codeLength := code.TotalLength()
|
||||||
codeSet := &OpcodeSet{
|
codeSet := &OpcodeSet{
|
||||||
|
Type: copiedType,
|
||||||
Code: code,
|
Code: code,
|
||||||
CodeLength: codeLength,
|
CodeLength: codeLength,
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) {
|
||||||
code = copyOpcode(code)
|
code = copyOpcode(code)
|
||||||
codeLength := code.TotalLength()
|
codeLength := code.TotalLength()
|
||||||
codeSet := &OpcodeSet{
|
codeSet := &OpcodeSet{
|
||||||
|
Type: copiedType,
|
||||||
Code: code,
|
Code: code,
|
||||||
CodeLength: codeLength,
|
CodeLength: codeLength,
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ func (t OpType) IsMultipleOpField() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type OpcodeSet struct {
|
type OpcodeSet struct {
|
||||||
|
Type *runtime.Type
|
||||||
Code *Opcode
|
Code *Opcode
|
||||||
CodeLength int
|
CodeLength int
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
fmt.Println("=============[DEBUG]===============")
|
fmt.Println("=============[DEBUG]===============")
|
||||||
|
fmt.Println("* [TYPE]")
|
||||||
|
fmt.Println(codeSet.Type)
|
||||||
|
fmt.Printf("\n")
|
||||||
fmt.Println("* [ALL OPCODE]")
|
fmt.Println("* [ALL OPCODE]")
|
||||||
fmt.Println(codeSet.Code.Dump())
|
fmt.Println(codeSet.Code.Dump())
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
|
|
Loading…
Reference in New Issue