diff options
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> |
