Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/PolyMutator.cc

    r8688ce1 r09f800b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // PolyMutator.cc --
     7// PolyMutator.cc -- 
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:26:22 2016
    13 // Update Count     : 16
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Fri Aug 14 15:28:50 2015
     13// Update Count     : 11
    1414//
    1515
     
    2727        }
    2828
    29         PolyMutator::PolyMutator() : scopeTyVars( (TypeDecl::Kind)-1 ), env( 0 ) {}
     29        PolyMutator::PolyMutator() : env( 0 ) {
     30        }
    3031
    3132        void PolyMutator::mutateStatementList( std::list< Statement* > &statements ) {
     
    6364                                env = expr->get_env();
    6465                        }
    65                         // xxx - should env be cloned (or moved) onto the result of the mutate?
    6666                        return expr->acceptMutator( *this );
    6767                } else {
     
    9999
    100100        Statement * PolyMutator::mutate(SwitchStmt *switchStmt) {
    101                 mutateStatementList( switchStmt->get_statements() );
     101                mutateStatementList( switchStmt->get_branches() );
     102                switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
     103                return switchStmt;
     104        }
     105
     106        Statement * PolyMutator::mutate(ChooseStmt *switchStmt) {
     107                mutateStatementList( switchStmt->get_branches() );
    102108                switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
    103109                return switchStmt;
     
    139145                return untypedExpr;
    140146        }
    141 
    142 
     147 
     148 
    143149        Initializer *PolyMutator::mutate( SingleInit *singleInit ) {
    144150                singleInit->set_value( mutateExpression( singleInit->get_value() ) );
     
    146152        }
    147153
     154
     155        /* static class method */
     156        void PolyMutator::makeTyVarMap( Type *type, TyVarMap &tyVarMap ) {
     157                for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
     158                        assert( *tyVar );
     159                        tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
     160                }
     161                if ( PointerType *pointer = dynamic_cast< PointerType* >( type ) ) {
     162                        makeTyVarMap( pointer->get_base(), tyVarMap );
     163                }
     164        }
    148165} // namespace GenPoly
    149166
Note: See TracChangeset for help on using the changeset viewer.