Class<?> variableType = getVariableType(variableName);
if (variableType != null) {
return new VariableExpression(variableName, analyzeExpressionNode(accessorNode), variableType);
} else {
if (node.getLiteralValue() instanceof ParserContext) {
ParserContext pCtx = (ParserContext)node.getLiteralValue();
// it's not a variable but a method invocation on this
Class<?> thisClass = pCtx.getInputs().get("this");
try {
return new EvaluatedExpression(new MethodInvocation(thisClass.getMethod(variableName)));
} catch (NoSuchMethodException e) {
if (node.getEgressType() == Class.class) {
// there's no method on this with the given name, check if it is a class literal
Class<?> classLiteral = pCtx.getParserConfiguration().getImport(variableName);
if (classLiteral != null) {
return new FixedExpression(Class.class, classLiteral);
}
}
throw new RuntimeException(e);