call CheckDefFailure("let x = ¬exist", 'E113:')
call CheckDefExecFailure("&grepprg = [343]", 'E1051:')
+
+ call CheckDefExecFailure("echo s:doesnt_exist", 'E121:')
+ call CheckDefExecFailure("echo g:doesnt_exist", 'E121:')
endfunc
let g:Funcrefs = [function('add')]
assert_equal('foobar', $ENVVAR)
$ENVVAR = ''
- appendToMe ..= 'yyy'
- assert_equal('xxxyyy', appendToMe)
- addToMe += 222
- assert_equal(333, addToMe)
+ s:appendToMe ..= 'yyy'
+ assert_equal('xxxyyy', s:appendToMe)
+ s:addToMe += 222
+ assert_equal(333, s:addToMe)
enddef
func Test_assignment_failure()
int idx = get_script_item_idx(current_sctx.sc_sid, name, FALSE);
imported_T *import;
- if (idx == -1)
+ if (idx == -1 || si->sn_version != SCRIPT_VERSION_VIM9)
{
- // variable exists but is not in sn_var_vals: old style script.
+ // variable is not in sn_var_vals: old style script.
return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid,
&t_any);
}
|| (len == 5 && STRNCMP("false", *arg, 5) == 0))
res = generate_PUSHBOOL(cctx, **arg == 't'
? VVAL_TRUE : VVAL_FALSE);
- else
+ else if (SCRIPT_ITEM(current_sctx.sc_sid)->sn_version
+ == SCRIPT_VERSION_VIM9)
+ // in Vim9 script "var" can be script-local.
res = compile_load_scriptvar(cctx, name);
}
}