operator-builtin.go: builtin "" output the list of builtin module names

This commit is contained in:
2026-08-02 17:06:57 +02:00
parent 5cd48bdc50
commit c31025c8cd
+12 -1
View File
@@ -10,6 +10,7 @@ import (
"git.portale-stac.it/go-pkg/expr/kern"
"git.portale-stac.it/go-pkg/expr/scan"
"git.portale-stac.it/go-pkg/expr/sym"
"git.portale-stac.it/go-pkg/expr/types/list"
"git.portale-stac.it/go-pkg/expr/types/str"
)
@@ -35,7 +36,17 @@ func evalBuiltin(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
count := 0
if str.IsString(childValue) {
module, _ := childValue.(string)
count, err = ImportInContextByGlobPattern(ctx, module)
if module == "" {
ll := list.NewLinkedList()
IterateBuiltinModules(func(name, description string, imported bool) bool {
ll.PushBack(name)
return true
})
v = ll
return
} else {
count, err = ImportInContextByGlobPattern(ctx, module)
}
} else {
var moduleSpec any
var it kern.Iterator