Changeset b1a6d6b for translator/GenPoly/GenPoly.cc
- Timestamp:
- May 14, 2015, 12:19:46 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:
- 4bf5298
- Parents:
- d4778a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/GenPoly/GenPoly.cc
rd4778a6 rb1a6d6b 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.