comparison src/eval.c @ 4870:b7bb20390111 v7.3.1181

updated for version 7.3.1181 Problem: Wrong error message for 1.0[0]. Solution: Check for funcref and float separately. (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Wed, 12 Jun 2013 22:08:58 +0200
parents e48cabe98453
children fefd8d33a7ea
comparison
equal deleted inserted replaced
4869:a5352e73dc00 4870:b7bb20390111
110 static char *e_funcref = N_("E718: Funcref required"); 110 static char *e_funcref = N_("E718: Funcref required");
111 static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary"); 111 static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
112 static char *e_letwrong = N_("E734: Wrong variable type for %s="); 112 static char *e_letwrong = N_("E734: Wrong variable type for %s=");
113 static char *e_nofunc = N_("E130: Unknown function: %s"); 113 static char *e_nofunc = N_("E130: Unknown function: %s");
114 static char *e_illvar = N_("E461: Illegal variable name: %s"); 114 static char *e_illvar = N_("E461: Illegal variable name: %s");
115 static char *e_float_as_string = N_("E806: using Float as a String");
115 116
116 static dictitem_T globvars_var; /* variable used for g: */ 117 static dictitem_T globvars_var; /* variable used for g: */
117 #define globvarht globvardict.dv_hashtab 118 #define globvarht globvardict.dv_hashtab
118 119
119 /* 120 /*
5266 long len = -1; 5267 long len = -1;
5267 int range = FALSE; 5268 int range = FALSE;
5268 char_u *s; 5269 char_u *s;
5269 char_u *key = NULL; 5270 char_u *key = NULL;
5270 5271
5271 if (rettv->v_type == VAR_FUNC 5272 if (rettv->v_type == VAR_FUNC)
5272 #ifdef FEAT_FLOAT
5273 || rettv->v_type == VAR_FLOAT
5274 #endif
5275 )
5276 { 5273 {
5277 if (verbose) 5274 if (verbose)
5278 EMSG(_("E695: Cannot index a Funcref")); 5275 EMSG(_("E695: Cannot index a Funcref"));
5279 return FAIL; 5276 return FAIL;
5280 } 5277 }
5278 #ifdef FEAT_FLOAT
5279 else if (rettv->v_type == VAR_FLOAT)
5280 {
5281 if (verbose)
5282 EMSG(_(e_float_as_string));
5283 return FAIL;
5284 }
5285 #endif
5281 5286
5282 if (**arg == '.') 5287 if (**arg == '.')
5283 { 5288 {
5284 /* 5289 /*
5285 * dict.name 5290 * dict.name
20083 case VAR_DICT: 20088 case VAR_DICT:
20084 EMSG(_("E731: using Dictionary as a String")); 20089 EMSG(_("E731: using Dictionary as a String"));
20085 break; 20090 break;
20086 #ifdef FEAT_FLOAT 20091 #ifdef FEAT_FLOAT
20087 case VAR_FLOAT: 20092 case VAR_FLOAT:
20088 EMSG(_("E806: using Float as a String")); 20093 EMSG(_(e_float_as_string));
20089 break; 20094 break;
20090 #endif 20095 #endif
20091 case VAR_STRING: 20096 case VAR_STRING:
20092 if (varp->vval.v_string != NULL) 20097 if (varp->vval.v_string != NULL)
20093 return varp->vval.v_string; 20098 return varp->vval.v_string;