MCPcopy Create free account
hub / github.com/Koihik/LuaFormatter / buildArguments

Method buildArguments

src/FormatVisitor.cpp:392–412  ·  view source on GitHub ↗

Builds arguments whitespaces in spaces. local a = f"a" "b" "c"...

Source from the content-addressed store, hash-verified

390// Builds arguments whitespaces in spaces.
391// local a = f"a"<WS>"b"<WS>"c"...
392void 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+;
415antlrcpp::Any FormatVisitor::visitFunctioncall(LuaParser::FunctioncallContext* ctx) {

Callers

nothing calls this directly

Calls 4

COLONMethod · 0.80
stringMethod · 0.80
argsMethod · 0.80
tableconstructorMethod · 0.80

Tested by

no test coverage detected