Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/ApplicationExpr.cc

    r8d7bef2 r4d6d62e  
    1717#include <list>                  // for list
    1818#include <map>                   // for _Rb_tree_const_iterator, map, map<>:...
     19#include <memory>                // for unique_ptr
    1920#include <ostream>               // for operator<<, ostream, basic_ostream
    2021#include <string>                // for operator<<, string, char_traits
     
    4243}
    4344
     45ParamEntry::~ParamEntry() {
     46        delete actualType;
     47        delete formalType;
     48        delete expr;
     49}
     50
     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
    4474ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    4575        PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
     
    5484                Expression( other ), function( maybeClone( other.function ) ) {
    5585        cloneAll( other.args, args );
     86}
     87
     88ApplicationExpr::~ApplicationExpr() {
     89        delete function;
     90        deleteAll( args );
    5691}
    5792
Note: See TracChangeset for help on using the changeset viewer.