#ifndef MALACHSCRIPT_BINDER_HPP #define MALACHSCRIPT_BINDER_HPP #include #include "../Diagnostics/Logger.hpp" #include "../Parser/Statements/ParsedStatement.hpp" #include "BoundNamespace.hpp" namespace MalachScript::Binder { class Binder { public: using log_func = const std::function&)>; static void Bind(BoundNamespace* ns, const std::vector& statements, const log_func& log); private: // Register all types and namespaces static void TypeRegistrationFirstPass(BoundNamespace* ns, const MalachScript::Parser::ParsedStatement* statement, std::optional activeType, const log_func& log); // Register typedefs and type inheritance static void TypeRegistrationSecondPass(BoundNamespace* ns, const MalachScript::Parser::ParsedStatement* statement, std::optional activeType, const log_func& log); // Register variables, fields, etc static void TypeRegistrationThirdPass(BoundNamespace* ns, const MalachScript::Parser::ParsedStatement* statement, std::optional activeType, const log_func& log); // Finalise types, calculating size. static void FinaliseTypes(BoundNamespace* ns, const log_func& log); }; } #endif // MALACHSCRIPT_BINDER_HPP