Lua.hpp & Js.hpp: Don't insert new lines and indentation when a function is empty
Py.hpp: Support empty functions Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
7df47da354
commit
97a9703a1a
|
@ -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 << '}';
|
||||
)
|
||||
};
|
||||
|
|
|
@ -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";
|
||||
)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue