Implemented struct parser
This commit is contained in:
@ -6,13 +6,15 @@ import (
|
||||
"git.akyoto.dev/cli/q/src/core"
|
||||
"git.akyoto.dev/cli/q/src/errors"
|
||||
"git.akyoto.dev/cli/q/src/fs"
|
||||
"git.akyoto.dev/cli/q/src/types"
|
||||
)
|
||||
|
||||
// Compile waits for the scan to finish and compiles all functions.
|
||||
func Compile(files <-chan *fs.File, functions <-chan *core.Function, 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{}
|
||||
|
||||
for functions != nil || files != nil || errs != nil {
|
||||
select {
|
||||
@ -25,6 +27,14 @@ func Compile(files <-chan *fs.File, functions <-chan *core.Function, errs <-chan
|
||||
function.Functions = allFunctions
|
||||
allFunctions[function.UniqueName] = function
|
||||
|
||||
case typ, ok := <-structs:
|
||||
if !ok {
|
||||
structs = nil
|
||||
continue
|
||||
}
|
||||
|
||||
allTypes[typ.Name] = typ
|
||||
|
||||
case file, ok := <-files:
|
||||
if !ok {
|
||||
files = nil
|
||||
|
Reference in New Issue
Block a user