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/assign-exp.hh | |
Diffstat (limited to 'tiger-compiler/src/ast/assign-exp.hh')
| -rw-r--r-- | tiger-compiler/src/ast/assign-exp.hh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/assign-exp.hh b/tiger-compiler/src/ast/assign-exp.hh new file mode 100644 index 0000000..ca575ec --- /dev/null +++ b/tiger-compiler/src/ast/assign-exp.hh @@ -0,0 +1,54 @@ +/** + ** \file ast/assign-exp.hh + ** \brief Declaration of ast::AssignExp. + */ + +#pragma once + +#include <ast/exp.hh> +#include <ast/var.hh> + +namespace ast +{ + /// AssignExp. + class AssignExp : public Exp + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct an AssignExp node. + AssignExp(const Location& location, Var* var, Exp* exp); + AssignExp(const AssignExp&) = delete; + AssignExp& operator=(const AssignExp&) = delete; + /// Destroy an AssignExp node. + ~AssignExp() override; + /** \} */ + + /// \name Visitors entry point. + /// \{ */ + /// Accept a const visitor \a v. + void accept(ConstVisitor& v) const override; + /// Accept a non-const visitor \a v. + void accept(Visitor& v) override; + /// \} + + /** \name Accessors. + ** \{ */ + /// Return reference to the affected variable. + const Var& var_get() const; + /// Return reference to the affected variable. + Var& var_get(); + /// Return assigned value. + const Exp& exp_get() const; + /// Return assigned value. + Exp& exp_get(); + /** \} */ + + protected: + /// Reference to the affected variable. + Var* var_; + /// Assigned value. + Exp* exp_; + }; +} // namespace ast +#include <ast/assign-exp.hxx> |
