diff options
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index 2b27f514cd..4bce9972d2 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8333,7 +8333,6 @@ compile_for(char_u *arg_start, cctx_T *cctx) lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE); } - // Script var is not supported. if (get_var_dest(name, &dest, CMD_for, &opt_flags, &vimvaridx, &type, cctx) == FAIL) goto failed; @@ -8351,17 +8350,18 @@ compile_for(char_u *arg_start, cctx_T *cctx) } else { - if (!valid_varname(arg, (int)varlen, FALSE)) - goto failed; - if (lookup_local(arg, varlen, NULL, cctx) == OK) + // Script var is not supported. + if (STRNCMP(name, "s:", 2) == 0) { - semsg(_(e_variable_already_declared), arg); + emsg(_(e_cannot_use_script_variable_in_for_loop)); goto failed; } - if (STRNCMP(name, "s:", 2) == 0) + if (!valid_varname(arg, (int)varlen, FALSE)) + goto failed; + if (lookup_local(arg, varlen, NULL, cctx) == OK) { - semsg(_(e_cannot_declare_script_variable_in_function), name); + semsg(_(e_variable_already_declared), arg); goto failed; } |