Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    r982f95d r6d53e779  
    2222#include "Common/GC.h"                   // for new_static_root
    2323#include "ResolvExpr/Cost.h"             // for Cost
    24 #include "ResolvExpr/TypeEnvironment.h"  // for ClassRef, TypeEnvironment
     24#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    2525#include "SymTab/Indexer.h"              // for Indexer
    2626#include "SynTree/Declaration.h"         // for TypeDecl, NamedTypeDecl
     
    2929
    3030namespace 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 };
    3739
    3840#if 0
     
    4446                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    4547                        PRINT( std::cerr << "type inst " << destAsTypeInst->name; )
    46                         if ( ClassRef eqvClass = 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 );
    4951                                } else {
    5052                                        return Cost::infinity;
     
    360362
    361363        void ConversionCost::postvisit( TypeInstType *inst ) {
    362                 if ( ClassRef eqvClass = 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 );
    364366                } else if ( TypeInstType *destAsInst = dynamic_cast< TypeInstType* >( dest ) ) {
    365367                        if ( inst->name == destAsInst->name ) {
Note: See TracChangeset for help on using the changeset viewer.