Allow record_fields() string arguments that name a record type

This commit is contained in:
Jon Siwek 2019-11-01 12:46:17 -07:00
parent 295c28b48e
commit 63fe835acf
7 changed files with 92 additions and 35 deletions

View file

@ -75,6 +75,7 @@ class VectorType;
class TypeType;
class OpaqueType;
class EnumVal;
class TableVal;
const int DOES_NOT_MATCH_INDEX = 0;
const int MATCHES_INDEX_SCALAR = 1;
@ -483,6 +484,13 @@ public:
int NumFields() const { return num_fields; }
/**
* Returns a "record_field_table" value for introspection purposes.
* @param rv an optional record value, if given the values of
* all fields will be provided in the returned table.
*/
TableVal* GetRecordFieldsVal(const RecordVal* rv = nullptr) const;
// Returns 0 if all is ok, otherwise a pointer to an error message.
// Takes ownership of list.
const char* AddFields(type_decl_list* types, attr_list* attr);