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/assert-exp.hh | |
Diffstat (limited to 'tiger-compiler/src/ast/assert-exp.hh')
| -rw-r--r-- | tiger-compiler/src/ast/assert-exp.hh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/assert-exp.hh b/tiger-compiler/src/ast/assert-exp.hh new file mode 100644 index 0000000..6650ca4 --- /dev/null +++ b/tiger-compiler/src/ast/assert-exp.hh @@ -0,0 +1,42 @@ +/** + ** \file ast/assert-exp.hh + ** \brief Declaration of ast::AssertExp. + */ + +#pragma once + +#include <ast/exp.hh> + +namespace ast +{ + // AssertExp + class AssertExp : public Exp + { + public: + /// Construct an AssertExp node. + AssertExp(const Location& location, Exp* cond); + AssertExp(const AssertExp&) = delete; + AssertExp& operator=(const AssertExp&) = delete; + + /// Destroy an AssertExp node. + ~AssertExp() override; + + + // Here are the visitor methods + /// Accept a const visitor \a v. + void accept(ConstVisitor& v) const override; + /// Accept a non-const visitor \a v. + void accept(Visitor& v) override; + + // Some basic getters + // Return the asserted condition in const form + const Exp& cond_get() const; + // Return the asserted condition + Exp& cond_get(); + + protected: + // The condition that the assertion will evaluate + Exp* cond_; + }; +} // namespace ast +#include <ast/assert-exp.hxx> |
