summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/nil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/type/nil.cc')
-rw-r--r--tiger-compiler/src/type/nil.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/tiger-compiler/src/type/nil.cc b/tiger-compiler/src/type/nil.cc
new file mode 100644
index 0000000..d3c663c
--- /dev/null
+++ b/tiger-compiler/src/type/nil.cc
@@ -0,0 +1,34 @@
+/**
+ ** \file type/nil.cc
+ ** \brief Implementation for type/nil.hh.
+ */
+
+#include <ostream>
+
+#include <type/class.hh>
+#include <type/nil.hh>
+#include <type/record.hh>
+#include <type/visitor.hh>
+
+namespace type
+{
+ /*------.
+ | Nil. |
+ `------*/
+
+ void Nil::accept(ConstVisitor& v) const { v(*this); }
+
+ void Nil::accept(Visitor& v) { v(*this); }
+
+ bool Nil::compatible_with(const Type& other) const
+ {
+ // FIXME DONE: Some code was deleted here
+ return dynamic_cast<const Record*>(&other.actual()) != nullptr
+ || dynamic_cast<const Class*>(&other.actual()) != nullptr;
+ }
+
+ const Type* Nil::record_type_get() const { return record_type_; }
+
+ void Nil::record_type_set(const Type& type) const { record_type_ = &type; }
+
+} // namespace type