-void ExpressionInliner::visit_and_record(RefPtr<Expression> &ptr)
-{
- r_ref_info = 0;
- ptr->visit(*this);
- if(r_ref_info && r_ref_info->expression && r_ref_info->available)
- {
- if(iteration_body && !r_ref_info->trivial)
- {
- /* Don't inline non-trivial expressions which were assigned outside
- an iteration statement. The iteration may run multiple times, which
- would cause the expression to also be evaluated multiple times. */
- Block *i = r_ref_info->assign_scope;
- for(; (i && i!=iteration_body); i=i->parent) ;
- if(!i)
- return;
- }
-
- if(r_ref_info->trivial)
- inline_expression(*r_ref_info->expression, ptr);
- else
- /* Record the inline point for a non-trivial expression but don't
- inline it yet. It might turn out it shouldn't be inlined after all. */
- r_ref_info->inline_point = &ptr;
- }
- r_ref_info = 0;
-}
-