code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(23 lines)
1 // Logic for handling function type values
3 #include <stdbool.h>
5 #include "datatypes.h"
6 #include "functiontype.h"
7 #include "structs.h"
8 #include "text.h"
9 #include "types.h"
10 #include "util.h"
12 public
13 Text_t Func$as_text(const void *fn, bool colorize, const TypeInfo_t *type) {
14 Text_t text = Text$from_str(type->FunctionInfo.type_str);
15 if (fn && colorize) text = Text$concat(Text("\x1b[32;1m"), text, Text("\x1b[m"));
16 return text;
19 public
20 PUREFUNC bool Func$is_none(const void *obj, const TypeInfo_t *info) {
21 (void)info;
22 return ((Closure_t *)obj)->fn == NULL;