fix for analyzing variable usage inside of table initializers

This commit is contained in:
Vern Paxson 2021-05-30 17:36:41 -07:00
parent 86aafb7c84
commit 22af54dda2

View file

@ -812,6 +812,17 @@ TraversalCode RD_Decorate::PreExpr(const Expr* e)
auto lhs = a->Op1();
auto rhs = a->Op2();
if ( lhs->Tag() == EXPR_LIST &&
rhs->GetType()->Tag() != TYPE_ANY )
{
// This combination occurs only for assignments used
// to initialize table entries. Treat it as references
// to both the lhs and the rhs, not as an assignment.
mgr.SetPreFromPre(a->GetOp1().get(), a);
mgr.SetPreFromPre(a->GetOp2().get(), a);
return TC_CONTINUE;
}
bool rhs_aggr = IsAggr(rhs);
mgr.SetPreFromPre(lhs, a);