Changeset cdb4eaa for src/ResolvExpr/ConversionCost.cc
- Timestamp:
- Apr 17, 2024, 2:27:56 PM (7 months ago)
- Branches:
- master
- Children:
- 748c751
- Parents:
- 76c7addb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r76c7addb rcdb4eaa 362 362 363 363 void ConversionCost::postvisit( const ast::EnumInstType * inst ) { 364 if ( inst->base && inst->base->base ) { 365 if ( auto dstAsAttr = dynamic_cast<const ast::EnumAttrType *>( dst ) ) { 366 auto instAsAttr = ast::EnumAttrType( inst, dstAsAttr->attr ); 367 if ( instAsAttr.match(dstAsAttr) ) { 368 cost.incUnsafe(); 369 } 370 371 } else if ( auto dstAsInst = dynamic_cast<const ast::EnumInstType *>( dst ) ) { 372 if (inst->base && dstAsInst->base) { 373 if (inst->base == dstAsInst->base) { 374 cost.incUnsafe(); 375 } 376 } 377 } else { 378 auto instAsVal = ast::EnumAttrType( inst, ast::EnumAttribute::Value ); 379 cost = costCalc( &instAsVal, dst, srcIsLvalue, symtab, env ); 380 if ( cost < Cost::infinity ) { 381 cost.incUnsafe(); 382 } 383 } 384 return; 364 if ( auto dstAsInst = dynamic_cast<const ast::EnumInstType *>( dst ) ) { 365 if (inst->base && dstAsInst->base) { 366 if (inst->base->name == dstAsInst->base->name) { 367 cost = Cost::zero; 368 return; 369 } 370 } 385 371 } 386 372 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) };
Note: See TracChangeset
for help on using the changeset viewer.