Changeset 4a8c875 for src/SynTree


Ignore:
Timestamp:
May 27, 2016, 2:38:19 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
2a7e29b
Parents:
9554d9b (diff), e24955a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/TypeSubstitution.cc

    r9554d9b r4a8c875  
    7272Type *TypeSubstitution::lookup( std::string formalType ) const {
    7373        TypeEnvType::const_iterator i = typeEnv.find( formalType );
     74       
     75        // break on not in substitution set
     76        if ( i == typeEnv.end() ) return 0;
     77       
     78        // attempt to transitively follow TypeInstType links.
     79        while ( TypeInstType *actualType = dynamic_cast< TypeInstType* >( i->second ) ) {
     80                const std::string& typeName = actualType->get_name();
     81               
     82                // break cycles in the transitive follow
     83                if ( formalType == typeName ) break;
     84               
     85                // Look for the type this maps to, returning previous mapping if none-such
     86                i = typeEnv.find( typeName );
     87                if ( i == typeEnv.end() ) return actualType;
     88        }
     89       
     90        // return type from substitution set
     91        return i->second;
     92       
     93#if 0
    7494        if ( i == typeEnv.end() ) {
    7595                return 0;
     
    7797                return i->second;
    7898        } // if
     99#endif
    79100}
    80101
Note: See TracChangeset for help on using the changeset viewer.