Changeset eba74ba for src/SynTree


Ignore:
Timestamp:
May 25, 2018, 2:51:06 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
cdc4d43
Parents:
3ef35bd (diff), 58e822a (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 remote-tracking branch 'origin/master' into with_gc

Location:
src/SynTree
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/ApplicationExpr.cc

    r3ef35bd reba74ba  
    4242}
    4343
     44ParamEntry::ParamEntry( ParamEntry && other ) :
     45                decl( other.decl ), actualType( other.actualType ), formalType( other.formalType ), expr( other.expr ), inferParams( std::move( other.inferParams ) ) {
     46        other.actualType = nullptr;
     47        other.formalType = nullptr;
     48        other.expr = nullptr;
     49}
     50
     51ParamEntry & ParamEntry::operator=( ParamEntry && other ) {
     52        if ( &other == this ) return *this;
     53        decl = other.decl;
     54        actualType = other.actualType;
     55        formalType = other.formalType;
     56        expr = other.expr;
     57        other.actualType = nullptr;
     58        other.formalType = nullptr;
     59        other.expr = nullptr;
     60        inferParams = std::move( other.inferParams );
     61        return *this;
     62}
     63
    4464ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    4565        PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
  • src/SynTree/Expression.cc

    r3ef35bd reba74ba  
    5050}
    5151
     52void Expression::spliceInferParams( Expression * other ) {
     53        if ( ! other ) return;
     54        for ( auto p : other->inferParams ) {
     55                inferParams[p.first] = std::move( p.second );
     56        }
     57}
     58
    5259Expression::~Expression() {
    5360        delete env;
  • src/SynTree/Expression.h

    r3ef35bd reba74ba  
    4141        ParamEntry( UniqueId decl, Type * actualType, Type * formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ), inferParams( new InferredParams ) {}
    4242        ParamEntry( const ParamEntry & other );
     43        ParamEntry( ParamEntry&& other );
    4344        ParamEntry & operator=( const ParamEntry & other );
     45        ParamEntry & operator=( ParamEntry && other );
    4446
    4547        UniqueId decl;
     
    7476
    7577        InferredParams & get_inferParams() { return inferParams; }
     78
     79        // move other's inferParams to this
     80        void spliceInferParams( Expression * other );
    7681
    7782        virtual Expression * clone() const override = 0;
Note: See TracChangeset for help on using the changeset viewer.