Changeset 361bf01 for src/ResolvExpr


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?

Location:
src/ResolvExpr
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    ra6e0e4c r361bf01  
    220220
    221221        void makeUnifiableVars(
    222                 const ast::ParameterizedType * type, ast::OpenVarSet & unifiableVars,
     222                const ast::FunctionType * type, ast::OpenVarSet & unifiableVars,
    223223                ast::AssertionSet & need
    224224        ) {
  • src/ResolvExpr/CastCost.cc

    ra6e0e4c r361bf01  
    165165                                } else {
    166166                                        ast::TypeEnvironment newEnv{ env };
    167                                         if ( auto wParams = pointerType->base.as< ast::ParameterizedType >() ) {
     167                                        if ( auto wParams = pointerType->base.as< ast::FunctionType >() ) {
    168168                                                newEnv.add( wParams->forall );
    169169                                        }
  • 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                }
  • src/ResolvExpr/Resolver.cc

    ra6e0e4c r361bf01  
    976976                        }
    977977
    978                         void previsit( const ast::Expr * ) {
     978                        void previsit( const ast::Expr * expr ) {
    979979                                if ( result ) { visit_children = false; }
     980                                if (expr->inferred.hasParams()) {
     981                                        for (auto & imp : expr->inferred.inferParams() ) {
     982                                                previsit(imp.second.expr);
     983                                        }
     984                                }
    980985                        }
    981986                };
  • src/ResolvExpr/Unify.cc

    ra6e0e4c r361bf01  
    898898                static void markAssertions(
    899899                        ast::AssertionSet & assn1, ast::AssertionSet & assn2,
    900                         const ast::ParameterizedType * type
     900                        const ast::FunctionType * type
    901901                ) {
    902902                        for ( const auto & tyvar : type->forall ) {
Note: See TracChangeset for help on using the changeset viewer.