diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-27 16:29:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-27 16:29:53 +0100 |
commit | ec15b1cfdc5faadb529dedda58adf7fc98c839ed (patch) | |
tree | cdcf7ffa3e2ed7de3fc890f6415a0be84ad1e490 /src/typval.c | |
parent | c75bca3ee955ff36ece99a42041733ddea5f45a7 (diff) |
patch 8.2.4634: Vim9: cannot initialize a variable to null_listv8.2.4634
Problem: Vim9: cannot initialize a variable to null_list.
Solution: Give negative count to NEWLIST. (closes #10027)
Also fix inconsistencies in comparing with null values.
Diffstat (limited to 'src/typval.c')
-rw-r--r-- | src/typval.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/typval.c b/src/typval.c index d0c937e5d1..50b1d620a6 100644 --- a/src/typval.c +++ b/src/typval.c @@ -1314,6 +1314,19 @@ typval_compare( return FAIL; } } +#ifdef FEAT_JOB_CHANNEL + else if (tv1->v_type == tv2->v_type + && (tv1->v_type == VAR_CHANNEL || tv1->v_type == VAR_JOB) + && (type == EXPR_NEQUAL || type == EXPR_EQUAL)) + { + if (tv1->v_type == VAR_CHANNEL) + n1 = tv1->vval.v_channel == tv2->vval.v_channel; + else + n1 = tv1->vval.v_job == tv2->vval.v_job; + if (type == EXPR_NEQUAL) + n1 = !n1; + } +#endif else { if (typval_compare_string(tv1, tv2, type, ic, &res) == FAIL) @@ -1417,7 +1430,7 @@ typval_compare_null(typval_T *tv1, typval_T *tv2) default: break; } } - // although comparing null with number, float or bool is not very usefule + // although comparing null with number, float or bool is not very useful // we won't give an error return FALSE; } |