Ignore:
Timestamp:
Dec 11, 2020, 11:20:45 PM (4 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
5b9a0ae
Parents:
a6e0e4c
Message:

remove ParameterizedType? and put content into FunctionType?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/RenameVars.cc

    ra6e0e4c r361bf01  
    9393                }
    9494
    95                 template<typename NodeT>
    96                 const NodeT * openLevel( const NodeT * type ) {
     95                const ast::FunctionType * openLevel( const ast::FunctionType * type ) {
    9796                        if ( type->forall.empty() ) return type;
    9897
     
    10099
    101100                        // Load new names from this forall clause and perform renaming.
    102                         NodeT * mutType = ast::mutate( type );
     101                        auto mutType = ast::mutate( type );
    103102                        assert( type == mutType && "mutated type must be unique from ForallSubstitutor" );
    104103                        for ( ast::ptr< ast::TypeDecl > & td : mutType->forall ) {
     104                                assertf(dynamic_cast<ast::FunctionType *>(mutType), "renaming vars in non-function type");
    105105                                std::ostringstream output;
    106106                                output << "_" << resetCount << "_" << level << "_" << td->name;
     
    119119                }
    120120
    121                 void closeLevel( const ast::ParameterizedType * type ) {
     121                void closeLevel( const ast::FunctionType * type ) {
    122122                        if ( type->forall.empty() ) return;
    123123
     
    149149                        return renaming.openLevel( type );
    150150                }
     151
     152                /*
    151153                const ast::StructInstType * previsit( const ast::StructInstType * type ) {
    152154                        return renaming.openLevel( type );
     
    158160                        return renaming.openLevel( type );
    159161                }
     162                */
     163
    160164                const ast::TypeInstType * previsit( const ast::TypeInstType * type ) {
    161                         return renaming.rename( renaming.openLevel( type ) );
     165                        return renaming.rename( type );
    162166                }
    163                 void postvisit( const ast::ParameterizedType * type ) {
     167                void postvisit( const ast::FunctionType * type ) {
    164168                        renaming.closeLevel( type );
    165169                }
Note: See TracChangeset for help on using the changeset viewer.