compiler: allow init statement in if

This commit is contained in:
Evgenii Stratonikov 2020-08-21 11:41:10 +03:00
parent d73f3cd24c
commit 84c36326f5
2 changed files with 33 additions and 0 deletions

View file

@ -565,6 +565,9 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
lElse := c.newLabel()
lElseEnd := c.newLabel()
if n.Init != nil {
ast.Walk(c, n.Init)
}
if n.Cond != nil {
c.emitBoolExpr(n.Cond, true, false, lElse)
}