mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-29 09:27:36 +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.Opcode(c.prog.BinWriter, opcode.OVER)
|
||||||
emit.Jmp(c.prog.BinWriter, opcode.JMPLEL, end)
|
emit.Jmp(c.prog.BinWriter, opcode.JMPLEL, end)
|
||||||
|
|
||||||
if n.Key != nil {
|
if n.Key != nil && n.Key.(*ast.Ident).Name != "_" {
|
||||||
if isMap {
|
if isMap {
|
||||||
c.rangeLoadKey()
|
c.rangeLoadKey()
|
||||||
} else {
|
} else {
|
||||||
|
@ -932,7 +932,7 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
||||||
}
|
}
|
||||||
c.emitStoreVar(n.Key.(*ast.Ident).Name)
|
c.emitStoreVar(n.Key.(*ast.Ident).Name)
|
||||||
}
|
}
|
||||||
if n.Value != nil {
|
if n.Value != nil && n.Value.(*ast.Ident).Name != "_" {
|
||||||
c.rangeLoadKey()
|
c.rangeLoadKey()
|
||||||
if isMap {
|
if isMap {
|
||||||
// we have loaded only key from key array, now load value
|
// we have loaded only key from key array, now load value
|
||||||
|
|
Loading…
Reference in a new issue