From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/src/ast/field.hh | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tiger-compiler/src/ast/field.hh (limited to 'tiger-compiler/src/ast/field.hh') 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 +#include +#include + +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 -- cgit v1.2.3