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/ast/object-visitor.hxx | |
Diffstat (limited to 'tiger-compiler/src/ast/object-visitor.hxx')
| -rw-r--r-- | tiger-compiler/src/ast/object-visitor.hxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/object-visitor.hxx b/tiger-compiler/src/ast/object-visitor.hxx new file mode 100644 index 0000000..c4eccbb --- /dev/null +++ b/tiger-compiler/src/ast/object-visitor.hxx @@ -0,0 +1,69 @@ +/** + ** \file ast/object-visitor.hxx + ** \brief Implementation for ast/object-visitor.hh. + */ + +#pragma once + +#include <ast/all.hh> +#include <ast/object-visitor.hh> +#include <misc/contract.hh> + +namespace ast +{ + template <template <typename> class Const> + GenObjectVisitor<Const>::GenObjectVisitor() + : GenVisitor<Const>() + {} + + template <template <typename> class Const> + GenObjectVisitor<Const>::~GenObjectVisitor() + {} + + /*-------------------------------. + | Object-related visit methods. | + `-------------------------------*/ + + template <template <typename> class Const> + void GenObjectVisitor<Const>::operator()(const_t<ClassTy>& e) + { + // FIXME DONE: Some code was deleted here. + e.chunks_get().accept(*this); + } + + template <template <typename> class Const> + void GenObjectVisitor<Const>::operator()(const_t<MethodChunk>& e) + { + // FIXME DONE: Some code was deleted here. + for (const auto dec : e) + dec->accept(*this); + } + + template <template <typename> class Const> + void GenObjectVisitor<Const>::operator()(const_t<MethodDec>& e) + { + // FIXME DONE: Some code was deleted here. + e.formals_get().accept(*this); + if (e.result_get() != nullptr) + e.result_get()->accept(*this); + if (e.body_get() != nullptr) + e.body_get()->accept(*this); + } + + template <template <typename> class Const> + void GenObjectVisitor<Const>::operator()(const_t<MethodCallExp>& e) + { + // FIXME DONE: Some code was deleted here. + e.object_get().accept(*this); + for (auto arg : e.args_get()) + arg->accept(*this); + } + + template <template <typename> class Const> + void GenObjectVisitor<Const>::operator()(const_t<ObjectExp>& e) + { + // FIXME DONE: Some code was deleted here. + e.type_name_get().accept(*this); + } + +} // namespace ast |
