diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/src/type/nil.cc | |
Diffstat (limited to 'tiger-compiler/src/type/nil.cc')
| -rw-r--r-- | tiger-compiler/src/type/nil.cc | 34 |
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 |
