- File:
-
- 1 edited
-
src/ResolvExpr/ConversionCost.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r6d53e779 r982f95d 22 22 #include "Common/GC.h" // for new_static_root 23 23 #include "ResolvExpr/Cost.h" // for Cost 24 #include "ResolvExpr/TypeEnvironment.h" // for EqvClass, TypeEnvironment24 #include "ResolvExpr/TypeEnvironment.h" // for ClassRef, TypeEnvironment 25 25 #include "SymTab/Indexer.h" // for Indexer 26 26 #include "SynTree/Declaration.h" // for TypeDecl, NamedTypeDecl … … 29 29 30 30 namespace ResolvExpr { 31 const Cost Cost::zero = Cost{ 0, 0, 0, 0, 0, 0 }; 32 const Cost Cost::infinity = Cost{ -1, -1, -1, 1, -1, -1 }; 33 const Cost Cost::unsafe = Cost{ 1, 0, 0, 0, 0, 0 }; 34 const Cost Cost::poly = Cost{ 0, 1, 0, 0, 0, 0 }; 35 const Cost Cost::var = Cost{ 0, 0, 1, 0, 0, 0 }; 36 const Cost Cost::spec = Cost{ 0, 0, 0, -1, 0, 0 }; 37 const Cost Cost::safe = Cost{ 0, 0, 0, 0, 1, 0 }; 38 const Cost Cost::reference = Cost{ 0, 0, 0, 0, 0, 1 }; 31 const Cost Cost::zero = Cost( 0, 0, 0, 0 ); 32 const Cost Cost::infinity = Cost( -1, -1, -1, -1 ); 33 const Cost Cost::unsafe = Cost( 1, 0, 0, 0 ); 34 const Cost Cost::poly = Cost( 0, 1, 0, 0 ); 35 const Cost Cost::safe = Cost( 0, 0, 1, 0 ); 36 const Cost Cost::reference = Cost( 0, 0, 0, 1 ); 39 37 40 38 #if 0 … … 46 44 if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) { 47 45 PRINT( std::cerr << "type inst " << destAsTypeInst->name; ) 48 if ( const EqvClass*eqvClass = env.lookup( destAsTypeInst->name ) ) {49 if ( eqvClass->type ) {50 return conversionCost( src, eqvClass->type, indexer, env );46 if ( ClassRef eqvClass = env.lookup( destAsTypeInst->name ) ) { 47 if ( Type* boundTy = eqvClass.get_bound().type ) { 48 return conversionCost( src, boundTy, indexer, env ); 51 49 } else { 52 50 return Cost::infinity; … … 362 360 363 361 void ConversionCost::postvisit( TypeInstType *inst ) { 364 if ( const EqvClass *eqvClass = env.lookup( inst->name ) ) {365 cost = costFunc( eqvClass ->type, dest, indexer, env );362 if ( ClassRef eqvClass = env.lookup( inst->name ) ) { 363 cost = costFunc( eqvClass.get_bound().type, dest, indexer, env ); 366 364 } else if ( TypeInstType *destAsInst = dynamic_cast< TypeInstType* >( dest ) ) { 367 365 if ( inst->name == destAsInst->name ) {
Note:
See TracChangeset
for help on using the changeset viewer.