- File:
-
- 1 edited
-
src/ResolvExpr/ConversionCost.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r0522ebe rbbf2cb1 288 288 cost = Cost::unsafe; 289 289 } 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 ); 290 293 } 291 294 } … … 363 366 } 364 367 365 void 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 374 void ConversionCost::postvisit( const ast::EnumPosType * ) { 368 void ConversionCost::postvisit( const ast::EnumInstType * inst ) { 375 369 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) }; 376 370 cost = costCalc( integer, dst, srcIsLvalue, symtab, env ); … … 378 372 cost.incSafe(); 379 373 } 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 380 394 } 381 395
Note:
See TracChangeset
for help on using the changeset viewer.