refactor(api): use typed keysets

Initially this is just for geting rid of boilerplate,
but eventually the types could get exposed as metadata
This commit is contained in:
bfredl
2023-08-01 14:01:19 +02:00
parent c01e624b07
commit 7bc93e0e2f
23 changed files with 771 additions and 866 deletions

View File

@@ -124,10 +124,20 @@ struct key_value_pair {
Object value;
};
typedef Object *(*field_hash)(void *retval, const char *str, size_t len);
typedef uint64_t OptionalKeys;
// this is the prefix of all keysets with optional keys
typedef struct {
OptionalKeys is_set_;
} OptKeySet;
typedef struct {
char *str;
size_t ptr_off;
ObjectType type; // kObjectTypeNil == untyped
int opt_index;
} KeySetLink;
typedef KeySetLink *(*FieldHashfn)(const char *str, size_t len);
#endif // NVIM_API_PRIVATE_DEFS_H