diff options
author | ZyX <kp-pav@yandex.ru> | 2017-12-12 01:13:04 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-12-12 08:43:31 +0300 |
commit | 932ea7a0d1d19288fad719afd52e9cbeb924c4c2 (patch) | |
tree | 24293d74172a92436b1c5e8dbe7b2425e9a7dd2c /src/nvim/eval/typval.h | |
parent | 45998deb5d325c7a44ce38b0c7d954919458f105 (diff) | |
download | rneovim-932ea7a0d1d19288fad719afd52e9cbeb924c4c2.tar.gz rneovim-932ea7a0d1d19288fad719afd52e9cbeb924c4c2.tar.bz2 rneovim-932ea7a0d1d19288fad719afd52e9cbeb924c4c2.zip |
clint,eval: Make linter check for direct usage of list attributes
Diffstat (limited to 'src/nvim/eval/typval.h')
-rw-r--r-- | src/nvim/eval/typval.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index c0d1790c63..2bce7bd6b2 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -440,6 +440,21 @@ static inline int tv_list_uidx(const list_T *const l, int n) return n; } +static inline bool tv_list_has_watchers(const list_T *const l) + REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT; + +/// Check whether list has watchers +/// +/// E.g. is referenced by a :for loop. +/// +/// @param[in] l List to check. +/// +/// @return true if there are watchers, false otherwise. +static inline bool tv_list_has_watchers(const list_T *const l) +{ + return l && l->lv_watch; +} + static inline listitem_T *tv_list_first(const list_T *const l) REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT; |