/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * File:   typeinference.h
 * Author: pgess <v.melnychenko@xreate.org>
 *
 * Created on April 16, 2017, 10:17 AM
 */

#ifndef TYPEINFERENCE_H
#define TYPEINFERENCE_H

#include "ast.h"
#include "llvm/IR/IRBuilder.h"

namespace llvm{
class Value;
class Type;
};

namespace xreate{ namespace typeinference{

/**
 * \brief Casts the given variable to the given type
 * \param source The variable that needs casting
 * \param tyTarget The type to cast to
 * \param builder Instance of llvm's IRBuilder
 */
llvm::Value* doAutomaticTypeConversion(llvm::Value* source, llvm::Type* tyTarget, llvm::IRBuilder<>& builder);
ExpandedType getType(const Expression& expression, const AST& ast);
}
}//namespace xreate::typeinference

#endif /* TYPEINFERENCE_H */

