Changeset fd344aa
 Timestamp:
 Aug 11, 2017, 10:11:27 AM (7 years ago)
 Branches:
 ADT, aaronthesis, armeh, astexperimental, cleanupdtors, deferred_resn, demangler, enum, forallpointerdecay, jacob/cs343translation, jenkinssandbox, master, newast, newastuniqueexpr, newenv, no_list, persistentindexer, pthreademulation, qualifiedEnum, resolvnew, with_gc
 Children:
 9236060
 Parents:
 83a071f9
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/ResolvExpr/typeops.h
r83a071f9 rfd344aa 67 67 Cost castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 68 68 69 template< typename SrcIterator, typename DestIterator >70 Cost castCostList( SrcIterator srcBegin, SrcIterator srcEnd, DestIterator destBegin, DestIterator destEnd, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {71 Cost ret;72 if ( destBegin == destEnd ) {73 if ( srcBegin == srcEnd ) {74 return Cost::zero;75 } else {76 return Cost( 0, 0, 1 );77 } // if78 } // if79 while ( srcBegin != srcEnd && destBegin != destEnd ) {80 Cost thisCost = castCost( *srcBegin++, *destBegin++, indexer, env );81 if ( thisCost == Cost::infinity ) {82 return Cost::infinity;83 } // if84 ret += thisCost;85 } // while86 if ( srcBegin == srcEnd && destBegin == destEnd ) {87 return ret;88 } else {89 return Cost::infinity;90 } // if91 }92 93 69 // in ConversionCost.cc 94 70 Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 95 96 template< typename SrcIterator, typename DestIterator >97 Cost conversionCostList( SrcIterator srcBegin, SrcIterator srcEnd, DestIterator destBegin, DestIterator destEnd, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {98 Cost ret;99 while ( srcBegin != srcEnd && destBegin != destEnd ) {100 Cost thisCost = conversionCost( *srcBegin++, *destBegin++, indexer, env );101 if ( thisCost == Cost::infinity ) {102 return Cost::infinity;103 } // if104 ret += thisCost;105 } // while106 if ( srcBegin == srcEnd && destBegin == destEnd ) {107 return ret;108 } else {109 return Cost::infinity;110 } // if111 }112 71 113 72 // in PtrsAssignable.cc
Note: See TracChangeset
for help on using the changeset viewer.