{
typval_T rettv;
int res;
- int vim9script = current_sctx.sc_version == SCRIPT_VERSION_VIM9;
+ int vim9script = in_vim9script();
garray_T *gap = &evalarg->eval_ga;
int save_flags = evalarg == NULL ? 0 : evalarg->eval_flags;
{
lp->ll_name = name;
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9 && *p == ':')
+ if (in_vim9script() && *p == ':')
{
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
char_u *tp = skipwhite(p + 1);
{
forinfo_T *fi = (forinfo_T *)fi_void;
int result;
- int flag = current_sctx.sc_version == SCRIPT_VERSION_VIM9 ?
- LET_NO_COMMAND : 0;
+ int flag = in_vim9script() ? LET_NO_COMMAND : 0;
listitem_T *item;
if (fi->fi_blob != NULL)
eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
{
*getnext = FALSE;
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9
+ if (in_vim9script()
&& evalarg != NULL
&& (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)
&& (*arg == NUL || (VIM_ISWHITE(arg[-1])
int br_nest = 0;
char_u *p;
int len;
- int vim9script = current_sctx.sc_version == SCRIPT_VERSION_VIM9;
+ int vim9script = in_vim9script();
if (expr_start != NULL)
{
emsg(_("E985: .= is not supported with script version 2"));
else if (!ends_excmd2(eap->cmd, arg))
{
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ if (in_vim9script())
{
// Vim9 declaration ":let var: type"
arg = vim9_declare_scriptvar(eap, arg);
return arg + 2;
end = find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
- if (include_type && current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ if (include_type && in_vim9script())
{
// "a: type" is declaring variable "a" with a type, not "a:".
if (end == arg + 2 && end[-1] == ':')
emsg(_("E996: Cannot lock an environment variable"));
return NULL;
}
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9
- && (flags & LET_NO_COMMAND) == 0)
+ if (in_vim9script() && (flags & LET_NO_COMMAND) == 0)
{
vim9_declare_error(arg);
return NULL;
dict_T *d;
dictitem_T *di;
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9
- && check_vim9_unlet(name) == FAIL)
+ if (in_vim9script() && check_vim9_unlet(name) == FAIL)
return FAIL;
ht = find_var_ht(name, &varname);
*dip = v;
}
- if (tv == NULL && (current_sctx.sc_version == SCRIPT_VERSION_VIM9
- || STRNCMP(name, "s:", 2) == 0))
+ if (tv == NULL && (in_vim9script() || STRNCMP(name, "s:", 2) == 0))
{
imported_T *import;
char_u *p = STRNCMP(name, "s:", 2) == 0 ? name + 2 : name;
return ht; // local variable
// in Vim9 script items at the script level are script-local
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ if (in_vim9script())
{
ht = get_script_local_ht();
if (ht != NULL)
}
is_script_local = ht == get_script_local_ht();
- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9
+ if (in_vim9script()
&& !is_script_local
&& (flags & LET_NO_COMMAND) == 0
&& name[1] == ':')
return;
}
- if (is_script_local
- && current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ if (is_script_local && in_vim9script())
{
if ((flags & LET_NO_COMMAND) == 0)
{
if (flags & LET_IS_CONST)
di->di_flags |= DI_FLAGS_LOCK;
- if (is_script_local && current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ if (is_script_local && in_vim9script())
{
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
}
// In Vim9 script a user function is script-local by default.
- vim9script = ASCII_ISUPPER(*start)
- && current_sctx.sc_version == SCRIPT_VERSION_VIM9;
+ vim9script = ASCII_ISUPPER(*start) && in_vim9script();
/*
* Copy the function name to allocated memory.
{
char_u *p;
- if (*name == K_SPECIAL && current_sctx.sc_version == SCRIPT_VERSION_VIM9)
+ if (*name == K_SPECIAL && in_vim9script())
{
p = vim_strchr(name, '_');
if (p != NULL)