Changes in src/Tuples/TupleAssignment.cc [2c187378:753bf60]
- File:
-
- 1 edited
-
src/Tuples/TupleAssignment.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Tuples/TupleAssignment.cc
r2c187378 r753bf60 62 62 struct Matcher { 63 63 public: 64 Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs, 65 constResolvExpr::AltList& rhs );64 Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs, const 65 ResolvExpr::AltList& rhs ); 66 66 virtual ~Matcher() {} 67 68 67 virtual void match( std::list< Expression * > &out ) = 0; 69 68 ObjectDecl * newObject( UniqueName & namer, Expression * expr ); 70 71 void combineState( const ResolvExpr::Alternative& alt ) {72 compositeEnv.simpleCombine( alt.env );73 ResolvExpr::mergeOpenVars( openVars, alt.openVars );74 cloneAll( alt.need, need );75 }76 77 void combineState( const ResolvExpr::AltList& alts ) {78 for ( const ResolvExpr::Alternative& alt : alts ) { combineState( alt ); }79 }80 81 69 ResolvExpr::AltList lhs, rhs; 82 70 TupleAssignSpotter &spotter; … … 84 72 std::list< ObjectDecl * > tmpDecls; 85 73 ResolvExpr::TypeEnvironment compositeEnv; 86 ResolvExpr::OpenVarSet openVars;87 ResolvExpr::AssertionSet need;88 74 }; 89 75 … … 259 245 } 260 246 261 // extract expressions from the assignment alternatives to produce a list of assignments 262 // t hat together form a single alternative247 // extract expressions from the assignment alternatives to produce a list of assignments that 248 // together form a single alternative 263 249 std::list< Expression *> solved_assigns; 264 250 for ( ResolvExpr::Alternative & alt : current ) { 265 251 solved_assigns.push_back( alt.expr->clone() ); 266 matcher->combineState( alt );267 }268 252 } 253 // combine assignment environments into combined expression environment 254 simpleCombineEnvironments( current.begin(), current.end(), matcher->compositeEnv ); 269 255 // xxx -- was push_front 270 currentFinder.get_alternatives().push_back( ResolvExpr::Alternative{ 271 new TupleAssignExpr{ solved_assigns, matcher->tmpDecls }, matcher->compositeEnv, 272 matcher->openVars, 273 ResolvExpr::AssertionList( matcher->need.begin(), matcher->need.end() ), 274 ResolvExpr::sumCost( current ) + matcher->baseCost } ); 256 currentFinder.get_alternatives().push_back( ResolvExpr::Alternative( 257 new TupleAssignExpr(solved_assigns, matcher->tmpDecls), matcher->compositeEnv, 258 ResolvExpr::sumCost( current ) + matcher->baseCost ) ); 275 259 } 276 260 … … 279 263 : lhs(lhs), rhs(rhs), spotter(spotter), 280 264 baseCost( ResolvExpr::sumCost( lhs ) + ResolvExpr::sumCost( rhs ) ) { 281 combineState( lhs );282 combineState( rhs);265 simpleCombineEnvironments( lhs.begin(), lhs.end(), compositeEnv ); 266 simpleCombineEnvironments( rhs.begin(), rhs.end(), compositeEnv ); 283 267 } 284 268
Note:
See TracChangeset
for help on using the changeset viewer.