1
0
forked from aniani/vim

patch 9.0.0623: error for modifying a const is not detected at compile time

Problem:    Error for modifying a const is not detected at compile time.
Solution:   Add TTFLAG_CONST and check for it in add() and extend().
This commit is contained in:
Bram Moolenaar
2022-09-29 19:14:42 +01:00
parent 9f573a8df0
commit fa1039760e
12 changed files with 446 additions and 62 deletions

View File

@@ -45,6 +45,30 @@ get_type_ptr(garray_T *type_gap)
return type;
}
/*
* Make a shallow copy of "type".
* When allocation fails returns "type".
*/
type_T *
copy_type(type_T *type, garray_T *type_gap)
{
type_T *copy = get_type_ptr(type_gap);
if (copy == NULL)
return type;
*copy = *type;
if (type->tt_args != NULL)
{
copy->tt_args = ALLOC_MULT(type_T *, type->tt_argcount);
if (copy->tt_args != NULL)
for (int i = 0; i < type->tt_argcount; ++i)
copy->tt_args[i] = type->tt_args[i];
}
return copy;
}
void
clear_type_list(garray_T *gap)
{