Change RecordVals to get resized at time of RecordType redef

Opposed to unconditionally checking all RecordVals whether they need to
be resized after parsing ends.
This commit is contained in:
Jon Siwek 2020-03-12 15:51:37 -07:00
parent da5fca7163
commit a61ad9ea5c
4 changed files with 21 additions and 13 deletions

View file

@ -924,14 +924,17 @@ public:
// Extend the underlying arrays of record instances created during
// parsing to match the number of fields in the record type (they may
// mismatch as a result of parse-time record type redefinitions.
static void ResizeParseTimeRecords();
static void ResizeParseTimeRecords(RecordType* rt);
static void DoneParsing();
protected:
Val* DoClone(CloneState* state) override;
BroObj* origin;
static vector<RecordVal*> parse_time_records;
using RecordTypeValMap = std::unordered_map<RecordType*, std::vector<IntrusivePtr<RecordVal>>>;
static RecordTypeValMap parse_time_records;
};
class EnumVal : public Val {