diff options
author | LemonBoy <thatlemon@gmail.com> | 2023-08-23 21:08:11 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-23 21:08:11 +0200 |
commit | afe0466fb1695fa8b9782eea8a8e9f9540d4cb85 (patch) | |
tree | f71446a214e45f7c0cdcb186fe40d25d1a1da39d /src/globals.h | |
parent | 1193951bebcff50d88403ce17dec5d3be14f131d (diff) |
patch 9.0.1786: Vim9: need instanceof() functionv9.0.1786
Problem: Vim9: need instanceof() function
Solution: Implement instanceof() builtin
Implemented in the same form as Python's isinstance because it allows
for checking multiple class types at the same time.
closes: #12867
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'src/globals.h')
-rw-r--r-- | src/globals.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/globals.h b/src/globals.h index c1e2d6fbc4..68e7ef2a2d 100644 --- a/src/globals.h +++ b/src/globals.h @@ -534,7 +534,13 @@ EXTERN int garbage_collect_at_exit INIT(= FALSE); #define t_super (static_types[80]) #define t_const_super (static_types[81]) -EXTERN type_T static_types[82] +#define t_object (static_types[82]) +#define t_const_object (static_types[83]) + +#define t_class (static_types[84]) +#define t_const_class (static_types[85]) + +EXTERN type_T static_types[86] #ifdef DO_INIT = { // 0: t_unknown @@ -700,6 +706,14 @@ EXTERN type_T static_types[82] // 80: t_super (VAR_CLASS with tt_member set to &t_bool {VAR_CLASS, 0, 0, TTFLAG_STATIC, &t_bool, NULL, NULL}, {VAR_CLASS, 0, 0, TTFLAG_STATIC|TTFLAG_CONST, &t_bool, NULL, NULL}, + + // 82: t_object + {VAR_OBJECT, 0, 0, TTFLAG_STATIC, NULL, NULL, NULL}, + {VAR_OBJECT, 0, 0, TTFLAG_STATIC|TTFLAG_CONST, NULL, NULL, NULL}, + + // 84: t_class + {VAR_CLASS, 0, 0, TTFLAG_STATIC, NULL, NULL, NULL}, + {VAR_CLASS, 0, 0, TTFLAG_STATIC|TTFLAG_CONST, NULL, NULL, NULL}, } #endif ; |