mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-05 11:21:58 -05:00
3ff6ee6add
Struct type definition is now inlined into the chunk. To break cycles we use back references. - Removes unresolved type refs - Removes packages Fixes #1164 Fixes #1165
29 lines
606 B
Go
29 lines
606 B
Go
package pkg
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/attic-labs/noms/d"
|
|
"github.com/attic-labs/noms/types"
|
|
)
|
|
|
|
func resolveImports(aliases map[string]string, includePath string) (imports map[string][]*types.Type) {
|
|
canonicalize := func(path string) string {
|
|
if filepath.IsAbs(path) {
|
|
return path
|
|
}
|
|
return filepath.Join(includePath, path)
|
|
}
|
|
|
|
for alias, target := range aliases {
|
|
canonical := canonicalize(target)
|
|
inFile, err := os.Open(canonical)
|
|
d.Chk.NoError(err)
|
|
defer inFile.Close()
|
|
ts := ParseNomDL(alias, inFile, filepath.Dir(canonical))
|
|
imports[alias] = ts
|
|
}
|
|
return
|
|
}
|