Changeset a16764a6 for src/ResolvExpr/Resolver.cc
- Timestamp:
- Feb 28, 2018, 4:48:22 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 446ffa3
- Parents:
- 6a8df56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r6a8df56 ra16764a6 174 174 findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) ); 175 175 if ( winners.size() == 0 ) { 176 throwSemanticError( untyped, toString( "No reasonable alternatives for ", kindStr, (kindStr != "" ? " " : ""), "expression: ") );176 SemanticError( untyped, toString( "No reasonable alternatives for ", kindStr, (kindStr != "" ? " " : ""), "expression: ") ); 177 177 } else if ( winners.size() != 1 ) { 178 178 std::ostringstream stream; … … 181 181 stream << " Alternatives are:\n"; 182 182 printAlts( winners, stream, 1 ); 183 throwSemanticError( untyped->location, stream.str() );183 SemanticError( untyped->location, stream.str() ); 184 184 } 185 185 … … 187 187 Alternative & choice = winners.front(); 188 188 if ( findDeletedExpr( choice.expr ) ) { 189 throwSemanticError( choice.expr, "Unique best alternative includes deleted identifier in " );189 SemanticError( choice.expr, "Unique best alternative includes deleted identifier in " ); 190 190 } 191 191 alt = std::move( choice ); … … 484 484 ss << strict_dynamic_cast<NameExpr*>( clause.target.function )->name; 485 485 ss << "' in call to waitfor"; 486 throwSemanticError( stmt->location, ss.str() );486 SemanticError( stmt->location, ss.str() ); 487 487 } 488 488 … … 501 501 // try matching the arguments to the parameters 502 502 // not the other way around because we have more arguments than parameters 503 SemanticError errors;503 SemanticErrorException errors; 504 504 for ( Alternative & func : funcFinder.get_alternatives() ) { 505 505 try { 506 506 PointerType * pointer = dynamic_cast< PointerType* >( func.expr->get_result()->stripReferences() ); 507 507 if( !pointer ) { 508 throwSemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" );508 SemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" ); 509 509 } 510 510 511 511 FunctionType * function = dynamic_cast< FunctionType* >( pointer->get_base() ); 512 512 if( !function ) { 513 throwSemanticError( pointer->get_base(), "candidate not viable: not a function type\n" );513 SemanticError( pointer->get_base(), "candidate not viable: not a function type\n" ); 514 514 } 515 515 … … 520 520 521 521 if( !advance_to_mutex( param, param_end ) ) { 522 throwSemanticError(function, "candidate function not viable: no mutex parameters\n");522 SemanticError(function, "candidate function not viable: no mutex parameters\n"); 523 523 } 524 524 } … … 559 559 // We ran out of parameters but still have arguments 560 560 // this function doesn't match 561 throwSemanticError( function, "candidate function not viable: too many mutex arguments\n" );561 SemanticError( function, "candidate function not viable: too many mutex arguments\n" ); 562 562 } 563 563 … … 571 571 (*param)->get_type()->print( ss ); 572 572 ss << "'\n"; 573 throwSemanticError( function, ss.str() );573 SemanticError( function, ss.str() ); 574 574 } 575 575 … … 583 583 // We ran out of arguments but still have parameters left 584 584 // this function doesn't match 585 throwSemanticError( function, "candidate function not viable: too few mutex arguments\n" );585 SemanticError( function, "candidate function not viable: too few mutex arguments\n" ); 586 586 } 587 587 … … 599 599 600 600 } 601 catch( SemanticError &e ) {601 catch( SemanticErrorException &e ) { 602 602 errors.append( e ); 603 603 } 604 604 } 605 605 } 606 catch( SemanticError &e ) {606 catch( SemanticErrorException &e ) { 607 607 errors.append( e ); 608 608 } … … 610 610 611 611 // Make sure we got the right number of arguments 612 if( func_candidates.empty() ) { SemanticError top( stmt->location, "No alternatives for function in call to waitfor" ); top.append( errors ); throw top; }613 if( args_candidates.empty() ) { SemanticError top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }614 if( func_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous function in call to waitfor" ); top.append( errors ); throw top; }615 if( args_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous arguments in call to waitfor" ); top.append( errors ); throw top; }612 if( func_candidates.empty() ) { SemanticErrorException top( stmt->location, "No alternatives for function in call to waitfor" ); top.append( errors ); throw top; } 613 if( args_candidates.empty() ) { SemanticErrorException top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; } 614 if( func_candidates.size() > 1 ) { SemanticErrorException top( stmt->location, "Ambiguous function in call to waitfor" ); top.append( errors ); throw top; } 615 if( args_candidates.size() > 1 ) { SemanticErrorException top( stmt->location, "Ambiguous arguments in call to waitfor" ); top.append( errors ); throw top; } 616 616 // TODO: need to use findDeletedExpr to ensure no deleted identifiers are used. 617 617
Note: See TracChangeset
for help on using the changeset viewer.