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