summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-16 20:01:39 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-16 20:01:39 +0000
commit4c8b546da2059865e20902586bb3e0ff07c279a0 (patch)
tree48f6530068bd15448802dbd076b155ce8b9c8e1f /src/eval.c
parentd597ab00d799aa078be32e6677e01a7582106105 (diff)
patch 8.2.4582: useless code handling a type declarationv8.2.4582
Problem: Useless code handling a type declaration. Solution: Remove the code and give an error.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/eval.c b/src/eval.c
index 62266f884b..e4f47b18bd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -937,8 +937,6 @@ get_lval(
}
if (*p == ':')
{
- garray_T tmp_type_list;
- garray_T *type_list;
char_u *tp = skipwhite(p + 1);
if (tp == p + 1 && !quiet)
@@ -947,27 +945,19 @@ get_lval(
return NULL;
}
- if (SCRIPT_ID_VALID(current_sctx.sc_sid))
- type_list = &SCRIPT_ITEM(current_sctx.sc_sid)->sn_type_list;
- else
+ if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
{
- // TODO: should we give an error here?
- type_list = &tmp_type_list;
- ga_init2(type_list, sizeof(type_T), 10);
+ semsg(_(e_using_type_not_in_script_context_str), p);
+ return NULL;
}
// parse the type after the name
- lp->ll_type = parse_type(&tp, type_list, !quiet);
+ lp->ll_type = parse_type(&tp,
+ &SCRIPT_ITEM(current_sctx.sc_sid)->sn_type_list,
+ !quiet);
if (lp->ll_type == NULL && !quiet)
return NULL;
lp->ll_name_end = tp;
-
- // drop the type when not in a script
- if (type_list == &tmp_type_list)
- {
- lp->ll_type = NULL;
- clear_type_list(type_list);
- }
}
}
}