Changeset 7042c60 for src/ResolvExpr/ConversionCost.cc
- Timestamp:
- Apr 25, 2024, 3:48:17 PM (17 months ago)
- Branches:
- master
- Children:
- eb7586e
- Parents:
- cf191ac (diff), 55c97e4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
rcf191ac r7042c60 31 31 #define PRINT(x) 32 32 #endif 33 34 namespace { 33 35 34 36 // GENERATED START, DO NOT EDIT … … 152 154 ); 153 155 154 namespace {155 156 int localPtrsAssignable(const ast::Type * t1, const ast::Type * t2, 156 157 const ast::SymbolTable &, const ast::TypeEnvironment & env ) { … … 379 380 380 381 void ConversionCost::postvisit( const ast::EnumAttrType * src ) { 381 382 auto dstAsEnumAttrType = dynamic_cast<const ast::EnumAttrType *>(dst); 382 383 assert( src->attr != ast::EnumAttribute::Label ); 383 384 385 386 387 388 384 if ( src->attr == ast::EnumAttribute::Value ) { 385 if ( dstAsEnumAttrType && dstAsEnumAttrType->attr == ast::EnumAttribute::Value) { 386 cost = costCalc( src->instance, dstAsEnumAttrType->instance, srcIsLvalue, symtab, env ); 387 } else { 388 auto baseType = src->instance->base->base; 389 cost = costCalc( baseType, dst, srcIsLvalue, symtab, env ); 389 390 if ( cost < Cost::infinity ) { 390 391 cost.incUnsafe(); 391 392 } 392 393 394 395 396 397 398 399 400 401 402 403 404 393 } 394 } else { // ast::EnumAttribute::Posn 395 if ( auto dstBase = dynamic_cast<const ast::EnumInstType *>( dst ) ) { 396 cost = costCalc( src->instance, dstBase, srcIsLvalue, symtab, env ); 397 if ( cost < Cost::unsafe ) cost.incSafe(); 398 } else { 399 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicKind::SignedInt ) }; 400 cost = costCalc( integer, dst, srcIsLvalue, symtab, env ); 401 if ( cost < Cost::unsafe ) { 402 cost.incSafe(); 403 } 404 } 405 } 405 406 } 406 407
Note:
See TracChangeset
for help on using the changeset viewer.