diff options
Diffstat (limited to 'src/nvim/api/private/helpers.h')
-rw-r--r-- | src/nvim/api/private/helpers.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index cb74c655cd..95e5cf67c8 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -63,8 +63,9 @@ #define NIL ((Object)OBJECT_INIT) #define NULL_STRING ((String)STRING_INIT) -// currently treat key=vim.NIL as if the key was missing -#define HAS_KEY(o) ((o).type != kObjectTypeNil) +#define HAS_KEY(d, typ, key) (((d)->is_set__##typ##_ & (1 << KEYSET_OPTIDX_##typ##__##key)) != 0) + +#define GET_BOOL_OR_TRUE(d, typ, key) (HAS_KEY(d, typ, key) ? (d)->key : true) #define PUT(dict, k, v) \ kv_push(dict, ((KeyValuePair) { .key = cstr_to_string(k), .value = v })) |