Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.h

    r2773ab8 rea6332d  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 13:09:04 2015
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Mon Jun 18 11:58:00 2018
    13 // Update Count     : 4
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Jul 21 23:09:34 2017
     13// Update Count     : 3
    1414//
    1515
     
    1818#include <list>                   // for list
    1919
    20 #include "AST/Node.hpp"             // for ptr
    21 #include "AST/TypeEnvironment.hpp"  // for TypeEnvironment, AssertionSet, OpenVarSet
    2220#include "Common/utility.h"       // for deleteAll
    2321#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Data
    2422#include "TypeEnvironment.h"      // for AssertionSet, OpenVarSet
    25 #include "WidenMode.h"              // for WidenMode
    2623
    2724class Type;
    2825class TypeInstType;
    2926namespace SymTab {
    30         class Indexer;
    31 }
    32 
    33 namespace ast {
    34         class SymbolTable;
    35         class Type;
    36 }
     27class Indexer;
     28}  // namespace SymTab
    3729
    3830namespace ResolvExpr {
     31        struct WidenMode {
     32                WidenMode( bool widenFirst, bool widenSecond ): widenFirst( widenFirst ), widenSecond( widenSecond ) {}
     33                WidenMode &operator|=( const WidenMode &other ) { widenFirst |= other.widenFirst; widenSecond |= other.widenSecond; return *this; }
     34                WidenMode &operator&=( const WidenMode &other ) { widenFirst &= other.widenFirst; widenSecond &= other.widenSecond; return *this; }
     35                WidenMode operator|( const WidenMode &other ) { WidenMode newWM( *this ); newWM |= other; return newWM; }
     36                WidenMode operator&( const WidenMode &other ) { WidenMode newWM( *this ); newWM &= other; return newWM; }
     37                operator bool() { return widenFirst && widenSecond; }
     38
     39                bool widenFirst : 1, widenSecond : 1;
     40        };
     41
     42        bool bindVar( TypeInstType *typeInst, Type *other, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
    3943        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
    4044        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
    4145        bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
    42         bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer, Type *&common );
    4346
    4447        template< typename Iterator1, typename Iterator2 >
     
    6972        }
    7073
    71         bool unify(
    72                 const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
    73                 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
    74                 ast::OpenVarSet & open, const ast::SymbolTable & symtab );
    75 
    76         bool unify(
    77                 const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
    78                 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
    79                 ast::OpenVarSet & open, const ast::SymbolTable & symtab, ast::ptr<ast::Type> & common );
    80 
    81         bool unifyExact(
    82                 const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env,
    83                 ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & open,
    84                 WidenMode widen, const ast::SymbolTable & symtab );
    85 
    86         bool unifyInexact(
    87                 const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
    88                 ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
    89                 const ast::OpenVarSet & open, WidenMode widen, const ast::SymbolTable & symtab,
    90                 ast::ptr<ast::Type> & common );
    91 
    9274} // namespace ResolvExpr
    9375
Note: See TracChangeset for help on using the changeset viewer.