};
/** Removes conditional statements and loops where the condition can be
-determined as constant at compile time. */
+determined as constant at compile time. Also removes such statements where
+the body is empty and the condition has no side effects. */
class ConstantConditionEliminator: private TraversingVisitor
{
private:
NodeList<Statement>::iterator insert_point;
std::set<Node *> nodes_to_remove;
RefPtr<Expression> r_ternary_result;
+ bool r_external_side_effects;
public:
void apply(Stage &);
virtual void visit(Block &);
virtual void visit(RefPtr<Expression> &);
+ virtual void visit(UnaryExpression &);
+ virtual void visit(Assignment &);
virtual void visit(TernaryExpression &);
+ virtual void visit(FunctionCall &);
virtual void visit(Conditional &);
virtual void visit(Iteration &);
};