aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r--src/nvim/api/private/helpers.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 23f5b10e18..7efa086af2 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -131,6 +131,19 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
dictitem_T *di = dict_find(dict, (char_u *)key.data, (int)key.size);
+ if (di != NULL) {
+ if (di->di_flags & DI_FLAGS_RO) {
+ api_set_error(err, Exception, _("Key is read-only: %s"), key.data);
+ return rv;
+ } else if (di->di_flags & DI_FLAGS_FIX) {
+ api_set_error(err, Exception, _("Key is fixed: %s"), key.data);
+ return rv;
+ } else if (di->di_flags & DI_FLAGS_LOCK) {
+ api_set_error(err, Exception, _("Key is locked: %s"), key.data);
+ return rv;
+ }
+ }
+
if (del) {
// Delete the key
if (di == NULL) {