- Timestamp:
- Apr 17, 2024, 2:27:56 PM (8 months ago)
- Branches:
- master
- Children:
- 748c751
- Parents:
- 76c7addb
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CandidateFinder.cpp
r76c7addb rcdb4eaa 513 513 // add new result 514 514 assert( common ); 515 // auto attrType = common.as<ast::EnumAttrType>();516 // if ( attrType && ( attrType->attr == ast::EnumAttribute::Value ) ) {517 // auto callExpr = new ast::UntypedExpr(518 // expr->location, new ast::NameExpr( expr->location, "valueE"), {expr} );519 // CandidateFinder finder( context, env );520 // finder.find( callExpr );521 // CandidateList winners = findMinCost( finder.candidates );522 // if (winners.size() != 1) {523 // SemanticError( callExpr, "Ambiguous expression in valueE" );524 // }525 // CandidateRef & choice = winners.front();526 // choice->expr = referenceToRvalueConversion( choice->expr, choice->cost );527 528 // results.emplace_back(529 // i, choice->expr,530 // std::move( env ), std::move( need ), std::move( have ), std::move( open ),531 // nextArg + 1, nTuples, expl.cost, expl.exprs.size() == 1 ? 0 : 1, j );532 // } else {533 515 results.emplace_back( 534 516 i, expr, std::move( env ), std::move( need ), std::move( have ), std::move( open ), … … 921 903 CandidateList winners = findMinCost( finder.candidates ); 922 904 if (winners.size() != 1) { 923 SemanticError( callExpr, "Ambiguous expression in valueE " );905 SemanticError( callExpr, "Ambiguous expression in valueE..." ); 924 906 } 925 907 CandidateRef & choice = winners.front(); 926 // choice->cost.incSafe();908 choice->cost.incVar(); 927 909 candidates.emplace_back( std::move(choice) ); 928 910 } … … 1801 1783 CandidateList winners = findMinCost( finder.candidates ); 1802 1784 if (winners.size() != 1) { 1803 SemanticError( callExpr, "Ambiguous expression in valueE " );1785 SemanticError( callExpr, "Ambiguous expression in valueE..." ); 1804 1786 } 1805 1787 CandidateRef & choice = winners.front(); … … 2161 2143 CandidateList winners = findMinCost( finder.candidates ); 2162 2144 if (winners.size() != 1) { 2163 SemanticError( callExpr, "Ambiguous expression in valueE " );2145 SemanticError( callExpr, "Ambiguous expression in valueE..." ); 2164 2146 } 2165 2147 CandidateRef & choice = winners.front(); -
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 ) }; -
src/main.cc
r76c7addb rcdb4eaa 382 382 DUMP( exprp, std::move( transUnit ) ); 383 383 PASS( "Replace Pseudo Func", Validate::replacePseudoFunc, transUnit ); 384 DUMP( reppseu, std::move( transUnit ) );385 384 PASS( "Fix Init", InitTweak::fix, transUnit, buildingLibrary() ); // Here 386 385 PASS( "Erase With", ResolvExpr::eraseWith, transUnit ); … … 534 533 { "instgen", genericsp, true, "print AST after instantiate generics" }, 535 534 { "bbox", bboxp, true, "print AST before box pass" }, 536 { "bcodegen", bcodegenp, true, "print AST before code generation" }, 537 { "reppseu", reppseu, true, "print AST after replacing pseudo functions" } 535 { "bcodegen", bcodegenp, true, "print AST before code generation" } 538 536 }; 539 537 enum { printoptsSize = sizeof( printopts ) / sizeof( printopts[0] ) };
Note: See TracChangeset
for help on using the changeset viewer.