//
// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// MultRet.h -- 
//
// Author           : Rodolfo G. Esteves
// Created On       : Mon May 18 07:44:20 2015
// Last Modified By : Peter A. Buhr
// Last Modified On : Mon May 18 12:39:20 2015
// Update Count     : 3
//

#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 // _MULTRET_H_

// Local Variables: //
// tab-width: 4 //
// mode: c++ //
// compile-command: "make install" //
// End: //
