Added core tests
All checks were successful
/ test (push) Successful in 14s

This commit is contained in:
Eduard Urbach 2025-06-20 15:52:13 +02:00
parent fe3212506d
commit ed6ae1d306
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
4 changed files with 37 additions and 32 deletions

View file

@ -9,18 +9,20 @@ import (
// Function is the smallest unit of code.
type Function struct {
name string
file *fs.File
Input []*Parameter
Output []*Parameter
Body token.List
Name string
UniqueName string
File *fs.File
Input []*Parameter
Output []*Parameter
Body token.List
}
// NewFunction creates a new function.
func NewFunction(name string, file *fs.File) *Function {
return &Function{
name: name,
file: file,
Name: name,
File: file,
UniqueName: fmt.Sprintf("%s.%s", file.Package, name),
}
}
@ -29,16 +31,7 @@ func (f *Function) IsExtern() bool {
return f.Body == nil
}
// ResolveTypes parses the input and output types.
func (f *Function) ResolveTypes() error {
for _, param := range f.Input {
param.name = param.tokens[0].String(f.file.Bytes)
}
return nil
}
// String returns the package and function name.
// String returns the unique name.
func (f *Function) String() string {
return fmt.Sprintf("%s.%s", f.file.Package, f.name)
return f.UniqueName
}