/*
 * LateContext.h
 *
 *  Created on: Jan 8, 2016
 *      Author: pgess
 */

#ifndef SRC_COMPILATION_LATECONTEXT_H_
#define SRC_COMPILATION_LATECONTEXT_H_

#include "ast.h"
#include "expressionserializer.h"

namespace llvm {
	class Value;
}

namespace xreate {
typedef unsigned int ScopePacked;

class CompilePass;
class ContextDomain;

class LateContext{

public:
	LateContext(const std::string& function, CompilePass* compilePass);
	~LateContext();

	llvm::Value* compileCheckContext(const Expression& e);
	llvm::Value* compileArgument(const std::string& callee, ScopePacked scopeOuter);
	llvm::Value* findFunction(const std::string name, ScopePacked scopeOuter, llvm::Function* functionOuter);

	const ContextDomain* const domain;
	llvm::Value* raw;

private:
	CompilePass* pass;
};

} /* namespace xreate */

#endif /* SRC_COMPILATION_LATECONTEXT_H_ */
