Ignore:
Timestamp:
Mar 1, 2024, 4:32:35 PM (4 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
bbf2cb1
Parents:
f1149ac
Message:

Add prototype of succ function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    rf1149ac r00eaeb8  
    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 );
    290293        }
    291294}
     
    366369        static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
    367370        cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
    368         // }
    369371        if ( cost < Cost::unsafe ) {
    370372                cost.incSafe();
     
    373375
    374376void ConversionCost::postvisit( const ast::EnumPosType * ) {
    375         static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
    376         cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
    377         if ( cost < Cost::unsafe ) {
    378                 cost.incSafe();
    379         }
     377        if ( dynamic_cast<const ast::EnumPosType *>( dst ) ) {
     378                // Tempoarary
     379                cost = Cost::zero;
     380        } else {
     381                static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
     382                cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
     383                if ( cost < Cost::unsafe ) {
     384                        cost.incSafe();
     385                }
     386        }
     387
    380388}
    381389
Note: See TracChangeset for help on using the changeset viewer.