Problem: Cannot call a dict function in autoloaded dict.
Solution: Call get_lval() passing the read-only flag.
test_assign \
test_autochdir \
test_autocmd \
+ test_autoload \
test_backspace_opt \
test_breakindent \
test_bufline \
cc = *p;
*p = NUL;
- v = find_var(lp->ll_name, &ht, flags & GLV_NO_AUTOLOAD);
+ /* Only pass &ht when we would write to the variable, it prevents autoload
+ * as well. */
+ v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
+ flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet)
EMSG2(_(e_undefvar), lp->ll_name);
*p = cc;
/*
* Get string v: variable value. Uses a static buffer, can only be used once.
+ * If the String variable has never been set, return an empty string.
+ * Never returns NULL;
*/
char_u *
get_vim_var_str(int idx)
test_assert.res \
test_autochdir.res \
test_autocmd.res \
+ test_autoload.res \
test_backspace_opt.res \
test_breakindent.res \
test_bufwintabinfo.res \
--- /dev/null
+let g:loaded_foo_vim += 1
+
+let foo#bar = {}
+
+func foo#bar.echo()
+ let g:called_foo_bar_echo += 1
+endfunc
--- /dev/null
+" used by Test_globpath()
--- /dev/null
+" used by Test_globpath()
--- /dev/null
+" Tests for autoload
+
+set runtimepath=./sautest
+
+func! Test_autoload_dict_func()
+ let g:loaded_foo_vim = 0
+ let g:called_foo_bar_echo = 0
+ call g:foo#bar.echo()
+ call assert_equal(1, g:loaded_foo_vim)
+ call assert_equal(1, g:called_foo_bar_echo)
+endfunc
endfunction
function Test_globpath()
- call assert_equal("sautest/autoload/Test104.vim\nsautest/autoload/footest.vim",
- \ globpath('sautest/autoload', '*.vim'))
- call assert_equal(['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim'],
- \ globpath('sautest/autoload', '*.vim', 0, 1))
+ call assert_equal("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim",
+ \ globpath('sautest/autoload', 'glob*.vim'))
+ call assert_equal(['sautest/autoload/globone.vim', 'sautest/autoload/globtwo.vim'],
+ \ globpath('sautest/autoload', 'glob*.vim', 0, 1))
endfunction
start += lead;
/* Note that TFN_ flags use the same values as GLV_ flags. */
- end = get_lval(start, NULL, &lv, FALSE, skip, flags,
+ end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY,
lead > 2 ? 0 : FNE_CHECK_START);
if (end == start)
{
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1377,
/**/
1376,
/**/