| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.268 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.268 |
| Problem: Using exists() on a funcref for a script-local function does not |
| work. |
| Solution: Translate <SNR> to the special byte sequence. Add a test. |
| Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok, |
| src/testdir/test_eval_func.vim, Filelist |
| |
| |
| |
| |
| |
| *** 22275,22280 **** |
| --- 22275,22288 ---- |
| { |
| name = vim_strsave(name); |
| *pp = end; |
| + if (STRNCMP(name, "<SNR>", 5) == 0) |
| + { |
| + /* Change "<SNR>" to the byte sequence. */ |
| + name[0] = K_SPECIAL; |
| + name[1] = KS_EXTRA; |
| + name[2] = (int)KE_SNR; |
| + mch_memmove(name + 3, name + 5, STRLEN(name + 5) + 1); |
| + } |
| goto theend; |
| } |
| |
| |
| |
| |
| *** 180,185 **** |
| --- 180,188 ---- |
| :echo g:Foo(2) |
| :echo Foo(3) |
| :" |
| + :" script-local function used in Funcref must exist. |
| + :so test_eval_func.vim |
| + :" |
| :/^start:/+1,$wq! test.out |
| :" vim: et ts=4 isk-=\: fmr=???,??? |
| :call getchar() |
| |
| |
| |
| *** 341,343 **** |
| --- 341,347 ---- |
| called Foo(1) |
| called Foo(2) |
| called Foo(3) |
| + s:Testje exists: 0 |
| + func s:Testje exists: 1 |
| + Bar exists: 1 |
| + func Bar exists: 1 |
| |
| |
| |
| |
| --- 1,10 ---- |
| + " Vim script used in test_eval.in. Needed for script-local function. |
| + |
| + func! s:Testje() |
| + return "foo" |
| + endfunc |
| + let Bar = function('s:Testje') |
| + $put ='s:Testje exists: ' . exists('s:Testje') |
| + $put ='func s:Testje exists: ' . exists('*s:Testje') |
| + $put ='Bar exists: ' . exists('Bar') |
| + $put ='func Bar exists: ' . exists('*Bar') |
| |
| |
| |
| *** 88,93 **** |
| --- 88,94 ---- |
| src/testdir/test60.vim \ |
| src/testdir/test83-tags? \ |
| src/testdir/test77a.com \ |
| + src/testdir/test_*.vim \ |
| src/testdir/python2/*.py \ |
| src/testdir/python3/*.py \ |
| src/testdir/pythonx/*.py \ |
| |
| |
| |
| *** 736,737 **** |
| --- 736,739 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 268, |
| /**/ |
| |
| -- |
| I AM THANKFUL... |
| ...for the piles of laundry and ironing because it means I |
| have plenty of clothes to wear. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |