Cleaned up function type
This commit is contained in:
parent
f870a5f1f8
commit
67b3a3d820
14 changed files with 310 additions and 294 deletions
|
@ -237,18 +237,20 @@ func scanFile(path string, functions chan<- *Function) error {
|
|||
}
|
||||
|
||||
function := &Function{
|
||||
Name: tokens[nameStart].Text(),
|
||||
File: file,
|
||||
Body: tokens[bodyStart:i],
|
||||
Variables: map[string]*Variable{},
|
||||
CPU: cpu.CPU{
|
||||
Call: x64.CallRegisters,
|
||||
General: x64.GeneralRegisters,
|
||||
Syscall: x64.SyscallRegisters,
|
||||
Return: x64.ReturnValueRegisters,
|
||||
},
|
||||
Assembler: asm.Assembler{
|
||||
Instructions: make([]asm.Instruction, 0, 32),
|
||||
Name: tokens[nameStart].Text(),
|
||||
File: file,
|
||||
Body: tokens[bodyStart:i],
|
||||
compiler: compiler{
|
||||
assembler: asm.Assembler{
|
||||
Instructions: make([]asm.Instruction, 0, 32),
|
||||
},
|
||||
cpu: cpu.CPU{
|
||||
Call: x64.CallRegisters,
|
||||
General: x64.GeneralRegisters,
|
||||
Syscall: x64.SyscallRegisters,
|
||||
Return: x64.ReturnValueRegisters,
|
||||
},
|
||||
variables: map[string]*Variable{},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -257,7 +259,7 @@ func scanFile(path string, functions chan<- *Function) error {
|
|||
err := expression.EachParameter(parameters, func(tokens token.List) error {
|
||||
if len(tokens) == 1 {
|
||||
name := tokens[0].Text()
|
||||
register := x64.CallRegisters[len(function.Variables)]
|
||||
register := x64.CallRegisters[len(function.variables)]
|
||||
variable := &Variable{Name: name, Register: register}
|
||||
function.addVariable(variable)
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue