Changeset 1f44196 for src/GenPoly/Specialize.cc
- Timestamp:
- Nov 29, 2016, 3:30:59 PM (9 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:
- 8e5724e
- Parents:
- 3a2128f (diff), 9129a84 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Specialize.cc
r3a2128f r1f44196 148 148 149 149 Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) { 150 assert ( ! actual->get_results().empty() ); // using front, should have this assert151 if ( needsSpecialization( formalType, actual->get_result s().front(), env ) ) {150 assertf( actual->has_result(), "attempting to specialize an untyped expression" ); 151 if ( needsSpecialization( formalType, actual->get_result(), env ) ) { 152 152 FunctionType *funType; 153 153 if ( ( funType = getFunctionType( formalType ) ) ) { … … 172 172 void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) { 173 173 // create thunks for the explicit parameters 174 assert( ! appExpr->get_function()->get_results().empty() );175 FunctionType *function = getFunctionType( appExpr->get_function()->get_result s().front() );174 assert( appExpr->get_function()->has_result() ); 175 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() ); 176 176 assert( function ); 177 177 std::list< DeclarationWithType* >::iterator formal; … … 201 201 Expression * Specialize::mutate( AddressExpr *addrExpr ) { 202 202 addrExpr->get_arg()->acceptMutator( *this ); 203 assert( ! addrExpr->get_results().empty() );204 addrExpr->set_arg( doSpecialization( addrExpr->get_result s().front(), addrExpr->get_arg() ) );203 assert( addrExpr->has_result() ); 204 addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) ); 205 205 return addrExpr; 206 206 } … … 208 208 Expression * Specialize::mutate( CastExpr *castExpr ) { 209 209 castExpr->get_arg()->acceptMutator( *this ); 210 if ( castExpr->get_result s().empty() ) {210 if ( castExpr->get_result()->isVoid() ) { 211 211 // can't specialize if we don't have a return value 212 212 return castExpr; 213 213 } 214 Expression *specialized = doSpecialization( castExpr->get_result s().front(), castExpr->get_arg() );214 Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() ); 215 215 if ( specialized != castExpr->get_arg() ) { 216 216 // assume here that the specialization incorporates the cast
Note:
See TracChangeset
for help on using the changeset viewer.