summaryrefslogtreecommitdiffstats
path: root/src/dict.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
commit75a9fa68f6cdd6769813a8c5e055bfb00a08c089 (patch)
treedaf1676b4e5ea491b7a370467a24b8181cc21827 /src/dict.c
parentAdding upstream version 2:9.1.0377. (diff)
downloadvim-75a9fa68f6cdd6769813a8c5e055bfb00a08c089.tar.xz
vim-75a9fa68f6cdd6769813a8c5e055bfb00a08c089.zip
Adding upstream version 2:9.1.0496.upstream/2%9.1.0496
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index c78995d..bf45b0b 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -1092,6 +1092,33 @@ failret:
}
/*
+ * Evaluate a literal dictionary: #{key: val, key: val}
+ * "*arg" points to the "#".
+ * On return, "*arg" points to the character after the Dict.
+ * Return OK or FAIL. Returns NOTDONE for {expr}.
+ */
+ int
+eval_lit_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
+{
+ int vim9script = in_vim9script();
+ int ret = OK;
+
+ if (vim9script)
+ {
+ ret = vim9_bad_comment(*arg) ? FAIL : NOTDONE;
+ }
+ else if ((*arg)[1] == '{')
+ {
+ ++*arg;
+ ret = eval_dict(arg, rettv, evalarg, TRUE);
+ }
+ else
+ ret = NOTDONE;
+
+ return ret;
+}
+
+/*
* Go over all entries in "d2" and add them to "d1".
* When "action" is "error" then a duplicate key is an error.
* When "action" is "force" then a duplicate key is overwritten.