- Timestamp:
- Dec 3, 2020, 1:41:11 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3233b91
- Parents:
- cc5cc27
- Location:
- src/ResolvExpr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
rcc5cc27 r2595df1 131 131 132 132 void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt ) { 133 Indenter indent = { indentAmt }; 134 135 std::vector<int> idx; 136 idx.reserve(list.size()); 137 for(int i = 0; i < list.size(); i++) { idx.push_back(i); } 138 139 std::sort(idx.begin(), idx.end(), [&list](int lhs_idx, int rhs_idx) -> bool { 140 const auto & lhs = list.at(lhs_idx); 141 const auto & rhs = list.at(rhs_idx); 142 if(lhs.expr->location.startsBefore(rhs.expr->location)) return true; 143 if(rhs.expr->location.startsBefore(lhs.expr->location)) return false; 144 145 if(lhs.env.size() < rhs.env.size()) return true; 146 if(lhs.env.size() > rhs.env.size()) return false; 147 148 if(lhs.openVars.size() < rhs.openVars.size()) return true; 149 if(lhs.openVars.size() > rhs.openVars.size()) return false; 150 151 if(lhs.need.size() < rhs.need.size()) return true; 152 if(lhs.need.size() > rhs.need.size()) return false; 153 154 return false; 155 }); 156 157 for ( AltList::const_iterator i = list.begin(); i != list.end(); ++i ) { 158 i->print( os, indent ); 159 os << std::endl; 133 std::vector<std::string> sorted; 134 sorted.reserve(list.size()); 135 for(const auto & c : list) { 136 std::stringstream ss; 137 print( ss, *c, indentAmt ); 138 sorted.push_back(ss.str()); 139 } 140 141 std::sort(sorted.begin(), sorted.end()); 142 143 for ( const auto & s : sorted ) { 144 os << s << std::endl; 160 145 } 161 146 } -
src/ResolvExpr/Candidate.cpp
rcc5cc27 r2595df1 41 41 42 42 void print( std::ostream & os, const CandidateList & cands, Indenter indent ) { 43 for ( const CandidateRef & cand : cands ) { 44 print( os, *cand, indent ); 45 os << std::endl; 43 std::vector<std::string> sorted; 44 sorted.reserve(cands.size()); 45 for(const auto & c : cands) { 46 std::stringstream ss; 47 print( ss, *c, indent ); 48 sorted.push_back(ss.str()); 49 } 50 51 std::sort(sorted.begin(), sorted.end()); 52 53 for ( const auto & s : sorted ) { 54 os << s << std::endl; 46 55 } 47 56 }
Note: See TracChangeset
for help on using the changeset viewer.