compiler: support shadowing via Block statements
This commit is contained in:
parent
40bacc6775
commit
26cfae7c9a
2 changed files with 11 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue