[51587aa] | 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 | // |
---|
[1ba88a0] | 7 | // PolyMutator.h -- |
---|
[51587aa] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[4e06c1e] | 11 | // Last Modified By : Peter A. Buhr |
---|
[6b0b624] | 12 | // Last Modified On : Sat Jul 22 09:20:31 2017 |
---|
| 13 | // Update Count : 7 |
---|
[51587aa] | 14 | // |
---|
[51b7345] | 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[51b7345] | 17 | |
---|
[08fc48f] | 18 | #include <list> // for list |
---|
[51b7345] | 19 | |
---|
[08fc48f] | 20 | #include "GenPoly.h" // for TyVarMap |
---|
| 21 | #include "SynTree/Mutator.h" // for Mutator |
---|
| 22 | #include "SynTree/SynTree.h" // for Visitor Nodes |
---|
[51b7345] | 23 | |
---|
| 24 | namespace GenPoly { |
---|
[01aeade] | 25 | class PolyMutator : public Mutator { |
---|
| 26 | public: |
---|
[1ba88a0] | 27 | typedef Mutator Parent; |
---|
| 28 | using Parent::mutate; |
---|
| 29 | |
---|
[01aeade] | 30 | PolyMutator(); |
---|
[51b7345] | 31 | |
---|
[01aeade] | 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); |
---|
[1ba88a0] | 42 | |
---|
[01aeade] | 43 | virtual Expression* mutate(UntypedExpr *untypedExpr); |
---|
[d9fa60a] | 44 | virtual Expression* mutate( StmtExpr *stmtExpr ); |
---|
[09f800b] | 45 | |
---|
| 46 | virtual Initializer* mutate(SingleInit *SingleInit); |
---|
| 47 | |
---|
[01aeade] | 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 ); |
---|
[1ba88a0] | 55 | |
---|
[01aeade] | 56 | TyVarMap scopeTyVars; |
---|
| 57 | TypeSubstitution *env; |
---|
| 58 | std::list< Statement* > stmtsToAdd; |
---|
| 59 | std::list< Statement* > stmtsToAddAfter; |
---|
| 60 | }; |
---|
[1ba88a0] | 61 | } // namespace |
---|
[51b7345] | 62 | |
---|
[51587aa] | 63 | // Local Variables: // |
---|
| 64 | // tab-width: 4 // |
---|
| 65 | // mode: c++ // |
---|
| 66 | // compile-command: "make install" // |
---|
| 67 | // End: // |
---|