(170 lines)
1 // Logic for defining and working with types13 type_t *type;14 ast_t *default_val;15 Text_t comment;17 } arg_t;20 ({ \21 arg_t *args[] = {__VA_ARGS__}; \25 })29 int64_t tag_value;30 type_t *type;32 } tag_t;35 type_t *type;37 } type_list_t;41 UnknownType,42 AbortType,43 ReturnType,44 VoidType,45 MemoryType,46 BoolType,47 ByteType,48 BigIntType,49 IntType,50 NumType,51 CStringType,52 TextType,53 PathType,54 ListType,55 TableType,56 FunctionType,57 ClosureType,58 PointerType,59 StructType,60 EnumType,61 OptionalType,62 TypeInfoType,63 ModuleType,64 } tag;68 } UnknownType, AbortType, VoidType, MemoryType, BoolType, PathType;70 type_t *ret;71 } ReturnType;73 } BigIntType;76 } IntType;78 } ByteType;81 } NumType;83 } CStringType;87 } TextType;89 type_t *item_type;90 } ListType;92 type_t *key_type, *value_type;94 ast_t *default_value;95 } TableType;97 arg_t *args;98 type_t *ret;99 } FunctionType;101 type_t *fn;102 } ClosureType;104 type_t *pointed;106 } PointerType;109 arg_t *fields;112 } StructType;115 tag_t *tags;118 } EnumType;120 type_t *type;121 } OptionalType;124 type_t *type;126 } TypeInfoType;129 } ModuleType;130 } __data;131 };137 _make_function_type(ret, sizeof((arg_t[]){__VA_ARGS__}) / sizeof(arg_t), (arg_t[]){__VA_ARGS__})148 NUM_PRECISION_EQUAL,149 NUM_PRECISION_LESS,150 NUM_PRECISION_MORE,151 NUM_PRECISION_INCOMPARABLE152 } precision_cmp_e;