Reorganized file structure

This commit is contained in:
2024-06-10 15:51:39 +02:00
parent c7354b8613
commit 6fe30f31da
57 changed files with 431 additions and 614 deletions

View File

@ -1,40 +0,0 @@
package compiler
import "sync"
// Compile compiles all the functions.
func Compile(directory string) (map[string]*Function, error) {
functions, errors := Scan(directory)
wg := sync.WaitGroup{}
allFunctions := map[string]*Function{}
for functions != nil || errors != nil {
select {
case err, ok := <-errors:
if !ok {
errors = nil
continue
}
return nil, err
case function, ok := <-functions:
if !ok {
functions = nil
continue
}
wg.Add(1)
go func() {
defer wg.Done()
function.Compile()
}()
allFunctions[function.Name] = function
}
}
wg.Wait()
return allFunctions, nil
}