#ifndef _DEFS_FUNCTION_FIXER_H_
#define _DEFS_FUNCTION_FIXER_H_

#include "SynTree/Mutator.h"
#include "SymTab/Indexer.h"

#include "SynTree/Expression.h"

namespace ArgTweak {
  class FunctionFixer : public Mutator
  {
    typedef Mutator Parent;

  public:
    FunctionFixer(SymTab::Indexer *ind = 0);
    ~FunctionFixer();

    virtual DeclarationWithType *mutate( FunctionDecl *functionDecl );
    virtual Expression *mutate( UntypedExpr *untypedExpr ) throw ( SemanticError );

  private:
    class Matcher {
      typedef std::string key;
      typedef DeclarationWithType * pattern_type;
      typedef Expression * permutation_type;
    public:
      static key null_key;
      static permutation_type null_value;

      std::string extract_key( DeclarationWithType * );
      std::string extract_key( Expression * );

      bool operator()( DeclarationWithType *, Expression * ) { return true; }
    };

    SymTab::Indexer *index;
  };

  template < class L1, class L2, class Predicate > bool align( L1 &pattern, L2 &possible_permutation, Predicate pred ); 

} // namespace ArgTweak


#endif // #ifndef _DEFS_FUNCTION_FIXER_H_

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