Changeset 4bf5298 for translator/GenPoly/GenPoly.cc
- Timestamp:
- May 14, 2015, 1:54:02 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 5c7fb6c
- Parents:
- c11e31c (diff), b1a6d6b (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
-
translator/GenPoly/GenPoly.cc
rc11e31c r4bf5298 9 9 #include "SynTree/Type.h" 10 10 11 #include <iostream> 12 using namespace std; 11 13 12 14 namespace GenPoly { 13 15 16 // interface functions 17 bool isPolyVal( Type *type, const TyVarMap &tyVars ) { 18 return isPolyVal( type, tyVars, false ); 19 } 20 21 bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) { 22 return needsAdapter( adaptee, tyVars, false ); 23 } 24 14 25 bool 15 isPolyVal( Type *type, const TyVarMap &tyVars )26 isPolyVal( Type *type, const TyVarMap &tyVars, bool considerAllTyVars ) 16 27 { 17 28 if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) { … … 19 30 return true; 20 31 } 32 return considerAllTyVars; 21 33 } 22 34 return false; … … 26 38 // parameters have polymorphic type 27 39 bool 28 needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars )40 needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars, bool considerAllTyVars ) 29 41 { 30 42 bool needsAdapter = false; 31 if( !adaptee->get_returnVals().empty() && isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {43 if( !adaptee->get_returnVals().empty() && isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars, considerAllTyVars ) ) { 32 44 needsAdapter = true; 33 45 } 34 46 for( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); !needsAdapter && innerArg != adaptee->get_parameters().end(); ++innerArg ) { 35 if( isPolyVal( (*innerArg)->get_type(), tyVars ) ) {47 if( isPolyVal( (*innerArg)->get_type(), tyVars, considerAllTyVars ) ) { 36 48 needsAdapter = true; 37 49 }
Note: See TracChangeset
for help on using the changeset viewer.