Hi,

I've noticed the following item in Vim TODO:
Why does this give a #705 error:
let X = function('haslocaldir')
let X = function('getcwd')
Inserting "unlet X" helps.


It seems this can be easily fixed with the patch below.

diff -r aab202d244b6 src/eval.c
--- a/src/eval.c        Wed Mar 10 17:16:12 2010 +0100
+++ b/src/eval.c        Tue Mar 16 09:16:33 2010 +0300
@@ -19103,6 +19103,14 @@
     hashtab_T  *ht;
     char_u     *p;

+    ht = find_var_ht(name, &varname);
+    if (ht == NULL || *varname == NUL)
+    {
+       EMSG2(_(e_illvar), name);
+       return;
+    }
+    v = find_var_in_ht(ht, varname, TRUE);
+
     if (tv->v_type == VAR_FUNC)
     {
        if (!(vim_strchr((char_u *)"wbs", name[0]) != NULL && name[1] == ':')
@@ -19112,7 +19120,7 @@
            EMSG2(_("E704: Funcref variable name must start with a capital:
%s"), name);
            return;
        }
-       if (function_exists(name))
+       if (function_exists(name) && v == NULL)
        {
            EMSG2(_("E705: Variable name conflicts with existing function: %s"),
                                                                        name);
@@ -19120,14 +19128,6 @@
        }
     }

-    ht = find_var_ht(name, &varname);
-    if (ht == NULL || *varname == NUL)
-    {
-       EMSG2(_(e_illvar), name);
-       return;
-    }
-
-    v = find_var_in_ht(ht, varname, TRUE);
     if (v != NULL)
     {
        /* existing variable, need to clear the value */

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui