From 9b9c1dee1352165fea2f9108456484b30b796fd6 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sat, 26 Apr 2014 10:24:06 +0200 Subject: vim-patch:7.4.264 Problem: Can't define a function starting with "g:". Can't assign a funcref to a buffer-local variable. Solution: Skip "g:" at the start of a function name. Don't check for colons when assigning to a variable. https://code.google.com/p/vim/source/detail?r=00acac0af680c2d8c82db5258474b121a5908926 --- src/testdir/test_eval.in | 21 ++++++++++++++++++++- src/testdir/test_eval.ok | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src/testdir') diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in index 44eeabfe73..a142036522 100644 --- a/src/testdir/test_eval.in +++ b/src/testdir/test_eval.in @@ -1,5 +1,5 @@ STARTTEST -:" function name includes a colon +:" function name not starting with a capital :try : func! g:test() : echo "test" @@ -15,9 +15,28 @@ STARTTEST :catch : let @b = v:exception :endtry +:" function name includes a colon +:try +: func! b:test() +: echo "test" +: endfunc +:catch +: let @c = v:exception +:endtry +:" function name starting with/without "g:", buffer-local funcref. +:function! g:Foo() +: let @d = 'called Foo()' +:endfunction +:let b:my_func = function('Foo') +:let @d = 'xxx' +:call b:my_func() +:endfunction +:" clean up :%d :pu a :pu b +:pu c +:pu d :1d :wq! test.out ENDTEST diff --git a/src/testdir/test_eval.ok b/src/testdir/test_eval.ok index 8aaac316c5..601a4261c8 100644 --- a/src/testdir/test_eval.ok +++ b/src/testdir/test_eval.ok @@ -1,2 +1,4 @@ Vim(function):E128: Function name must start with a capital or "s:": g:test() Vim(function):E128: Function name must start with a capital or "s:": test2() "# +Vim(function):E128: Function name must start with a capital or "s:": b:test() +called Foo() -- cgit