Changeset 28e58fd for src/ResolvExpr/typeops.h
- Timestamp:
- Aug 25, 2017, 10:38:34 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 800d275
- Parents:
- af08051 (diff), 3eab308c (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/typeops.h
raf08051 r28e58fd 66 66 Cost castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 67 67 68 template< typename SrcIterator, typename DestIterator >69 Cost castCostList( SrcIterator srcBegin, SrcIterator srcEnd, DestIterator destBegin, DestIterator destEnd, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {70 Cost ret;71 if ( destBegin == destEnd ) {72 if ( srcBegin == srcEnd ) {73 return Cost::zero;74 } else {75 return Cost( 0, 0, 1 );76 } // if77 } // if78 while ( srcBegin != srcEnd && destBegin != destEnd ) {79 Cost thisCost = castCost( *srcBegin++, *destBegin++, indexer, env );80 if ( thisCost == Cost::infinity ) {81 return Cost::infinity;82 } // if83 ret += thisCost;84 } // while85 if ( srcBegin == srcEnd && destBegin == destEnd ) {86 return ret;87 } else {88 return Cost::infinity;89 } // if90 }91 92 68 // in ConversionCost.cc 93 69 Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ); 94 95 template< typename SrcIterator, typename DestIterator >96 Cost conversionCostList( SrcIterator srcBegin, SrcIterator srcEnd, DestIterator destBegin, DestIterator destEnd, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {97 Cost ret;98 while ( srcBegin != srcEnd && destBegin != destEnd ) {99 Cost thisCost = conversionCost( *srcBegin++, *destBegin++, indexer, env );100 if ( thisCost == Cost::infinity ) {101 return Cost::infinity;102 } // if103 ret += thisCost;104 } // while105 if ( srcBegin == srcEnd && destBegin == destEnd ) {106 return ret;107 } else {108 return Cost::infinity;109 } // if110 }111 70 112 71 // in PtrsAssignable.cc
Note:
See TracChangeset
for help on using the changeset viewer.