From 48b67e9378f974c04e57c2d1e9eba86ffde57f27 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Thu, 25 Nov 2021 21:46:51 +0900 Subject: [PATCH] fix color test --- internal/encoder/code.go | 6 ++++-- internal/encoder/opcode.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/encoder/code.go b/internal/encoder/code.go index a3918e5..80d36f9 100644 --- a/internal/encoder/code.go +++ b/internal/encoder/code.go @@ -413,6 +413,8 @@ func (c *StructCode) ToOpcode(ctx *compileContext) Opcodes { Type: c.typ, DisplayIdx: ctx.opcodeIndex, Indent: ctx.indent, + Next: end, + End: end, } codes = append(codes, head, end) end.PrevField = head @@ -750,9 +752,9 @@ func (c *InterfaceCode) ToOpcode(ctx *compileContext) Opcodes { var code *Opcode switch { case c.isPtr: - code = newOpCode(ctx, OpInterfacePtr) + code = newOpCode(ctx.withType(c.typ), OpInterfacePtr) default: - code = newOpCode(ctx, OpInterface) + code = newOpCode(ctx.withType(c.typ), OpInterface) } ctx.incIndex() return Opcodes{code} diff --git a/internal/encoder/opcode.go b/internal/encoder/opcode.go index 642cf6a..5c87f69 100644 --- a/internal/encoder/opcode.go +++ b/internal/encoder/opcode.go @@ -81,7 +81,7 @@ func (c *Opcode) IterNext() *Opcode { func (c *Opcode) IsEnd() bool { if c == nil { - return false + return true } return c.Op == OpEnd || c.Op == OpInterfaceEnd || c.Op == OpRecursiveEnd }