Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    rbbf2cb1 r0522ebe  
    288288            cost = Cost::unsafe;
    289289                }
    290         } else if ( dynamic_cast< const ast::EnumPosType *>(dst) ) {
    291                 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
    292                 cost = costCalc( basicType, integer, srcIsLvalue, symtab, env );
    293290        }
    294291}
     
    366363}
    367364
    368 void ConversionCost::postvisit( const ast::EnumInstType * inst ) {
     365void ConversionCost::postvisit( const ast::EnumInstType * ) {
     366        static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
     367        cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
     368        // }
     369        if ( cost < Cost::unsafe ) {
     370                cost.incSafe();
     371        }
     372}
     373
     374void ConversionCost::postvisit( const ast::EnumPosType * ) {
    369375        static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
    370376        cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
     
    372378                cost.incSafe();
    373379        }
    374 }
    375 
    376 void ConversionCost::postvisit( const ast::EnumPosType * src ) {
    377         if ( auto dstBase = dynamic_cast<const ast::EnumPosType *>( dst ) ) {
    378                 // cost = costCalc( src->instance, dstBase->instance, srcIsLvalue, symtab, env );
    379                 // if ( cost < Cost::unsafe ) cost.incSafe();
    380                 cost = Cost::zero;
    381         }
    382         // if ( auto dstBase = dynamic_cast<const ast::EnumInstType *>( dst ) ) {
    383         //      cost = costCalc( src->instance, dstBase, srcIsLvalue, symtab, env );
    384         //      if ( cost < Cost::unsafe ) cost.incSafe();
    385         // }
    386         else {
    387                 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
    388                 cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
    389                 if ( cost < Cost::unsafe ) {
    390                         cost.incSafe();
    391                 }
    392         }
    393 
    394380}
    395381
Note: See TracChangeset for help on using the changeset viewer.