use of japa.parser.ast.expr.Expression in project enumerable by hraberg.
the class ExpressionTreeTest method parseViaASM.
Expression parseViaASM(String expression, Class<?> returnValue, Param... parameters) throws Exception {
Class<?> c = compileExpression(expression, returnValue, parameters);
Class<?>[] parameterTypes = new Class<?>[parameters.length];
String[] parameterNames = new String[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterNames[i] = parameters[i].name;
parameterTypes[i] = parameters[i].type;
}
Method method = c.getDeclaredMethod("eval", parameterTypes);
debug("compiling: " + expression);
debug("asm:");
if (debug)
printASMifiedMethod(method);
Expression result = parseExpressionFromSingleMethodClass(c, parameterNames);
debug("decompiled: " + result + (result == null ? "" : " // " + result.getClass()));
debug("");
return result;
}
Aggregations