Builds arguments whitespaces in spaces. local a = f"a" "b" "c"...
| 390 | // Builds arguments whitespaces in spaces. |
| 391 | // local a = f"a"<WS>"b"<WS>"c"... |
| 392 | void FormatVisitor::buildArguments(std::vector<LuaParser::NameAndArgsContext*> v) { |
| 393 | for (size_t i = 0; i < v.size(); i++) { |
| 394 | auto* ctx = v[i]; |
| 395 | std::string ws; |
| 396 | |
| 397 | // Write out the argument |
| 398 | visitNameAndArgs(ctx); |
| 399 | |
| 400 | if (ctx == v.back()) { // Last element, bail out |
| 401 | break; |
| 402 | } |
| 403 | |
| 404 | auto* nctx = v[i + 1]; |
| 405 | if (nctx->COLON() == nullptr && |
| 406 | ((nctx->args()->string() != nullptr) || (nctx->args()->tableconstructor() != nullptr))) { |
| 407 | ws = " "; |
| 408 | } |
| 409 | |
| 410 | cur_writer() << commentAfter(ctx, ws); |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | // varOrExp nameAndArgs+; |
| 415 | antlrcpp::Any FormatVisitor::visitFunctioncall(LuaParser::FunctioncallContext* ctx) { |
nothing calls this directly
no test coverage detected