diff --git a/internal/encoder/code.go b/internal/encoder/code.go index 1c079cf..9dbeca2 100644 --- a/internal/encoder/code.go +++ b/internal/encoder/code.go @@ -732,6 +732,9 @@ func (c *InterfaceCode) ToOpcode(ctx *compileContext) Opcodes { default: code = newOpCode(ctx.withType(c.typ), OpInterface) } + if c.typ.NumMethod() > 0 { + code.Flags |= NonEmptyInterfaceFlags + } ctx.incIndex() return Opcodes{code} } diff --git a/internal/encoder/opcode.go b/internal/encoder/opcode.go index 309cfe6..5b16f00 100644 --- a/internal/encoder/opcode.go +++ b/internal/encoder/opcode.go @@ -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 { return &Opcode{ Op: OpRecursive,