Changeset 6f096d2 for src/ResolvExpr


Ignore:
Timestamp:
Jul 12, 2019, 4:34:56 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e3d7f9f
Parents:
8fd52e90
Message:

Resolver now uses constant interface

Location:
src/ResolvExpr
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r8fd52e90 r6f096d2  
    336336                }
    337337
    338                 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->result ) ) {
     338                if ( StructInstType * structInst = dynamic_cast< StructInstType* >( aggrExpr->result ) ) {
    339339                        addAggMembers( structInst, aggrExpr.get(), alt, alt.cost+Cost::safe, "" );
    340                 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->result ) ) {
     340                } else if ( UnionInstType * unionInst = dynamic_cast< UnionInstType* >( aggrExpr->result ) ) {
    341341                        addAggMembers( unionInst, aggrExpr.get(), alt, alt.cost+Cost::safe, "" );
    342342                } // if
     
    344344
    345345        template< typename StructOrUnionType >
    346         void AlternativeFinder::Finder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Alternative& alt, const Cost &newCost, const std::string & name ) {
     346        void AlternativeFinder::Finder::addAggMembers( StructOrUnionType * aggInst, Expression * expr, const Alternative& alt, const Cost &newCost, const std::string & name ) {
    347347                std::list< Declaration* > members;
    348348                aggInst->lookup( name, members );
    349349
    350350                for ( Declaration * decl : members ) {
    351                         if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( decl ) ) {
     351                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType* >( decl ) ) {
    352352                                // addAnonAlternatives uses vector::push_back, which invalidates references to existing elements, so
    353353                                // can't construct in place and use vector::back
     
    362362        }
    363363
    364         void AlternativeFinder::Finder::addTupleMembers( TupleType *tupleType, Expression *expr,                        const Alternative &alt, const Cost &newCost, Expression *member ) {
     364        void AlternativeFinder::Finder::addTupleMembers( TupleType * tupleType, Expression * expr, const Alternative &alt, const Cost &newCost, Expression * member ) {
    365365                if ( ConstantExpr * constantExpr = dynamic_cast< ConstantExpr * >( member ) ) {
    366366                        // get the value of the constant expression as an int, must be between 0 and the length of the tuple type to have meaning
     
    368368                        std::string tmp;
    369369                        if ( val >= 0 && (unsigned long long)val < tupleType->size() ) {
    370                                 alternatives.push_back( Alternative{ 
     370                                alternatives.push_back( Alternative{
    371371                                        alt, new TupleIndexExpr( expr->clone(), val ), newCost } );
    372372                        } // if
     
    374374        }
    375375
    376         void AlternativeFinder::Finder::postvisit( ApplicationExpr *applicationExpr ) {
     376        void AlternativeFinder::Finder::postvisit( ApplicationExpr * applicationExpr ) {
    377377                alternatives.push_back( Alternative{ applicationExpr->clone(), env } );
    378378        }
     
    475475                }
    476476
    477                 // specialization cost of return types can't be accounted for directly, it disables 
     477                // specialization cost of return types can't be accounted for directly, it disables
    478478                // otherwise-identical calls, like this example based on auto-newline in the I/O lib:
    479479                //
     
    12261226                                // count one safe conversion for each value that is thrown away
    12271227                                thisCost.incSafe( discardedValues );
    1228                                 Alternative newAlt{ 
    1229                                         restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ), 
     1228                                Alternative newAlt{
     1229                                        restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ),
    12301230                                        alt.env, openVars, needAssertions, alt.cost, alt.cost + thisCost };
    12311231                                inferParameters( newAlt, back_inserter( candidates ) );
     
    13281328                if ( sizeofExpr->get_isType() ) {
    13291329                        Type * newType = sizeofExpr->get_type()->clone();
    1330                         alternatives.push_back( Alternative{ 
     1330                        alternatives.push_back( Alternative{
    13311331                                new SizeofExpr{ resolveTypeof( newType, indexer ) }, env } );
    13321332                } else {
     
    13431343                        Alternative &choice = winners.front();
    13441344                        referenceToRvalueConversion( choice.expr, choice.cost );
    1345                         alternatives.push_back( Alternative{ 
     1345                        alternatives.push_back( Alternative{
    13461346                                choice, new SizeofExpr( choice.expr->clone() ), Cost::zero } );
    13471347                } // if
     
    13511351                if ( alignofExpr->get_isType() ) {
    13521352                        Type * newType = alignofExpr->get_type()->clone();
    1353                         alternatives.push_back( Alternative{ 
     1353                        alternatives.push_back( Alternative{
    13541354                                new AlignofExpr{ resolveTypeof( newType, indexer ) }, env } );
    13551355                } else {
     
    13661366                        Alternative &choice = winners.front();
    13671367                        referenceToRvalueConversion( choice.expr, choice.cost );
    1368                         alternatives.push_back( Alternative{ 
     1368                        alternatives.push_back( Alternative{
    13691369                                choice, new AlignofExpr{ choice.expr->clone() }, Cost::zero } );
    13701370                } // if
     
    13771377                for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
    13781378                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) {
    1379                                 alternatives.push_back( Alternative{ 
     1379                                alternatives.push_back( Alternative{
    13801380                                        new OffsetofExpr{ aggInst->clone(), dwt }, env } );
    13811381                                renameTypes( alternatives.back().expr );
     
    14051405
    14061406        namespace {
    1407                 void resolveAttr( SymTab::Indexer::IdData data, FunctionType *function, Type *argType, const TypeEnvironment &env, AlternativeFinder & finder ) {
     1407                void resolveAttr( SymTab::Indexer::IdData data, const FunctionType * function, Type * argType, const TypeEnvironment &env, AlternativeFinder & finder ) {
    14081408                        // assume no polymorphism
    14091409                        // assume no implicit conversions
    1410                         assert( function->get_parameters().size() == 1 );
     1410                        assert( function->parameters.size() == 1 );
    14111411                        PRINT(
    14121412                                std::cerr << "resolvAttr: funcDecl is ";
     
    14181418                        const SymTab::Indexer & indexer = finder.get_indexer();
    14191419                        AltList & alternatives = finder.get_alternatives();
    1420                         if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
     1420                        if ( typesCompatibleIgnoreQualifiers( argType, function->parameters.front()->get_type(), indexer, env ) ) {
    14211421                                Cost cost = Cost::zero;
    14221422                                Expression * newExpr = data.combine( cost );
    1423                                 alternatives.push_back( Alternative{ 
    1424                                         new AttrExpr{ newExpr, argType->clone() }, env, OpenVarSet{}, 
     1423                                alternatives.push_back( Alternative{
     1424                                        new AttrExpr{ newExpr, argType->clone() }, env, OpenVarSet{},
    14251425                                        AssertionList{}, Cost::zero, cost } );
    14261426                                for ( DeclarationWithType * retVal : function->returnVals ) {
     
    14311431        }
    14321432
    1433         void AlternativeFinder::Finder::postvisit( AttrExpr *attrExpr ) {
     1433        void AlternativeFinder::Finder::postvisit( AttrExpr * attrExpr ) {
    14341434                // assume no 'pointer-to-attribute'
    1435                 NameExpr *nameExpr = dynamic_cast< NameExpr* >( attrExpr->get_attr() );
     1435                NameExpr * nameExpr = dynamic_cast< NameExpr* >( attrExpr->get_attr() );
    14361436                assert( nameExpr );
    14371437                std::list< SymTab::Indexer::IdData > attrList;
     
    14391439                if ( attrExpr->get_isType() || attrExpr->get_expr() ) {
    14401440                        for ( auto & data : attrList ) {
    1441                                 DeclarationWithType * id = data.id;
     1441                                const DeclarationWithType * id = data.id;
    14421442                                // check if the type is function
    1443                                 if ( FunctionType *function = dynamic_cast< FunctionType* >( id->get_type() ) ) {
     1443                                if ( const FunctionType * function = dynamic_cast< const FunctionType * >( id->get_type() ) ) {
    14441444                                        // assume exactly one parameter
    1445                                         if ( function->get_parameters().size() == 1 ) {
     1445                                        if ( function->parameters.size() == 1 ) {
    14461446                                                if ( attrExpr->get_isType() ) {
    14471447                                                        resolveAttr( data, function, attrExpr->get_type(), env, altFinder);
     
    14621462                                Cost cost = Cost::zero;
    14631463                                Expression * newExpr = data.combine( cost );
    1464                                 alternatives.push_back( Alternative{ 
     1464                                alternatives.push_back( Alternative{
    14651465                                        newExpr, env, OpenVarSet{}, AssertionList{}, Cost::zero, cost } );
    14661466                                renameTypes( alternatives.back().expr );
     
    14691469        }
    14701470
    1471         void AlternativeFinder::Finder::postvisit( LogicalExpr *logicalExpr ) {
     1471        void AlternativeFinder::Finder::postvisit( LogicalExpr * logicalExpr ) {
    14721472                AlternativeFinder firstFinder( indexer, env );
    14731473                firstFinder.findWithAdjustment( logicalExpr->get_arg1() );
     
    14861486                                cloneAll( second.need, need );
    14871487
    1488                                 LogicalExpr *newExpr = new LogicalExpr{ 
     1488                                LogicalExpr *newExpr = new LogicalExpr{
    14891489                                        first.expr->clone(), second.expr->clone(), logicalExpr->get_isAnd() };
    1490                                 alternatives.push_back( Alternative{ 
    1491                                         newExpr, std::move(compositeEnv), std::move(openVars), 
     1490                                alternatives.push_back( Alternative{
     1491                                        newExpr, std::move(compositeEnv), std::move(openVars),
    14921492                                        AssertionList( need.begin(), need.end() ), first.cost + second.cost } );
    14931493                        }
     
    15221522                                        cloneAll( third.need, need );
    15231523                                        AssertionSet have;
    1524                                        
     1524
    15251525                                        // unify true and false types, then infer parameters to produce new alternatives
    15261526                                        Type* commonType = nullptr;
    1527                                         if ( unify( second.expr->result, third.expr->result, compositeEnv, 
     1527                                        if ( unify( second.expr->result, third.expr->result, compositeEnv,
    15281528                                                        need, have, openVars, indexer, commonType ) ) {
    1529                                                 ConditionalExpr *newExpr = new ConditionalExpr{ 
     1529                                                ConditionalExpr *newExpr = new ConditionalExpr{
    15301530                                                        first.expr->clone(), second.expr->clone(), third.expr->clone() };
    15311531                                                newExpr->result = commonType ? commonType : second.expr->result->clone();
    15321532                                                // convert both options to the conditional result type
    15331533                                                Cost cost = first.cost + second.cost + third.cost;
    1534                                                 cost += computeExpressionConversionCost( 
     1534                                                cost += computeExpressionConversionCost(
    15351535                                                        newExpr->arg2, newExpr->result, indexer, compositeEnv );
    1536                                                 cost += computeExpressionConversionCost( 
     1536                                                cost += computeExpressionConversionCost(
    15371537                                                        newExpr->arg3, newExpr->result, indexer, compositeEnv );
    15381538                                                // output alternative
    1539                                                 Alternative newAlt{ 
    1540                                                         newExpr, std::move(compositeEnv), std::move(openVars), 
     1539                                                Alternative newAlt{
     1540                                                        newExpr, std::move(compositeEnv), std::move(openVars),
    15411541                                                        AssertionList( need.begin(), need.end() ), cost };
    15421542                                                inferParameters( newAlt, back_inserter( alternatives ) );
     
    15531553                secondFinder.findWithAdjustment( commaExpr->get_arg2() );
    15541554                for ( const Alternative & alt : secondFinder.alternatives ) {
    1555                         alternatives.push_back( Alternative{ 
     1555                        alternatives.push_back( Alternative{
    15561556                                alt, new CommaExpr{ newFirstArg->clone(), alt.expr->clone() }, alt.cost } );
    15571557                } // for
     
    15791579
    15801580                                Type* commonType = nullptr;
    1581                                 if ( unify( first.expr->result, second.expr->result, compositeEnv, need, have, 
     1581                                if ( unify( first.expr->result, second.expr->result, compositeEnv, need, have,
    15821582                                                openVars, indexer, commonType ) ) {
    1583                                         RangeExpr * newExpr = 
     1583                                        RangeExpr * newExpr =
    15841584                                                new RangeExpr{ first.expr->clone(), second.expr->clone() };
    15851585                                        newExpr->result = commonType ? commonType : first.expr->result->clone();
    1586                                         Alternative newAlt{ 
    1587                                                 newExpr, std::move(compositeEnv), std::move(openVars), 
     1586                                        Alternative newAlt{
     1587                                                newExpr, std::move(compositeEnv), std::move(openVars),
    15881588                                                AssertionList( need.begin(), need.end() ), first.cost + second.cost };
    15891589                                        inferParameters( newAlt, back_inserter( alternatives ) );
     
    16121612                                cloneAll( alt.need, need );
    16131613                        }
    1614                        
    1615                         alternatives.push_back( Alternative{ 
    1616                                 new TupleExpr{ exprs }, std::move(compositeEnv), std::move(openVars), 
     1614
     1615                        alternatives.push_back( Alternative{
     1616                                new TupleExpr{ exprs }, std::move(compositeEnv), std::move(openVars),
    16171617                                AssertionList( need.begin(), need.end() ), sumCost( alts ) } );
    16181618                } // for
     
    16331633                finder.findWithoutPrune( ctorExpr->get_callExpr() );
    16341634                for ( Alternative & alt : finder.alternatives ) {
    1635                         alternatives.push_back( Alternative{ 
     1635                        alternatives.push_back( Alternative{
    16361636                                alt, new ConstructorExpr( alt.expr->clone() ), alt.cost } );
    16371637                }
     
    16851685                                cloneAll( alt.need, need );
    16861686                                AssertionSet have;
    1687                                 OpenVarSet openVars( alt.openVars ); 
    1688                                 // xxx - find things in env that don't have a "representative type" and claim 
     1687                                OpenVarSet openVars( alt.openVars );
     1688                                // xxx - find things in env that don't have a "representative type" and claim
    16891689                                // those are open vars?
    16901690                                PRINT(
    16911691                                        std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl;
    16921692                                )
    1693                                 // It's possible that a cast can throw away some values in a multiply-valued 
    1694                                 // expression. (An example is a cast-to-void, which casts from one value to 
    1695                                 // zero.)  Figure out the prefix of the subexpression results that are cast 
    1696                                 // directly.  The candidate is invalid if it has fewer results than there are 
     1693                                // It's possible that a cast can throw away some values in a multiply-valued
     1694                                // expression. (An example is a cast-to-void, which casts from one value to
     1695                                // zero.)  Figure out the prefix of the subexpression results that are cast
     1696                                // directly.  The candidate is invalid if it has fewer results than there are
    16971697                                // types to cast to.
    16981698                                int discardedValues = alt.expr->result->size() - toType->size();
    16991699                                if ( discardedValues < 0 ) continue;
    1700                                 // xxx - may need to go into tuple types and extract relevant types and use 
    1701                                 // unifyList. Note that currently, this does not allow casting a tuple to an 
     1700                                // xxx - may need to go into tuple types and extract relevant types and use
     1701                                // unifyList. Note that currently, this does not allow casting a tuple to an
    17021702                                // atomic type (e.g. (int)([1, 2, 3]))
    1703                                
     1703
    17041704                                // unification run for side-effects
    17051705                                unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer );
     
    17101710                                        // count one safe conversion for each value that is thrown away
    17111711                                        thisCost.incSafe( discardedValues );
    1712                                         Alternative newAlt{ 
    1713                                                 new InitExpr{ 
    1714                                                         restructureCast( alt.expr->clone(), toType, true ), initAlt.designation->clone() }, 
    1715                                                 std::move(newEnv), std::move(openVars), 
     1712                                        Alternative newAlt{
     1713                                                new InitExpr{
     1714                                                        restructureCast( alt.expr->clone(), toType, true ), initAlt.designation->clone() },
     1715                                                std::move(newEnv), std::move(openVars),
    17161716                                                AssertionList( need.begin(), need.end() ), alt.cost, thisCost };
    17171717                                        inferParameters( newAlt, back_inserter( candidates ) );
  • src/ResolvExpr/ResolveAssertions.cc

    r8fd52e90 r6f096d2  
    197197                        }
    198198                        if ( i == b.size() /* && i < a.size() */ ) return 1;
    199                        
     199
    200200                        int c = a[i].compare( b[i] );
    201201                        if ( c != 0 ) return c;
     
    220220
    221221                /// Initial resolution state for an alternative
    222                 ResnState( Alternative& a, SymTab::Indexer& indexer )
     222                ResnState( Alternative & a, SymTab::Indexer & indexer )
    223223                : alt(a), need(), newNeed(), deferred(), inferred(), costs{ Cost::zero }, indexer(indexer) {
    224224                        need.swap( a.need );
     
    226226
    227227                /// Updated resolution state with new need-list
    228                 ResnState( ResnState&& o, IterateFlag )
     228                ResnState( ResnState && o, IterateFlag )
    229229                : alt(std::move(o.alt)), need(o.newNeed.begin(), o.newNeed.end()), newNeed(), deferred(),
    230230                  inferred(std::move(o.inferred)), costs(o.costs), indexer(o.indexer) {
     
    234234
    235235        /// Binds a single assertion, updating resolution state
    236         void bindAssertion( const DeclarationWithType* decl, AssertionSetValue info, Alternative& alt,
    237                         AssnCandidate& match, InferCache& inferred ) {
    238 
    239                 DeclarationWithType* candidate = match.cdata.id;
    240                 assertf( candidate->get_uniqueId(), "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
    241 
    242                 Expression* varExpr = match.cdata.combine( alt.cvtCost );
     236        void bindAssertion( const DeclarationWithType * decl, AssertionSetValue info, Alternative & alt,
     237                        AssnCandidate & match, InferCache & inferred ) {
     238
     239                const DeclarationWithType * candidate = match.cdata.id;
     240                assertf( candidate->uniqueId, "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
     241
     242                Expression * varExpr = match.cdata.combine( alt.cvtCost );
    243243                delete varExpr->result;
    244244                varExpr->result = match.adjType->clone();
     
    247247                // place newly-inferred assertion in proper place in cache
    248248                inferred[ info.resnSlot ][ decl->get_uniqueId() ] = ParamEntry{
    249                                 candidate->get_uniqueId(), candidate->clone(), match.adjType->clone(), decl->get_type()->clone(),
     249                                candidate->uniqueId, candidate->clone(), match.adjType->clone(), decl->get_type()->clone(),
    250250                                varExpr };
    251251        }
    252252
    253253        /// Adds a captured assertion to the symbol table
    254         void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) {
     254        void addToIndexer( AssertionSet & assertSet, SymTab::Indexer & indexer ) {
    255255                for ( auto&  i : assertSet ) {
    256256                        if ( i.second.isUsed ) {
     
    264264
    265265        /// Resolve a single assertion, in context
    266         bool resolveAssertion( AssertionItem& assn, ResnState& resn ) {
     266        bool resolveAssertion( AssertionItem & assn, ResnState & resn ) {
    267267                // skip unused assertions
    268268                if ( ! assn.info.isUsed ) return true;
     
    274274                // find the candidates that unify with the desired type
    275275                CandidateList matches;
    276                 for ( const auto& cdata : candidates ) {
    277                         DeclarationWithType* candidate = cdata.id;
     276                for ( const auto & cdata : candidates ) {
     277                        const DeclarationWithType * candidate = cdata.id;
    278278
    279279                        // build independent unification context for candidate
     
    281281                        TypeEnvironment newEnv{ resn.alt.env };
    282282                        OpenVarSet newOpenVars{ resn.alt.openVars };
    283                         Type* adjType = candidate->get_type()->clone();
     283                        Type * adjType = candidate->get_type()->clone();
    284284                        adjustExprType( adjType, newEnv, resn.indexer );
    285285                        renameTyVars( adjType );
     
    370370                return resKey;
    371371        }
    372        
    373         /// Replace resnSlots with inferParams and add alternative to output list, if meets pruning 
     372
     373        /// Replace resnSlots with inferParams and add alternative to output list, if meets pruning
    374374        /// threshold.
    375375        void finalizeAssertions( ResnState& resn, PruneMap & pruneThresholds, AltList& out ) {
     
    406406                ResnList resns{ ResnState{ alt, root_indexer } };
    407407                ResnList new_resns{};
    408                
     408
    409409                // Pruning thresholds by result type of the output alternatives.
    410410                // Alternatives *should* be generated in sorted order, so no need to retroactively prune
  • src/ResolvExpr/Unify.cc

    r8fd52e90 r6f096d2  
    102102                WidenMode widen, const ast::SymbolTable & symtab );
    103103
    104         bool typesCompatible( Type *first, Type *second, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
     104        bool typesCompatible( const Type * first, const Type * second, const SymTab::Indexer & indexer, const TypeEnvironment & env ) {
    105105                TypeEnvironment newEnv;
    106106                OpenVarSet openVars, closedVars; // added closedVars
    107107                AssertionSet needAssertions, haveAssertions;
    108                 Type *newFirst = first->clone(), *newSecond = second->clone();
     108                Type * newFirst = first->clone(), * newSecond = second->clone();
    109109                env.apply( newFirst );
    110110                env.apply( newSecond );
  • src/ResolvExpr/typeops.h

    r8fd52e90 r6f096d2  
    2828#include "SynTree/SynTree.h"
    2929#include "SynTree/Type.h"
    30 #include "SymTab/Indexer.h"
     30
     31namespace SymTab {
     32        class Indexer;
     33}
    3134
    3235namespace ResolvExpr {
     
    6063        // in AdjustExprType.cc
    6164        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
    62         void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer );
     65        void adjustExprType( Type *& type, const TypeEnvironment & env, const SymTab::Indexer & indexer );
    6366
    6467        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer
     
    6669
    6770        template< typename ForwardIterator >
    68         void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
     71        void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment & env, const SymTab::Indexer & indexer ) {
    6972                while ( begin != end ) {
    7073                        adjustExprType( *begin++, env, indexer );
     
    7780
    7881        // in CastCost.cc
    79         Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
     82        Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    8083        Cost castCost(
    8184                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
     
    8386
    8487        // in ConversionCost.cc
    85         Cost conversionCost( const Type *src, const Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
     88        Cost conversionCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    8689        Cost conversionCost(
    8790                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
     
    8992
    9093        // in AlternativeFinder.cc
    91         Cost computeConversionCost( Type *actualType, Type *formalType,
    92                 const SymTab::Indexer &indexer, const TypeEnvironment &env );
     94        Cost computeConversionCost( Type * actualType, Type * formalType,
     95                const SymTab::Indexer & indexer, const TypeEnvironment & env );
    9396
    9497        // in PtrsAssignable.cc
    95         int ptrsAssignable( const Type * src, const Type * dest, const TypeEnvironment &env );
     98        int ptrsAssignable( const Type * src, const Type * dest, const TypeEnvironment & env );
    9699        int ptrsAssignable( const ast::Type * src, const ast::Type * dst,
    97100                const ast::TypeEnvironment & env );
    98101
    99102        // in PtrsCastable.cc
    100         int ptrsCastable( const Type * src, const Type * dest, const TypeEnvironment &env, const SymTab::Indexer &indexer );
     103        int ptrsCastable( const Type * src, const Type * dest, const TypeEnvironment & env, const SymTab::Indexer & indexer );
    101104        int ptrsCastable(
    102105                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
     
    104107
    105108        // in Unify.cc
    106         bool typesCompatible( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    107         bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    108 
    109         inline bool typesCompatible( Type *t1, Type *t2, const SymTab::Indexer &indexer ) {
     109        bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     110        bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     111
     112        inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
    110113                TypeEnvironment env;
    111114                return typesCompatible( t1, t2, indexer, env );
    112115        }
    113116
    114         inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer &indexer ) {
     117        inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
    115118                TypeEnvironment env;
    116119                return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env );
     
    131134
    132135        // in CommonType.cc
    133         Type * commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     136        Type * commonType( Type * type1, Type * type2, bool widenFirst, bool widenSecond, const SymTab::Indexer & indexer, TypeEnvironment & env, const OpenVarSet & openVars );
    134137        ast::ptr< ast::Type > commonType(
    135138                const ast::ptr< ast::Type > & type1, const ast::ptr< ast::Type > & type2, WidenMode widen,
     
    137140
    138141        // in PolyCost.cc
    139         int polyCost( Type *type, const TypeEnvironment &env, const SymTab::Indexer &indexer );
     142        int polyCost( Type * type, const TypeEnvironment & env, const SymTab::Indexer & indexer );
    140143        int polyCost(
    141144                const ast::Type * type, const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );
    142145
    143146        // in SpecCost.cc
    144         int specCost( Type *type );
     147        int specCost( Type * type );
    145148        int specCost( const ast::Type * type );
    146149
    147150        // in Occurs.cc
    148         bool occurs( Type *type, std::string varName, const TypeEnvironment &env );
     151        bool occurs( Type * type, std::string varName, const TypeEnvironment & env );
    149152        // new AST version in TypeEnvironment.cpp (only place it was used in old AST)
    150153
    151154        template<typename Iter>
    152         bool occursIn( Type* ty, Iter begin, Iter end, const TypeEnvironment &env ) {
     155        bool occursIn( Type* ty, Iter begin, Iter end, const TypeEnvironment & env ) {
    153156                while ( begin != end ) {
    154157                        if ( occurs( ty, *begin, env ) ) return true;
     
    197200
    198201        // in TypeEnvironment.cc
    199         bool isFtype( Type *type );
     202        bool isFtype( Type * type );
    200203} // namespace ResolvExpr
    201204
Note: See TracChangeset for help on using the changeset viewer.