ExpressionUse use;
use.reference = &expr;
use.ref_scope = current_block;
- use.blocked = access_write;
+ use.blocked = access_write || r_ref_info->blocked;
if(iteration_body && !r_ref_info->trivial)
{
r_trivial = true;
visit(assign.right);
- auto i = assignments.find(assign.target);
+ auto i = assignments.find(assign.target.declaration);
if(i!=assignments.end())
{
- if(iteration_body && i->second->expression)
+ if(iteration_body && i->second && i->second->expression)
{
/* Block inlining into previous references within the iteration
statement. On iterations after the first they would refer to the
u.blocked = (k==iteration_body);
}
+ for(; (i!=assignments.end() && i->first.declaration==assign.target.declaration); ++i)
+ if(targets_overlap(i->first, assign.target))
+ i->second->blocked = true;
+
expressions.push_back(ExpressionInfo());
ExpressionInfo &info = expressions.back();
info.target = assign.target;
info.assign_scope = current_block;
info.trivial = r_trivial;
- i->second = &info;
+ assignments[assign.target] = &info;
}
r_trivial = false;