Changes in / [3d1e617:4df85197]
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/GenPoly.cc
r3d1e617 r4df85197 64 64 return false; 65 65 } 66 66 67 67 /// Replaces a TypeInstType by its referrent in the environment, if applicable 68 68 Type* replaceTypeInst( Type* type, const TypeSubstitution* env ) { … … 78 78 Type *isPolyType( Type *type, const TypeSubstitution *env ) { 79 79 type = replaceTypeInst( type, env ); 80 80 81 81 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { 82 82 return type; … … 91 91 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) { 92 92 type = replaceTypeInst( type, env ); 93 93 94 94 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { 95 95 if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) { … … 106 106 Type *isPolyPtr( Type *type, const TypeSubstitution *env ) { 107 107 type = replaceTypeInst( type, env ); 108 108 109 109 if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) { 110 110 return isPolyType( ptr->get_base(), env ); … … 115 115 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) { 116 116 type = replaceTypeInst( type, env ); 117 117 118 118 if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) { 119 119 return isPolyType( ptr->get_base(), tyVars, env ); … … 129 129 while ( true ) { 130 130 type = replaceTypeInst( type, env ); 131 131 132 132 if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) { 133 133 type = ptr->get_base(); … … 146 146 while ( true ) { 147 147 type = replaceTypeInst( type, env ); 148 148 149 149 if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) { 150 150 type = ptr->get_base(); -
src/SymTab/Validate.cc
r3d1e617 r4df85197 291 291 292 292 namespace { 293 template< typename DWT Iterator>294 void fixFunctionList( DWT Iterator begin, DWTIterator end, FunctionType *func ) {293 template< typename DWTList > 294 void fixFunctionList( DWTList & dwts, FunctionType * func ) { 295 295 // the only case in which "void" is valid is where it is the only one in the list; then it should be removed 296 296 // entirely other fix ups are handled by the FixFunction class 297 typedef typename DWTList::iterator DWTIterator; 298 DWTIterator begin( dwts.begin() ), end( dwts.end() ); 297 299 if ( begin == end ) return; 298 300 FixFunction fixer; 299 301 DWTIterator i = begin; 300 *i = (*i 302 *i = (*i)->acceptMutator( fixer ); 301 303 if ( fixer.get_isVoid() ) { 302 304 DWTIterator j = i; 303 305 ++i; 304 func->get_parameters().erase( j );306 dwts.erase( j ); 305 307 if ( i != end ) { 306 308 throw SemanticError( "invalid type void in function type ", func ); … … 321 323 void Pass1::visit( FunctionType *func ) { 322 324 // Fix up parameters and return types 323 fixFunctionList( func->get_parameters() .begin(), func->get_parameters().end(), func );324 fixFunctionList( func->get_returnVals() .begin(), func->get_returnVals().end(), func );325 fixFunctionList( func->get_parameters(), func ); 326 fixFunctionList( func->get_returnVals(), func ); 325 327 Visitor::visit( func ); 326 328 }
Note: See TracChangeset
for help on using the changeset viewer.