return !unused_nodes.empty();
}
-void UnusedTypeRemover::visit(Literal &literal)
+void UnusedTypeRemover::visit(RefPtr<Expression> &expr)
{
- unused_nodes.erase(literal.type);
-}
-
-void UnusedTypeRemover::visit(UnaryExpression &unary)
-{
- unused_nodes.erase(unary.type);
- TraversingVisitor::visit(unary);
-}
-
-void UnusedTypeRemover::visit(BinaryExpression &binary)
-{
- unused_nodes.erase(binary.type);
- TraversingVisitor::visit(binary);
-}
-
-void UnusedTypeRemover::visit(TernaryExpression &ternary)
-{
- unused_nodes.erase(ternary.type);
- TraversingVisitor::visit(ternary);
-}
-
-void UnusedTypeRemover::visit(FunctionCall &call)
-{
- unused_nodes.erase(call.type);
- TraversingVisitor::visit(call);
+ unused_nodes.erase(expr->type);
+ TraversingVisitor::visit(expr);
}
void UnusedTypeRemover::visit(BasicTypeDeclaration &type)
void UnusedTypeRemover::visit(VariableDeclaration &var)
{
unused_nodes.erase(var.type_declaration);
+ TraversingVisitor::visit(var);
}
void UnusedTypeRemover::visit(InterfaceBlock &iface)
bool apply(Stage &);
private:
- virtual void visit(Literal &);
- virtual void visit(UnaryExpression &);
- virtual void visit(BinaryExpression &);
- virtual void visit(TernaryExpression &);
- virtual void visit(FunctionCall &);
+ virtual void visit(RefPtr<Expression> &);
virtual void visit(BasicTypeDeclaration &);
virtual void visit(ImageTypeDeclaration &);
virtual void visit(StructDeclaration &);