Mercurial > vim
comparison src/eval.c @ 2119:111554354870 v7.2.402
updated for version 7.2.402
Problem: This gives a #705 error: let X = function('haslocaldir')
let X = function('getcwd')
Solution: Don't give E705 when the name is found in the hashtab. (Sergey
Khorev)
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 17 Mar 2010 19:53:49 +0100 |
parents | 15674e198164 |
children | e10d3c073449 |
comparison
equal
deleted
inserted
replaced
2118:63bf37c1e7a2 | 2119:111554354870 |
---|---|
19101 dictitem_T *v; | 19101 dictitem_T *v; |
19102 char_u *varname; | 19102 char_u *varname; |
19103 hashtab_T *ht; | 19103 hashtab_T *ht; |
19104 char_u *p; | 19104 char_u *p; |
19105 | 19105 |
19106 ht = find_var_ht(name, &varname); | |
19107 if (ht == NULL || *varname == NUL) | |
19108 { | |
19109 EMSG2(_(e_illvar), name); | |
19110 return; | |
19111 } | |
19112 v = find_var_in_ht(ht, varname, TRUE); | |
19113 | |
19106 if (tv->v_type == VAR_FUNC) | 19114 if (tv->v_type == VAR_FUNC) |
19107 { | 19115 { |
19108 if (!(vim_strchr((char_u *)"wbs", name[0]) != NULL && name[1] == ':') | 19116 if (!(vim_strchr((char_u *)"wbs", name[0]) != NULL && name[1] == ':') |
19109 && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') | 19117 && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') |
19110 ? name[2] : name[0])) | 19118 ? name[2] : name[0])) |
19111 { | 19119 { |
19112 EMSG2(_("E704: Funcref variable name must start with a capital: %s"), name); | 19120 EMSG2(_("E704: Funcref variable name must start with a capital: %s"), name); |
19113 return; | 19121 return; |
19114 } | 19122 } |
19115 if (function_exists(name)) | 19123 /* Don't allow hiding a function. When "v" is not NULL we migth be |
19124 * assigning another function to the same var, the type is checked | |
19125 * below. */ | |
19126 if (v == NULL && function_exists(name)) | |
19116 { | 19127 { |
19117 EMSG2(_("E705: Variable name conflicts with existing function: %s"), | 19128 EMSG2(_("E705: Variable name conflicts with existing function: %s"), |
19118 name); | 19129 name); |
19119 return; | 19130 return; |
19120 } | 19131 } |
19121 } | 19132 } |
19122 | 19133 |
19123 ht = find_var_ht(name, &varname); | |
19124 if (ht == NULL || *varname == NUL) | |
19125 { | |
19126 EMSG2(_(e_illvar), name); | |
19127 return; | |
19128 } | |
19129 | |
19130 v = find_var_in_ht(ht, varname, TRUE); | |
19131 if (v != NULL) | 19134 if (v != NULL) |
19132 { | 19135 { |
19133 /* existing variable, need to clear the value */ | 19136 /* existing variable, need to clear the value */ |
19134 if (var_check_ro(v->di_flags, name) | 19137 if (var_check_ro(v->di_flags, name) |
19135 || tv_check_lock(v->di_tv.v_lock, name)) | 19138 || tv_check_lock(v->di_tv.v_lock, name)) |