&on_change working for removals from tables.

Insertions and changes are still noops.
This commit is contained in:
Johanna Amann 2020-01-13 15:28:56 -08:00
parent 5b5d36cd83
commit b343cf9bb7
2 changed files with 73 additions and 11 deletions

View file

@ -879,10 +879,10 @@ public:
void InitTimer(double delay);
void DoExpire(double t);
// If the &default attribute is not a function, or the functon has
// already been initialized, this does nothing. Otherwise, evaluates
// the function in the frame allowing it to capture its closure.
void InitDefaultFunc(Frame* f);
// If the &default attribute is not a function, or the functon has
// already been initialized, this does nothing. Otherwise, evaluates
// the function in the frame allowing it to capture its closure.
void InitDefaultFunc(Frame* f);
unsigned int MemoryAllocation() const override;
@ -922,6 +922,12 @@ protected:
// takes ownership of the reference.
double CallExpireFunc(Val *idx);
// Enum for the different kinds of changes an &on_change handler can see
enum OnChangeType { element_new, element_changed, element_removed };
// Calls &change_func. Takes ownership of old_value.
void CallChangeFunc(const Val* index, Val* old_value, OnChangeType tpe);
Val* DoClone(CloneState* state) override;
TableType* table_type;