summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/call-exp.hh
blob: a4b6c9081b3190976c0f04b8c1dd80f997adc20e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
 ** \file ast/call-exp.hh
 ** \brief Declaration of ast::CallExp.
 */

#pragma once

#include <ast/exp.hh>
#include <ast/function-dec.hh>
#include <misc/symbol.hh>

namespace ast
{
  /// CallExp.
  class CallExp : public Exp
  {
  public:
    /** \name Ctor & dtor.
     ** \{ */
    /// Construct a CallExp node.
    CallExp(const Location& location, misc::symbol name, exps_type* args);
    CallExp(const CallExp&) = delete;
    CallExp& operator=(const CallExp&) = delete;
    /// Destroy a CallExp node.
    ~CallExp() 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 called function.
    misc::symbol name_get() const;
    /// Set identifier of the called function.
    void name_set(misc::symbol);
    /// Return list of arguments passed to the function.
    const exps_type& args_get() const;
    /// Return list of arguments passed to the function.
    exps_type& args_get();
    // FIXME DONE: Some code was deleted here.
    /// Return definition site.
    const FunctionDec* def_get() const;
    FunctionDec* def_get();
    // FIXME DONE: Some code was deleted here.
    /// Set definition site.
    void def_set(FunctionDec*);
    /** \} */

  protected:
    /// Identifier of the called function.
    misc::symbol name_;
    /// List of arguments passed to the function.
    exps_type* args_;
    /// Definition site.
    FunctionDec* def_ = nullptr;
  };
} // namespace ast
#include <ast/call-exp.hxx>