Warning: session_start(): open(/var/lib/php/sessions/sess_obec6nr7uo8kbgio5gadql0oc2, 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
sS makeSFSynonym(S oldName, S newName) {
stdFunctions_clearCache();
S snippetID = stdFunctions_cached().get(oldName);
if (snippetID == null)
fail("Standard function " + oldName + " not found");
if (isStandardFunction(newName))
ret print("Standard function " + newName + "exists");
L tok = javaTok(loadSnippet(snippetID));
LL funcs = findFullFunctionDefs(tok, true);
new L out;
for (L tokF : funcs) {
int i = indexOfAny(tokF, 0, "(", "{");
if (i < 0) continue;
S fname = get(tokF, i-2);
if (!eq(fname, oldName)) continue;
L args = tok_parseArgsList(tokF);
jreplace(tokF = cloneList(tokF), oldName, newName);
L start = cloneList(subList(tokF, 0, i));
jreplace(start, "synchronized", "");
bool isVoid = contains(start, "void");
out.add(join(start) + "(" + joinWithComma(trimAll(map tok_dropFinal(args))) + ") {\n"
+ " " + (isVoid ? "" : "ret ") + oldName + "(" + joinWithComma(map tok_lastIdentifier(args)) + ");\n"
+ "}");
}
if (empty(out))
fail("No functions found");
print();
S src = joinWithEmptyLines(out);
printIndent(src);
S newSnippetID = createSnippet(src, newName + " - synonym of " + oldName, snippetType_JavaXInclude());
checkMarkAnimation_bottomLeft(addStdFunction(newSnippetID, true), 2);
stdFunctions_clearCache();
ret "Synonym made!";
}