diff --git a/src/headers/transpiler/implementations/Js.hpp b/src/headers/transpiler/implementations/Js.hpp index 7c11394..2efd8c8 100644 --- a/src/headers/transpiler/implementations/Js.hpp +++ b/src/headers/transpiler/implementations/Js.hpp @@ -15,9 +15,9 @@ struct JsTarget: Target { output << "function " << parseComponent.name << '('; separate_transpileTree(parseComponent.parameters, ", "); output << ") {"; - if (newLines) output << separator << indentation; + if (newLines and not parseComponent.empty()) output << separator << indentation; separate_transpileTree(parseComponent, 1); - if (newLines) output << separator; + if (newLines and not parseComponent.empty()) output << separator; output << '}'; ) }; diff --git a/src/headers/transpiler/implementations/Lua.hpp b/src/headers/transpiler/implementations/Lua.hpp index 421e944..d512bb2 100644 --- a/src/headers/transpiler/implementations/Lua.hpp +++ b/src/headers/transpiler/implementations/Lua.hpp @@ -18,10 +18,12 @@ struct LuaTarget: Target { make_task(Function, output << "function " << parseComponent.name << '('; separate_transpileTree(parseComponent.parameters, ", "); - output << ')' << separator; - if (newLines) output << indentation; + output << ')'; + if (not parseComponent.empty()) output << separator << indentation; + else output << ' '; separate_transpileTree(parseComponent, 1); - output << separator << "end"; + if (not parseComponent.empty()) output << separator; + output << "end"; ) }; } diff --git a/src/headers/transpiler/implementations/Py.hpp b/src/headers/transpiler/implementations/Py.hpp index 2e58832..829caf3 100644 --- a/src/headers/transpiler/implementations/Py.hpp +++ b/src/headers/transpiler/implementations/Py.hpp @@ -13,6 +13,7 @@ struct PyTarget: Target { output << "def " << parseComponent.name << '('; separate_transpileTree(parseComponent.parameters, ", "); output << "):" << separator << indentation; + if (parseComponent.empty()) output << "pass"; separate_transpileTree(parseComponent, 1); ), };