Changeset 6840e7c for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Oct 19, 2017, 12:01:04 PM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 837ce06
- Parents:
- b96ec83 (diff), a15b72c (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/AlternativeFinder.cc
rb96ec83 r6840e7c 75 75 76 76 namespace { 77 void printAlts( const AltList &list, std::ostream &os, int indent = 0 ) { 77 void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt = 0 ) { 78 Indenter indent = { Indenter::tabsize, indentAmt }; 78 79 for ( AltList::const_iterator i = list.begin(); i != list.end(); ++i ) { 79 80 i->print( os, indent ); … … 195 196 AltList winners; 196 197 findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) ); 197 stream << "Cannot choose between " << winners.size() << " alternatives for expression 198 stream << "Cannot choose between " << winners.size() << " alternatives for expression\n"; 198 199 expr->print( stream ); 199 stream << "Alternatives are: ";200 printAlts( winners, stream, 8);200 stream << "Alternatives are:\n"; 201 printAlts( winners, stream, 1 ); 201 202 throw SemanticError( stream.str() ); 202 203 } … … 604 605 Alternative newerAlt( newAlt ); 605 606 newerAlt.env = newEnv; 606 assert ( (*candidate)->get_uniqueId() );607 assertf( (*candidate)->get_uniqueId(), "Assertion candidate does not have a unique ID: %s", toString( *candidate ).c_str() ); 607 608 DeclarationWithType *candDecl = static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) ); 608 609 … … 728 729 PRINT( 729 730 std::cerr << "known function ops:" << std::endl; 730 printAlts( funcOpFinder.alternatives, std::cerr, 8);731 printAlts( funcOpFinder.alternatives, std::cerr, 1 ); 731 732 ) 732 733 … … 838 839 bool isLvalue( Expression *expr ) { 839 840 // xxx - recurse into tuples? 840 return expr-> has_result()&& ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) );841 return expr->result && ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) ); 841 842 } 842 843 … … 972 973 PRINT( std::cerr << "nameExpr is " << nameExpr->get_name() << std::endl; ) 973 974 for ( std::list< DeclarationWithType* >::iterator i = declList.begin(); i != declList.end(); ++i ) { 974 VariableExpr newExpr( *i , nameExpr->get_argName());975 VariableExpr newExpr( *i ); 975 976 alternatives.push_back( Alternative( newExpr.clone(), env, Cost::zero ) ); 976 977 PRINT( … … 1267 1268 // O(N^2) checks of d-types with e-types 1268 1269 for ( InitAlternative & initAlt : initExpr->get_initAlts() ) { 1269 Type * toType = resolveTypeof( initAlt.type , indexer );1270 Type * toType = resolveTypeof( initAlt.type->clone(), indexer ); 1270 1271 SymTab::validateType( toType, &indexer ); 1271 1272 adjustExprType( toType, env, indexer );
Note:
See TracChangeset
for help on using the changeset viewer.