comparison src/userfunc.c @ 25046:2f702d19013a v8.2.3060

patch 8.2.3060: Vim9: cannot use ternary operator in parenthesis Commit: https://github.com/vim/vim/commit/98f9a5f4cbe6061e09bccf6074afe0a88a504219 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 26 22:22:38 2021 +0200 patch 8.2.3060: Vim9: cannot use ternary operator in parenthesis Problem: Vim9: cannot use ternary operator in parenthesis. Solution: Do not use "=~" for a default argument value. (closes https://github.com/vim/vim/issues/8462)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Jun 2021 22:30:05 +0200
parents a9a21631c090
children 8f2262c72178
comparison
equal deleted inserted replaced
25045:bb817601d9f5 25046:2f702d19013a
273 evalarg, FALSE, skip); 273 evalarg, FALSE, skip);
274 if (p == arg) 274 if (p == arg)
275 break; 275 break;
276 276
277 // Recognize " = expr" but not " == expr". A lambda can have 277 // Recognize " = expr" but not " == expr". A lambda can have
278 // "(a = expr" but "(a == expr" is not a lambda. 278 // "(a = expr" but "(a == expr" and "(a =~ expr" are not a lambda.
279 np = skipwhite(p); 279 np = skipwhite(p);
280 if (*np == '=' && np[1] != '=' && default_args != NULL) 280 if (*np == '=' && np[1] != '=' && np[1] != '~'
281 && default_args != NULL)
281 { 282 {
282 typval_T rettv; 283 typval_T rettv;
283 284
284 // find the end of the expression (doesn't evaluate it) 285 // find the end of the expression (doesn't evaluate it)
285 any_default = TRUE; 286 any_default = TRUE;