Implemented structs

This commit is contained in:
2025-02-04 18:16:31 +01:00
parent 4609a814df
commit 03a3bd8f02
32 changed files with 267 additions and 63 deletions

View File

@ -10,11 +10,11 @@ import (
)
// Compile waits for the scan to finish and compiles all functions.
func Compile(files <-chan *fs.File, functions <-chan *core.Function, structs <-chan *types.Type, errs <-chan error) (Result, error) {
func Compile(files <-chan *fs.File, functions <-chan *core.Function, structs <-chan types.Type, errs <-chan error) (Result, error) {
result := Result{}
allFiles := make([]*fs.File, 0, 8)
allFunctions := map[string]*core.Function{}
allTypes := map[string]*types.Type{}
allTypes := map[string]types.Type{}
for functions != nil || files != nil || errs != nil {
select {
@ -25,6 +25,7 @@ func Compile(files <-chan *fs.File, functions <-chan *core.Function, structs <-c
}
function.Functions = allFunctions
function.Types = allTypes
allFunctions[function.UniqueName] = function
case typ, ok := <-structs:
@ -33,7 +34,7 @@ func Compile(files <-chan *fs.File, functions <-chan *core.Function, structs <-c
continue
}
allTypes[typ.Name] = typ
allTypes[typ.UniqueName()] = typ
case file, ok := <-files:
if !ok {