summaryrefslogtreecommitdiffstats
path: root/src/vim9compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 4aa83606b9..a4ed44951d 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1327,11 +1327,12 @@ assignment_len(char_u *p, int *heredoc)
/*
* Generate the load instruction for "name".
*/
- static void
+ static int
generate_loadvar(cctx_T *cctx, lhs_T *lhs)
{
char_u *name = lhs->lhs_name;
type_T *type = lhs->lhs_type;
+ int res = OK;
switch (lhs->lhs_dest)
{
@@ -1360,7 +1361,7 @@ generate_loadvar(cctx_T *cctx, lhs_T *lhs)
generate_LOAD(cctx, ISN_LOADT, 0, name + 2, type);
break;
case dest_script:
- compile_load_scriptvar(cctx,
+ res = compile_load_scriptvar(cctx,
name + (name[1] == ':' ? 2 : 0), NULL, NULL);
break;
case dest_env:
@@ -1392,6 +1393,8 @@ generate_loadvar(cctx_T *cctx, lhs_T *lhs)
// list or dict value should already be on the stack.
break;
}
+
+ return res;
}
/*
@@ -2240,10 +2243,11 @@ compile_load_lhs(
&& need_type(rhs_type, member_type, FALSE,
-3, 0, cctx, FALSE, FALSE) == FAIL)
return FAIL;
+
+ return OK;
}
- else
- generate_loadvar(cctx, lhs);
- return OK;
+
+ return generate_loadvar(cctx, lhs);
}
/*
@@ -2301,7 +2305,8 @@ compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx)
return generate_CLASSMEMBER(cctx, TRUE, cl, lhs->lhs_member_idx);
}
- compile_load_lhs(lhs, var_start, NULL, cctx);
+ if (compile_load_lhs(lhs, var_start, NULL, cctx) == FAIL)
+ return FAIL;
if (lhs->lhs_has_index)
{
@@ -2510,6 +2515,7 @@ push_default_value(
case VAR_VOID:
case VAR_INSTR:
case VAR_CLASS:
+ case VAR_TYPEALIAS:
case VAR_SPECIAL: // cannot happen
// This is skipped for local variables, they are always
// initialized to zero. But in a "for" or "while" loop
@@ -3963,6 +3969,11 @@ compile_def_function(
line = (char_u *)"";
break;
+ case CMD_type:
+ emsg(_(e_type_can_only_be_used_in_script));
+ goto erret;
+ break;
+
case CMD_global:
if (check_global_and_subst(ea.cmd, p) == FAIL)
goto erret;