Ignore:
Timestamp:
Sep 19, 2016, 4:39:33 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
aefcc3b
Parents:
3c13c03
Message:

decouple code that uses Type's forall list from std::list in preparation for trying to replace with a managed list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/TypeSubstitution.cc

    r3c13c03 r8c49c0e  
    7272Type *TypeSubstitution::lookup( std::string formalType ) const {
    7373        TypeEnvType::const_iterator i = typeEnv.find( formalType );
    74        
     74
    7575        // break on not in substitution set
    7676        if ( i == typeEnv.end() ) return 0;
    77        
     77
    7878        // attempt to transitively follow TypeInstType links.
    7979        while ( TypeInstType *actualType = dynamic_cast< TypeInstType* >( i->second ) ) {
    8080                const std::string& typeName = actualType->get_name();
    81                
     81
    8282                // break cycles in the transitive follow
    8383                if ( formalType == typeName ) break;
    84                
     84
    8585                // Look for the type this maps to, returning previous mapping if none-such
    8686                i = typeEnv.find( typeName );
    8787                if ( i == typeEnv.end() ) return actualType;
    8888        }
    89        
     89
    9090        // return type from substitution set
    9191        return i->second;
    92        
     92
    9393#if 0
    9494        if ( i == typeEnv.end() ) {
     
    149149        // bind type variables from forall-qualifiers
    150150        if ( freeOnly ) {
    151                 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     151                for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    152152                        boundVars.insert( (*tyvar )->get_name() );
    153153                } // for
     
    163163        // bind type variables from forall-qualifiers
    164164        if ( freeOnly ) {
    165                 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     165                for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    166166                        boundVars.insert( (*tyvar )->get_name() );
    167167                } // for
Note: See TracChangeset for help on using the changeset viewer.