//
// 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.
//
// CandidateFinder.hpp --
//
// Author           : Aaron B. Moss
// Created On       : Wed Jun 5 14:30:00 2019
// Last Modified By : Aaron B. Moss
// Last Modified On : Wed Jun 5 14:30:00 2019
// Update Count     : 1
//

#pragma once

#include "Candidate.hpp"
#include "ResolvMode.h"
#include "AST/Fwd.hpp"
#include "AST/SymbolTable.hpp"
#include "AST/TypeEnvironment.hpp"

namespace ResolvExpr {

/// Data to perform expression resolution
struct CandidateFinder {
	CandidateList candidates;                ///< List of candidate resolutions
	const ast::SymbolTable & symtab;         ///< Symbol table to lookup candidates
	const ast::TypeEnvironment & env;        ///< Substitutions performed in this resolution
	const ast::Type * targetType = nullptr;  ///< Target type for resolution

	CandidateFinder( const ast::SymbolTable & symtab, const ast::TypeEnvironment & env )
	: candidates(), symtab( symtab ), env( env ) {}

	/// Fill candidates with feasible resolutions for `expr`
	void find( const ast::Expr * expr, ResolvMode mode = {} );
};

} // namespace ResolvExpr

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