Ignore:
Timestamp:
May 14, 2015, 1:54:02 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

update merged files from master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/GenPoly/GenPoly.cc

    rc11e31c r4bf5298  
    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.