[moulette] switched to boost::signals2
[ozulis.git] / src / ozulis / visitors / type-checker.hh
blobb2636d615ecb4281c8efe04c325fb2ca10bbf20c
1 #ifndef VISITORS_TYPE_CHECKER_VISITOR_HH
2 # define VISITORS_TYPE_CHECKER_VISITOR_HH
4 # include <utility>
5 # include <map>
7 # include <ozulis/visitors/visitor.hh>
9 namespace ozulis
11 namespace visitors
13 /// @defgroup Visitors
14 /**
15 * @brief Check ast's type is semanticaly correct
16 * @ingroup Visitors
18 class TypeChecker : public Visitor<TypeChecker>
20 public:
21 TypeChecker();
22 virtual ~TypeChecker();
24 /** @brief type check the node, and may replace it */
25 template <typename T>
26 T check(T node);
28 /** @brief initialise the visitor's table */
29 static void initBase();
31 /** @brief add a cast to a member if it is needed */
32 static void homogenizeTypes(ast::BinaryExp & node);
33 void pointerArith(ast::Exp * pointer, ast::Exp * offset);
35 ast::FunctionPtr currentFunction;
36 ast::Scope * scope;
37 ast::NodePtr replacement;
42 #endif /* !VISITORS_TYPE_CHECKER_VISITOR_HH */