static int
arg_float_or_nr(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_FLOAT
- || type->tt_type == VAR_NUMBER)
+ if (type->tt_type == VAR_FLOAT
+ || type->tt_type == VAR_NUMBER
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_number, type, context->arg_idx + 1);
return FAIL;
static int
arg_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_LIST
- || type->tt_type == VAR_BLOB)
+ if (type->tt_type == VAR_LIST
+ || type->tt_type == VAR_BLOB
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
static int
arg_string_or_nr(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
- || type->tt_type == VAR_NUMBER)
+ if (type->tt_type == VAR_STRING
+ || type->tt_type == VAR_NUMBER
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_buffer(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
- || type->tt_type == VAR_NUMBER)
+ if (type->tt_type == VAR_STRING
+ || type->tt_type == VAR_NUMBER
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_buffer_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
+ if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
- || type->tt_type == VAR_DICT)
+ || type->tt_type == VAR_DICT
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_lnum(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
- || type->tt_type == VAR_NUMBER)
+ if (type->tt_type == VAR_STRING
+ || type->tt_type == VAR_NUMBER
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_string_or_list_string(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING)
+ if (type->tt_type == VAR_STRING
+ || type_any_or_unknown(type))
return OK;
if (type->tt_type != VAR_LIST)
{
static int
arg_string_or_list_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
- || type->tt_type == VAR_LIST)
+ if (type->tt_type == VAR_STRING
+ || type->tt_type == VAR_LIST
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
- || type->tt_type == VAR_DICT)
+ if (type->tt_type == VAR_STRING
+ || type->tt_type == VAR_DICT
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_string_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
- || type->tt_type == VAR_BLOB)
+ if (type->tt_type == VAR_STRING
+ || type->tt_type == VAR_BLOB
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_list_or_dict(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_LIST
- || type->tt_type == VAR_DICT)
+ if (type->tt_type == VAR_LIST
+ || type->tt_type == VAR_DICT
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
type_T *decl_type UNUSED,
argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_LIST
+ if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
- || type->tt_type == VAR_BLOB)
+ || type->tt_type == VAR_BLOB
+ || type_any_or_unknown(type))
return arg_type_modifiable(type, context->arg_idx + 1);
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
static int
arg_list_or_dict_or_blob_or_string(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_LIST
+ if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
|| type->tt_type == VAR_BLOB
- || type->tt_type == VAR_STRING)
+ || type->tt_type == VAR_STRING
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
}
}
- if ((type->tt_member != &t_any && type->tt_member != &t_unknown)
- || args[0] != NULL)
+ if (!type_any_or_unknown(type->tt_member) || args[0] != NULL)
{
where_T where = WHERE_INIT;
if (is_map)
t_func_exp.tt_member = expected_member == NULL
- || type->tt_member == &t_any
- || type->tt_member == &t_unknown
+ || type_any_or_unknown(type->tt_member)
? &t_any : expected_member;
else
t_func_exp.tt_member = &t_bool;
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
- || type == &t_unknown
- || type == &t_any)
+ || type_any_or_unknown(type))
return OK;
if (type->tt_type == VAR_FUNC)
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
- || type == &t_unknown
- || type == &t_any)
+ || type_any_or_unknown(type))
return OK;
if (type->tt_type == VAR_FUNC)
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
- || type == &t_unknown
- || type == &t_any)
+ || type_any_or_unknown(type))
return OK;
if (type->tt_type == VAR_FUNC)
args[0] = context->arg_types[0].type_curr->tt_member;
else
args[0] = &t_unknown;
- if ((type->tt_member != &t_any && type->tt_member != &t_unknown)
- || args[0] != &t_unknown)
+ if (!type_any_or_unknown(type->tt_member) || args[0] != &t_unknown)
{
where_T where = WHERE_INIT;
static int
arg_string_or_func(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
+ if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
|| type->tt_type == VAR_FUNC
|| type->tt_type == VAR_BOOL
- || type->tt_type == VAR_NUMBER)
+ || type->tt_type == VAR_NUMBER
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_func_any, type, context->arg_idx + 1);
return FAIL;
static int
arg_string_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_LIST
+ if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_BLOB
- || type->tt_type == VAR_STRING)
+ || type->tt_type == VAR_STRING
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
static int
arg_chan_or_job(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_CHANNEL
- || type->tt_type == VAR_JOB)
+ if (type->tt_type == VAR_CHANNEL
+ || type->tt_type == VAR_JOB
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_channel, type, context->arg_idx + 1);
return FAIL;
static int
arg_str_or_nr_or_list(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
+ if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
- || type->tt_type == VAR_LIST)
+ || type->tt_type == VAR_LIST
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_dict_any_or_string(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_DICT
- || type->tt_type == VAR_STRING)
+ if (type->tt_type == VAR_DICT
+ || type->tt_type == VAR_STRING
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
static int
arg_get1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_BLOB
+ if (type->tt_type == VAR_BLOB
|| type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
|| type->tt_type == VAR_FUNC
- || type->tt_type == VAR_PARTIAL)
+ || type->tt_type == VAR_PARTIAL
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
static int
arg_len1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
+ if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_BLOB
|| type->tt_type == VAR_LIST
- || type->tt_type == VAR_DICT)
+ || type->tt_type == VAR_DICT
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
static int
arg_repeat1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
+ if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_BLOB
- || type->tt_type == VAR_LIST)
+ || type->tt_type == VAR_LIST
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
static int
arg_slice1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_LIST
+ if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_BLOB
- || type->tt_type == VAR_STRING)
+ || type->tt_type == VAR_STRING
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
static int
arg_string_or_list_or_dict(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_STRING
+ if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_LIST
- || type->tt_type == VAR_DICT)
+ || type->tt_type == VAR_DICT
+ || type_any_or_unknown(type))
return OK;
semsg(_(e_string_list_or_dict_required_for_argument_nr),
static int
arg_cursor1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_UNKNOWN
- || type->tt_type == VAR_NUMBER
+ if (type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_STRING
- || type->tt_type == VAR_LIST)
+ || type->tt_type == VAR_LIST
+ || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_number, type, context->arg_idx + 1);