mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: do not allocate slotes for unused "_" vars
This commit is contained in:
parent
0b44a43043
commit
18369c489e
3 changed files with 29 additions and 7 deletions
|
@ -434,13 +434,15 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
switch t := spec.(type) {
|
||||
case *ast.ValueSpec:
|
||||
for _, id := range t.Names {
|
||||
if c.scope == nil {
|
||||
// it is a global declaration
|
||||
c.newGlobal("", id.Name)
|
||||
} else {
|
||||
c.scope.newLocal(id.Name)
|
||||
if id.Name != "_" {
|
||||
if c.scope == nil {
|
||||
// it is a global declaration
|
||||
c.newGlobal("", id.Name)
|
||||
} else {
|
||||
c.scope.newLocal(id.Name)
|
||||
}
|
||||
c.registerDebugVariable(id.Name, t.Type)
|
||||
}
|
||||
c.registerDebugVariable(id.Name, t.Type)
|
||||
}
|
||||
for i := range t.Names {
|
||||
if len(t.Values) != 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue