blob: 2accb82619ab89abd78ec1a7ab1aca2ad9066063 (
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
|
/**
** \file type/function.hh
** \brief The class Function.
*/
#pragma once
#include <type/fwd.hh>
#include <type/record.hh>
#include <type/type.hh>
namespace type
{
/** \brief Function types.
**
** Encapsulate the signature of a function, i.e. the type structures
** of both function's arguments and its result. */
class Function : public Type
{
public:
/** \brief Construct a Function.
**
** \param formals type structures of formal arguments.
** \param result type structure of what function returns. */
Function(const Record* formals, const Type& result);
/** \brief Destructor.
**/
~Function() 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 type structures of the function's arguments.
const Record& formals_get() const;
/// Return the type structure of the function's result.
const Type& result_get() const;
/** \} */
// FIXME DONE: Some code was deleted here (Special implementation of "compatible_with" for Function).
bool compatible_with(const Type& other) const override;
protected:
/// Formals' types.
const Record* formals_;
/// Result's type.
const Type& result_;
};
} // namespace type
#include <type/function.hxx>
|