Implemented variable scopes
This commit is contained in:
parent
96078f40d8
commit
1bf288b8fd
13 changed files with 81 additions and 26 deletions
|
@ -16,8 +16,11 @@ func (f *Function) CompileIf(branch *ast.If) error {
|
|||
return err
|
||||
}
|
||||
|
||||
f.AddLabel(success)
|
||||
defer f.AddLabel(fail)
|
||||
f.count.branch++
|
||||
return f.CompileAST(branch.Body)
|
||||
f.AddLabel(success)
|
||||
f.pushScope()
|
||||
err = f.CompileAST(branch.Body)
|
||||
f.popScope()
|
||||
f.AddLabel(fail)
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue