55
66
77#include " scriptCompiler.hpp"
8- #include " sol/sol.hpp"
98
9+ #include " sol/sol.hpp"
1010extern std::queue<std::filesystem::path> tasks;
1111extern void processFile (ScriptCompiler& comp, std::filesystem::path path);
1212extern std::filesystem::path outputDir;
@@ -335,17 +335,29 @@ LuaHandler::LuaHandler() {
335335 " file_offset" , sol::readonly (&sqf::runtime::diagnostics::diag_info::file_offset)
336336 );
337337
338-
339-
340-
341-
342-
343-
344-
345-
346-
347-
338+ lua. new_usertype <OptimizerModuleBase::Node>(
339+ " OptimizerNode " , sol::no_constructor,
340+ " type " , sol::var (&OptimizerModuleBase::Node::type),
341+ " file " , sol::var (&OptimizerModuleBase::Node::file),
342+ " line " , sol::var (&OptimizerModuleBase::Node::line),
343+ " offset " , sol::var (&OptimizerModuleBase::Node::offset),
344+ " children " , sol::var (&OptimizerModuleBase::Node::children),
345+ " constant " , sol::var (&OptimizerModuleBase::Node::constant),
346+ " areChildrenConstant " , &OptimizerModuleBase::Node::areChildrenConstant
347+ );
348348
349+ lua.new_enum (" InstructionType"
350+ " OptimizerNode" , sol::no_constructor,
351+ " endStatement" , InstructionType::endStatement,
352+ " push" , InstructionType::push,
353+ " callUnary" , InstructionType::callUnary,
354+ " callBinary" , InstructionType::callBinary,
355+ " callNular" , InstructionType::callNular,
356+ " assignTo" , InstructionType::assignTo,
357+ " assignToLocal" , InstructionType::assignToLocal,
358+ " getVariable" , InstructionType::getVariable,
359+ " makeArray" , InstructionType::makeArray
360+ );
349361
350362 lua[" ASC" ] = LuaASC{};
351363}
@@ -357,14 +369,6 @@ void LuaHandler::LoadFromFile(std::filesystem::path filePath) {
357369}
358370
359371
360- void LuaHandler::ScanFiles () {
361-
362- auto fx = lua.get <sol::function>(" ScanFiles" );
363- if (fx.valid ())
364- fx ();
365-
366- }
367-
368372void LuaHandler::SetupCompiler (ScriptCompiler& compiler) {
369373 if (!isActive)
370374 return ;
0 commit comments