Ignore:
Timestamp:
Jun 4, 2019, 6:39:23 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
c6a1e8a
Parents:
7564e10 (diff), 1346914 (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:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/TypeEnvironment.cc

    r7564e10 r67130fe  
    205205                                // attempt to unify bound types
    206206                                std::unique_ptr<Type> toType{ to.type->clone() }, fromType{ from.type->clone() };
    207                                 WidenMode widenMode{ to.allowWidening, from.allowWidening };
     207                                WidenMode widen{ to.allowWidening, from.allowWidening };
    208208                                Type* common = nullptr;
    209209                                AssertionSet need, have;
    210                                 if ( unifyInexact( toType.get(), fromType.get(), *this, need, have, openVars, widenMode, indexer, common ) ) {
     210                                if ( unifyInexact( toType.get(), fromType.get(), *this, need, have, openVars, widen, indexer, common ) ) {
    211211                                        // unifies, set common type if necessary
    212212                                        if ( common ) {
     
    343343        }
    344344
    345         bool TypeEnvironment::bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
     345        bool TypeEnvironment::bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer ) {
    346346
    347347                // remove references from other, so that type variables can only bind to value types
     
    362362                                std::unique_ptr< Type > newType( curClass->type->clone() );
    363363                                newType->get_qualifiers() = typeInst->get_qualifiers();
    364                                 if ( unifyInexact( newType.get(), bindTo, *this, need, have, openVars, widenMode & WidenMode( curClass->allowWidening, true ), indexer, common ) ) {
     364                                if ( unifyInexact( newType.get(), bindTo, *this, need, have, openVars, widen & WidenMode( curClass->allowWidening, true ), indexer, common ) ) {
    365365                                        if ( common ) {
    366366                                                common->get_qualifiers() = Type::Qualifiers{};
     
    372372                                newType->get_qualifiers() = Type::Qualifiers{};
    373373                                curClass->set_type( newType );
    374                                 curClass->allowWidening = widenMode.widenFirst && widenMode.widenSecond;
     374                                curClass->allowWidening = widen.first && widen.second;
    375375                        } // if
    376376                } else {
     
    379379                        newClass.type = bindTo->clone();
    380380                        newClass.type->get_qualifiers() = Type::Qualifiers();
    381                         newClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond;
     381                        newClass.allowWidening = widen.first && widen.second;
    382382                        newClass.data = data;
    383383                        env.push_back( std::move(newClass) );
     
    388388        bool TypeEnvironment::bindVarToVar( TypeInstType *var1, TypeInstType *var2,
    389389                        TypeDecl::Data && data, AssertionSet &need, AssertionSet &have,
    390                         const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
     390                        const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer ) {
    391391
    392392                auto class1 = internal_lookup( var1->get_name() );
     
    395395                // exit early if variables already bound together
    396396                if ( class1 != env.end() && class1 == class2 ) {
    397                         class1->allowWidening &= widenMode;
     397                        class1->allowWidening &= widen;
    398398                        return true;
    399399                }
     
    408408                                type1 = class1->type;
    409409                        } // if
    410                         widen1 = widenMode.widenFirst && class1->allowWidening;
     410                        widen1 = widen.first && class1->allowWidening;
    411411                } // if
    412412                if ( class2 != env.end() ) {
     
    415415                                type2 = class2->type;
    416416                        } // if
    417                         widen2 = widenMode.widenSecond && class2->allowWidening;
     417                        widen2 = widen.second && class2->allowWidening;
    418418                } // if
    419419
Note: See TracChangeset for help on using the changeset viewer.