Added assembler merging

This commit is contained in:
Eduard Urbach 2023-10-31 14:50:53 +01:00
parent 92b7c22c61
commit 8549aedc60
Signed by: eduard
GPG key ID: 49226B848C78F6C8
6 changed files with 122 additions and 63 deletions

40
src/build/Compile.go Normal file
View file

@ -0,0 +1,40 @@
package build
import "sync"
// Compile compiles all the functions.
func (build *Build) Compile() (map[string]*Function, error) {
functions, errors := Scan(build.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
}