Added scope package
This commit is contained in:
parent
fd66296826
commit
8e725da9c6
37 changed files with 416 additions and 371 deletions
|
@ -47,7 +47,7 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
|||
|
||||
// Push
|
||||
for _, register := range f.cpu.General {
|
||||
if f.Scope().IsUsed(register) {
|
||||
if f.CurrentScope().IsUsed(register) {
|
||||
f.Register(asm.PUSH, register)
|
||||
}
|
||||
}
|
||||
|
@ -64,14 +64,14 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
|||
continue
|
||||
}
|
||||
|
||||
f.Scope().Free(register)
|
||||
f.CurrentScope().Free(register)
|
||||
}
|
||||
|
||||
// Pop
|
||||
for i := len(f.cpu.General) - 1; i >= 0; i-- {
|
||||
register := f.cpu.General[i]
|
||||
|
||||
if f.Scope().IsUsed(register) {
|
||||
if f.CurrentScope().IsUsed(register) {
|
||||
f.Register(asm.POP, register)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue