mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 08:56:07 +00:00
add anymap to allow map with __call__ in thread
This commit is contained in:
@@ -11,9 +11,12 @@ func ArThread(args ...any) (any, ArErr) {
|
|||||||
}
|
}
|
||||||
var tocall any
|
var tocall any
|
||||||
switch x := args[0].(type) {
|
switch x := args[0].(type) {
|
||||||
case Callable:
|
case anymap:
|
||||||
tocall = x
|
if _, ok := x["__call__"]; !ok {
|
||||||
case builtinFunc:
|
return nil, ArErr{TYPE: "TypeError", message: "Cannot call thread with a '" + typeof(args[0]) + "'", EXISTS: true}
|
||||||
|
}
|
||||||
|
tocall = x["__call__"]
|
||||||
|
case builtinFunc, Callable:
|
||||||
tocall = x
|
tocall = x
|
||||||
default:
|
default:
|
||||||
return nil, ArErr{TYPE: "TypeError", message: "Cannot call thread with a '" + typeof(args[0]) + "'", EXISTS: true}
|
return nil, ArErr{TYPE: "TypeError", message: "Cannot call thread with a '" + typeof(args[0]) + "'", EXISTS: true}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ func typeof(val any) string {
|
|||||||
return "string"
|
return "string"
|
||||||
case []any:
|
case []any:
|
||||||
return "array"
|
return "array"
|
||||||
|
case anymap:
|
||||||
|
return "map"
|
||||||
case Callable:
|
case Callable:
|
||||||
return "function"
|
return "function"
|
||||||
case builtinFunc:
|
case builtinFunc:
|
||||||
|
|||||||
Reference in New Issue
Block a user