ExprContext.SetVar() no longer requires the explicit specification of the type of number
This commit is contained in:
@@ -73,6 +73,8 @@ func anyInteger(v any) (i int64, ok bool) {
|
||||
i = int64(intval)
|
||||
case uint16:
|
||||
i = int64(intval)
|
||||
case uint64:
|
||||
i = int64(intval)
|
||||
case uint32:
|
||||
i = int64(intval)
|
||||
case int8:
|
||||
@@ -89,6 +91,22 @@ func anyInteger(v any) (i int64, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func fromGenericAny(v any) (exprAny any, ok bool) {
|
||||
if exprAny, ok = v.(bool); ok {
|
||||
return
|
||||
}
|
||||
if exprAny, ok = v.(string); ok {
|
||||
return
|
||||
}
|
||||
if exprAny, ok = anyInteger(v); ok {
|
||||
return
|
||||
}
|
||||
if exprAny, ok = anyFloat(v); ok {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func anyFloat(v any) (float float64, ok bool) {
|
||||
ok = true
|
||||
switch floatval := v.(type) {
|
||||
|
||||
Reference in New Issue
Block a user