BIT-1288: Improve coercion of &default expressions.

This commit is contained in:
Jon Siwek 2014-11-18 12:40:16 -06:00
parent 08d843c258
commit f214158cc5
5 changed files with 50 additions and 1 deletions

View file

@ -45,6 +45,13 @@ public:
attr_tag Tag() const { return tag; }
Expr* AttrExpr() const { return expr; }
// Up to the caller to decide if previous expr can be unref'd since it may
// not always be safe. e.g. expressions (at time of writing) don't always
// keep careful track of referencing their operands, so doing something
// like SetAttrExpr(coerce(AttrExpr())) must not completely unref the
// previous expr as the new expr depends on it.
void SetAttrExpr(Expr* e) { expr = e; }
int RedundantAttrOkay() const
{ return tag == ATTR_REDEF || tag == ATTR_OPTIONAL; }