aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/vars.c
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-12-28 14:55:22 +0600
committerLewis Russell <me@lewisr.dev>2025-01-14 09:34:17 +0000
commitc5f93d7ab04f93db1470d58ca1f70e947e716c2b (patch)
tree27c460ef4b486f91efdb8d89bb0d731c81239273 /src/nvim/eval/vars.c
parentb192d58284a791c55f5ae000250fc948e9098d47 (diff)
downloadrneovim-c5f93d7ab04f93db1470d58ca1f70e947e716c2b.tar.gz
rneovim-c5f93d7ab04f93db1470d58ca1f70e947e716c2b.tar.bz2
rneovim-c5f93d7ab04f93db1470d58ca1f70e947e716c2b.zip
refactor(options): remove code for multitype options
Problem: It was decided on Matrix chat that multitype options won't be necessary for Neovim options, and that options should only have a single canonical type. Therefore the code for supporting multitype options is unnecessary. Solution: Remove the additional code that's used to provide multitype option support.
Diffstat (limited to 'src/nvim/eval/vars.c')
-rw-r--r--src/nvim/eval/vars.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index b9b5a055fb..012d23b567 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -843,11 +843,10 @@ static char *ex_let_option(char *arg, typval_T *const tv, const bool is_const,
goto theend;
}
- // Don't assume current and new values are of the same type in order to future-proof the code for
- // when an option can have multiple types.
- const bool is_num = ((curval.type == kOptValTypeNumber || curval.type == kOptValTypeBoolean)
- && (newval.type == kOptValTypeNumber || newval.type == kOptValTypeBoolean));
- const bool is_string = curval.type == kOptValTypeString && newval.type == kOptValTypeString;
+ // Current value and new value must have the same type.
+ assert(curval.type == newval.type);
+ const bool is_num = curval.type == kOptValTypeNumber || curval.type == kOptValTypeBoolean;
+ const bool is_string = curval.type == kOptValTypeString;
if (op != NULL && *op != '=') {
if (!hidden && is_num) { // number or bool
@@ -1900,8 +1899,6 @@ static void getwinvar(typval_T *argvars, typval_T *rettv, int off)
///
/// @return Typval converted to OptVal. Must be freed by caller.
/// Returns NIL_OPTVAL for invalid option name.
-///
-/// TODO(famiu): Refactor this to support multitype options.
static OptVal tv_to_optval(typval_T *tv, OptIndex opt_idx, const char *option, bool *error)
{
OptVal value = NIL_OPTVAL;