comparison src/eval.c @ 12728:9c1659761fc3 v8.0.1242

patch 8.0.1242: function argument with only dash is seen as number zero commit https://github.com/vim/vim/commit/ffd99f729bd806e09d9355ede9c17780b61057bf Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 2 15:44:14 2017 +0100 patch 8.0.1242: function argument with only dash is seen as number zero Problem: Function argument with only dash is seen as number zero. (Wang Shidong) Solution: See a dash as a string. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Thu, 02 Nov 2017 15:45:06 +0100
parents 7749260f261c
children f7b2ecaeb79c
comparison
equal deleted inserted replaced
12727:ed7e40447153 12728:9c1659761fc3
1054 } 1054 }
1055 1055
1056 if (str_arg_only) 1056 if (str_arg_only)
1057 len = 0; 1057 len = 0;
1058 else 1058 else
1059 /* Recognize a number argument, the others must be strings. */ 1059 {
1060 /* Recognize a number argument, the others must be strings. A dash
1061 * is a string too. */
1060 vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0); 1062 vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0);
1063 if (len == 1 && *argv[i] == '-')
1064 len = 0;
1065 }
1061 if (len != 0 && len == (int)STRLEN(argv[i])) 1066 if (len != 0 && len == (int)STRLEN(argv[i]))
1062 { 1067 {
1063 argvars[i].v_type = VAR_NUMBER; 1068 argvars[i].v_type = VAR_NUMBER;
1064 argvars[i].vval.v_number = n; 1069 argvars[i].vval.v_number = n;
1065 } 1070 }