#ifndef _MULTRET_H_
#define _MULTRET_H_

#include "SynTree/Mutator.h"
#include "SynTree/Visitor.h"

#include "SynTree/Expression.h"
#include "SynTree/Statement.h"

namespace Tuples {
  class MVRMutator : public Mutator
  {
    typedef Mutator Parent;

  public:
    MVRMutator();
    ~MVRMutator();

    virtual Statement  *mutate( ExprStmt        *exprStmt );
    virtual Expression *mutate( ApplicationExpr *appExpr  );

    bool hasCode() const { return ( newCode != 0 ); }
    CompoundStmt *getCode() const { return newCode; }
    CompoundStmt *getVars() const { return newVars; }

    bool hasResults() const { return (! results.empty()); }
    std::list<Expression *> &get_results() { return results; }

  private:
    CompoundStmt *newVars;
    CompoundStmt *newCode;
    std::list<Expression *> argsToAdd;
    std::list<Expression *> results;

    static int curVal;
    DeclStmt *newVar( DeclarationWithType * );
    void add_pending( Declaration * );
  };

} // namespace Tuples


#endif // #ifndef _MULTRET_H_

/*
  Local Variables:
  mode: c++
  End:
*/
