Improved separation of concerns

This commit is contained in:
Eduard Urbach 2024-07-23 16:41:21 +02:00
parent dc5456b820
commit abba962455
Signed by: eduard
GPG key ID: 49226B848C78F6C8
36 changed files with 243 additions and 236 deletions

View file

@ -7,6 +7,7 @@ import (
"git.akyoto.dev/cli/q/src/build/fs"
"git.akyoto.dev/cli/q/src/build/scope"
"git.akyoto.dev/cli/q/src/build/token"
"git.akyoto.dev/cli/q/src/build/z"
)
// NewFunction creates a new function.
@ -15,19 +16,20 @@ func NewFunction(name string, file *fs.File, body []token.Token) *Function {
Name: name,
File: file,
Body: body,
Assembler: asm.Assembler{
Instructions: make([]asm.Instruction, 0, 8),
Compiler: z.Compiler{
Assembler: asm.Assembler{
Instructions: make([]asm.Instruction, 0, 8),
},
Stack: scope.Stack{
Scopes: []*scope.Scope{{}},
},
CPU: cpu.CPU{
All: x64.AllRegisters,
Input: x64.CallRegisters,
General: x64.GeneralRegisters,
Syscall: x64.SyscallRegisters,
Output: x64.ReturnValueRegisters,
},
},
Stack: scope.Stack{
Scopes: []*scope.Scope{{}},
},
cpu: cpu.CPU{
All: x64.AllRegisters,
Input: x64.CallRegisters,
General: x64.GeneralRegisters,
Syscall: x64.SyscallRegisters,
Output: x64.ReturnValueRegisters,
},
finished: make(chan struct{}),
}
}