Add a separate_transpileTree overload and transpile function parameters correctly
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
5f3c8d785d
commit
ba14e95d50
|
@ -106,9 +106,13 @@ protected:
|
|||
IS(ParseTree)
|
||||
void separate_transpileTree(const T& parseTree, const unsigned short& indentationLevel = 0) {
|
||||
transpileTree(parseTree, indentationLevel, [this, &parseTree](const auto& iterator){
|
||||
if (iterator + 1 != parseTree.cend()) {
|
||||
output << separator;
|
||||
}
|
||||
if (iterator + 1 != parseTree.cend()) { output << separator; }
|
||||
});
|
||||
}
|
||||
IS(ParseTree)
|
||||
void separate_transpileTree(const T& parseTree, const string_view separation_characters) {
|
||||
transpileTree(parseTree, 0, [this, &parseTree, &separation_characters](const auto& iterator){
|
||||
if (iterator + 1 != parseTree.cend()) { output << separation_characters; }
|
||||
});
|
||||
}
|
||||
typedef optional<const char*> optional_string;
|
||||
|
|
|
@ -13,7 +13,7 @@ struct JsTarget: Target {
|
|||
make_task(types::String, stringInterpolation(parseComponent.content);),
|
||||
make_task(Function,
|
||||
output << "function " << parseComponent.name << '(';
|
||||
transpileTree(parseComponent.parameters);
|
||||
separate_transpileTree(parseComponent.parameters, ", ");
|
||||
output << ") {";
|
||||
if (newLines) output << separator << indentation;
|
||||
separate_transpileTree(parseComponent, 1);
|
||||
|
|
|
@ -17,7 +17,7 @@ struct LuaTarget: Target {
|
|||
make_task(types::String, stringInterpolation(parseComponent.content, "[[", "]]", "..");),
|
||||
make_task(Function,
|
||||
output << "function " << parseComponent.name << '(';
|
||||
transpileTree(parseComponent.parameters);
|
||||
separate_transpileTree(parseComponent.parameters, ", ");
|
||||
output << ')' << separator;
|
||||
if (newLines) output << indentation;
|
||||
separate_transpileTree(parseComponent, 1);
|
||||
|
|
|
@ -11,7 +11,7 @@ struct PyTarget: Target {
|
|||
make_task(types::String, stringInterpolation(R"(""")", parseComponent.content);),
|
||||
make_task(Function,
|
||||
output << "def " << parseComponent.name << '(';
|
||||
transpileTree(parseComponent.parameters);
|
||||
separate_transpileTree(parseComponent.parameters, ", ");
|
||||
output << "):" << separator << indentation;
|
||||
separate_transpileTree(parseComponent, 1);
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue