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/method-call-exp.hh | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 tiger-compiler/src/ast/method-call-exp.hh (limited to 'tiger-compiler/src/ast/method-call-exp.hh') diff --git a/tiger-compiler/src/ast/method-call-exp.hh b/tiger-compiler/src/ast/method-call-exp.hh new file mode 100644 index 0000000..ef728d9 --- /dev/null +++ b/tiger-compiler/src/ast/method-call-exp.hh @@ -0,0 +1,70 @@ +/** + ** \file ast/method-call-exp.hh + ** \brief Declaration of ast::MethodCallExp. + */ + +#pragma once + +#include +#include +#include + +namespace ast +{ + /** \class ast::MethodCallExp + ** \brief Method call. + ** + ** A method call is \em not a function call in the strict sense + ** of object-oriented programming. Inheritance is used as a + ** factoring tool here. + */ + + class MethodCallExp : public CallExp + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct a MethodCallExp node. + MethodCallExp(const Location& location, + misc::symbol name, + exps_type* args, + Var* object); + MethodCallExp(const MethodCallExp&) = delete; + MethodCallExp& operator=(const MethodCallExp&) = delete; + /// Destroy a MethodCallExp node. + ~MethodCallExp() 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 object on which the method is called. + const Var& object_get() const; + /// Return the object on which the method is called. + Var& object_get(); + // FIXME DONE: Some code was deleted here. + /// Return definition site. + const MethodDec* def_get() const; + MethodDec* def_get(); + + // FIXME DONE: Some code was deleted here. + /// Set definition site. + void def_set(MethodDec*); + + /** \} */ + + protected: + /// The object on which the method is called. + Var* object_; + /// Definition site. + MethodDec* def_ = nullptr; + }; +} // namespace ast +#include -- cgit v1.2.3