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 | // PolyMutator.h -- |
---|
8 | // |
---|
9 | // Author : Richard C. Bilson |
---|
10 | // Created On : Mon May 18 07:44:20 2015 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Sat Jul 22 09:20:31 2017 |
---|
13 | // Update Count : 7 |
---|
14 | // |
---|
15 | |
---|
16 | #pragma once |
---|
17 | |
---|
18 | #include <list> // for list |
---|
19 | |
---|
20 | #include "GenPoly.h" // for TyVarMap |
---|
21 | #include "SynTree/Mutator.h" // for Mutator |
---|
22 | #include "SynTree/SynTree.h" // for Visitor Nodes |
---|
23 | |
---|
24 | namespace GenPoly { |
---|
25 | class PolyMutator : public Mutator { |
---|
26 | public: |
---|
27 | typedef Mutator Parent; |
---|
28 | using Parent::mutate; |
---|
29 | |
---|
30 | PolyMutator(); |
---|
31 | |
---|
32 | virtual CompoundStmt* mutate(CompoundStmt *compoundStmt); |
---|
33 | virtual Statement* mutate(IfStmt *ifStmt); |
---|
34 | virtual Statement* mutate(WhileStmt *whileStmt); |
---|
35 | virtual Statement* mutate(ForStmt *forStmt); |
---|
36 | virtual Statement* mutate(SwitchStmt *switchStmt); |
---|
37 | virtual Statement* mutate(CaseStmt *caseStmt); |
---|
38 | virtual Statement* mutate(TryStmt *returnStmt); |
---|
39 | virtual Statement* mutate(CatchStmt *catchStmt); |
---|
40 | virtual Statement* mutate(ExprStmt *catchStmt); |
---|
41 | virtual Statement* mutate(ReturnStmt *catchStmt); |
---|
42 | |
---|
43 | virtual Expression* mutate(UntypedExpr *untypedExpr); |
---|
44 | virtual Expression* mutate( StmtExpr *stmtExpr ); |
---|
45 | |
---|
46 | virtual Initializer* mutate(SingleInit *SingleInit); |
---|
47 | |
---|
48 | // template method |
---|
49 | virtual void doBeginScope() {} |
---|
50 | virtual void doEndScope() {} |
---|
51 | protected: |
---|
52 | void mutateStatementList( std::list< Statement* > &statements ); |
---|
53 | Statement* mutateStatement( Statement *stmt ); |
---|
54 | Expression* mutateExpression( Expression *expr ); |
---|
55 | |
---|
56 | TyVarMap scopeTyVars; |
---|
57 | TypeSubstitution *env; |
---|
58 | std::list< Statement* > stmtsToAdd; |
---|
59 | std::list< Statement* > stmtsToAddAfter; |
---|
60 | }; |
---|
61 | } // namespace |
---|
62 | |
---|
63 | // Local Variables: // |
---|
64 | // tab-width: 4 // |
---|
65 | // mode: c++ // |
---|
66 | // compile-command: "make install" // |
---|
67 | // End: // |
---|