Mercurial > vim
comparison src/eval.c @ 24408:96e0b898d5b4 v8.2.2744
patch 8.2.2744: Vim9: no way to explicitly ignore an argument
Commit: https://github.com/vim/vim/commit/962c43bf0d6a33b905f2acd920d3701476ebb5c9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 10 17:18:09 2021 +0200
patch 8.2.2744: Vim9: no way to explicitly ignore an argument
Problem: Vim9: no way to explicitly ignore an argument.
Solution: Use the underscore as the name for an ignored argument.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Apr 2021 17:30:03 +0200 |
parents | 1a145eb83a28 |
children | 78343859f42d |
comparison
equal
deleted
inserted
replaced
24407:31c7a2a80f9c | 24408:96e0b898d5b4 |
---|---|
3512 ret = FAIL; | 3512 ret = FAIL; |
3513 else | 3513 else |
3514 { | 3514 { |
3515 int flags = evalarg == NULL ? 0 : evalarg->eval_flags; | 3515 int flags = evalarg == NULL ? 0 : evalarg->eval_flags; |
3516 | 3516 |
3517 if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(') | 3517 if (in_vim9script() && len == 1 && *s == '_') |
3518 { | |
3519 emsg(_(e_cannot_use_underscore_here)); | |
3520 ret = FAIL; | |
3521 } | |
3522 else if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(') | |
3518 { | 3523 { |
3519 // "name(..." recursive! | 3524 // "name(..." recursive! |
3520 *arg = skipwhite(*arg); | 3525 *arg = skipwhite(*arg); |
3521 ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL); | 3526 ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL); |
3522 } | 3527 } |