use of com.axellience.vuegwt.processors.component.template.parser.result.TemplateExpression in project vue-gwt by Axellience.
the class TemplateParser method processJavaExpression.
/**
* Process the given string as a Java expression.
* @param expressionString A valid Java expression
* @return A processed expression, should be placed in the HTML in place of the original
* expression
*/
private TemplateExpression processJavaExpression(String expressionString) {
Expression expression;
try {
expression = JavaParser.parseExpression(expressionString);
} catch (ParseProblemException parseException) {
logger.error("Couldn't parse Expression, make sure it is valid Java.", expressionString);
throw parseException;
}
resolveTypesUsingImports(expression);
resolveStaticMethodsUsingImports(expression);
checkMethodNames(expression);
// Find the parameters used by the expression
List<VariableInfo> expressionParameters = new LinkedList<>();
findExpressionParameters(expression, expressionParameters);
// If there is a cast first, we use this as the type of our expression
if (currentProp == null)
expression = getTypeFromCast(expression);
// Update the expression as it might have been changed
expressionString = expression.toString();
// Add the resulting expression to our result
return result.addExpression(expressionString, currentExpressionReturnType, currentProp == null, expressionParameters);
}
Aggregations