-
Notifications
You must be signed in to change notification settings - Fork 1
/
return_check.h
46 lines (41 loc) · 1.04 KB
/
return_check.h
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
#ifndef LATTE_RETURN_CHECK_H
#define LATTE_RETURN_CHECK_H
#include "functions_types.h"
#include <iostream>
/*
* Class checking whether all non-void functions actually return.
* */
namespace latte_type_check
{
class ReturnCheck : public Visitor
{
public:
ReturnCheck(FunTypesEnv const& _funEnv) : funEnv(_funEnv) {}
void visitPProg(PProg* p);
void visitTFnDef(TFnDef* p);
void visitBBlock(BBlock* p);
void visitSEmpty(SEmpty* p);
void visitSBStmt(SBStmt* p);
void visitSDecl(SDecl* p);
void visitSAss(SAss* p);
void visitSIncr(SIncr* p);
void visitSDecr(SDecr* p);
void visitSRet(SRet* p);
void visitSVRet(SVRet* p);
void visitSCond(SCond* p);
void visitSCondElse(SCondElse* p);
void visitSWhile(SWhile* p);
void visitSSExp(SSExp* p);
void visitListTopDef(ListTopDef* p);
void visitListStmt(ListStmt* p);
void visitIdent(Ident x);
Errors const& getErrors();
private:
FunTypesEnv funEnv;
Environment<std::shared_ptr<LatteType>> typeEnv;
Errors err;
std::shared_ptr<Ident> funName;
bool reachable;
};
}
#endif