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/field-init.hh | |
Diffstat (limited to 'tiger-compiler/src/ast/field-init.hh')
| -rw-r--r-- | tiger-compiler/src/ast/field-init.hh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/field-init.hh b/tiger-compiler/src/ast/field-init.hh new file mode 100644 index 0000000..9ea18b2 --- /dev/null +++ b/tiger-compiler/src/ast/field-init.hh @@ -0,0 +1,55 @@ +/** + ** \file ast/field-init.hh + ** \brief Declaration of ast::FieldInit. + */ + +#pragma once + +#include <ast/ast.hh> +#include <ast/exp.hh> +#include <misc/symbol.hh> + +namespace ast +{ + /// FieldInit. + class FieldInit : public Ast + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct a FieldInit node. + FieldInit(const Location& location, misc::symbol name, Exp* init); + FieldInit(const FieldInit&) = delete; + FieldInit& operator=(const FieldInit&) = delete; + /// Destroy a FieldInit node. + ~FieldInit() 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 name of the field. + misc::symbol name_get() const; + /// Set name of the field. + void name_set(misc::symbol); + /// Return initial value of the field. + const Exp& init_get() const; + /// Return initial value of the field. + Exp& init_get(); + /** \} */ + + protected: + /// Name of the field. + misc::symbol name_; + /// Initial value of the field. + Exp* init_; + }; +} // namespace ast +#include <ast/field-init.hxx> |
