Ignore:
Timestamp:
Mar 2, 2018, 5:34:52 PM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
b8baa37
Parents:
dd05e12
git-author:
Rob Schluntz <rschlunt@…> (03/02/18 17:10:28)
git-committer:
Rob Schluntz <rschlunt@…> (03/02/18 17:34:52)
Message:

Add function to add bindings from TypeSubstitution? to TypeEnvironment?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/TypeEnvironment.cc

    rdd05e12 r09c72d5  
    118118                        env.push_back( newClass );
    119119                } // for
     120        }
     121
     122        void TypeEnvironment::add( const TypeSubstitution & sub ) {
     123                EqvClass newClass;
     124                for ( auto p : sub ) {
     125                        newClass.vars.insert( p.first );
     126                        newClass.type = p.second->clone();
     127                        newClass.allowWidening = false;
     128                        // Minimal assumptions. Not technically correct, but might be good enough, and
     129                        // is the best we can do at the moment since information is lost in the
     130                        // transition to TypeSubstitution
     131                        newClass.data = TypeDecl::Data{ TypeDecl::Dtype, false };
     132                        add( newClass );
     133                }
    120134        }
    121135
Note: See TracChangeset for help on using the changeset viewer.