Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/GenPoly/GenPoly.cc

    r51b7345 rb1a6d6b  
    99#include "SynTree/Type.h"
    1010
     11#include <iostream>
     12using namespace std;
    1113
    1214namespace GenPoly {
    1315
     16// interface functions
     17bool isPolyVal( Type *type, const TyVarMap &tyVars ) {
     18  return isPolyVal( type, tyVars, false );
     19}
     20
     21bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) { 
     22  return needsAdapter( adaptee, tyVars, false );
     23}
     24
    1425bool
    15 isPolyVal( Type *type, const TyVarMap &tyVars )
     26isPolyVal( Type *type, const TyVarMap &tyVars, bool considerAllTyVars )
    1627{
    1728  if( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
     
    1930      return true;
    2031    }
     32    return considerAllTyVars;
    2133  }
    2234  return false;
     
    2638// parameters have polymorphic type
    2739bool
    28 needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars )
     40needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars, bool considerAllTyVars )
    2941{
    3042  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 ) ) {
    3244    needsAdapter = true;
    3345  }
    3446  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 ) ) {
    3648      needsAdapter = true;
    3749    }
Note: See TracChangeset for help on using the changeset viewer.