Changeset d55d7a6 for src/ResolvExpr/Resolver.cc
- Timestamp:
- Feb 15, 2018, 3:58:56 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:
- 75e3cb2
- Parents:
- d27e340
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
rd27e340 rd55d7a6 188 188 findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) ); 189 189 if ( winners.size() == 0 ) { 190 throw SemanticError( "No reasonable alternatives for " + kindStr + " expression: ", untyped);190 throw SemanticError( untyped, "No reasonable alternatives for " + kindStr + " expression: " ); 191 191 } else if ( winners.size() != 1 ) { 192 192 std::ostringstream stream; … … 195 195 stream << "Alternatives are:\n"; 196 196 printAlts( winners, stream, 1 ); 197 throw SemanticError( stream.str() );197 throw SemanticError( untyped->location, stream.str() ); 198 198 } 199 199 … … 429 429 ss << strict_dynamic_cast<NameExpr*>( clause.target.function )->name; 430 430 ss << "' in call to waitfor"; 431 throw SemanticError( s s.str() );431 throw SemanticError( stmt->location, ss.str() ); 432 432 } 433 433 … … 451 451 PointerType * pointer = dynamic_cast< PointerType* >( func.expr->get_result()->stripReferences() ); 452 452 if( !pointer ) { 453 throw SemanticError( "candidate not viable: not a pointer type\n", func.expr->get_result());453 throw SemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" ); 454 454 } 455 455 456 456 FunctionType * function = dynamic_cast< FunctionType* >( pointer->get_base() ); 457 457 if( !function ) { 458 throw SemanticError( "candidate not viable: not a function type\n", pointer->get_base());458 throw SemanticError( pointer->get_base(), "candidate not viable: not a function type\n" ); 459 459 } 460 460 … … 465 465 466 466 if( !advance_to_mutex( param, param_end ) ) { 467 throw SemanticError( "candidate function not viable: no mutex parameters\n", function);467 throw SemanticError(function, "candidate function not viable: no mutex parameters\n"); 468 468 } 469 469 } … … 504 504 // We ran out of parameters but still have arguments 505 505 // this function doesn't match 506 throw SemanticError( "candidate function not viable: too many mutex arguments\n", function);506 throw SemanticError( function, "candidate function not viable: too many mutex arguments\n" ); 507 507 } 508 508 … … 516 516 (*param)->get_type()->print( ss ); 517 517 ss << "'\n"; 518 throw SemanticError( ss.str(), function);518 throw SemanticError( function, ss.str() ); 519 519 } 520 520 … … 528 528 // We ran out of arguments but still have parameters left 529 529 // this function doesn't match 530 throw SemanticError( "candidate function not viable: too few mutex arguments\n", function);530 throw SemanticError( function, "candidate function not viable: too few mutex arguments\n" ); 531 531 } 532 532 … … 555 555 556 556 // Make sure we got the right number of arguments 557 if( func_candidates.empty() ) { SemanticError top( "No alternatives for function in call to waitfor" ); top.append( errors ); throw top; }558 if( args_candidates.empty() ) { SemanticError top( "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }559 if( func_candidates.size() > 1 ) { SemanticError top( "Ambiguous function in call to waitfor" ); top.append( errors ); throw top; }560 if( args_candidates.size() > 1 ) { SemanticError top( "Ambiguous arguments in call to waitfor" ); top.append( errors ); throw top; }557 if( func_candidates.empty() ) { SemanticError top( stmt->location, "No alternatives for function in call to waitfor" ); top.append( errors ); throw top; } 558 if( args_candidates.empty() ) { SemanticError top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; } 559 if( func_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous function in call to waitfor" ); top.append( errors ); throw top; } 560 if( args_candidates.size() > 1 ) { SemanticError top( stmt->location, "Ambiguous arguments in call to waitfor" ); top.append( errors ); throw top; } 561 561 562 562
Note: See TracChangeset
for help on using the changeset viewer.