Warning: session_start(): open(/var/lib/php/sessions/sess_r3f201rrnvhrndojntfdg40u8s, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// e.g.
// void tailCall aka replace(Computable x) {...}
// to:
// void tailCall(Computable x) {...}
// final void replace(Computable x) { tailCall(x); }
// (or the other way around)
svoid tok_akaFunctionNames(LS tok) {
int i;
bool useFinal = true;
while ((i = jfind(tok, " aka ")) >= 0) {
int iName1 = i, _iLastName = i+4;
while (eqGet(tok, _iLastName+2, "aka")
&& isIdentifier(get(tok, _iLastName+4)))
_iLastName += 4;
int iLastName = _iLastName;
// find arguments
int iOpening = indexOf(tok, iLastName, "(");
int iClosing = findEndOfBracketPart2(tok, iOpening)-1;
// find all names
new LS names;
for (int j = iName1; j <= iLastName; j += 4)
names.add(tok.get(j));
// find javax modifiers, return type & modifiers
int iType = tok_leftScanJavaxModifiers(tok, iName1);
iType = tok_leftScanType(tok, iType);
int iStart = leftScanModifiers(tok, tok_leftScanTypeArgsOpt(tok, iType));
// parse argument list
LS _args = subList(tok, iOpening+1, iClosing);
LS args = tok_parseArgsDeclList2(_args);
// analyze return type
LS type = subList(tok, iType-1, iName1); // return type
bool isVoid = containsOneOf(codeTokens(type), javaxVoidAliases());
// drop all but first name
clearTokens(tok, iName1+1, iLastName+1);
// modifiers include return type actually
LS tokModifiers = subList(tok, iStart, iName1-1);
S modifiers = join(tokModifiers);
if (!containsOneOf(tokModifiers, "final", "default")) modifiers = "final " + modifiers;
S _modifiers = modifiers;
int iBodyOpen = indexOfAny(tok, iClosing, "{", ";");
//S exceptionClauses = joinSubList(tok, iClosing+1, iBodyOpen-1);
// add synonyms
tokPrepend(tok, iStart, joinMap(dropFirst(names), name ->
_modifiers + " "
+ name
// arguments and declared exceptions
+ joinSubList(tok, iLastName+1, iBodyOpen-1)
+ "{ " + stringIf(!isVoid, "return ")
+ first(names) + "(" + joinWithComma(lmap tok_lastIdentifier(args)) + "); }\n"));
reTok(tok, iStart, iLastName+1);
}
}