Separated compiler into its own package
This commit is contained in:
parent
38043ca12a
commit
61dc691c65
14 changed files with 199 additions and 167 deletions
|
@ -15,7 +15,7 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
|||
isSyscall := funcName == "syscall"
|
||||
|
||||
if !isSyscall {
|
||||
_, exists := f.functions[funcName]
|
||||
_, exists := f.Functions[funcName]
|
||||
|
||||
if !exists {
|
||||
return errors.New(&errors.UnknownFunction{Name: funcName}, f.File, root.Children[0].Token.Position)
|
||||
|
@ -52,6 +52,10 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
|||
}
|
||||
|
||||
for _, register := range registers {
|
||||
if register == f.cpu.Output[0] && root.Parent != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
f.Scope().Free(register)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue