1 | #ifndef _FUNFIX_H_ |
---|
2 | #define _FUNFIX_H_ |
---|
3 | |
---|
4 | #include "SynTree/Mutator.h" |
---|
5 | |
---|
6 | #include "SynTree/Declaration.h" |
---|
7 | #include "SynTree/Expression.h" |
---|
8 | #include "SynTree/Statement.h" |
---|
9 | #include "SynTree/Type.h" |
---|
10 | |
---|
11 | #include "SymTab/Indexer.h" |
---|
12 | #include "ResolvExpr/Resolver.h" |
---|
13 | #include "ResolvExpr/AlternativeFinder.h" |
---|
14 | |
---|
15 | namespace Tuples { |
---|
16 | class FunctionFixer : public Mutator |
---|
17 | { |
---|
18 | typedef Mutator Parent; |
---|
19 | |
---|
20 | public: |
---|
21 | FunctionFixer() {} |
---|
22 | virtual ~FunctionFixer() {} |
---|
23 | virtual Type *mutate( FunctionType *functionType ); |
---|
24 | virtual Statement *mutate( ReturnStmt *retStmt ); |
---|
25 | virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ); |
---|
26 | virtual Expression *mutate( VariableExpr *variableExpr); |
---|
27 | |
---|
28 | // indexer runs |
---|
29 | virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) |
---|
30 | { index.visit( objectDecl ); return objectDecl; } |
---|
31 | virtual TypeDecl *mutate( TypeDecl *typeDecl ) |
---|
32 | { index.visit( typeDecl ); return typeDecl; } |
---|
33 | virtual TypedefDecl *mutate( TypedefDecl *typeDecl ) |
---|
34 | { index.visit( typeDecl ); return typeDecl; } |
---|
35 | virtual StructDecl *mutate( StructDecl *aggregateDecl ) |
---|
36 | { index.visit( aggregateDecl ); return aggregateDecl; } |
---|
37 | virtual UnionDecl *mutate( UnionDecl *aggregateDecl ) |
---|
38 | { index.visit( aggregateDecl ); return aggregateDecl; } |
---|
39 | virtual EnumDecl *mutate( EnumDecl *aggregateDecl ) |
---|
40 | { index.visit( aggregateDecl ); return aggregateDecl; } |
---|
41 | |
---|
42 | virtual Type *mutate( StructInstType *aggrInst ) |
---|
43 | { index.visit( aggrInst ); return aggrInst; } |
---|
44 | virtual Type *mutate( UnionInstType *aggrInst ) |
---|
45 | { index.visit( aggrInst ); return aggrInst; } |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | private: |
---|
50 | std::list< DeclarationWithType * > rets; |
---|
51 | SymTab::Indexer index; |
---|
52 | }; |
---|
53 | |
---|
54 | } // namespace Tuples |
---|
55 | |
---|
56 | |
---|
57 | #endif // #ifndef _FUNFIX_H_ |
---|
58 | |
---|
59 | /* |
---|
60 | Local Variables: |
---|
61 | mode: c++ |
---|
62 | End: |
---|
63 | */ |
---|