TraversingVisitor::visit(func);
}
-void InlineableFunctionLocator::visit(Conditional &)
+void InlineableFunctionLocator::visit(Conditional &cond)
{
+ TraversingVisitor::visit(cond);
inlineable.erase(current_function);
}
-void InlineableFunctionLocator::visit(Iteration &)
+void InlineableFunctionLocator::visit(Iteration &iter)
{
+ TraversingVisitor::visit(iter);
inlineable.erase(current_function);
}
-void InlineableFunctionLocator::visit(Return &)
+void InlineableFunctionLocator::visit(Return &ret)
{
+ TraversingVisitor::visit(ret);
if(return_count)
inlineable.erase(current_function);
++return_count;
TraversingVisitor::visit(func);
}
+void FunctionInliner::visit(Conditional &cond)
+{
+ visit_and_inline(cond.condition);
+ cond.body.visit(*this);
+}
+
+void FunctionInliner::visit(Iteration &iter)
+{
+ SetForScope<Block *> set_block(current_block, &iter.body);
+ if(iter.init_statement)
+ iter.init_statement->visit(*this);
+ /* Skip the condition and loop expression parts because they're executed on
+ every iteration of the loop */
+ iter.body.visit(*this);
+}
+
void FunctionInliner::visit(Return &ret)
{
if(ret.expression)
virtual void visit(ExpressionStatement &);
virtual void visit(VariableDeclaration &);
virtual void visit(FunctionDeclaration &);
+ virtual void visit(Conditional &);
+ virtual void visit(Iteration &);
virtual void visit(Return &);
};