Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Type.cpp

    r3e5dd913 r361bf01  
    2121
    2222#include "Decl.hpp"
     23#include "ForallSubstitutor.hpp" // for substituteForall
    2324#include "Init.hpp"
    2425#include "Common/utility.h"      // for copy, move
     
    9192// GENERATED END
    9293
     94// --- ParameterizedType
     95
     96void FunctionType::initWithSub(
     97        const FunctionType & o, Pass< ForallSubstitutor > & sub
     98) {
     99        forall = sub.core( o.forall );
     100}
     101
    93102// --- FunctionType
     103
     104
     105FunctionType::FunctionType( const FunctionType & o )
     106: Type( o.qualifiers, copy( o.attributes ) ), returns(), params(),
     107  isVarArgs( o.isVarArgs ) {
     108        Pass< ForallSubstitutor > sub;
     109        initWithSub( o, sub );           // initialize substitution map
     110        returns = sub.core( o.returns ); // apply to return and parameter types
     111        params = sub.core( o.params );
     112}
     113
    94114namespace {
    95115        bool containsTtype( const std::vector<ptr<Type>> & l ) {
     
    179199                // TODO: once TypeInstType representation is updated, it should properly check
    180200                // if the context id is filled. this is a temporary hack for now
    181                 return typeInst->formal_usage > 0;
     201                return isUnboundType(typeInst->name);
     202        }
     203        return false;
     204}
     205
     206bool isUnboundType(const std::string & tname) {
     207        // xxx - look for a type name produced by renameTyVars.
     208
     209        // TODO: once TypeInstType representation is updated, it should properly check
     210        // if the context id is filled. this is a temporary hack for now
     211        if (std::count(tname.begin(), tname.end(), '_') >= 3) {
     212                return true;
    182213        }
    183214        return false;
Note: See TracChangeset for help on using the changeset viewer.