| 1 | #include <list> | 
|---|
| 2 | #include <vector> | 
|---|
| 3 | #include <cassert> | 
|---|
| 4 | #include <algorithm> | 
|---|
| 5 |  | 
|---|
| 6 | #include "FlattenTuple.h" | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 | namespace Tuples { | 
|---|
| 10 |  | 
|---|
| 11 | FlattenTuple::FlattenTuple() | 
|---|
| 12 | { | 
|---|
| 13 | } | 
|---|
| 14 |  | 
|---|
| 15 | FlattenTuple::~FlattenTuple() | 
|---|
| 16 | { | 
|---|
| 17 | } | 
|---|
| 18 |  | 
|---|
| 19 | Expression *FlattenTuple::mutate( TupleExpr *tupleExpr ) | 
|---|
| 20 | { | 
|---|
| 21 | CollectArgs c; | 
|---|
| 22 |  | 
|---|
| 23 | acceptAll( tupleExpr->get_exprs(), c ); | 
|---|
| 24 | tupleExpr->set_exprs( c.get_args() ); | 
|---|
| 25 |  | 
|---|
| 26 | return tupleExpr; | 
|---|
| 27 | } | 
|---|
| 28 |  | 
|---|
| 29 | void FlattenTuple::CollectArgs::visit( UntypedExpr       *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 30 | void FlattenTuple::CollectArgs::visit( NameExpr          *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 31 | void FlattenTuple::CollectArgs::visit( CastExpr          *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 32 | void FlattenTuple::CollectArgs::visit( AddressExpr       *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 33 | void FlattenTuple::CollectArgs::visit( UntypedMemberExpr *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 34 | void FlattenTuple::CollectArgs::visit( MemberExpr        *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 35 | void FlattenTuple::CollectArgs::visit( VariableExpr      *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 36 | void FlattenTuple::CollectArgs::visit( ConstantExpr      *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 37 | void FlattenTuple::CollectArgs::visit( SizeofExpr        *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 38 | void FlattenTuple::CollectArgs::visit( AttrExpr          *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 39 | void FlattenTuple::CollectArgs::visit( LogicalExpr       *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 40 | void FlattenTuple::CollectArgs::visit( ConditionalExpr   *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 41 | void FlattenTuple::CollectArgs::visit( CommaExpr         *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 42 | void FlattenTuple::CollectArgs::visit( TypeExpr          *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 43 | void FlattenTuple::CollectArgs::visit( UntypedValofExpr  *expr )  {  currentArgs.insert( currentArgs.end(), expr );  } | 
|---|
| 44 |  | 
|---|
| 45 | void FlattenTuple::CollectArgs::visit( TupleExpr *tupleExpr) | 
|---|
| 46 | { | 
|---|
| 47 | acceptAll( tupleExpr->get_exprs(), *this ); | 
|---|
| 48 |  | 
|---|
| 49 | //currentArgs.splice( currentArgs.end(), c.get_args() ); | 
|---|
| 50 | } | 
|---|
| 51 | } // namespace Tuples | 
|---|