Fix issue with constant initializers for metamethods
This commit is contained in:
parent
0b76011a45
commit
0ef96cb3c0
@ -120,7 +120,7 @@ Int_t Array$binary_search(Array_t array, void *target, Closure_t comparison);
|
||||
void Array$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type);
|
||||
void Array$deserialize(FILE *in, void *obj, Array_t *pointers, const TypeInfo_t *type);
|
||||
|
||||
#define Array$metamethods ((metamethods_t){ \
|
||||
#define Array$metamethods { \
|
||||
.as_text=Array$as_text, \
|
||||
.compare=Array$compare, \
|
||||
.equal=Array$equal, \
|
||||
@ -128,7 +128,7 @@ void Array$deserialize(FILE *in, void *obj, Array_t *pointers, const TypeInfo_t
|
||||
.is_none=Array$is_none, \
|
||||
.serialize=Array$serialize, \
|
||||
.deserialize=Array$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define Array$info(item_info) &((TypeInfo_t){.size=sizeof(Array_t), .align=__alignof__(Array_t), \
|
||||
.tag=ArrayInfo, .ArrayInfo.item=item_info, \
|
||||
|
@ -15,7 +15,7 @@ PUREFUNC bool Enum$is_none(const void *obj, const TypeInfo_t *type);
|
||||
void Enum$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type);
|
||||
void Enum$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo_t *type);
|
||||
|
||||
#define Enum$metamethods ((metamethods_t){ \
|
||||
#define Enum$metamethods { \
|
||||
.as_text=Enum$as_text, \
|
||||
.compare=Enum$compare, \
|
||||
.equal=Enum$equal, \
|
||||
@ -23,9 +23,9 @@ void Enum$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo_
|
||||
.is_none=Enum$is_none, \
|
||||
.serialize=Enum$serialize, \
|
||||
.deserialize=Enum$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define PackedDataEnum$metamethods ((metamethods_t){ \
|
||||
#define PackedDataEnum$metamethods { \
|
||||
.hash=PackedData$hash, \
|
||||
.compare=Enum$compare, \
|
||||
.equal=PackedData$equal, \
|
||||
@ -33,6 +33,6 @@ void Enum$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo_
|
||||
.is_none=Enum$is_none, \
|
||||
.serialize=Enum$serialize, \
|
||||
.deserialize=Enum$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
|
||||
|
@ -17,12 +17,12 @@ int64_t get_function_line_num(void *fn);
|
||||
Text_t Func$as_text(const void *fn, bool colorize, const TypeInfo_t *type);
|
||||
PUREFUNC bool Func$is_none(const void *obj, const TypeInfo_t*);
|
||||
|
||||
#define Func$metamethods ((metamethods_t){ \
|
||||
#define Func$metamethods { \
|
||||
.as_text=Func$as_text, \
|
||||
.is_none=Func$is_none, \
|
||||
.serialize=cannot_serialize, \
|
||||
.deserialize=cannot_deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define Function$info(typestr) &((TypeInfo_t){.size=sizeof(void*), .align=__alignof__(void*), \
|
||||
.tag=FunctionInfo, .FunctionInfo.type_str=typestr, \
|
||||
|
@ -33,14 +33,14 @@ Text_t Optional$as_text(const void *obj, bool colorize, const TypeInfo_t *type);
|
||||
void Optional$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type);
|
||||
void Optional$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo_t *type);
|
||||
|
||||
#define Optional$metamethods ((metamethods_t){ \
|
||||
#define Optional$metamethods { \
|
||||
.hash=Optional$hash, \
|
||||
.compare=Optional$compare, \
|
||||
.equal=Optional$equal, \
|
||||
.as_text=Optional$as_text, \
|
||||
.serialize=Optional$serialize, \
|
||||
.deserialize=Optional$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define Optional$info(_size, _align, t) &((TypeInfo_t){.size=_size, .align=_align, \
|
||||
.tag=OptionalInfo, .OptionalInfo.type=t, \
|
||||
|
@ -20,14 +20,14 @@ void Pointer$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeIn
|
||||
#define POINTER_TYPE(_sigil, _pointed) (&(TypeInfo_t){\
|
||||
.size=sizeof(void*), .align=alignof(void*), .tag=PointerInfo, .PointerInfo.sigil=_sigil, .PointerInfo.pointed=_pointed})
|
||||
|
||||
#define Pointer$metamethods ((metamethods_t){ \
|
||||
#define Pointer$metamethods { \
|
||||
.as_text=Pointer$as_text, \
|
||||
.compare=Pointer$compare, \
|
||||
.equal=Pointer$equal, \
|
||||
.is_none=Pointer$is_none, \
|
||||
.serialize=Pointer$serialize, \
|
||||
.deserialize=Pointer$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define Pointer$info(sigil_expr, pointed_info) &((TypeInfo_t){.size=sizeof(void*), .align=__alignof__(void*), \
|
||||
.tag=PointerInfo, .PointerInfo={.sigil=sigil_expr, .pointed=pointed_info}, \
|
||||
|
@ -17,7 +17,7 @@ PUREFUNC bool Struct$is_none(const void *obj, const TypeInfo_t *type);
|
||||
void Struct$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeInfo_t *type);
|
||||
void Struct$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo_t *type);
|
||||
|
||||
#define Struct$metamethods ((metamethods_t){ \
|
||||
#define Struct$metamethods { \
|
||||
.hash=Struct$hash, \
|
||||
.compare=Struct$compare, \
|
||||
.equal=Struct$equal, \
|
||||
@ -25,9 +25,9 @@ void Struct$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInf
|
||||
.is_none=Struct$is_none, \
|
||||
.serialize=Struct$serialize, \
|
||||
.deserialize=Struct$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define PackedData$metamethods ((metamethods_t){ \
|
||||
#define PackedData$metamethods { \
|
||||
.hash=PackedData$hash, \
|
||||
.compare=Struct$compare, \
|
||||
.equal=PackedData$equal, \
|
||||
@ -35,6 +35,6 @@ void Struct$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInf
|
||||
.is_none=Struct$is_none, \
|
||||
.serialize=Struct$serialize, \
|
||||
.deserialize=Struct$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
|
||||
|
@ -92,7 +92,7 @@ void Table$deserialize(FILE *in, void *outval, Array_t *pointers, const TypeInfo
|
||||
|
||||
extern const TypeInfo_t CStrToVoidStarTable;
|
||||
|
||||
#define Table$metamethods ((metamethods_t){ \
|
||||
#define Table$metamethods { \
|
||||
.as_text=Table$as_text, \
|
||||
.compare=Table$compare, \
|
||||
.equal=Table$equal, \
|
||||
@ -100,7 +100,7 @@ extern const TypeInfo_t CStrToVoidStarTable;
|
||||
.is_none=Table$is_none, \
|
||||
.serialize=Table$serialize, \
|
||||
.deserialize=Table$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
#define Table$info(key_expr, value_expr) &((TypeInfo_t){.size=sizeof(Table_t), .align=__alignof__(Table_t), \
|
||||
.tag=TableInfo, .TableInfo.key=key_expr, .TableInfo.value=value_expr, .metamethods=Table$metamethods})
|
||||
|
@ -86,7 +86,7 @@ MACROLIKE int32_t Text$get_grapheme(Text_t text, int64_t index)
|
||||
extern const TypeInfo_t Text$info;
|
||||
extern Text_t EMPTY_TEXT;
|
||||
|
||||
#define Text$metamethods ((metamethods_t){ \
|
||||
#define Text$metamethods { \
|
||||
.as_text=Text$as_text, \
|
||||
.hash=Text$hash, \
|
||||
.compare=Text$compare, \
|
||||
@ -94,6 +94,6 @@ extern Text_t EMPTY_TEXT;
|
||||
.is_none=Text$is_none, \
|
||||
.serialize=Text$serialize, \
|
||||
.deserialize=Text$deserialize, \
|
||||
})
|
||||
}
|
||||
|
||||
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
|
||||
|
Loading…
Reference in New Issue
Block a user