Ignore:
Timestamp:
Jun 27, 2018, 3:28:41 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
b21c77a
Parents:
0182bfa (diff), 63238a4 (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' into with_gc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/TypeEnvironment.h

    r0182bfa r28f3a19  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:24:58 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:35:45 2017
    13 // Update Count     : 3
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Mon Jun 18 11:58:00 2018
     13// Update Count     : 4
    1414//
    1515
     
    2121#include <set>                         // for set
    2222#include <string>                      // for string
     23#include <utility>                     // for move, swap
     24
     25#include "WidenMode.h"                 // for WidenMode
    2326
    2427#include "SynTree/Declaration.h"       // for TypeDecl::Data, DeclarationWit...
     
    7780
    7881                void initialize( const EqvClass &src, EqvClass &dest );
     82                void initialize( const EqvClass &src, EqvClass &dest, const Type *ty );
    7983                EqvClass();
    8084                EqvClass( const EqvClass &other );
     85                EqvClass( const EqvClass &other, const Type *ty );
     86                EqvClass( EqvClass &&other );
    8187                EqvClass &operator=( const EqvClass &other );
     88                EqvClass &operator=( EqvClass &&other );
    8289                void print( std::ostream &os, Indenter indent = {} ) const;
     90
     91                /// Takes ownership of `ty`, freeing old `type`
     92                void set_type(Type* ty);
    8393        };
    8494
     
    8696          public:
    8797                const EqvClass* lookup( const std::string &var ) const;
    88                 void add( const EqvClass &eqvClass );
     98          private:
    8999                void add( EqvClass &&eqvClass  );
     100          public:
    90101                void add( const Type::ForallList &tyDecls );
    91102                void add( const TypeSubstitution & sub );
     
    95106                bool isEmpty() const { return env.empty(); }
    96107                void print( std::ostream &os, Indenter indent = {} ) const;
    97                 void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );
     108                // void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );
    98109                void simpleCombine( const TypeEnvironment &second );
    99110                void extractOpenVars( OpenVarSet &openVars ) const;
     
    104115                void addActual( const TypeEnvironment& actualEnv, OpenVarSet& openVars );
    105116
    106                 typedef std::list< EqvClass >::iterator iterator;
    107                 iterator begin() { return env.begin(); }
    108                 iterator end() { return env.end(); }
    109                 typedef std::list< EqvClass >::const_iterator const_iterator;
    110                 const_iterator begin() const { return env.begin(); }
    111                 const_iterator end() const { return env.end(); }
     117                /// Binds the type class represented by `typeInst` to the type `bindTo`; will add
     118                /// the class if needed. Returns false on failure.
     119                bool bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     120               
     121                /// Binds the type classes represented by `var1` and `var2` together; will add
     122                /// one or both classes if needed. Returns false on failure.
     123                bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     124
     125                /// Disallows widening for all bindings in the environment
     126                void forbidWidening();
     127
     128                using iterator = std::list< EqvClass >::const_iterator;
     129                iterator begin() const { return env.begin(); }
     130                iterator end() const { return env.end(); }
     131
    112132          private:
    113133                std::list< EqvClass > env;
     134               
    114135                std::list< EqvClass >::iterator internal_lookup( const std::string &var );
    115136        };
Note: See TracChangeset for help on using the changeset viewer.