[Spicy] Clean up representation of EVT record fields.

This commit is contained in:
Robin Sommer 2023-08-21 10:25:49 +02:00
parent cdadd934ce
commit 36a6770e98
No known key found for this signature in database
GPG key ID: 6BEDA4DA6B8B23E3
5 changed files with 41 additions and 18 deletions

View file

@ -151,9 +151,17 @@ extern TypePtr create_enum_type(
const std::string& ns, const std::string& id,
const hilti::rt::Vector<std::tuple<std::string, hilti::rt::integer::safe<int64_t>>>& labels);
using RecordField = std::tuple<std::string, TypePtr, hilti::rt::Bool, hilti::rt::Bool>; // (ID, type, optional, &log)
struct RecordField {
std::string id; /**< name of record field */
TypePtr type; /**< Spicy-side type object */
bool is_optional; /**< true if field is optional */
bool is_log; /**< true if field has `&log` */
};
extern TypePtr create_record_type(const std::string& ns, const std::string& id,
const hilti::rt::Vector<RecordField>& fields);
extern RecordField create_record_field(const std::string& id, const TypePtr& type, hilti::rt::Bool is_optional,
hilti::rt::Bool is_log);
extern TypePtr create_table_type(TypePtr key, std::optional<TypePtr> value);
extern TypePtr create_vector_type(const TypePtr& elem);