completed list-type to array-type conversion and fixed common test module

This commit is contained in:
2026-07-13 10:42:17 +02:00
parent 77f36642b4
commit 072fd9af39
39 changed files with 160 additions and 318 deletions
+9 -3
View File
@@ -61,8 +61,8 @@ func isRationalFunc(ctx kern.ExprContext, name string, args map[string]any) (res
return
}
func isListFunc(ctx kern.ExprContext, name string, args map[string]any) (result any, err error) {
result = array.IsList(args[kern.ParamValue])
func isArrayFunc(ctx kern.ExprContext, name string, args map[string]any) (result any, err error) {
result = array.IsArray(args[kern.ParamValue])
return
}
@@ -71,6 +71,11 @@ func isDictionaryFunc(ctx kern.ExprContext, name string, args map[string]any) (r
return
}
func isListFunc(ctx kern.ExprContext, name string, args map[string]any) (result any, err error) {
result = list.IsLinkedList(args[kern.ParamValue])
return
}
func boolFunc(ctx kern.ExprContext, name string, args map[string]any) (result any, err error) {
switch v := args[kern.ParamValue].(type) {
case int64:
@@ -307,8 +312,9 @@ func ImportBuiltinsFuncs(ctx kern.ExprContext) {
ctx.RegisterFunc("isString", kern.NewGolangFunctor(isStringFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("isFract", kern.NewGolangFunctor(isFractionFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("isRational", kern.NewGolangFunctor(isRationalFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("isList", kern.NewGolangFunctor(isListFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("isArray", kern.NewGolangFunctor(isArrayFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("isDict", kern.NewGolangFunctor(isDictionaryFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("isList", kern.NewGolangFunctor(isListFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("bool", kern.NewGolangFunctor(boolFunc), kern.TypeBoolean, anyParams)
ctx.RegisterFunc("int", kern.NewGolangFunctor(intFunc), kern.TypeInt, anyParams)