compiler: support shadowing via Block statements

This commit is contained in:
Evgenii Stratonikov 2020-06-29 16:59:13 +03:00
parent 40bacc6775
commit 26cfae7c9a
2 changed files with 11 additions and 0 deletions

View file

@ -890,6 +890,16 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
return nil
case *ast.BlockStmt:
c.scope.vars.newScope()
defer c.scope.vars.dropScope()
for i := range n.List {
ast.Walk(c, n.List[i])
}
return nil
case *ast.ForStmt:
c.scope.vars.newScope()
defer c.scope.vars.dropScope()