// We'd be really fancy if we filtered out return statements in all // inner blocks. sbool containsReturnWithArgument(LS tok) { for (int i = 1; i+2 < l(tok); i += 2) { S t = tok.get(i); if (eqOneOf(t, "ret", "return") && neqOneOf(tok.get(i+2), ";", "if", "unless", "with")) true; // skip embedded functions & classes if (eqOneOf(t, "embedded", "class") && isIdentifier(get(tok, i+2)) // skip anonymous classes || eq(t, "(") && eqGet(tok, i+2, ")") && eqGet(tok, i+4, "{")) i = tok_findEndOfMethodDecl(tok, i)-1; // this might just work for classes too // skip runnables / lambdas if (eqOneOf(t, "r", ">") && eqGet(tok, i+2, "{")) i = findEndOfBlock(tok, i+2)-1; } false; } sbool containsReturnWithArgument(S code) { ret containsReturnWithArgument(javaTok(code)); }