Query newQuery = new Query();
if(condition)
newQuery.conditionFunction = queryFunction;
newQuery.source = oldQuery.source;
newQuery.subObjectId = oldQuery.subObjectId;
Parser p = new Parser(compilerEnvirons, compilerEnvirons.getErrorReporter());
ScriptOrFnNode tree;
tree = p.parse("(" + queryStr + ")", "jsonpath-sub-expression", 0);
Node functionBody = tree.getFunctionNode(0).getFirstChild();
Node returnNode = functionBody.getFirstChild();
if(returnNode.getType() != Token.RETURN){
returnNode = returnNode.getFirstChild().getFirstChild().getFirstChild();
}