Changes in src/GenPoly/GenPoly.cc [4da152a:c8837e5]
- File:
-
- 1 edited
-
src/GenPoly/GenPoly.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/GenPoly.cc
r4da152a rc8837e5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Oct 24 15:19:00 202213 // Update Count : 1 712 // Last Modified On : Fri Oct 7 15:25:00 2022 13 // Update Count : 16 14 14 // 15 15 … … 118 118 } 119 119 120 const Type* replaceTypeInst( const Type* type, const TypeSubstitution* env ) {121 if ( ! env ) return type;122 if ( auto typeInst = dynamic_cast< const TypeInstType* >( type ) ) {123 Type *newType = env->lookup( typeInst->get_name() );124 if ( newType ) return newType;125 }126 return type;127 }128 129 120 const ast::Type * replaceTypeInst(const ast::Type * type, const ast::TypeSubstitution * env) { 130 121 if (!env) return type; 131 if ( auto typeInst = dynamic_cast<const ast::TypeInstType*>(type)) {122 if (auto typeInst = dynamic_cast<const ast::TypeInstType*> (type)) { 132 123 auto newType = env->lookup(typeInst); 133 124 if (newType) return newType; … … 203 194 204 195 if ( auto inst = dynamic_cast< const ast::TypeInstType * >( type ) ) { 205 if ( typeVars.find( *inst) != typeVars.end() ) return type;196 if ( typeVars.find( inst->typeString() ) != typeVars.end() ) return type; 206 197 } else if ( auto array = dynamic_cast< const ast::ArrayType * >( type ) ) { 207 198 return isPolyType( array->base, subst ); … … 236 227 237 228 if ( auto inst = dynamic_cast<ast::TypeInstType const *>( type ) ) { 238 auto var = typeVars.find( *inst);229 auto var = typeVars.find( inst->name ); 239 230 if ( var != typeVars.end() && var->second.isComplete ) { 240 return inst; 231 241 232 } 242 233 } else if ( auto inst = dynamic_cast<ast::StructInstType const *>( type ) ) { … … 793 784 794 785 void addToTypeVarMap( const ast::TypeInstType * type, TypeVarMap & typeVars ) { 795 typeVars.insert( *type, ast::TypeDecl::Data( type->base ) );786 typeVars.insert( type->typeString(), ast::TypeDecl::Data( type->base ) ); 796 787 } 797 788 … … 825 816 } 826 817 818 void printTypeVarMap( std::ostream &os, const TypeVarMap & typeVars ) { 819 for ( auto const & pair : typeVars ) { 820 os << pair.first << " (" << pair.second << ") "; 821 } // for 822 os << std::endl; 823 } 824 827 825 } // namespace GenPoly 828 826
Note:
See TracChangeset
for help on using the changeset viewer.