compiler: implement shadowing of global variables
Before introducing slots it was hard to change global variables preserving changes across multiple function calls. This commit implements such possibility. Closes #638.
This commit is contained in:
parent
0cb6dc47e4
commit
e21015233b
2 changed files with 24 additions and 0 deletions
|
@ -410,6 +410,9 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
if !multiRet {
|
||||
c.registerDebugVariable(t.Name, n.Rhs[i])
|
||||
}
|
||||
if t.Name != "_" {
|
||||
c.scope.newLocal(t.Name)
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
if i == 0 || !multiRet {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue