Changeset 5fb6830 for src/Tuples/TupleAssignment.cc
- Timestamp:
- Aug 22, 2017, 7:09:33 PM (7 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:
- fc56cdbf
- Parents:
- 0b5d871
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tuples/TupleAssignment.cc
r0b5d871 r5fb6830 182 182 183 183 ResolvExpr::Alternative lhsAlt = alts.front(); 184 // peel off the cast that exists on ctor/dtor expressions 185 bool isCast = false; 186 if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( lhsAlt.expr ) ) { 187 lhsAlt.expr = castExpr->get_arg(); 188 castExpr->set_arg( nullptr ); 189 delete castExpr; 190 isCast = true; 184 // explode is aware of casts - ensure every LHS expression is sent into explode with a reference cast 185 if ( ! dynamic_cast< CastExpr * >( lhsAlt.expr ) ) { 186 lhsAlt.expr = new CastExpr( lhsAlt.expr, new ReferenceType( Type::Qualifiers(), lhsAlt.expr->get_result()->clone() ) ); 191 187 } 192 188 … … 194 190 explode( lhsAlt, spotter.currentFinder.get_indexer(), back_inserter(lhs), true ); 195 191 196 // and finally, re-add the cast to each lhs expr, so that qualified tuple fields can be constructed197 if ( isCast ) {198 for ( ResolvExpr::Alternative & alt : lhs ) {199 Expression *& expr = alt.expr;200 Type * type = expr->get_result()->clone();201 type->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );202 expr = new CastExpr( expr, new ReferenceType( Type::Qualifiers(), type ) );203 }204 }205 206 192 for ( ResolvExpr::Alternative & alt : lhs ) { 207 193 // every LHS value must be a reference - some come in with a cast expression, if it doesn't just cast to reference here. 208 // TODO: can this somehow be merge with the cast code directly above?209 194 if ( ! dynamic_cast< ReferenceType * >( alt.expr->get_result() ) ) { 210 195 alt.expr = new CastExpr( alt.expr, new ReferenceType( Type::Qualifiers(), alt.expr->get_result()->clone() ) );
Note: See TracChangeset
for help on using the changeset viewer.