From afd8f3b87a9d176b5f40680493c965bb66f8bc33 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 17 Jun 2020 11:21:37 +0300 Subject: [PATCH] compiler: push Null item for `nil` values --- pkg/compiler/codegen.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/compiler/codegen.go b/pkg/compiler/codegen.go index 9055abd16..27cfeca14 100644 --- a/pkg/compiler/codegen.go +++ b/pkg/compiler/codegen.go @@ -586,6 +586,8 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { case *ast.Ident: if tv := c.typeAndValueOf(n); tv.Value != nil { c.emitLoadConst(tv) + } else if n.Name == "nil" { + emit.Opcode(c.prog.BinWriter, opcode.PUSHNULL) } else { c.emitLoadVar(n.Name) }