sS tok_reverseFunctionArguments(S s) { ret join(tok_reverseFunctionArguments(javaTok(s)); } static LS tok_reverseFunctionArguments(LS tok) { tok = first(findFullFunctionDefs(tok, true)); S name = tok_methodName(tok); bool isVoid = tok_staticFunctionAlwaysReturnsVoid(tok, name); IntRange r = tok_findArgs(tok); LPairS typesAndNames = tok_typesAndNamesOfParams(subList(tok, r)); replaceSublist(tok, shrinkIntRange(r, 1), ll(tok_joinTypesAndNames(reversed(typesAndNames)))); replaceSublist(tok, cloneList(tok_methodBody(tok)), ll( " {\n " + (isVoid ? "" : "ret ") + name + "(" + joinWithComma(secondOfPairs(typesAndNames)) + ");" + "\n}\n")); jreplace_multi(tok, asList(functionAdjuvantKeywords()), ""); ret tok; }