forked from TrueCloudLab/neoneo-go
compiler: load nil
directly on inline
This commit is contained in:
parent
3484025065
commit
57a0377c81
2 changed files with 7 additions and 0 deletions
|
@ -230,6 +230,9 @@ func (c *codegen) emitLoadVar(pkg string, name string) {
|
|||
if vi.tv.Value != nil {
|
||||
c.emitLoadConst(vi.tv)
|
||||
return
|
||||
} else if vi.index == unspecifiedVarIndex {
|
||||
emit.Opcodes(c.prog.BinWriter, opcode.PUSHNULL)
|
||||
return
|
||||
}
|
||||
c.emitLoadByIndex(vi.refType, vi.index)
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ func (c *codegen) inlineCall(f *funcScope, n *ast.CallExpr) {
|
|||
c.scope.vars.locals = newScope
|
||||
c.scope.vars.addAlias(name, vi.refType, vi.index, vi.tv)
|
||||
continue
|
||||
} else if arg.Name == "nil" {
|
||||
c.scope.vars.locals = newScope
|
||||
c.scope.vars.addAlias(name, varLocal, unspecifiedVarIndex, types.TypeAndValue{})
|
||||
continue
|
||||
}
|
||||
}
|
||||
ast.Walk(c, n.Args[i])
|
||||
|
|
Loading…
Reference in a new issue