summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile1
-rw-r--r--src/eval.c7
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/sautest/autoload/foo.vim7
-rw-r--r--src/testdir/sautest/autoload/globone.vim1
-rw-r--r--src/testdir/sautest/autoload/globtwo.vim1
-rw-r--r--src/testdir/test_autoload.vim11
-rw-r--r--src/testdir/test_escaped_glob.vim8
-rw-r--r--src/userfunc.c2
-rw-r--r--src/version.c2
10 files changed, 35 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile
index 7ccd766999..2a66a02de4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2120,6 +2120,7 @@ test_arglist \
test_assign \
test_autochdir \
test_autocmd \
+ test_autoload \
test_backspace_opt \
test_breakindent \
test_bufline \
diff --git a/src/eval.c b/src/eval.c
index b3e2be5d0e..1cced57ec0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1956,7 +1956,10 @@ get_lval(
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;
@@ -6610,6 +6613,8 @@ get_vim_var_nr(int idx)
/*
* 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)
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index df79e9ab9a..5d5fccf109 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -73,6 +73,7 @@ NEW_TESTS = test_arabic.res \
test_assert.res \
test_autochdir.res \
test_autocmd.res \
+ test_autoload.res \
test_backspace_opt.res \
test_breakindent.res \
test_bufwintabinfo.res \
diff --git a/src/testdir/sautest/autoload/foo.vim b/src/testdir/sautest/autoload/foo.vim
new file mode 100644
index 0000000000..d7dcd5ce3d
--- /dev/null
+++ b/src/testdir/sautest/autoload/foo.vim
@@ -0,0 +1,7 @@
+let g:loaded_foo_vim += 1
+
+let foo#bar = {}
+
+func foo#bar.echo()
+ let g:called_foo_bar_echo += 1
+endfunc
diff --git a/src/testdir/sautest/autoload/globone.vim b/src/testdir/sautest/autoload/globone.vim
new file mode 100644
index 0000000000..98c9a10582
--- /dev/null
+++ b/src/testdir/sautest/autoload/globone.vim
@@ -0,0 +1 @@
+" used by Test_globpath()
diff --git a/src/testdir/sautest/autoload/globtwo.vim b/src/testdir/sautest/autoload/globtwo.vim
new file mode 100644
index 0000000000..98c9a10582
--- /dev/null
+++ b/src/testdir/sautest/autoload/globtwo.vim
@@ -0,0 +1 @@
+" used by Test_globpath()
diff --git a/src/testdir/test_autoload.vim b/src/testdir/test_autoload.vim
new file mode 100644
index 0000000000..a92851f655
--- /dev/null
+++ b/src/testdir/test_autoload.vim
@@ -0,0 +1,11 @@
+" 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
diff --git a/src/testdir/test_escaped_glob.vim b/src/testdir/test_escaped_glob.vim
index b91c6e7424..e0723da6f0 100644
--- a/src/testdir/test_escaped_glob.vim
+++ b/src/testdir/test_escaped_glob.vim
@@ -25,8 +25,8 @@ function Test_glob()
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
diff --git a/src/userfunc.c b/src/userfunc.c
index e187684551..9b60554406 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1594,7 +1594,7 @@ trans_function_name(
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)
{
diff --git a/src/version.c b/src/version.c
index 4361c384f9..7fe7e8f2c5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1377,
+/**/
1376,
/**/
1375,