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/record-exp.hh | |
Diffstat (limited to 'tiger-compiler/src/ast/record-exp.hh')
| -rw-r--r-- | tiger-compiler/src/ast/record-exp.hh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/record-exp.hh b/tiger-compiler/src/ast/record-exp.hh new file mode 100644 index 0000000..f0ba79e --- /dev/null +++ b/tiger-compiler/src/ast/record-exp.hh @@ -0,0 +1,57 @@ +/** + ** \file ast/record-exp.hh + ** \brief Declaration of ast::RecordExp. + */ + +#pragma once + +#include <ast/exp.hh> +#include <ast/field-init.hh> +#include <ast/name-ty.hh> + +namespace ast +{ + /// RecordExp. + class RecordExp : public Exp + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct a RecordExp node. + RecordExp(const Location& location, + NameTy* type_name, + fieldinits_type* fields); + RecordExp(const RecordExp&) = delete; + RecordExp& operator=(const RecordExp&) = delete; + /// Destroy a RecordExp node. + ~RecordExp() 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 identifier of the record type. + const NameTy& type_name_get() const; + /// Return identifier of the record type. + NameTy& type_name_get(); + /// Return list of field initializations. + const fieldinits_type& fields_get() const; + /// Return list of field initializations. + fieldinits_type& fields_get(); + /** \} */ + + protected: + /// Identifier of the record type. + NameTy* type_name_; + /// List of field initializations. + fieldinits_type* fields_; + }; +} // namespace ast +#include <ast/record-exp.hxx> |
