summaryrefslogtreecommitdiff
path: root/src/evalfunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 1abcd5e11..0d17b9ed7 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -340,7 +340,7 @@ arg_list_or_dict(type_T *type, argcontext_T *context)
}
/*
- * Check "type" is the same type as the previous argument
+ * Check "type" is the same type as the previous argument.
* Must not be used for the first argcheck_T entry.
*/
static int
@@ -352,6 +352,21 @@ arg_same_as_prev(type_T *type, argcontext_T *context)
}
/*
+ * Check "type" is the same basic type as the previous argument, checks list or
+ * dict vs other type, but not member type.
+ * Must not be used for the first argcheck_T entry.
+ */
+ static int
+arg_same_struct_as_prev(type_T *type, argcontext_T *context)
+{
+ type_T *prev_type = context->arg_types[context->arg_idx - 1];
+
+ if (prev_type->tt_type != context->arg_types[context->arg_idx]->tt_type)
+ return check_arg_type(prev_type, type, context->arg_idx + 1);
+ return OK;
+}
+
+/*
* Check "type" is an item of the list or blob of the previous arg.
* Must not be used for the first argcheck_T entry.
*/
@@ -394,6 +409,7 @@ arg_extend3(type_T *type, argcontext_T *context)
argcheck_T arg1_float_or_nr[] = {arg_float_or_nr};
argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev};
argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3};
+argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3};
argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number};
/*
@@ -877,6 +893,8 @@ static funcentry_T global_functions[] =
ret_string, f_expandcmd},
{"extend", 2, 3, FEARG_1, arg23_extend,
ret_first_arg, f_extend},
+ {"extendnew", 2, 3, FEARG_1, arg23_extendnew,
+ ret_first_cont, f_extendnew},
{"feedkeys", 1, 2, FEARG_1, NULL,
ret_void, f_feedkeys},
{"file_readable", 1, 1, FEARG_1, NULL, // obsolete