forked from mirror/go-json
refactor
This commit is contained in:
parent
0472aebe51
commit
67cb2b9a75
|
@ -732,6 +732,9 @@ func (c *InterfaceCode) ToOpcode(ctx *compileContext) Opcodes {
|
||||||
default:
|
default:
|
||||||
code = newOpCode(ctx.withType(c.typ), OpInterface)
|
code = newOpCode(ctx.withType(c.typ), OpInterface)
|
||||||
}
|
}
|
||||||
|
if c.typ.NumMethod() > 0 {
|
||||||
|
code.Flags |= NonEmptyInterfaceFlags
|
||||||
|
}
|
||||||
ctx.incIndex()
|
ctx.incIndex()
|
||||||
return Opcodes{code}
|
return Opcodes{code}
|
||||||
}
|
}
|
||||||
|
|
|
@ -697,22 +697,6 @@ func newMapEndCode(ctx *compileContext, head *Opcode) *Opcode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newInterfaceCode(ctx *compileContext) *Opcode {
|
|
||||||
var flag OpFlags
|
|
||||||
if ctx.typ.NumMethod() > 0 {
|
|
||||||
flag |= NonEmptyInterfaceFlags
|
|
||||||
}
|
|
||||||
return &Opcode{
|
|
||||||
Op: OpInterface,
|
|
||||||
Idx: opcodeOffset(ctx.ptrIndex),
|
|
||||||
Next: newEndOp(ctx),
|
|
||||||
Type: ctx.typ,
|
|
||||||
DisplayIdx: ctx.opcodeIndex,
|
|
||||||
Indent: ctx.indent,
|
|
||||||
Flags: flag,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func newRecursiveCode(ctx *compileContext, jmp *CompiledCode) *Opcode {
|
func newRecursiveCode(ctx *compileContext, jmp *CompiledCode) *Opcode {
|
||||||
return &Opcode{
|
return &Opcode{
|
||||||
Op: OpRecursive,
|
Op: OpRecursive,
|
||||||
|
|
Loading…
Reference in New Issue