Changes in src/SynTree/TupleExpr.cc [d3b7937:6eb8948]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/TupleExpr.cc
rd3b7937 r6eb8948 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TupleExpr.cc -- 7 // TupleExpr.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 16 16 #include "Expression.h" 17 17 #include "Common/utility.h" 18 #include "Type.h" 19 #include "Declaration.h" 18 20 19 21 TupleExpr::TupleExpr( Expression *_aname ) : Expression( _aname ) { … … 34 36 } 35 37 36 SolvedTupleExpr::SolvedTupleExpr( std::list<Expression *> &_exprs, Expression *_aname ) : Expression( _aname ) { 37 std::copy(_exprs.begin(), _exprs.end(), back_inserter(exprs)); 38 TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) { 39 // TupleType * type = safe_dynamic_cast< TypeType * >( tuple->get_ ) 40 assert( tuple->get_results().size() >= index ); 41 add_result( *std::next( tuple->get_results().begin(), index ) ); 38 42 } 39 43 40 SolvedTupleExpr::SolvedTupleExpr( const SolvedTupleExpr &other ) : Expression( other ) { 41 cloneAll( other.exprs, exprs ); 44 TupleIndexExpr::TupleIndexExpr( const TupleIndexExpr &other ) : Expression( other ), tuple( other.tuple->clone() ), index( other.index ) { 42 45 } 43 46 44 void SolvedTupleExpr::print( std::ostream &os, int indent ) const { 45 os << std::string( indent, ' ' ) << "Solved Tuple:" << std::endl; 46 printAll( exprs, os, indent+2 ); 47 TupleIndexExpr::~TupleIndexExpr() { 48 delete tuple; 49 } 50 51 void TupleIndexExpr::print( std::ostream &os, int indent ) const { 52 os << std::string( indent, ' ' ) << "Tuple Index Expression, with tuple:" << std::endl; 53 tuple->print( os, indent+2 ); 54 os << std::string( indent+2, ' ' ) << "with index: " << index << std::endl; 47 55 Expression::print( os, indent ); 48 56 } 57 58 MemberTupleExpr::MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname ) : Expression( _aname ) { 59 cloneAll( member->get_results(), get_results() ); // xxx - ??? 60 } 61 62 MemberTupleExpr::MemberTupleExpr( const MemberTupleExpr &other ) : Expression( other ), member( other.member->clone() ), aggregate( other.aggregate->clone() ) { 63 } 64 65 MemberTupleExpr::~MemberTupleExpr() { 66 delete member; 67 delete aggregate; 68 } 69 70 void MemberTupleExpr::print( std::ostream &os, int indent ) const { 71 os << std::string( indent, ' ' ) << "Member Tuple Expression, with aggregate:" << std::endl; 72 aggregate->print( os, indent+2 ); 73 os << std::string( indent+2, ' ' ) << "with member: " << std::endl; 74 member->print( os, indent+2 ); 75 Expression::print( os, indent ); 76 } 77 78 79 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ), assigns( assigns ), tempDecls( tempDecls ) { 80 for ( Expression * expr : assigns ) { 81 cloneAll( expr->get_results(), get_results() ); 82 } 83 } 84 85 TupleAssignExpr::TupleAssignExpr( const TupleAssignExpr &other ) : Expression( other ), tempDecls( other.tempDecls ) /* temporary */ { 86 cloneAll( other.assigns, assigns ); 87 // xxx - clone needs to go into assigns and replace tempDecls 88 } 89 90 TupleAssignExpr::~TupleAssignExpr() { 91 deleteAll( assigns ); 92 // deleteAll( tempDecls ); 93 } 94 95 void TupleAssignExpr::print( std::ostream &os, int indent ) const { 96 os << std::string( indent, ' ' ) << "Tuple Assignment Expression, with temporaries:" << std::endl; 97 printAll( tempDecls, os, indent+4 ); 98 os << std::string( indent+2, ' ' ) << "with assignments: " << std::endl; 99 printAll( assigns, os, indent+4 ); 100 Expression::print( os, indent ); 101 } 102 103 49 104 50 105 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.