summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/default-visitor.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/type/default-visitor.hxx')
-rw-r--r--tiger-compiler/src/type/default-visitor.hxx95
1 files changed, 95 insertions, 0 deletions
diff --git a/tiger-compiler/src/type/default-visitor.hxx b/tiger-compiler/src/type/default-visitor.hxx
new file mode 100644
index 0000000..02cbd15
--- /dev/null
+++ b/tiger-compiler/src/type/default-visitor.hxx
@@ -0,0 +1,95 @@
+/**
+ ** \file type/default-visitor.hxx
+ ** \brief Implementation for type/default-visitor.hh.
+ */
+
+#pragma once
+
+#include <misc/algorithm.hh>
+#include <type/class.hh>
+#include <type/default-visitor.hh>
+#include <type/types.hh>
+
+namespace type
+{
+ template <template <typename> class Const>
+ GenDefaultVisitor<Const>::GenDefaultVisitor()
+ : GenVisitor<Const>()
+ {}
+
+ template <template <typename> class Const>
+ GenDefaultVisitor<Const>::~GenDefaultVisitor() = default;
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Nil>&)
+ {}
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Void>&)
+ {}
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Int>&)
+ {}
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<String>&)
+ {}
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Named>& e)
+ {
+ // FIXME DONE: Some code was deleted here.
+ e.type_get()->accept(*this);
+ }
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Array>& e)
+ {
+ // FIXME DONE: Some code was deleted here.
+ e.get_element_type()->accept(*this);
+ }
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Record>& e)
+ {
+ // FIXME DONE: Some code was deleted here.
+ for (auto field : e)
+ {
+ field.type_get().accept(*this);
+ }
+ }
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Class>& e)
+ {
+ // FIXME DONE: Some code was deleted here.
+ for (auto attr : e.attrs_get())
+ {
+ attr.type_get().accept(*this);
+ }
+ for (auto meth : e.meths_get())
+ {
+ meth->accept(*this);
+ }
+ for (auto subclass : e.attrs_get())
+ {
+ subclass.type_get().accept(*this);
+ }
+ }
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Function>& e)
+ {
+ // FIXME DONE: Some code was deleted here.
+ e.formals_get().accept(*this);
+ e.result_get().accept(*this);
+ }
+
+ template <template <typename> class Const>
+ void GenDefaultVisitor<Const>::operator()(const_t<Method>& e)
+ {
+ e.Function::accept(*this);
+ }
+
+} // namespace type