Changeset 21bdce2 for src/SynTree


Ignore:
Timestamp:
May 21, 2018, 10:52:15 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, 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, with_gc
Children:
2f0a0678
Parents:
b12c036 (diff), 1596726 (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 plg2:software/cfa/cfa-cc

Location:
src/SynTree
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/ApplicationExpr.cc

    rb12c036 r21bdce2  
    4949}
    5050
     51ParamEntry::ParamEntry( ParamEntry && other ) :
     52                decl( other.decl ), actualType( other.actualType ), formalType( other.formalType ), expr( other.expr ), inferParams( std::move( other.inferParams ) ) {
     53        other.actualType = nullptr;
     54        other.formalType = nullptr;
     55        other.expr = nullptr;
     56}
     57
     58ParamEntry & ParamEntry::operator=( ParamEntry && other ) {
     59        if ( &other == this ) return *this;
     60        delete actualType;
     61        delete formalType;
     62        delete expr;
     63        decl = other.decl;
     64        actualType = other.actualType;
     65        formalType = other.formalType;
     66        expr = other.expr;
     67        other.actualType = nullptr;
     68        other.formalType = nullptr;
     69        other.expr = nullptr;
     70        inferParams = std::move( other.inferParams );
     71        return *this;
     72}
     73
    5174ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    5275        PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
  • src/SynTree/Expression.cc

    rb12c036 r21bdce2  
    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

    rb12c036 r21bdce2  
    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();
    4445        ParamEntry & operator=( const ParamEntry & other );
     46        ParamEntry & operator=( ParamEntry && other );
    4547
    4648        UniqueId decl;
     
    7375
    7476        InferredParams & get_inferParams() { return inferParams; }
     77
     78        // move other's inferParams to this
     79        void spliceInferParams( Expression * other );
    7580
    7681        virtual Expression * clone() const override = 0;
Note: See TracChangeset for help on using the changeset viewer.