Changeset b5629d8 for src/ResolvExpr
- Timestamp:
- Dec 3, 2020, 1:49:01 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 62e456f, ab0257b9
- Parents:
- f0d67e5 (diff), fa11053 (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. - Location:
- src/ResolvExpr
- Files:
-
- 3 edited
-
AlternativeFinder.cc (modified) (2 diffs)
-
TypeEnvironment.cc (modified) (1 diff)
-
TypeEnvironment.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
rf0d67e5 rb5629d8 132 132 void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt ) { 133 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 134 157 for ( AltList::const_iterator i = list.begin(); i != list.end(); ++i ) { 135 158 i->print( os, indent ); … … 1718 1741 std::cerr << std::endl; 1719 1742 ) 1720 1743 1721 1744 if ( thisCost != Cost::infinity ) { 1722 1745 // count one safe conversion for each value that is thrown away -
src/ResolvExpr/TypeEnvironment.cc
rf0d67e5 rb5629d8 107 107 108 108 void EqvClass::print( std::ostream &os, Indenter indent ) const { 109 if( !deterministic_output ) { 110 os << "( "; 111 std::copy( vars.begin(), vars.end(), std::ostream_iterator< std::string >( os, " " ) ); 112 os << ")"; 113 } 109 os << "("; 110 bool first = true; 111 for(const auto & var : vars) { 112 if(first) first = false; 113 else os << " "; 114 if( deterministic_output && isUnboundType(var) ) os << "[unbound]"; 115 else os << var; 116 } 117 os << ")"; 114 118 if ( type ) { 115 119 os << " -> "; -
src/ResolvExpr/TypeEnvironment.h
rf0d67e5 rb5629d8 149 149 iterator end() const { return env.end(); } 150 150 151 auto size() const { return env.size(); } 152 151 153 private: 152 154 ClassList env;
Note:
See TracChangeset
for help on using the changeset viewer.