Warning: session_start(): open(/var/lib/php/sessions/sess_aqlea4gd4kov33407q7smoa3f7, 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
sbool findFunctionInvocations_v2_debug;
// tok: the code
// sf: map of functions (keys) to look for - null to record every function call
// hardReferences (out parameter): records every "please include" statement if not null
// haveFunctions: functions to skip (or null)
// includePossiblyMapLikes: include calls with pre-brackets argument (e.g. map l(...))
// mainClassName: name of program's main class (calls to this class will be skipped)
static Set findFunctionInvocations_v2(LS tok, SS sf, Cl hardReferences, Set haveFunctions, bool includePossiblyMapLikes, Set knownClassNames) {
new LinkedHashSet l;
for (int i : jfindAll(tok, "please include functions")) {
int j = i + 6;
while licensed {
String fname = tok.get(j);
assertIdentifier("in please include functions section", get(tok, j));
l.add(fname);
add(hardReferences, fname);
j += 2;
if (eqGet(tok, j, ".")) break;
while (eqGetOneOf(tok, j, ",", "and")) j += 2;
}
clearAllTokens(tok.subList(i, j+2));
}
for (int i : jfindAll(tok, "please include function *.")) {
String fname = tok.get(i+6);
l.add(fname);
add(hardReferences, fname);
clearAllTokens(tok.subList(i, i+10));
}
int i, n = tok.size();
boolean result = false;
for (i = 1; i+2 < n; i += 2) {
S f = tok.get(i);
if (!isIdentifier_quick(f)) continue;
// main.bla()
if (eq(mainClassName, f) && eq(tok.get(i+2), ".") && eqGet(tok, i+4, "<")) {
i = findEndOfTypeArgs(tok, i+4)+1;
f = tok.get(i);
if (!isIdentifier(f)) continue;
}
// e.g. ... html_findLIs(LS [auto htmlTok] tok) { ... }
if (eqGet(tok, i-4, "[") && eqGet(tok, i-2, "auto")) {
// ok
} else if (eqGet(tok, i-2, ":") && eqGet(tok, i-4, ":") && eqGet(tok, i-6, mainClassName)) {
// ok, function reference (main::bla)
} else if (eqGet(tok, i+2, "(")) {
// ok, normal function invocation
} else if (includePossiblyMapLikes && eqGet(tok, i+4, "(") && isIdentifier(get(tok, i+2))) {
// ok, mapLike invocation (bla blubb(...))
} else
// not an invocation
continue;
if (!tok_isMethodDeclarationNotSFInvocation(tok, i, mainClassName, knownClassNames)) {
bool inSF = sf == null || sf.containsKey(f);
if (findFunctionInvocations_v2_debug)
print("Possible invocation: " + f + ", inSF: " + inSF);
if (inSF && !contains(haveFunctions, f) && l.add(f))
if (findFunctionInvocations_v2_debug)
print("Found reference to standard function " + f + ": " + lineAroundToken(tok, i));
}
}
ret l;
}