mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 15:42:54 +00:00
compiler: do not load values which will be dropped
This commit is contained in:
parent
72be5412f4
commit
1847c28b42
1 changed files with 2 additions and 2 deletions
|
@ -924,7 +924,7 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
emit.Opcode(c.prog.BinWriter, opcode.OVER)
|
||||
emit.Jmp(c.prog.BinWriter, opcode.JMPLEL, end)
|
||||
|
||||
if n.Key != nil {
|
||||
if n.Key != nil && n.Key.(*ast.Ident).Name != "_" {
|
||||
if isMap {
|
||||
c.rangeLoadKey()
|
||||
} else {
|
||||
|
@ -932,7 +932,7 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
}
|
||||
c.emitStoreVar(n.Key.(*ast.Ident).Name)
|
||||
}
|
||||
if n.Value != nil {
|
||||
if n.Value != nil && n.Value.(*ast.Ident).Name != "_" {
|
||||
c.rangeLoadKey()
|
||||
if isMap {
|
||||
// we have loaded only key from key array, now load value
|
||||
|
|
Loading…
Reference in a new issue