Changes in src/ResolvExpr/Alternative.cc [bd4f2e9:f229fc2]
- File:
-
- 1 edited
-
src/ResolvExpr/Alternative.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Alternative.cc
rbd4f2e9 rf229fc2 20 20 #include <utility> // for move 21 21 22 #include "Common/GC.h" 23 #include "Common/PassVisitor.h" 22 24 #include "Common/utility.h" // for maybeClone 23 25 #include "ResolvExpr/Cost.h" // for Cost, Cost::zero, operator<< 24 26 #include "ResolvExpr/TypeEnvironment.h" // for TypeEnvironment 25 27 #include "SynTree/Expression.h" // for Expression 28 #include "SynTree/GcTracer.h" 26 29 #include "SynTree/Type.h" // for Type 27 30 … … 34 37 Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost, const Cost &cvtCost ) 35 38 : cost( cost ), cvtCost( cvtCost ), expr( expr ), env( env ) {} 36 37 Alternative::Alternative( const Alternative &other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( maybeClone( other.expr ) ), env( other.env ) {38 }39 40 Alternative &Alternative::operator=( const Alternative &other ) {41 if ( &other == this ) return *this;42 delete expr;43 cost = other.cost;44 cvtCost = other.cvtCost;45 expr = maybeClone( other.expr );46 env = other.env;47 return *this;48 }49 50 Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( other.env ) {51 other.expr = nullptr;52 }53 54 Alternative & Alternative::operator=( Alternative && other ) {55 if ( &other == this ) return *this;56 delete expr;57 cost = other.cost;58 cvtCost = other.cvtCost;59 expr = other.expr;60 env = other.env;61 other.expr = nullptr;62 return *this;63 }64 65 Alternative::~Alternative() {66 delete expr;67 }68 39 69 40 void Alternative::print( std::ostream &os, Indenter indent ) const { … … 96 67 } 97 68 69 const GC& operator<< ( const GC& gc, const Alternative& alt ) { 70 PassVisitor<GcTracer> tracer{ gc }; 71 maybeAccept( alt.expr, tracer ); 72 tracer << alt.env; 73 return gc; 74 } 75 98 76 } // namespace ResolvExpr 99 77
Note:
See TracChangeset
for help on using the changeset viewer.