1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // XXX.cc -- |
---|
8 | // |
---|
9 | // Author : Richard C. Bilson |
---|
10 | // Created On : Mon May 18 07:44:20 2015 |
---|
11 | // Last Modified By : |
---|
12 | // Last Modified On : |
---|
13 | // Update Count : 0 |
---|
14 | // |
---|
15 | /* |
---|
16 | * This file is part of the Cforall project |
---|
17 | * |
---|
18 | * $Id: PolyMutator.h,v 1.8 2005/08/29 20:14:13 rcbilson Exp $ |
---|
19 | * |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef GENPOLY_POLYMUTATOR_H |
---|
23 | #define GENPOLY_POLYMUTATOR_H |
---|
24 | |
---|
25 | #include <map> |
---|
26 | #include <string> |
---|
27 | #include <list> |
---|
28 | |
---|
29 | #include "GenPoly.h" |
---|
30 | |
---|
31 | #include "SynTree/SynTree.h" |
---|
32 | #include "SynTree/Declaration.h" |
---|
33 | #include "SynTree/Mutator.h" |
---|
34 | |
---|
35 | namespace GenPoly { |
---|
36 | |
---|
37 | class PolyMutator : public Mutator |
---|
38 | { |
---|
39 | public: |
---|
40 | PolyMutator(); |
---|
41 | |
---|
42 | virtual CompoundStmt* mutate(CompoundStmt *compoundStmt); |
---|
43 | virtual Statement* mutate(IfStmt *ifStmt); |
---|
44 | virtual Statement* mutate(WhileStmt *whileStmt); |
---|
45 | virtual Statement* mutate(ForStmt *forStmt); |
---|
46 | virtual Statement* mutate(SwitchStmt *switchStmt); |
---|
47 | virtual Statement* mutate(ChooseStmt *chooseStmt); |
---|
48 | virtual Statement* mutate(CaseStmt *caseStmt); |
---|
49 | virtual Statement* mutate(TryStmt *returnStmt); |
---|
50 | virtual Statement* mutate(CatchStmt *catchStmt); |
---|
51 | virtual Statement* mutate(ExprStmt *catchStmt); |
---|
52 | virtual Statement* mutate(ReturnStmt *catchStmt); |
---|
53 | |
---|
54 | virtual Expression* mutate(UntypedExpr *untypedExpr); |
---|
55 | |
---|
56 | // template method |
---|
57 | virtual void doBeginScope() {} |
---|
58 | virtual void doEndScope() {} |
---|
59 | |
---|
60 | protected: |
---|
61 | void mutateStatementList( std::list< Statement* > &statements ); |
---|
62 | Statement* mutateStatement( Statement *stmt ); |
---|
63 | Expression* mutateExpression( Expression *expr ); |
---|
64 | static void makeTyVarMap( Type *type, TyVarMap &tyVarMap ); |
---|
65 | |
---|
66 | TyVarMap scopeTyVars; |
---|
67 | TypeSubstitution *env; |
---|
68 | std::list< Statement* > stmtsToAdd; |
---|
69 | std::list< Statement* > stmtsToAddAfter; |
---|
70 | }; |
---|
71 | |
---|
72 | } // namespace |
---|
73 | |
---|
74 | #endif /* #ifndef GENPOLY_POLYMUTATOR_H */ |
---|
75 | // Local Variables: // |
---|
76 | // tab-width: 4 // |
---|
77 | // mode: c++ // |
---|
78 | // compile-command: "make install" // |
---|
79 | // End: // |
---|