logic (other than in profiling) for assignments that yield separate values

This commit is contained in:
Vern Paxson 2022-01-07 14:18:42 -08:00
parent e22d279fdf
commit fa142438fe
3 changed files with 39 additions and 2 deletions

View file

@ -959,6 +959,15 @@ public:
bool IsTemp() const { return is_temp; }
void SetIsTemp() { is_temp = true; }
// The following is a hack that's used in "when" expressions to support
// assignments to new locals, like "when ( (local l = foo()) && ...".
// These methods return the value to use when evaluating such
// assignments. That would normally be the RHS of the assignment,
// but to get when's to work in a convenient fashion, for them it's
// instead boolean T.
ValPtr AssignVal() { return val; }
const ValPtr& AssignVal() const { return val; }
protected:
bool TypeCheck(const AttributesPtr& attrs = nullptr);
bool TypeCheckArithmetics(TypeTag bt1, TypeTag bt2);