- File:
-
- 1 edited
-
src/ResolvExpr/ConversionCost.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r982f95d r6d53e779 22 22 #include "Common/GC.h" // for new_static_root 23 23 #include "ResolvExpr/Cost.h" // for Cost 24 #include "ResolvExpr/TypeEnvironment.h" // for ClassRef, TypeEnvironment24 #include "ResolvExpr/TypeEnvironment.h" // for EqvClass, 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 ); 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 ); 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 }; 37 39 38 40 #if 0 … … 44 46 if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) { 45 47 PRINT( std::cerr << "type inst " << destAsTypeInst->name; ) 46 if ( ClassRefeqvClass = env.lookup( destAsTypeInst->name ) ) {47 if ( Type* boundTy = eqvClass.get_bound().type ) {48 return conversionCost( src, boundTy, indexer, env );48 if ( const EqvClass* eqvClass = env.lookup( destAsTypeInst->name ) ) { 49 if ( eqvClass->type ) { 50 return conversionCost( src, eqvClass->type, indexer, env ); 49 51 } else { 50 52 return Cost::infinity; … … 360 362 361 363 void ConversionCost::postvisit( TypeInstType *inst ) { 362 if ( ClassRefeqvClass = env.lookup( inst->name ) ) {363 cost = costFunc( eqvClass .get_bound().type, dest, indexer, env );364 if ( const EqvClass *eqvClass = env.lookup( inst->name ) ) { 365 cost = costFunc( eqvClass->type, dest, indexer, env ); 364 366 } else if ( TypeInstType *destAsInst = dynamic_cast< TypeInstType* >( dest ) ) { 365 367 if ( inst->name == destAsInst->name ) {
Note:
See TracChangeset
for help on using the changeset viewer.