Changeset f5234f3
- Timestamp:
- Nov 26, 2015, 3:48:04 PM (9 years ago)
- 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, string, with_gc
- Children:
- b81096f
- Parents:
- 32d281d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
r32d281d rf5234f3 508 508 handleRefType( inst, other ); 509 509 if ( ! result ) return; 510 // Check that parameters of type unify, if any510 // Check that parameters of types unify, if any 511 511 std::list< Expression* > params = inst->get_parameters(); 512 if ( ! params.empty() ) { 513 std::list< TypeDecl* > *baseParams = inst->get_baseParameters(); 514 if ( ! baseParams ) { 512 std::list< Expression* > otherParams = ((RefType*)other)->get_parameters(); 513 514 std::list< Expression* >::const_iterator it = params.begin(), jt = otherParams.begin(); 515 for ( ; it != params.end() && jt != otherParams.end(); ++it, ++jt ) { 516 TypeExpr *param = dynamic_cast< TypeExpr* >(*it); 517 assert(param && "Aggregate parameters should be type expressions"); 518 TypeExpr *otherParam = dynamic_cast< TypeExpr* >(*jt); 519 assert(otherParam && "Aggregate parameters should be type expressions"); 520 521 if ( ! unifyExact( param->get_type(), otherParam->get_type(), env, needAssertions, haveAssertions, openVars, WidenMode(false, false), indexer ) ) { 515 522 result = false; 516 523 return; 517 524 } 518 std::list< Expression* >::const_iterator it = params.begin();519 std::list< TypeDecl* >::const_iterator baseIt = baseParams->begin();520 while ( it != params.end() && baseIt != baseParams->end()) {521 TypeExpr *param = dynamic_cast< TypeExpr* >(*it);522 assert(param && "Aggregate parameters should be type expressions");523 TypeInstType baseType(Type::Qualifiers(), (*baseIt)->get_name(), *baseIt);524 if ( ! unifyExact( param->get_type(), &baseType, env, needAssertions, haveAssertions, openVars, WidenMode(false, false), indexer ) ) {525 result = false;526 return;527 }528 529 ++it;530 ++baseIt;531 }532 if ( it != params.end() || baseIt != baseParams->end() ) {533 result = false;534 }535 525 } 526 result = ( it == params.end() && jt == otherParams.end() ); 536 527 } 537 528
Note: See TracChangeset
for help on using the changeset viewer.