Changeset 490ff5c3 for src/Tuples/Explode.h
- Timestamp:
- Feb 14, 2018, 1:54:14 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:
- 44b4114
- Parents:
- 54c9000
- git-author:
- Rob Schluntz <rschlunt@…> (02/14/18 12:00:25)
- git-committer:
- Rob Schluntz <rschlunt@…> (02/14/18 13:54:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tuples/Explode.h
r54c9000 r490ff5c3 43 43 /// Append alternative to an OutputIterator of Alternatives 44 44 template<typename OutputIterator> 45 void append( OutputIterator out, Expression* expr, const ResolvExpr::TypeEnvironment& env, 45 void append( OutputIterator out, Expression* expr, const ResolvExpr::TypeEnvironment& env, 46 46 const ResolvExpr::Cost& cost, const ResolvExpr::Cost& cvtCost ) { 47 47 *out++ = ResolvExpr::Alternative{ expr, env, cost, cvtCost }; … … 49 49 50 50 /// Append alternative to an ExplodedActual 51 static inline void append( ResolvExpr::ExplodedActual& ea, Expression* expr, 51 static inline void append( ResolvExpr::ExplodedActual& ea, Expression* expr, 52 52 const ResolvExpr::TypeEnvironment&, const ResolvExpr::Cost&, const ResolvExpr::Cost& ) { 53 53 ea.exprs.emplace_back( expr ); … … 57 57 /// helper function used by explode 58 58 template< typename Output > 59 void explodeUnique( Expression * expr, const ResolvExpr::Alternative & alt, 59 void explodeUnique( Expression * expr, const ResolvExpr::Alternative & alt, 60 60 const SymTab::Indexer & indexer, Output&& out, bool isTupleAssign ) { 61 61 if ( isTupleAssign ) { … … 63 63 if ( CastExpr * castExpr = isReferenceCast( expr ) ) { 64 64 ResolvExpr::AltList alts; 65 explodeUnique( 65 explodeUnique( 66 66 castExpr->get_arg(), alt, indexer, back_inserter( alts ), isTupleAssign ); 67 67 for ( ResolvExpr::Alternative & alt : alts ) { 68 68 // distribute reference cast over all components 69 append( std::forward<Output>(out), distributeReference( alt.release_expr() ), 69 append( std::forward<Output>(out), distributeReference( alt.release_expr() ), 70 70 alt.env, alt.cost, alt.cvtCost ); 71 71 } … … 108 108 /// expands a tuple-valued alternative into multiple alternatives, each with a non-tuple-type 109 109 template< typename Output > 110 void explode( const ResolvExpr::Alternative &alt, const SymTab::Indexer & indexer, 110 void explode( const ResolvExpr::Alternative &alt, const SymTab::Indexer & indexer, 111 111 Output&& out, bool isTupleAssign = false ) { 112 112 explodeUnique( alt.expr, alt, indexer, std::forward<Output>(out), isTupleAssign ); … … 115 115 // explode list of alternatives 116 116 template< typename AltIterator, typename Output > 117 void explode( AltIterator altBegin, AltIterator altEnd, const SymTab::Indexer & indexer, 117 void explode( AltIterator altBegin, AltIterator altEnd, const SymTab::Indexer & indexer, 118 118 Output&& out, bool isTupleAssign = false ) { 119 119 for ( ; altBegin != altEnd; ++altBegin ) { … … 123 123 124 124 template< typename Output > 125 void explode( const ResolvExpr::AltList & alts, const SymTab::Indexer & indexer, Output&& out, 125 void explode( const ResolvExpr::AltList & alts, const SymTab::Indexer & indexer, Output&& out, 126 126 bool isTupleAssign = false ) { 127 127 explode( alts.begin(), alts.end(), indexer, std::forward<Output>(out), isTupleAssign );
Note: See TracChangeset
for help on using the changeset viewer.