- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r0bd3faf rc75b30a 279 279 conversionCostFromBasicToBasic( basicType, dstAsBasic ); 280 280 } else if ( const ast::EnumInstType * enumInst = dynamic_cast< const ast::EnumInstType * >( dst ) ) { 281 const ast::EnumDecl * enumDecl = enumInst->base.get(); 282 if ( enumDecl->isTyped && !enumDecl->base.get() ) { 283 cost = Cost::infinity; 284 } else if ( const ast::Type * enumType = enumDecl->base.get() ) { 285 if ( const ast::BasicType * enumTypeAsBasic = dynamic_cast<const ast::BasicType *>(enumType) ) { 286 conversionCostFromBasicToBasic( basicType, enumTypeAsBasic ); 287 } else { 288 cost = Cost::infinity; 289 } 281 auto enumDecl = enumInst->base; 282 if ( auto baseType = enumDecl->base.get() ) { 283 cost = costCalc( basicType, baseType, srcIsLvalue, symtab, env ); 284 cost.incUnsafe(); 290 285 } else { 291 286 cost = Cost::unsafe; … … 367 362 368 363 void ConversionCost::postvisit( const ast::EnumInstType * enumInstType ) { 369 const ast::EnumDecl * baseEnum = enumInstType->base;370 if ( const ast::Type * baseType = baseEnum->base ) {371 costCalc( baseType, dst, srcIsLvalue, symtab, env );372 } else {373 374 375 }364 // const ast::EnumDecl * baseEnum = enumInstType->base; 365 // if ( const ast::Type * baseType = baseEnum->base ) { 366 // costCalc( baseType, dst, srcIsLvalue, symtab, env ); 367 // } else { 368 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicType::SignedInt ) }; 369 cost = costCalc( integer, dst, srcIsLvalue, symtab, env ); 370 // } 376 371 if ( cost < Cost::unsafe ) { 377 372 cost.incSafe();
Note: See TracChangeset
for help on using the changeset viewer.