[visitors] ported llvm asm generator
[ozulis.git] / src / ozulis / visitors / type-checker.hh
blob83b2e8d131c5a028a2e3272f27c4526189d1705a
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 that all expressions are correct (type)
16 * @ingroup Visitors
18 class TypeChecker : public Visitor<TypeChecker>
20 public:
21 TypeChecker();
22 virtual ~TypeChecker();
24 inline void setScope(ast::Scope * scope);
26 template <typename T>
27 void check(T *& node);
29 static void initBase();
31 static void homogenizeTypes(ast::BinaryExp & node);
32 void pointerArith(ast::Exp * pointer, ast::Exp * offset);
34 ast::Function * currentFunction;
35 ast::Scope * scope;
36 ast::Node * replacement;
41 # include "type-checker.hxx"
43 #endif /* !VISITORS_TYPE_CHECKER_VISITOR_HH */